add untested driver prototype for DHT11 humidity and temperature sensor
This commit is contained in:
30
Core/Inc/dht11.h
Normal file
30
Core/Inc/dht11.h
Normal 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
|
||||
Reference in New Issue
Block a user