9 releases

0.3.0 Sep 29, 2022
0.3.0-pre.1 Sep 11, 2022
0.2.0 Sep 10, 2022
0.1.0 Sep 10, 2022
0.1.0-pre.3 Sep 6, 2022

#6 in #thermometer

31 downloads per month

MPL-2.0 license

47KB
860 lines

HP203B Rust Driver

A driver for the HopeRF HP203B barometer/thermometer written for embedded-hal-based applications.

Current in a mostly untested, prerelease state.


lib.rs:

To get started, create an HP203B.

Examples

use hp203b::{HP203B, csb::CSBLow, OSR, Channel};

// ... initialise i2c device and delay

let altimeter = HP203B::<_, _, CSBLow>::new(
    i2c,
    OSR::OSR1024,
    Channel::SensorPressureTemperature,
    &mut delay,
)?;
let mut altimeter = altimeter.to_altitude()?;
altimeter.set_offset(1000)?; // We're 1000m above sea level
let alti = altimeter.read_alti()?;
println!("Altitude: {}m", alti.0);

Features

The defmt feature provides logging of various levels with the defmt crate. It is disabled by default.

Dependencies

~420–600KB
~11K SLoC