Restructure DHT22 code, move defines to header, remove redundant includes

This commit is contained in:
Imbus 2025-02-05 14:16:54 +01:00
parent be4b394bed
commit 2c4a1b1565
2 changed files with 7 additions and 12 deletions

12
DHT22.c
View file

@ -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

View file

@ -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 */
#endif /* DHT22_H */