add untested driver prototype for DHT11 humidity and temperature sensor

This commit is contained in:
2025-02-20 01:02:11 +02:00
parent a2c5b2fe87
commit 5b4d65d45c
6 changed files with 152 additions and 11 deletions

30
Core/Inc/dht11.h Normal file
View File

@@ -0,0 +1,30 @@
#ifndef __DHT11
#define __DHT11
#define SKIP_LOW while (!(GPIOD->IDR & 0x0800)) {}
#define SKIP_HIGH while (GPIOD->IDR & 0x0800) {}
#define FILL_REGISTER do { \
for (int i = 0; i < 8; i++) { \
read_register <<= 1; \
SKIP_LOW; \
read_register |= dht11_measure_high_duration(); \
} } while (0)
struct SysTickConfig {
uint32_t ctrl;
uint32_t load;
uint32_t val;
};
struct DHT11_Data {
uint8_t humid_integral;
uint8_t humid_decimal;
uint8_t temp_integral;
uint8_t temp_decimal;
uint8_t crc;
};
void dht11_show_both(void);
#endif