Sensirion SHT4x Driver for Embedded HAL

A platform agnostic device driver for the Sensirion SHT4x temperature and humidity sensor family. It is based on embedded-hal traits and works in no_std environments.

In theory, it supports all of the sensor family's devices but has only been tested with the SHT40-AD1B so far.

Build Status crates.io Documentation

Features

Example

```rust ignore use embedded_hal::blocking::delay::DelayMs; use sht4x::Sht4x; // Device-specific use declarations.

let mut delay = // Device-specific initialization of delay. let i2c = // Device-specific initialization of I2C peripheral. let mut sht40 = Sht4x::new(i2c);

let serial = sht40.serial_number(&mut delay); defmt::info!("serial number: {}", serial);

let measurement = sht40.measure(Precision::Low, &mut delay); defmt::info!("measurement: {}", &measurement);

if let Ok(measurement) = measurement { // Convert temperature measurand into different formats for further // processing. let int: i32 = measurement.temperaturemillicelsius(); let fixed: I16F16 = measurement.temperaturecelsius(); let float: f32 = measurement.temperaturecelsius().to_num(); } ```

Related Work

sensor-temp-humidity-sht40 is another driver for this sensor family.

License

Licensed under either of

at your discretion.

Contribution

Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.