Documentation ¶
Index ¶
- type BitValue
- type Bitmask
- type Logger
- type T67XX
- func (t *T67XX) EnableABC() error
- func (t *T67XX) FirmwareVersion() (int, error)
- func (t *T67XX) GasPPM() (int, error)
- func (t *T67XX) PrintStatus() error
- func (t *T67XX) Reset() error
- func (t *T67XX) SensorIsAtFullAccuracy() (bool, error)
- func (t *T67XX) SetAddress(address byte) error
- func (t *T67XX) SetLogger(l Logger)
- func (t *T67XX) SleepUntilFullAccuracy() error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type BitValue ¶
type BitValue struct {
// contains filtered or unexported fields
}
BitValue is a value and a description
type Bitmask ¶
type Bitmask uint16
Bitmask represents a bitmask value
func (Bitmask) ListDescriptions ¶
ListDescriptions returns a string array of all set bits
func (Bitmask) ListValues ¶
ListValues returns a string array of all set bits
type Logger ¶
type Logger interface { Debug(...interface{}) Debugf(string, ...interface{}) Fatalf(string, ...interface{}) }
Logger is the definition of the logger interface we need
type T67XX ¶
T67XX encapsulates communications with the T67XX CO₂ sensor
func (*T67XX) EnableABC ¶
EnableABC enables the ABC calibration. From the datasheet:
"ABC LOGIC™ Automatic Background Logic, or ABC Logic™, is a patented self-calibration technique that is designed to be used in applications where concentrations will drop to outside ambient conditions (400 ppm) at least three times in a 7 days, typically during unoccupied periods. Full accuracy to be achieved utilizing ABC Logic™. With ABC Logic™ enabled, the sensor will typically reach its operational accuracy after 24 hours of continuous operation at a condition that it was exposed to ambient reference levels of air at 400 ppm CO2. Sensor will maintain accuracy specifications with ABC Logic™ enabled, given that it is at least four times in 21 days exposed to the reference value and this reference value is the lowest concentration to which the sensor is exposed. ABC Logic™ requires continuous operation of the sensor for periods of at least 24 hours. Note: Applies when used in typical residential ambient air. Consult Telaire if other gases or corrosive agents are part of the application environment."
func (*T67XX) FirmwareVersion ¶
FirmwareVersion returns the a sensors firmware
func (*T67XX) PrintStatus ¶
PrintStatus prints the status of the sensor
func (*T67XX) Reset ¶
Reset resets the sensor. You will need to make sure the sensor is available before getting a new reading
func (*T67XX) SensorIsAtFullAccuracy ¶
SensorIsAtFullAccuracy returns true if the sensor has reached it's full accuracy, or false otherwise.
From the datasheet:
"The sensor is capable of responding to commands after power on, but operational accuracy of sensor won’t happen until 120 sec have elapsed. The sensor will reach full accuracy / warm up after 10 min. of operation."
This code assumed that the sensor was plugged in when the system was booted and hasn't been removed since.
Only works in Linux currently.
func (*T67XX) SetAddress ¶
SetAddress sets the i2c address of the sensor
func (*T67XX) SleepUntilFullAccuracy ¶
SleepUntilFullAccuracy sleeps for 10 minutes from the time the system was booted, which is the amount of time it takes for the sensor to achieve full accuracy.
If the system was booted more than 10 minutes ago it returns immetiately. Only works on Linux. Not sure if the file is available/works in containers.
This code (and the associated functions it calls) probably aren't really too relevant to the sensor driver itself, they're more her for my convenience.