Documentation ¶
Overview ¶
Package bme280 implements Bosch BME280 sensor driver in Go It allows for reaching temperature, pressure and humidity data provided by the sensor
It is designed to work well with the golang.org/x/exp/io/i2c package See https://godoc.org/golang.org/x/exp/io/i2c
Index ¶
- Constants
- type Driver
- func (d *Driver) Close() error
- func (d *Driver) GetMode() (Mode, error)
- func (d *Driver) GetSettings() (Settings, error)
- func (d *Driver) Init() error
- func (d *Driver) InitWith(mode Mode, c Settings) error
- func (d *Driver) Read() (Response, error)
- func (d *Driver) SetMode(m Mode) error
- func (d *Driver) SetSettings(s Settings) error
- func (d *Driver) Sleep() error
- type Filter
- type Mode
- type Oversampling
- type Response
- type Settings
- type StandByTime
Constants ¶
const ( I2CAddr = 0x77 // Stand-by modes StandByTime1ms StandByTime = 0x00 StandByTime62_5ms StandByTime = 0x01 StandByTime125ms StandByTime = 0x02 StandByTime250ms StandByTime = 0x03 StandByTime500ms StandByTime = 0x04 StandByTime1000ms StandByTime = 0x05 StandByTime10ms StandByTime = 0x06 StandByTime20ms StandByTime = 0x07 // Filter coefficients FilterOff Filter = 0x00 Filter2 Filter = 0x01 Filter4 Filter = 0x02 Filter8 Filter = 0x03 Filter16 Filter = 0x04 // Oversampling OversamplingOff Oversampling = 0x00 Oversampling1x Oversampling = 0x01 Oversampling2x Oversampling = 0x02 Oversampling4x Oversampling = 0x03 Oversampling8x Oversampling = 0x04 Oversampling16x Oversampling = 0x05 )
noinspection GoUnusedConst,GoSnakeCaseUsage
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Driver ¶
type Driver struct {
// contains filtered or unexported fields
}
func New ¶
func New(device bus) *Driver
Creates a new BME280 Driver
The device argument can be an instance of i2c.Device struct from golang.org/x/exp/io/i2c package
func (*Driver) GetMode ¶
Gets the current power mode of the device
Note that either ModeNormal or ModeSleep will be returned. ModeForced is only active during a measurement, the device later returns to ModeSleep. See device datasheet for details.
func (*Driver) GetSettings ¶
Reads and outputs the current device settings
func (*Driver) Read ¶
Reads data from Device
If ModeForced is selected an ad-hoc measurement is performed.
func (*Driver) SetSettings ¶
type Oversampling ¶
type Oversampling byte
func (Oversampling) String ¶
func (i Oversampling) String() string
type Settings ¶
type Settings struct { Filter Filter Standby StandByTime PressureOversampling Oversampling TemperatureOversampling Oversampling HumidityOversampling Oversampling }
type StandByTime ¶
type StandByTime byte
func (StandByTime) String ¶
func (i StandByTime) String() string