docs.rs failed to build bmp280_rust_no_std-0.1.1
Please check the build logs for more information.
See Builds for ideas on how to fix a failed build, or Metadata for how to configure docs.rs builds.
If you believe this is docs.rs' fault, open an issue.
Please check the build logs for more information.
See Builds for ideas on how to fix a failed build, or Metadata for how to configure docs.rs builds.
If you believe this is docs.rs' fault, open an issue.
BMP280 Driver — no_std Rust for ESP32
A minimal BMP280 temperature, pressure, and altitude driver written in no_std Rust for ESP32 using Embassy + esp-hal.
Hardware
| BMP280 Pin | ESP32 Pin |
|---|---|
| SDA | GPIO21 |
| SCL | GPIO22 |
| VCC | 3.3V |
| GND | GND |
Default I2C address: 0x76
Dependencies
[]
= { = "...", = ["async"] }
= "..."
= "..."
= "..."
= "..."
= "..."
Usage
// Initialize I2C and create the driver
let bmp_i2c = new
.unwrap
.with_sda
.with_scl
.into_async;
let mut bmp280 = new.await;
bmp280.begin.await; // reads calibration coefficients and sets sampling
// Read temperature (°C)
if let Some = bmp280.read_temperature.await
// Read pressure (Pa / hPa)
if let Some = bmp280.read_pressure.await
// Read altitude (meters) — pass today's local QNH, not 1013.25
if let Some = bmp280.read_altitude.await
Note on altitude: Pass your local sea-level pressure (QNH) for accurate results.
1013.25is the ISA standard average — it will give wrong altitude unless that happens to be today's actual pressure.
Default Sampling Settings
| Parameter | Value |
|---|---|
| Mode | Normal |
| Temperature OS | 2x |
| Pressure OS | 4x |
| Filter | 2x |
| Standby | 125ms |
Call change_settings() before begin() to override.