DHT11 readout library
dht11.h
Go to the documentation of this file.
1 /* @file */
15 #ifndef __DHT11_H__
16 #define __DHT11_H__
17 #include <stdbool.h>
18 #include <sys/timeb.h>
19 #include <time.h>
20 #include <strings.h>
21 
22 #define DHT11_GPIO_PIN 0
23 #define DHT11_PROTOCOL_TIMEOUT 100
24 #define DHT11_PROTOCOL_SIZE 800
25 #define DHT11_PROTOCOL_SIZE_MARGIN 200
26 /* error codes */
27 #define DHT11_SUCCESS 0
28 #define DHT11_MISSING_INIT -1
29 #define DHT11_NO_MEAS_YET -2
30 #define DHT11_NO_VALID_MEAS_YET -3
31 #define DHT11_MEM_ALLOC_ERROR -4
32 #define DHT11_PROTOCOL_ERROR -5
33 #define DHT11_BAD_CHECKSUM -6
34 #define DHT11_BAD_TIME_STAMP -10
35 /* functions */
36 void dht11SetDebug(bool);
37 int dht11Measurement(void);
38 void dht11PrintError(int);
39 void dht11Init(void);
40 int dht11GetTemperature(void);
41 int dht11GetValidTemperature(void);
42 int dht11GetHumidity(void);
43 int dht11GetValidHumidity(void);
44 time_t dht11GetMeasTimeStamp(void);
45 time_t dht11GetValidMeasTimeStamp(void);
46 int dht11GetRawData(int *);
47 int dht11GetValidRawData(int *);
48 int dht11GetChecksum(void);
50 #endif
int dht11Measurement(void)
make a measurement and saves the data in an internal array returns DHT11_SUCCESS if successful DHT11_...
Definition: dht11.c:100
int dht11GetHumidity(void)
returns the measured humidity value in %
Definition: dht11.c:329
time_t dht11GetValidMeasTimeStamp(void)
returns the time stamp of the last valid measurement
Definition: dht11.c:364
int dht11GetRawData(int *)
returns the measured data independent of the checksum test
Definition: dht11.c:378
time_t dht11GetMeasTimeStamp(void)
returns the time stamp of the last measurement
Definition: dht11.c:350
int dht11GetValidRawData(int *)
returns the measured data which were checked by the checksum test
Definition: dht11.c:398
void dht11PrintError(int)
prints an error message in human understandable form
Definition: dht11.c:52
void dht11Init(void)
connects to the wiringPi library
Definition: dht11.c:86
int dht11GetChecksum(void)
returns the checksum as calculated from the data
Definition: dht11.c:412
void dht11SetDebug(bool)
switches debug mode on or off
Definition: dht11.c:45
int dht11GetValidTemperature(void)
returns the measured temperature value in degrees C
Definition: dht11.c:315
int dht11GetTemperature(void)
returns the measured temperature value in degrees C
Definition: dht11.c:304
int dht11GetValidHumidity(void)
returns the measured humidity value in %
Definition: dht11.c:340
int dht11GetDeviceChecksum()
returns the checksum as read from the dht11
Definition: dht11.c:426