|
Contiki-NG
|
Files | |
| file | dht11-sensor.c |
| DHT 11 sensor implementation. | |
| file | dht11-sensor.h |
| DHT 11 sensor header file. | |
Macros | |
| #define | DHT11_SIGNAL_HIGH (1) |
| GPIO High. More... | |
| #define | DHT11_SIGNAL_LOW (0) |
| GPIO Low. More... | |
| #define | DHT11_SIGNAL_START_PHASE1_DURATION (40) |
| Duration of signal start phase 1 according to data sheet. More... | |
| #define | DHT11_SIGNAL_START_PHASE2_DURATION (80) |
| Duration of signal start phase 2 according to data sheet. More... | |
| #define | DHT11_SIGNAL_START_PHASE3_DURATION (80) |
| Duration of signal start phase 3 according to data sheet. More... | |
| #define | DHT11_SIGNAL_RESPONSE_PHASE1_DURATION (50) |
| Duration of signal response phase 1 according to data sheet. More... | |
| #define | DHT11_SIGNAL_RESPONSE_BIT_0_DURATION (28) |
| Duration of signal response if bit is set to 0, according to data sheet. More... | |
| #define | DHT11_SIGNAL_RESPONSE_BIT_1_DURATION (70) |
| Duration of signal response if bit is set to 1, according to data sheet. More... | |
| #define | DHT11_TICKS_GUARD (1) |
| Sensor timer drift in ticks. More... | |
| #define | DHT11_US_GUARD RTIMERTICKS_TO_US(1) |
| Sensor timer drift in us from rtimer. More... | |
| #define | DHT11_DATA_SAMPLES (40) |
| Number of data requests. More... | |
| #define | DHT11_DATA_SIZE (5) |
| Number of bytes in data. More... | |
| #define | DHT11_SAMPLING_RATE_SECONDS (1) |
| DHT11 maximum sample rate is 1 Hz (1 second) More... | |
| #define | DHT11_CONFIGURE_GPIO_PORT (0) |
| DHT11 Configuration type for GPIO Port. More... | |
| #define | DHT11_CONFIGURE_GPIO_PIN (1) |
| DHT11 Configuration type for GPIO Pin. More... | |
| #define | DHT11_VALUE_HUMIDITY_INTEGER (0) |
| DHT11 value type for humidity integer part. More... | |
| #define | DHT11_VALUE_HUMIDITY_DECIMAL (1) |
| DHT11 value type for humidity decimal part. More... | |
| #define | DHT11_VALUE_TEMPERATURE_INTEGER (2) |
| DHT11 value type for temperature integer part. More... | |
| #define | DHT11_VALUE_TEMPERATURE_DECIMAL (3) |
| DHT11 value type for temperature decimal part. More... | |
| #define | DHT11_STATUS_OKAY (0) |
| DHT11 status okay. More... | |
| #define | DHT11_STATUS_TIMEOUT (1) |
| DHT11 status timeout. More... | |
| #define | DHT11_STATUS_CHECKSUM_FAILED (2) |
| DHT11 status checksum failed. More... | |
Functions | |
| static uint8_t | dht_read (void) |
Variables | |
| static dht_t | dht |
| DHT struct. More... | |
| #define DHT11_CONFIGURE_GPIO_PIN (1) |
DHT11 Configuration type for GPIO Pin.
Definition at line 63 of file dht11-sensor.h.
| #define DHT11_CONFIGURE_GPIO_PORT (0) |
DHT11 Configuration type for GPIO Port.
Definition at line 57 of file dht11-sensor.h.
| #define DHT11_DATA_SAMPLES (40) |
Number of data requests.
Definition at line 121 of file dht11-sensor.c.
| #define DHT11_DATA_SIZE (5) |
Number of bytes in data.
Definition at line 127 of file dht11-sensor.c.
| #define DHT11_SAMPLING_RATE_SECONDS (1) |
DHT11 maximum sample rate is 1 Hz (1 second)
Definition at line 133 of file dht11-sensor.c.
| #define DHT11_SIGNAL_HIGH (1) |
GPIO High.
Definition at line 55 of file dht11-sensor.c.
| #define DHT11_SIGNAL_LOW (0) |
GPIO Low.
Definition at line 61 of file dht11-sensor.c.
| #define DHT11_SIGNAL_RESPONSE_BIT_0_DURATION (28) |
Duration of signal response if bit is set to 0, according to data sheet.
Definition at line 91 of file dht11-sensor.c.
| #define DHT11_SIGNAL_RESPONSE_BIT_1_DURATION (70) |
Duration of signal response if bit is set to 1, according to data sheet.
Definition at line 97 of file dht11-sensor.c.
| #define DHT11_SIGNAL_RESPONSE_PHASE1_DURATION (50) |
Duration of signal response phase 1 according to data sheet.
Definition at line 85 of file dht11-sensor.c.
| #define DHT11_SIGNAL_START_PHASE1_DURATION (40) |
Duration of signal start phase 1 according to data sheet.
Definition at line 67 of file dht11-sensor.c.
| #define DHT11_SIGNAL_START_PHASE2_DURATION (80) |
Duration of signal start phase 2 according to data sheet.
Definition at line 73 of file dht11-sensor.c.
| #define DHT11_SIGNAL_START_PHASE3_DURATION (80) |
Duration of signal start phase 3 according to data sheet.
Definition at line 79 of file dht11-sensor.c.
| #define DHT11_STATUS_CHECKSUM_FAILED (2) |
DHT11 status checksum failed.
Definition at line 105 of file dht11-sensor.h.
| #define DHT11_STATUS_OKAY (0) |
DHT11 status okay.
Definition at line 93 of file dht11-sensor.h.
| #define DHT11_STATUS_TIMEOUT (1) |
DHT11 status timeout.
Definition at line 99 of file dht11-sensor.h.
| #define DHT11_TICKS_GUARD (1) |
Sensor timer drift in ticks.
DHT uses 1us granularity and rtimer granularity is higher. So, allow the reading to drift by 1 tick
Definition at line 106 of file dht11-sensor.c.
| #define DHT11_US_GUARD RTIMERTICKS_TO_US(1) |
Sensor timer drift in us from rtimer.
DHT uses 1us granularity and rtimer granularity is higher. So, allow the reading to drift by 1 tick in us
Definition at line 115 of file dht11-sensor.c.
| #define DHT11_VALUE_HUMIDITY_DECIMAL (1) |
DHT11 value type for humidity decimal part.
Definition at line 75 of file dht11-sensor.h.
| #define DHT11_VALUE_HUMIDITY_INTEGER (0) |
DHT11 value type for humidity integer part.
Definition at line 69 of file dht11-sensor.h.
| #define DHT11_VALUE_TEMPERATURE_DECIMAL (3) |
DHT11 value type for temperature decimal part.
Definition at line 87 of file dht11-sensor.h.
| #define DHT11_VALUE_TEMPERATURE_INTEGER (2) |
DHT11 value type for temperature integer part.
Definition at line 81 of file dht11-sensor.h.
|
static |
Data Single-bus free status is at high voltage level. When the communication between MCU and DHT11 begins, the programme of MCU will set Data Single-bus voltage level from high to low and this process must take at least 18ms to ensure DHT’s detection of MCU's signal, then MCU will pull up voltage and wait 20-40us for DHT’s response.
Once DHT detects the start signal,it will send out a low-voltage-level response signal, which lasts 80us. Then the programme of DHT sets Data Single-bus voltage level from low to high and keeps it for 80us for DHT’s preparation for sending data.
When DHT is sending data to MCU, every bit of data begins with the 50us low-voltage-level and the length of the following high-voltage-level signal determines whether data bit is "0" or "1"
26-28us voltage-length means data "0" 70us voltage-length means 1 bit data "1"
Definition at line 229 of file dht11-sensor.c.
|
static |
DHT struct.
Definition at line 171 of file dht11-sensor.c.
1.8.13