From 2c4a1b15652453363850bfc41611ab696450de57 Mon Sep 17 00:00:00 2001 From: Imbus <> Date: Wed, 5 Feb 2025 14:16:54 +0100 Subject: [PATCH] Restructure DHT22 code, move defines to header, remove redundant includes --- DHT22.c | 12 +----------- DHT22.h | 7 ++++++- 2 files changed, 7 insertions(+), 12 deletions(-) diff --git a/DHT22.c b/DHT22.c index 8816f0d..2a8f8df 100644 --- a/DHT22.c +++ b/DHT22.c @@ -1,18 +1,8 @@ -#include "config.h" - +#include "DHT22.h" #include #include #include -#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 diff --git a/DHT22.h b/DHT22.h index 9c30cc5..914d84a 100644 --- a/DHT22.h +++ b/DHT22.h @@ -1,7 +1,12 @@ #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(); -#endif /* DHT22_H */ \ No newline at end of file +#endif /* DHT22_H */