esp-open-rtos/extras/dht/dht.h
sheinz a41407e3d1 DHT11/22 library fix
Support DHT11/DHT22 modules.
Data representation fix.
Library refactoring.
2016-07-06 15:58:59 +03:00

38 lines
841 B
C

/*
* Part of esp-open-rtos
* Copyright (C) 2016 Jonathan Hartsuiker (https://github.com/jsuiker)
* BSD Licensed as described in the file LICENSE
*
*/
#ifndef __DHT_H__
#define __DHT_H__
#include <stdint.h>
#include <stdbool.h>
#define DHT11 11
#define DHT22 22
// Type of sensor to use
#define DHT_TYPE DHT22
/**
* 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);
#endif // __DHT_H__