42 template<BOARD::pin_t DATA_PIN, u
int8_t DEVICE>
87 }
while (
m_data && --retry);
94 for (
int i = 0; i < 5; i++) {
96 for (
int j = 0; j < 8; j++) {
97 uint8_t width =
m_data.pulse();
101 if (i < 4) chsum += v;
105 if (chsum != d[4])
return (-1);
113 humidity = ((d[0] << 8) | d[1]) / 10.0;
114 temperature = (((d[2] & 0x7f) << 8) | d[3]) / 10.0;
115 if (d[2] & 0x80) temperature *= -1;
153 template<BOARD::pin_t DATA_PIN>
class DHT11 :
public DHT<DATA_PIN, 11> {};
159 template<BOARD::pin_t DATA_PIN>
class DHT21 :
public DHT<DATA_PIN, 21> {};
165 template<BOARD::pin_t DATA_PIN>
class DHT22 :
public DHT<DATA_PIN, 22> {};
static const uint16_t PULLUP
static const int THRESHOLD
static const uint16_t START_SIGNAL
int read(float &humidity, float &temperature)