aht20

package
v0.17.1 Latest Latest
Warning

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

Go to latest
Published: Jul 1, 2021 License: BSD-3-Clause Imports: 3 Imported by: 3

Documentation

Index

Constants

View Source
const (
	Address = 0x38

	CMD_INITIALIZE = 0xBE
	CMD_STATUS     = 0x71
	CMD_TRIGGER    = 0xAC
	CMD_SOFTRESET  = 0xBA

	STATUS_BUSY       = 0x80
	STATUS_CALIBRATED = 0x08
)

Variables

View Source
var (
	ErrBusy    = errors.New("device busy")
	ErrTimeout = errors.New("timeout")
)

Functions

This section is empty.

Types

type Device

type Device struct {
	Address uint16
	// contains filtered or unexported fields
}

Device wraps an I2C connection to an AHT20 device.

func New

func New(bus drivers.I2C) Device

New creates a new AHT20 connection. The I2C bus must already be configured.

This function only creates the Device object, it does not touch the device.

func (*Device) Celsius

func (d *Device) Celsius() float32

Temperature in degrees celsius

func (*Device) Configure

func (d *Device) Configure()

Configure the device

func (*Device) DeciCelsius

func (d *Device) DeciCelsius() int32

Temperature in mutiples of one tenth of a degree celsius

Using this method avoids floating point calculations.

func (*Device) DeciRelHumidity

func (d *Device) DeciRelHumidity() int32

func (*Device) RawHumidity

func (d *Device) RawHumidity() uint32

func (*Device) RawTemp

func (d *Device) RawTemp() uint32

func (*Device) Read

func (d *Device) Read() error

Read the temperature and humidity

The actual temperature and humidity are stored and can be accessed using `Temp` and `Humidity`.

func (*Device) RelHumidity

func (d *Device) RelHumidity() float32

func (*Device) Reset

func (d *Device) Reset()

Reset the device

func (*Device) Status

func (d *Device) Status() byte

Status of the device

Jump to

Keyboard shortcuts

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