Documentation ¶
Overview ¶
bmw280 reads sensor data from Bosh BME280 sensor. TODO: unit tests.
Index ¶
- Constants
- type BME280
- func (b *BME280) EnvData() (temp, press, hum float64, err error)
- func (b *BME280) Hum() (float64, error)
- func (b *BME280) Init() error
- func (b *BME280) Press() (float64, error)
- func (b *BME280) RawData() (temp, press, hum int32, err error)
- func (b *BME280) SetPressUnit(unit int)
- func (b *BME280) SetTempUnit(unit int)
- func (b *BME280) Temp() (float64, error)
- type Option
Constants ¶
const ( T1 byte = 0x88 + iota*2 T2 T3 P1 P2 P3 P4 P5 P6 P7 P8 P9 H1 byte = 0xA1 H2 byte = 0xE1 H3 byte = 0xE3 H4 byte = 0xE4 H5 byte = 0xE5 H6 byte = 0xE7 )
Compensation registers addresses.
const ( TempCompAddr byte = 0x88 PressCompAddr byte = 0x8E H1CompAddr byte = 0xA1 H2CompAddr byte = 0xE1 )
const ( HumAddr byte = 0xFD TempAddr byte = 0xFA PressAddr byte = 0xF7 DataAddr byte = 0xF7 )
Data registers addresses.
const ( IDAddr byte = 0xD0 ResetAddr byte = 0xE0 CtrlHumAddr byte = 0xF2 StatusAddr byte = 0xF3 CtrlMeasAddr byte = 0xF4 ConfigAddr byte = 0xF5 )
Other registers addresses.
const ( // I2CAddr is default BME280 I2C address. I2CAddr int = 0x77 // ResetVal is a value which when written to ResetAddr resets the sensor. ResetVal byte = 0xB6 // IDVal is a ID value of the sensor. IDVal byte = 0x60 )
General constants.
const ( OverSmpl1 byte OverSmpl2 OverSmpl4 OverSmpl8 OverSmpl16 )
Oversampling constants.
const ( SleepMode byte = 0x00 ForcedMode byte = 0x01 NormalMode byte = 0x03 )
Modes of operation.
const ( FilterOff byte = iota << 2 Filter2 Filter4 Filter8 Filter16 )
Filter settins
const ( // Standby for 0.5 ms. Stndby05 byte = iota << 5 // Standby for 62.5 ms. Stndby625 // Standby for 125 ms. Stndby125 // Standby for 250 ms. Stndby250 // Standby for 500 ms. Stndby500 // Standby for 1000 ms. Stbdby1000 // Standby for 10 ms. Stndby10 // Standby for 20 ms. Stndby20 )
Normal mode standby modes.
const ( Celsius = iota Fahrenheit Kelvin )
Available temperature units.
const ( HPa = iota Bar PSI )
Available pressure units.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type BME280 ¶
type BME280 struct {
// contains filtered or unexported fields
}
BME280 is an object representing BME280 sensor.
func New ¶
New returns new BME280 object. New object has following default values: mode = ForcedMode tempOverSmpl = 16 pressOverSmpl = 16 humOverSmpl = 16 filter = off standby = 500ms Temperature units Celsius Presure units hPa
func (*BME280) SetPressUnit ¶
SetPressUnit sets pressure unit.
func (*BME280) SetTempUnit ¶
SetTempUnit sets temperature unit.
type Option ¶
type Option interface {
// contains filtered or unexported methods
}
Option is an interface used to set various options in BME280 object.
func HumOverSmpl ¶
HumOverSmpl sets default oversampling for humidity.
func PressOverSmpl ¶
PressOverSmpl sets default oversampling for pressure.
func TempOverSmpl ¶
TempOverSmpl sets default oversampling for temperature.