Skip to main content

Module bme280

Module bme280 

Source
Expand description

Bosch BME280 temperature, pressure, and humidity sensor.

The BME280 ships raw, uncompensated readings plus a block of per-chip calibration coefficients; the real measurement only appears after running those raw values through Bosch’s compensation formulas. Those formulas are the classic place a from-memory port goes subtly wrong, so the integer arithmetic here is ported from Bosch’s published reference code, and the tests cross-check it against the reference floating-point form and the datasheet’s worked temperature example.

A caller reads the calibration registers once with Calibration::from_registers, then reads the data registers each cycle into a RawMeasurement and calls Calibration::compensate. The control registers (CtrlHum, CtrlMeas, Config) and the measurement-time formula are here too, and the Bme280 driver (the embedded-hal feature) runs the whole sequence over an I2C or SPI bus.

Modules§

register
The BME280 register addresses used to read calibration and measurements.
sim
A BME280 that is not there.

Structs§

Bme280
A BME280 on an I2C or SPI bus, measuring on demand in forced mode.
Calibration
The per-chip calibration coefficients read from the sensor’s calibration registers.
Config
The configuration register (0xF5, config).
CtrlHum
The humidity control register (0xF2, ctrl_hum).
CtrlMeas
The measurement control register (0xF4, ctrl_meas).
Measurement
A compensated BME280 measurement.
RawMeasurement
The raw, uncompensated readings from the BME280 data registers.

Enums§

Filter
The IIR filter coefficient, the filter[2:0] field.
Mode
The power mode selected by the mode[1:0] field.
Oversampling
An oversampling setting for one of the three measurements.
Standby
The inactive period between measurements in normal mode, the t_sb[2:0] field.

Constants§

CALIB_HUMIDITY_LEN
The number of bytes in the humidity calibration block.
CALIB_TEMP_PRESS_LEN
The number of bytes in the temperature and pressure calibration block.
CHIP_ID
The value the chip-id register (0xD0) returns for a BME280.
DATA_LEN
The number of bytes in the burst-read data block.
I2C_ADDRESS_PRIMARY
The I2C address with the SDO pin tied low.
I2C_ADDRESS_SECONDARY
The I2C address with the SDO pin tied high.
RESET_WORD
The soft-reset word: writing it to register::RESET runs the power-on sequence.
SKIPPED_HUMIDITY
The value a skipped humidity measurement leaves in its registers.
SKIPPED_OUTPUT
The value a skipped temperature or pressure measurement leaves in its registers.
STARTUP_MICROS
The start-up time from power-on or reset until the part accepts a transfer, in microseconds.
STATUS_POLLS
How many times the status register is polled, 1 ms apart, before a conversion or a reset is called overdue.

Functions§

image_updating
Reads the im_update flag of a status register value.
max_measurement_micros
The longest one measurement cycle can take, in microseconds.
measuring
Reads the measuring flag of a status register value.
typical_measurement_micros
The typical time one measurement cycle takes, in microseconds.