lps28dfw

Crates.iolps28dfw
lib.rslps28dfw
version0.1.6
sourcesrc
created_at2024-07-07 12:27:20.843169
updated_at2024-07-15 03:12:07.103151
descriptionPlatform-agnostic Rust driver for the LPS28DFW pressure sensor
homepagehttps://github.com/tomatenkuchen/lps28dfw
repositoryhttps://github.com/tomatenkuchen/lps28dfw
max_upload_size
id1294832
size40,901
Timo (tomatenkuchen)

documentation

https://docs.rs/lps28dfw

README

hardware driver for ST LPS28DFW pressure sensor

This is a platform agnostic Rust driver for the LPS28DFW pressure sensor from ST, based on the embedded-hal traits.

This driver allows you to:

  • read pressure and temperature values from sensor
  • enable pressure value interrupts
  • set sampling rates

The device

LPS28DFW is a high precision MEMS pressure and temperature sensor for multiple fluids. Pressure measuring range is variable between 1024 and 4096 kPa.

Datasheet: LPS28DFW

Usage

To use this driver, import this crate and an embedded_hal implementation, then instantiate the device.

use ds1307::{DateTimeAccess, Ds1307, NaiveDate};
use linux_embedded_hal::I2cdev;

fn main() {
    let dev = I2cdev::new("/dev/i2c-1").unwrap();
    let mut pressure_sensor = LPS28DFW::new(dev);
    let mut pressure_sensor_cfg = LPS28DFW::get_default_config();
    pressure_sensor.write_config(pressure_sensor_cfg).unwrap();
    let pressure = pressure_sensor.get_pressure().unwrap();
    println!("{pressure} kPa");
}

Todos

  • fifo control and status methods
  • temperature sensor methods
  • pressure data output methods
  • oneshot mode
  • autoresets
  • update tests
  • create raspberry pi example for i2c testing

Minimum Supported Rust Version (MSRV)

This crate is guaranteed to compile on stable Rust 1.62 and up. It might compile with older versions but that may change in any new patch release.

Support

For questions, issues, feature requests, and other changes, please file an issue in the github project

License

Licensed under

Contributing

Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in MIT Licence text.

Commit count: 0

cargo fmt