bmp581 0.1.0

Platform-agnostic Rust driver for the Bosch BMP581 pressure sensor.
Documentation

BMP581

A no_std compatible Rust driver for the Bosch BMP581 pressure and temperature sensor.

Features

  • Working but yet no full implementation of complete BMP581 register interface yet
  • Supports I2C communication, SPI mode untested
  • no_std compatible for use in embedded systems
  • Example implementation for Raspberry Pi using RPPAL

Usage

Add this to your Cargo.toml:

[dependencies]
bmp581 = "0.1.0"  # Use the current version

Examples

Basic Reading (I2C)

use bmp581::{Bmp581, I2cAddr};
use linux_embedded_hal::I2cdev;
use rppal::hal::Delay;

fn main() {
    let i2c = I2cdev::new("/dev/i2c-1").unwrap();
    let mut sensor = Bmp581::new_i2c(i2c, I2cAddr::Default);
    let mut delay = Delay::new();

    // Initialize the sensor
    sensor.init(&mut delay).unwrap();
    
    // Read temperature and pressure
    let temp = sensor.read_temperature().unwrap();
    let press = sensor.read_pressure().unwrap();
    
    println!("Temperature: {:.2}°C", temp);
    println!("Pressure: {:.1} Pa", press);
}

Data-Ready Interrupt Example

Run the included example that demonstrates interrupt-based data acquisition:

cargo run --example rppal-drdy-interrupt

This example configures the BMP581 to generate interrupts when new sensor data is available, and reads the data via interrupt handling on GPIO22.

Hardware Compatibility

This driver has been tested with:

  • Raspberry Pi with RPPAL
  • STM32H743 using embassy

But should work with any platform that implements the embedded-hal traits.

License

Licensed under either of:

at your option.

Contribution

Any contribution intentionally submitted for inclusion in the work by you shall be dual licensed as above, without any additional terms or conditions.