Documentation
¶
Overview ¶
https://github.com/tinygo-org/drivers/tree/release/aht20 的 https://github.com/d2r2/go-i2c 移植
Index ¶
- Constants
- Variables
- type Device
- func (d *Device) Celsius() float32
- func (d *Device) Configure()
- func (d *Device) DeciCelsius() int32
- func (d *Device) DeciRelHumidity() int32
- func (d *Device) RawHumidity() uint32
- func (d *Device) RawTemp() uint32
- func (d *Device) Read() error
- func (d *Device) ReadRelativeHumidity() (float32, error)
- func (d *Device) ReadTemperatureC() (float32, error)
- func (d *Device) RelHumidity() float32
- func (d *Device) Reset()
- func (d *Device) Status() byte
Constants ¶
View Source
const ( 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("AHT20 busy") ErrTimeout = errors.New("timeout") )
Functions ¶
This section is empty.
Types ¶
type Device ¶ added in v0.5.0
type Device struct {
// contains filtered or unexported fields
}
Device wraps an I2C connection to an AHT20 device.
func New ¶ added in v0.7.0
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) DeciCelsius ¶ added in v0.5.0
Temperature in mutiples of one tenth of a degree celsius
Using this method avoids floating point calculations.
func (*Device) DeciRelHumidity ¶ added in v0.8.0
func (*Device) RawHumidity ¶ added in v0.5.0
func (*Device) Read ¶ added in v0.5.0
Read the temperature and humidity
The actual temperature and humidity are stored and can be accessed using `Temp` and `Humidity`.
func (*Device) ReadRelativeHumidity ¶ added in v0.9.0
func (*Device) ReadTemperatureC ¶ added in v0.9.0
ReadTemperatureC reads and calculates temrature in C (celsius).
func (*Device) RelHumidity ¶ added in v0.5.0
Click to show internal directories.
Click to hide internal directories.