Expand description
Driver for the BME680 temperature, humidity, pressure and gas sensor.
The compensation maths follows Bosch Sensortec’s official BME68x SensorAPI
(bme68x.c, BSD-3-Clause), which is also the reference for the register map.
The sensor’s own state machine is deliberately not reproduced: this driver
exposes a small, idiomatic embedded-hal API instead. Raw register access is
available through BME680::read_reg, BME680::read_regs and
BME680::write_reg for anything the high-level API does not cover.
Only the BME680 (Bosch BME68X_VARIANT_GAS_LOW) gas path is implemented.
The integer (“no FPU”) Bosch compensation is used, so the driver itself does
no floating point work; the f32 accessors on Measurements perform a
single final conversion. The BME688 shares the die and answers the same chip
ID (0x61), but uses the BME68X_VARIANT_GAS_HIGH gas-resistance formula,
so BME680::variant_id is exposed and gas readings on a BME688 should be
treated as invalid.
This module contains the asynchronous driver. See blocking for the
blocking variant.
§Licence
This crate is distributed under MIT OR Apache-2.0, but it derives from
Bosch’s BSD-3-Clause BME68x SensorAPI. The retained upstream notice is in
LICENSE-BOSCH.
Modules§
Structs§
- BME680
- Async BME680 driver.
- Calibration
Data - Calibration coefficients, named after Bosch’s
struct bme68x_calib_data. - Measurements
- One compensated measurement.
Enums§
- Error
- Errors returned by the BME680 driver.
Constants§
- ADDRESS
- Default 7-bit I2C address, selected when SDO is tied low.
- ADDRESS_
ALT - Alternative 7-bit I2C address, selected when SDO is tied high.
- CHIP_ID
- Value expected in the chip ID register (
0xD0). - DEFAULT_
AMBIENT_ CELSIUS - Ambient temperature, in degrees Celsius, used to compute the heater
resistance. Bosch’s
calc_res_heatis the only compensation step that needs an ambient temperature; 25 C is used by default because the BME680 cannot measure it before the first conversion. OverrideBME680::ambient_temperature_celsiusif the board runs hot or cold. - DEFAULT_
HEATER_ DURATION_ MS - Default gas heater duration, in milliseconds. This is Bosch’s recommended duration for the BME680.
- DEFAULT_
HEATER_ TARGET_ CELSIUS - Default gas heater target, in degrees Celsius. This is Bosch’s recommended set point for the BME680.
- SOFT_
RESET_ COMMAND - Soft reset command written to
regs::SOFT_RESET.