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-07-06 12:57:00 +00:00
|
|
|
#define DHT11 11
|
|
|
|
#define DHT22 22
|
2016-04-20 22:03:18 +00:00
|
|
|
|
2016-07-06 12:57:00 +00:00
|
|
|
// Type of sensor to use
|
|
|
|
#define DHT_TYPE DHT22
|
2016-04-20 22:03:18 +00:00
|
|
|
|
2016-10-24 13:09:17 +00:00
|
|
|
#ifdef __cplusplus
|
|
|
|
extern "C" {
|
|
|
|
#endif
|
|
|
|
|
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
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
bool dht_read_data(uint8_t pin, int16_t *humidity, int16_t *temperature);
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Float version of dht_read_data.
|
|
|
|
*
|
|
|
|
* Return values as floating point values.
|
|
|
|
*/
|
|
|
|
bool dht_read_float_data(uint8_t pin, float *humidity, float *temperature);
|
|
|
|
|
2016-10-24 13:09:17 +00:00
|
|
|
#ifdef __cplusplus
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
2016-07-06 12:57:00 +00:00
|
|
|
#endif // __DHT_H__
|