Skip to main content

Crate edrv_bme680

Crate edrv_bme680 

Source
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§

blocking
Blocking API.
regs
BME680 register addresses and register fields.

Structs§

BME680
Async BME680 driver.
CalibrationData
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_heat is 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. Override BME680::ambient_temperature_celsius if 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.