Extras/DHT improvements: makefile fix, replace DHT_TYPE macro by param (#252)

This commit is contained in:
Ruslan V. Uss 2016-10-26 19:41:08 +06:00 committed by sheinz
parent 574f944fbb
commit 2ab9beb946
5 changed files with 38 additions and 36 deletions

View file

@ -11,16 +11,19 @@
#include <stdint.h>
#include <stdbool.h>
#define DHT11 11
#define DHT22 22
// Type of sensor to use
#define DHT_TYPE DHT22
#ifdef __cplusplus
extern "C" {
#endif
/**
* Sensor type
*/
typedef enum
{
DHT_TYPE_DHT11 = 0, //!< DHT11
DHT_TYPE_DHT22 //!< DHT22
} dht_sensor_type_t;
/**
* Read data from sensor on specified pin.
*
@ -29,7 +32,7 @@ extern "C" {
* temperature=24.4 is 24.4 degrees Celsius
*
*/
bool dht_read_data(uint8_t pin, int16_t *humidity, int16_t *temperature);
bool dht_read_data(dht_sensor_type_t sensor_type, uint8_t pin, int16_t *humidity, int16_t *temperature);
/**
@ -37,7 +40,7 @@ bool dht_read_data(uint8_t pin, int16_t *humidity, int16_t *temperature);
*
* Return values as floating point values.
*/
bool dht_read_float_data(uint8_t pin, float *humidity, float *temperature);
bool dht_read_float_data(dht_sensor_type_t sensor_type, uint8_t pin, float *humidity, float *temperature);
#ifdef __cplusplus
}