Expand description
§BME680 Environmental Sensor Driver
A type-safe, no_std driver for the Bosch BME680 environmental sensor.
This driver is designed for high-reliability embedded applications where
floating-point arithmetic is either unavailable or too slow.
§Key Features
- Typestate Architecture: The driver uses a compile-time state machine (
Uninitialized->Ready) to ensure methods likeread_new_datacannot be called before the sensor is properly set up. - Fixed-Point Arithmetic: All calculations (Temperature, Pressure, Humidity, Gas) are performed using integer arithmetic. This ensures deterministic behavior and high performance on Cortex-M0/M3/M4 cores.
- Power Efficiency: The driver supports granular control over which measurements are enabled (e.g., disabling Gas or Pressure sensing to save energy).
§Data Units
To avoid floats, this driver uses scaled integer units:
- Temperature: Centigrade (
°C * 100). Example:2350= 23.50 °C. - Humidity: Milli-percent (
%rH * 1000). Example:45123= 45.123 %rH. - Pressure: Pascal (
Pa). Example:101325= 1013.25 hPa. - Gas Resistance: Ohms (
Ω). Higher values typically indicate cleaner air.
Re-exports§
pub use settings::BME680Builder;pub use settings::Config;pub use settings::GasProfile;pub use settings::GasProfileIndex;pub use settings::IIRFilter;pub use settings::Oversampling;
Modules§
Structs§
- Bme680
- The main BME680 driver structure.
- Calc
Temp Data - Intermediate temperature values used for compensation.
- Calib
Data - Factory-fused calibration coefficients read from the sensor.
- Celsius
- Temperature wrapper for type-safety.
- Gas
- Represents gas resistance.
- Humidity
- Represents relative humidity.
- Idle
- Initial state of the driver. No logical connection established yet.
- Measurement
- Compensated measurement result in physical units.
- Milliseconds
- Duration wrapper for type-safety. Stored in milliseconds.
- Pressure
- Represents atmospheric pressure.
- RawData
- Raw ADC output and status bits read directly from the sensor registers.
- Ready
- Sensor is fully initialized, calibrated, and ready for measurements.
- Uninitialized
- Sensor instance created, but hardware not yet initialized (calibration data missing).