Documentation
¶
Overview ¶
Package bme280 provides a driver for the BME280 temperature, humidity, and pressure sensor using I2C communication.
Index ¶
Constants ¶
const ( DefaultI2CBus = "/dev/i2c-1" DefaultI2CAddress = 0x77 )
Variables ¶
Functions ¶
func ConvertCtoF ¶
ConvertCtoF converts Celsius to Fahrenheit
Types ¶
type BME280 ¶
type BME280 struct {
*devices.DeviceBase[Env]
// contains filtered or unexported fields
}
BME280 represents an I2C temperature, humidity and pressure sensor. It defaults to address 0x77 and implements the device.Device interface.
func New ¶
Create a new BME280 at the give bus and address. Defaults are typically /dev/i2c-1 address 0x99 func New(id, bus string, addr int) (*BME280, error) {
func (*BME280) Get ¶
Read one Response from the sensor. If this device is being mocked we will make up some random floating point numbers between 0 and 100.
type BME280Config ¶
type BME280Config struct {
Mode bme280.Mode
Filter bme280.Filter
Standby bme280.StandByTime
Oversample struct {
Pressure bme280.Oversampling
Temperature bme280.Oversampling
Humidity bme280.Oversampling
}
}
BME280Config holds the configuration for the BME280 sensor
func DefaultConfig ¶
func DefaultConfig() BME280Config
DefaultConfig returns the default configuration
type BME280Mock ¶ added in v0.0.3
type BME280Mock struct {
*devices.DeviceBase[Env]
Env
// contains filtered or unexported fields
}
BME280Mock provides a mocked BME280 for testing purposes
func (*BME280Mock) Close ¶ added in v0.0.3
func (b *BME280Mock) Close() error
func (*BME280Mock) Get ¶ added in v0.0.3
func (b *BME280Mock) Get() (Env, error)
func (*BME280Mock) Open ¶ added in v0.0.3
func (b *BME280Mock) Open() error
func (*BME280Mock) Set ¶ added in v0.0.3
func (b *BME280Mock) Set(v Env) error