Crate sensirion_rht

Source
Expand description

This crate implements multiple Temperature and Humidity Sensors from Sensirion. Multiple Sensors are combined into one single crate since the sensors share a common API.

§Supported Sensors:

SensorKindLink
SHT3xHumidity and TemperatureSensirion SHT3x
STS3xTemperatureSensirion STS3x

§Usage Example

The SHT3X returns both temperature and humidity

use sensirion_rht::*;
let mut sensor = Device::new_sht3x(Addr::A, i2c, delay);

if let Ok((temperature, humidity)) = sensor.single_shot(Repeatability::High) {
  log::info!(
    "Temperature: {}, Humidity: {}",
    temperature,
    humidity
  );
}

The STS3X returns only temperature

use sensirion_rht::*;
let mut sensor = Device::new_sts3x(Addr::A, i2c, delay);

if let Ok(temperature) = sensor.single_shot(Repeatability::High) {
  log::info!(
    "Temperature: {}",
    temperature
  );
}

§License

Open Logistics Foundation License
Version 1.3, January 2023

See the LICENSE file in the top-level directory.

§Contact

Fraunhofer IML Embedded Rust Group - embedded-rust@iml.fraunhofer.de

Modules§

kind
Module containing markers to decide between SHT3X and STS3X implementation

Structs§

Device
Common implementation for SHT/STS. Stores the address and device peripherals.
StatusRegister
Internal Status Register of the Sensor

Enums§

Addr
I2C Address of the sensor in use, determined by the sensors address pin
Error
Possible errors in this driver
Repeatability
Measurement duration and thus energy use