Documentation ¶
Overview ¶
Package bmp280 provides a driver for the BMP280 digital temperature & pressure sensor by Bosch.
Datasheet: https://www.bosch-sensortec.com/media/boschsensortec/downloads/datasheets/bst-bmp280-ds001.pdf
Index ¶
- Constants
- type Device
- func (d *Device) Configure(standby Standby, filter Filter, temp Oversampling, pres Oversampling, ...)
- func (d *Device) Connected() bool
- func (d *Device) PrintCali()
- func (d *Device) ReadPressure() (pressure int32, err error)
- func (d *Device) ReadTemperature() (temperature int32, err error)
- func (d *Device) Reset()
- type Filter
- type Mode
- type Oversampling
- type Standby
Constants ¶
const ( REG_ID = 0xD0 // WHO_AM_I REG_RESET = 0xE0 REG_STATUS = 0xF3 REG_CTRL_MEAS = 0xF4 REG_CONFIG = 0xF5 REG_TEMP = 0xFA REG_PRES = 0xF7 REG_CALI = 0x88 CHIP_ID = 0x58 CMD_RESET = 0xB6 )
Registers
const Address = 0x77
The I2C address which this device listens to.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Device ¶
type Device struct { Address uint16 Temperature Oversampling Pressure Oversampling Mode Mode Standby Standby Filter Filter // contains filtered or unexported fields }
Device wraps an I2C connection to a BMP280 device.
func New ¶
New creates a new BMP280 connection. The I2C bus must already be configured.
This function only creates the Device object, it does not initialize the device. You must call Configure() first in order to use the device itself.
func (*Device) Configure ¶
func (d *Device) Configure(standby Standby, filter Filter, temp Oversampling, pres Oversampling, mode Mode)
Configure sets up the device for communication and read the calibration coefficients.
func (*Device) Connected ¶
Connected returns whether a BMP280 has been found. It does a "who am I" request and checks the response.
func (*Device) PrintCali ¶
func (d *Device) PrintCali()
PrintCali prints the Calibration information.
func (*Device) ReadPressure ¶
ReadPressure returns the pressure in milli pascals (mPa).
func (*Device) ReadTemperature ¶
ReadTemperature returns the temperature in celsius milli degrees (°C/1000).
type Filter ¶
type Filter uint
Filter unwanted changes in measurement caused by external (environmental) or internal changes (IC).
type Oversampling ¶
type Oversampling uint
OversamplingMode is the oversampling ratio of the temperature or pressure measurement.
const ( SAMPLING_SKIPPED Oversampling = iota SAMPLING_1X SAMPLING_2X SAMPLING_4X SAMPLING_8X SAMPLING_16X )