libyggdrasil  v1.0.0
bsp::ygg::prph::HumiditySensor Class Reference

Humidity sensor SHT40-AD1B-R2 driver. More...

#include <humidity_sensor.hpp>

Public Types

enum  Heat : u8 {
  Heat::_200mWFor1s = 0x39, Heat::_200mWFor0p1s = 0x32, Heat::_110mWFor1s = 0x2F, Heat::_110mWFor0p1s = 0x24,
  Heat::_20mWFor1s = 0x1E, Heat::_20mWFor0p1s = 0x15
}
 Heater commands for the SHT40-AD1B-R2 sensor. More...
 
enum  Precision : u8 { Precision::High = 0xFD, Precision::Medium = 0xF6, Precision::Low = 0xE0 }
 

Public Member Functions

 HumiditySensor ()=delete
 

Static Public Member Functions

static bool init ()
 Initialization of the SHT40-AD1B-R2 relative humidity and temperature sensor. More...
 
static float getTemperature (Precision precision=Precision::High)
 Get the temperature without using the heater. More...
 
static float getHumidity (Precision precision=Precision::High)
 Get the temperature without using the heater. More...
 
static void enableHeater (Heat level)
 Enable the heater module on the sensor. More...
 

Detailed Description

Humidity sensor SHT40-AD1B-R2 driver.

Member Enumeration Documentation

◆ Heat

Heater commands for the SHT40-AD1B-R2 sensor.

Warning
Do not use heater for extended periods of time. The heater is designed for a maximal duty cycle of less than 5% when it is periodically heated
Enumerator
_200mWFor1s 

200mW @ 3.3V for 1s

_200mWFor0p1s 

200mW @ 3.3V for 0.1s

_110mWFor1s 

110mW @ 3.3V for 1s

_110mWFor0p1s 

110mW @ 3.3V for 0.1s

_20mWFor1s 

20mW @ 3.3V for 1s

_20mWFor0p1s 

20mW @ 3.3V for 0.1s

◆ Precision

Enumerator
High 

measure T & RH with High precision (High repeatability)

Medium 

measure T & RH with medium precision (medium repeatability)

Low 

measure T & RH with lowest precision (low repeatability)

Constructor & Destructor Documentation

◆ HumiditySensor()

bsp::ygg::prph::HumiditySensor::HumiditySensor ( )
delete

Member Function Documentation

◆ enableHeater()

static void bsp::ygg::prph::HumiditySensor::enableHeater ( Heat  level)
inlinestatic

Enable the heater module on the sensor.

Warning
The heater is designed for a maximal duty cycle of less than 5% when it is periodically heated
Parameters
levelPower and duration command

◆ getHumidity()

static float bsp::ygg::prph::HumiditySensor::getHumidity ( Precision  precision = Precision::High)
inlinestatic

Get the temperature without using the heater.

Note
The measurement takes about 10ms
Parameters
precisionPrecision for the conversion
Returns
Temperature sensor temperature

◆ getTemperature()

static float bsp::ygg::prph::HumiditySensor::getTemperature ( Precision  precision = Precision::High)
inlinestatic

Get the temperature without using the heater.

Note
The measurement takes about 10ms
Parameters
precisionPrecision for the conversion
Returns
Temperature sensor temperature

◆ init()

static bool bsp::ygg::prph::HumiditySensor::init ( )
inlinestatic

Initialization of the SHT40-AD1B-R2 relative humidity and temperature sensor.

Note
The sensor does not need a special initialization, this function just does a soft reset
Returns
Success

The documentation for this class was generated from the following file: