sensor_dht11.c File Reference

library to query measurements from Aosong DHT11 temperature and relative humidity sensor (code) More...

Go to the source code of this file.

## Macros

#define | SENSOR_DHT11_TIMER 3
| timer peripheral
#define | SENSOR_DHT11_CHANNEL 1
| channel used as input capture
#define | SENSOR_DHT11_JITTER 0.1
| signal timing jitter tolerated in timing

## Enumerations

enum | sensor_dht11_state_t { SENSOR_DHT11_OFF, SENSOR_DHT11_HOST_START, SENSOR_DHT11_HOST_STARTED, SENSOR_DHT11_SLAVE_START, SENSOR_DHT11_SLAVE_BIT, SENSOR_DHT11_MAX }
| communication states

## Functions

static void | sensor_dht11_reset (void)
| reset all states
void | sensor_dht11_setup (void)
| setup peripherals to communicate with sensor
bool | sensor_dht11_measurement_request (void)
| request measurement from sensor More...
struct sensor_dht11_measurement_t | sensor_dht11_measurement_decode (void)
| decode received measurement More...
void TIM_ISR() | SENSOR_DHT11_TIMER (void)
| interrupt service routine called for timer

## Variables

volatile bool | sensor_dht11_measurement_received = false
| a measurement response has been received
enum sensor_dht11_state_t | sensor_dht11_state = SENSOR_DHT11_OFF
| current communication state
volatile uint8_t | sensor_dht11_bit = 0
| the bit number being sent (MSb first), up to 40
volatile uint8_t | sensor_dht11_bits [5] = {0}
| the 40 bits (5 bytes) being sent by the device

## Detailed Description

library to query measurements from Aosong DHT11 temperature and relative humidity sensor (code)

Author
  King Kévin kingk.nosp@m.evin.nosp@m.@cuvo.nosp@m.odoo.nosp@m..info

Date
  2017

Note
  peripherals used: timer channel timer peripheral used to measure signal timing for bit decoding

Definition in file sensor_dht11.c.

## Function Documentation

## sensor_dht11_measurement_decode()

struct sensor_dht11_measurement_t sensor_dht11_measurement_decode | ( | void |  | ) |

decode received measurement

Returns
  decoded measurement (0xff,0xff if invalid)

Definition at line 122 of file sensor_dht11.c.

## sensor_dht11_measurement_request()

bool sensor_dht11_measurement_request | ( | void |  | ) |

request measurement from sensor

Returns
  request started successfully

Definition at line 100 of file sensor_dht11.c.