Restructure DHT22 code, move defines to header, remove redundant includes
This commit is contained in:
parent
be4b394bed
commit
2c4a1b1565
2 changed files with 7 additions and 12 deletions
12
DHT22.c
12
DHT22.c
|
@ -1,18 +1,8 @@
|
|||
#include "config.h"
|
||||
|
||||
#include "DHT22.h"
|
||||
#include <avr/io.h>
|
||||
#include <stdbool.h>
|
||||
#include <util/delay.h>
|
||||
|
||||
#include "GDM1602K.h"
|
||||
|
||||
#define DATAPIN PC0
|
||||
#define PORT PORTC
|
||||
#define PIN PINC
|
||||
#define DDR DDRC
|
||||
|
||||
bool is_high() { return (PIN & (1 << DATAPIN)); }
|
||||
|
||||
// Function to read data from the DHT22 sensor
|
||||
int DHT22_Read(int *temperature, int *humidity) {
|
||||
// Set the data pin as output
|
||||
|
|
5
DHT22.h
5
DHT22.h
|
@ -1,6 +1,11 @@
|
|||
#ifndef DHT22_H
|
||||
#define DHT22_H
|
||||
|
||||
#define DATAPIN PC0
|
||||
#define PORT PORTC
|
||||
#define PIN PINC
|
||||
#define DDR DDRC
|
||||
|
||||
int DHT22_Read(int *temperature, int *humidity);
|
||||
void DHT22_Init();
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue