bosch-bme690
AI-generated Rust port of the official Bosch BME690 environmental sensor driver.
About
This crate provides a no_std Rust driver for the BME690 environmental sensor, based on the official Bosch C driver. The implementation has been automatically translated and verified to match the floating-point calculation formulas from the original C driver.
Features
- ✅ Temperature measurement (°C)
- ✅ Pressure measurement (Pa)
- ✅ Relative humidity measurement (%)
- ✅ Blocking and async implementations using
embedded-haltraits - ✅
no_stdcompatible - ✅ Calculation formulas verified against official C driver
Limitations
- Gas resistance measurement not yet implemented
- Only forced mode supported (no sequential/parallel modes)
- Basic configuration only (1x oversampling)
Usage
Blocking
use bosch_bme690::{AsyncBme690, DeviceAddr, Measurement};
use embassy_time::Delay;
// Create driver instance
let i2c = /* your I2C peripheral */;
let delay = Delay;
let mut bme = AsyncBme690::new(i2c, delay, DeviceAddr::Primary).await.unwrap();
// Take measurements
let data = bme.measure().await;
println!("Temperature: {} °C", data.temperature);
println!("Pressure: {} Pa", data.pressure);
println!("Humidity: {} %", data.humidity);
Async (embassy-rs)
use bosch_bme690::{AsyncBme690, DeviceAddr};
use embassy_time::Delay;
let i2c = /* your async I2C peripheral */;
let delay = Delay;
let mut bme = AsyncBme690::new(i2c, delay, DeviceAddr::Primary).await.unwrap();
loop {
let data = bme.measure().await;
// Use measurement data...
Timer::after_secs(1).await;
}
I2C Addresses
- Primary (0x76): SDO pin connected to GND - use
DeviceAddr::Primary - Secondary (0x77): SDO pin connected to VDD - use
DeviceAddr::Secondary
License
BSD-3-Clause (matching the original Bosch driver)
Acknowledgments
This is an AI-generated port of the official Bosch Sensortec BME690 driver. All calculation formulas and calibration logic are derived from the original C implementation.
