ndir

package
v0.0.0-...-2e22e3b Latest Latest
Warning

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

Go to latest
Published: Apr 1, 2024 License: BSD-3-Clause Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Addr

func Addr(a0, a1 bool) uint8

Addr returns the I2C address given the solder pad configuration on the Sandbox Electronics i2c/uart converter. When the resistor is connected between the left and middle pads the bit is said to be set and a0 or a1 should be passed in as true.

Types

type DevI2C

type DevI2C struct {
	// contains filtered or unexported fields
}

DevI2C is a handle to a MH-Z16 NDIR CO2 Sensor using the I2C interface.

func NewDevI2C

func NewDevI2C(bus drivers.I2C, addr uint8) *DevI2C

NewDevI2C returns a new NDIR device ready for use. It performs no I/O.

func (*DevI2C) CalibrateZero

func (d *DevI2C) CalibrateZero() error

CalibrateZero calibrates the NDIR to around 412ppm.

func (*DevI2C) Init

func (d *DevI2C) Init() (err error)

func (*DevI2C) PPMCO2

func (d *DevI2C) PPMCO2() int32

PPM returns the CO2 parts per million read in the last Update call.

func (*DevI2C) ReadRegister

func (d *DevI2C) ReadRegister(addr uint8) (uint8, error)

func (*DevI2C) SetAutoCalibration

func (d *DevI2C) SetAutoCalibration(enable bool) (err error)

SetAutoCalibration can enable or disable the NDIR's auto calibration mode.

func (*DevI2C) Update

func (d *DevI2C) Update(which drivers.Measurement) (err error)

Update reads the CO2 concentration from the NDIR and stores it ready for the PPM() method.

func (*DevI2C) WriteRegisters

func (d *DevI2C) WriteRegisters(addr uint8, vals []byte) (err error)

Jump to

Keyboard shortcuts

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