Contiki-NG
Loading...
Searching...
No Matches
dht11-sensor.c File Reference

DHT 11 sensor implementation. More...

#include "contiki.h"
#include "dht11-sensor.h"
#include <string.h>
#include "dev/gpio-hal.h"

Go to the source code of this file.

Macros

#define DHT11_SIGNAL_HIGH   (1)
 GPIO High.
 
#define DHT11_SIGNAL_LOW   (0)
 GPIO Low.
 
#define DHT11_SIGNAL_START_PHASE1_DURATION   (40)
 Duration of signal start phase 1 according to data sheet.
 
#define DHT11_SIGNAL_START_PHASE2_DURATION   (80)
 Duration of signal start phase 2 according to data sheet.
 
#define DHT11_SIGNAL_START_PHASE3_DURATION   (80)
 Duration of signal start phase 3 according to data sheet.
 
#define DHT11_SIGNAL_RESPONSE_PHASE1_DURATION   (50)
 Duration of signal response phase 1 according to data sheet.
 
#define DHT11_SIGNAL_RESPONSE_BIT_0_DURATION   (28)
 Duration of signal response if bit is set to 0, according to data sheet.
 
#define DHT11_SIGNAL_RESPONSE_BIT_1_DURATION   (70)
 Duration of signal response if bit is set to 1, according to data sheet.
 
#define DHT11_TICKS_GUARD   (1)
 Sensor timer drift in ticks.
 
#define DHT11_US_GUARD   RTIMERTICKS_TO_US(1)
 Sensor timer drift in us from rtimer.
 
#define DHT11_DATA_SAMPLES   (40)
 Number of data requests.
 
#define DHT11_DATA_SIZE   (5)
 Number of bytes in data.
 
#define DHT11_SAMPLING_RATE_SECONDS   (1)
 DHT11 maximum sample rate is 1 Hz (1 second)
 

Functions

static uint8_t dht_read (void)
 

Variables

static dht_t dht
 DHT struct.
 

Detailed Description