dps422

Crates.iodps422
lib.rsdps422
version0.1.1
sourcesrc
created_at2020-05-11 11:54:07.664437
updated_at2020-05-11 12:31:41.823769
descriptionA platform agnostic driver to interface with the DPS422 barometric pressure & temp sensor through I2C
homepage
repositoryhttps://github.com/devboard-io/dps422-rs
max_upload_size
id240093
size32,084
Ingmar Jager (ijager)

documentation

https://docs.rs/dps422

README

DPS422 embedded-hal I2C driver crate

A platform agnostic driver to interface with the DPS422 barometric pressure & temp sensor. This driver uses I2C via embedded-hal. Note that the DPS422 also supports SPI, however that is not (yet) implemented in this driver.

Usage

Include this crate as a dependency in your Cargo.toml

[dependencies.dps422]
version = "<version>"

Use embedded-hal implementation to get I2C, then create a driver instance

use dps422::{DPS422, self};


let address = 0x76;
let mut dps = DPS422::new(i2c, address, &dps422::Config::new()).unwrap();

dps.trigger_measurement(true, true, false).unwrap();

if dps.data_ready().unwrap() {
    let pressure = dps.read_pressure_calibrated().unwrap();
    let temp = dps.read_temp_calibrated().unwrap();
    writeln!(usart, "pressure: {:.1} [kPa]\t temp: {:.1} [˚C]", pressure, temp).unwrap();
}
Commit count: 11

cargo fmt