blob: 8a60e817a801ad634d507cc40c1e0b1807f355e1 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
|
# 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](https://github.com/boschsensortec/BME690_SensorAPI). 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-hal` traits
- ✅ `no_std` compatible
- ✅ 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
```rust
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)
```rust
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](https://github.com/boschsensortec/BME690_SensorAPI).
|