Crates.io | lps28dfw |
lib.rs | lps28dfw |
version | 0.1.6 |
source | src |
created_at | 2024-07-07 12:27:20.843169 |
updated_at | 2024-07-15 03:12:07.103151 |
description | Platform-agnostic Rust driver for the LPS28DFW pressure sensor |
homepage | https://github.com/tomatenkuchen/lps28dfw |
repository | https://github.com/tomatenkuchen/lps28dfw |
max_upload_size | |
id | 1294832 |
size | 40,901 |
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:
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
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");
}
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.
For questions, issues, feature requests, and other changes, please file an issue in the github project
Licensed under
Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in MIT Licence text.