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.

Modules§

register
The BME280 register addresses used to read calibration and measurements.

Structs§

Calibration
The per-chip calibration coefficients read from the sensor’s calibration registers.
Measurement
A compensated BME280 measurement.
RawMeasurement
The raw, uncompensated readings from the BME280 data registers.

Constants§

CHIP_ID
The value the chip-id register (0xD0) returns for a BME280.
I2C_ADDRESS_PRIMARY
The I2C address with the SDO pin tied low.
I2C_ADDRESS_SECONDARY
The I2C address with the SDO pin tied high.