2016-04-20 22:03:18 +00:00
|
|
|
/*
|
|
|
|
* Part of esp-open-rtos
|
|
|
|
* Copyright (C) 2016 Jonathan Hartsuiker (https://github.com/jsuiker)
|
|
|
|
* BSD Licensed as described in the file LICENSE
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
2016-07-06 12:57:00 +00:00
|
|
|
#ifndef __DHT_H__
|
2016-04-20 22:03:18 +00:00
|
|
|
#define __DHT_H__
|
|
|
|
|
2016-07-06 12:57:00 +00:00
|
|
|
#include <stdint.h>
|
|
|
|
#include <stdbool.h>
|
2016-04-20 22:03:18 +00:00
|
|
|
|
2016-10-24 13:09:17 +00:00
|
|
|
#ifdef __cplusplus
|
|
|
|
extern "C" {
|
|
|
|
#endif
|
|
|
|
|
2016-10-26 13:41:08 +00:00
|
|
|
/**
|
|
|
|
* Sensor type
|
|
|
|
*/
|
|
|
|
typedef enum
|
|
|
|
{
|
|
|
|
DHT_TYPE_DHT11 = 0, //!< DHT11
|
2019-07-21 21:21:27 +00:00
|
|
|
DHT_TYPE_DHT22, //!< DHT22
|
|
|
|
DHT_TYPE_SI7021 //!< Itead SI7021
|
2016-10-26 13:41:08 +00:00
|
|
|
} dht_sensor_type_t;
|
|
|
|
|
2016-07-06 12:57:00 +00:00
|
|
|
/**
|
|
|
|
* Read data from sensor on specified pin.
|
|
|
|
*
|
|
|
|
* Humidity and temperature is returned as integers.
|
|
|
|
* For example: humidity=625 is 62.5 %
|
|
|
|
* temperature=24.4 is 24.4 degrees Celsius
|
|
|
|
*
|
|
|
|
*/
|
2016-10-26 13:41:08 +00:00
|
|
|
bool dht_read_data(dht_sensor_type_t sensor_type, uint8_t pin, int16_t *humidity, int16_t *temperature);
|
2016-07-06 12:57:00 +00:00
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Float version of dht_read_data.
|
|
|
|
*
|
|
|
|
* Return values as floating point values.
|
|
|
|
*/
|
2016-10-26 13:41:08 +00:00
|
|
|
bool dht_read_float_data(dht_sensor_type_t sensor_type, uint8_t pin, float *humidity, float *temperature);
|
2016-07-06 12:57:00 +00:00
|
|
|
|
2016-10-24 13:09:17 +00:00
|
|
|
#ifdef __cplusplus
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
2016-07-06 12:57:00 +00:00
|
|
|
#endif // __DHT_H__
|