dht11.h
776 Bytes
#ifndef __DHT11_H__
#define __DHT11_H__
#include <stdint.h>
#define DATA_PIN NRF_GPIO_PIN_MAP(1,3) //Set P1.03 as temperature sensor out interface
#define PIN_DATA_OUT (nrf_gpio_cfg_output(DATA_PIN));
#define PIN_DATA_IN (nrf_gpio_cfg_input(DATA_PIN,NRF_GPIO_PIN_PULLUP));
#define PIN_DATA_SET (nrf_gpio_pin_set(DATA_PIN));
#define PIN_DATA_CLEAR (nrf_gpio_pin_clear(DATA_PIN));
#define DHT11_SUCCESS NRF_SUCCESS
#define DHT11_DATA_ERR 0xFD
#define DHT11_NACK 0xFE
typedef struct
{
uint8_t h_int;
uint8_t h_deci;
uint8_t t_int;
uint8_t t_deci;
uint8_t check_sum;
}DHT11_Data_t;
uint32_t Read_DHT11(DHT11_Data_t *DHT11_Data);
#endif