-
Notifications
You must be signed in to change notification settings - Fork 0
/
DHT.h
37 lines (30 loc) · 812 Bytes
/
DHT.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
#ifndef __DHT_H__
#define __DHT_H__
/*
* DHT Sensor for AVR-GCC Family
*
* Author : David Feng
* Updated : June 26th, 2018
* Description : DHT Sensor Library for AVR-GCC compiler
* Usage : Use library with AVR-GCC for Atmega family of microcontrollers (tested with Atmega 1284)
*/
#include <stdio.h>
#include <avr/io.h>
//Port where DHT sensor is connected
#define DHT_DDR DDRD
#define DHT_PORT PORTD
#define DHT_PIN PIND
#define DHT_INPUTPIN 2
//Define sensor type
#define DHT_DHT11 0
#define DHT_DHT22 1
#define DHT_TYPE DHT_DHT22
//timeout retries
#define DHT_TIMEOUT 200
//functions
#if DHT_TYPE == 1
extern int8_t dht_GetTempUtil(uint16_t *temperature, uint16_t *humidity);
#elif DHT_TYPE == 0
extern int8_t dht_GetTempUtil(int8_t *temperature, int8_t *humidity);
#endif
#endif