DHT22Gen3_RK
Public Member Functions | Data Fields
DHTSensorType Class Referenceabstract

Abstract base class for all types of sensor. More...

#include <DHT22Gen3_RK.h>

Inheritance diagram for DHTSensorType:
DHTSensorTypeDHT11 DHTSensorTypeDHT22

Public Member Functions

 DHTSensorType (const char *name, unsigned long minSamplePeriodMs, unsigned long oneBitThreshold)
 Constructor for a sensor type. More...
 
virtual ~DHTSensorType ()
 Destructor.
 
virtual float getTempC (const DHTSample &sample) const =0
 For the sample, convert it into degrees C based on the sensor type. More...
 
virtual float getHumidity (const DHTSample &sample) const =0
 For the sample, convert it into percent humidity (0-100) based on the sensor type. More...
 

Data Fields

const char * name
 Short name of sensor.
 
unsigned long minSamplePeriodMs
 Minimum period between samples.
 
int oneBitThreshold
 Threshold in number of I2S bits for a 1-bit.
 

Detailed Description

Abstract base class for all types of sensor.

Constructor & Destructor Documentation

◆ DHTSensorType()

DHTSensorType::DHTSensorType ( const char *  name,
unsigned long  minSamplePeriodMs,
unsigned long  oneBitThreshold 
)
inline

Constructor for a sensor type.

Parameters
nameShort descriptive name (DHT11, DHT22)
minSamplePeriodMsMinimum number of milliseconds between queries to the sensor
oneBitThresholdNumber of counts for the bit in the I2S buffer to be considered a 1 bit

Member Function Documentation

◆ getHumidity()

virtual float DHTSensorType::getHumidity ( const DHTSample sample) const
pure virtual

For the sample, convert it into percent humidity (0-100) based on the sensor type.

Parameters
sampleThe sample data to convert

Implemented in DHTSensorTypeDHT22, and DHTSensorTypeDHT11.

◆ getTempC()

virtual float DHTSensorType::getTempC ( const DHTSample sample) const
pure virtual

For the sample, convert it into degrees C based on the sensor type.

Parameters
sampleThe sample data to convert

Implemented in DHTSensorTypeDHT22, and DHTSensorTypeDHT11.


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