sensor

package
v1.0.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 28, 2019 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const (
	InitAirQuality       uint16 = 0x2003
	MeasureAirQuality    uint16 = 0x2008
	GetBaseline          uint16 = 0x2015
	SetBaseline          uint16 = 0x201e
	SetHumidity          uint16 = 0x2061
	MeasureTest          uint16 = 0x2032
	GetFeatureSetVersion uint16 = 0x202f
	MeasureRawSignals    uint16 = 0x2050
	GetSerialID          uint16 = 0x3682
	ExpectedFeatureSet   uint16 = 0x0020

	Crc8Polynomial byte = 0x31
	Crc8Init       byte = 0xFF
	Crc8XorOut     byte = 0x00
	Crc8Check      byte = 0xF7

	DefaultI2CFsPath   string  = "/dev/i2c-1"
	DefaultI2CAddr     byte    = 0x58
	DefaultFrequency   float32 = 100000.0
	DefaultDelayMillis int     = 10
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	I2CFsPath   string
	I2CAddr     byte
	Frequency   float32
	Logger      *logging.Logger
	DelayMillis int
}

func DefaultConfig

func DefaultConfig() *Config

type SGP30Sensor

type SGP30Sensor struct {
	SerialID uint64
	// contains filtered or unexported fields
}

func NewSensor

func NewSensor(cfg *Config) *SGP30Sensor

func (*SGP30Sensor) Close

func (s *SGP30Sensor) Close() error

func (*SGP30Sensor) GetBaseline

func (s *SGP30Sensor) GetBaseline() (eCO2 uint16, TVOC uint16, err error)

func (*SGP30Sensor) Init

func (s *SGP30Sensor) Init() error

func (*SGP30Sensor) Measure

func (s *SGP30Sensor) Measure() (eCO2 uint16, TVOC uint16, err error)

func (*SGP30Sensor) SetBaseline

func (s *SGP30Sensor) SetBaseline(eCO2 uint16, TVOC uint16) error

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL