31 lines
547 B
C
31 lines
547 B
C
#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
|