A platform agnostic driver to interface with the DPS310 barometric pressure & temp sensor. This driver uses I2C via embedded-hal. Note that the DPS310 also supports SPI, however that is not (yet) implemented in this driver.
Include this crate as a dependency in your Cargo.toml
[dependencies.dps310]
version = "<version>"
Use embedded-hal implementation to get I2C, then create a driver instance
```rust use dps310::{DPS310, self};
let address = 0x77; let mut dps = DPS310::new(i2c, address, &dps310::Config::new()).unwrap();
while !dps.initcomplete().unwrap() || !dps.coefready().unwrap() { delay.delayms(200u8); }
dps.readcalibrationcoefficients().unwrap();
dps.trigger_measurement(true, true, true).unwrap();
loop { delay.delayms(200u8); if dps.tempready().unwrap() { let temp = dps.readtemp_calibrated().unwrap(); iprintln!(stim, "Temperature: {:.1} [C]", temp); }
if dps.pres_ready().unwrap() {
let pressure = dps.read_pressure_calibrated().unwrap();
iprintln!(stim, "Pressure: {:.1} [Pa]", pressure);
}
} ```