Skip to content

sw-embed/bmp280

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

26 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

bmp280

no_std driver for the bmp280 (pressure sensor).

Build Status

What works

  • Temperature and pressure readings
  • Multiple sensors on the same I2C bus (addresses 0x76 and 0x77)
  • Per-sensor calibration data
  • Configurable oversampling, filtering, and power modes

Supported chips

  • BMP280

Basic usage

Include library as a dependency in your Cargo.toml crates.io:

[dependencies.bmp280-ehal]
version = "<version>"

Use an embedded-hal implementation to get an I2C handle, then create a BMP280 driver:

use bmp280_ehal::BMP280;

// Create the driver (auto-calibrates sensor at 0x76 if present):
let mut bmp = BMP280::new(i2c)?;

// Read temperature and pressure from the default sensor:
let temp = bmp.temp(0x76);
let pres = bmp.pressure(0x76);

Two sensors on one bus

The BMP280 supports two I2C addresses (0x76 and 0x77, selected by the SDO pin). This driver can manage both through a single instance:

let mut bmp = BMP280::new(i2c)?;

// The constructor auto-calibrates 0x76. Manually calibrate the second sensor:
bmp.read_calibration(0x77);

let temp1 = bmp.temp(0x76);
let temp2 = bmp.temp(0x77);
let pres1 = bmp.pressure(0x76);
let pres2 = bmp.pressure(0x77);

For more advanced multi-sensor setups using I2C multiplexers, see docs/multiple-sensor-support.md.

More examples

Additional examples can be found in the proving-ground repo.

Documentation

API Docs available on docs.rs.

License

About

embedded-hal compatible driver for bmp280 pressure sensor

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages

  • Rust 100.0%