|
|
@ -134,7 +134,9 @@ static void aht20_parse_data(const rt_uint8_t raw[6], rt_int32_t *temp, rt_int32 |
|
|
static void aht20_thread_entry(void *parameter) |
|
|
static void aht20_thread_entry(void *parameter) |
|
|
{ |
|
|
{ |
|
|
rt_uint8_t raw_data[6]; |
|
|
rt_uint8_t raw_data[6]; |
|
|
rt_int32_t temperature, humidity; |
|
|
|
|
|
|
|
|
extern unsigned int sys_temperature; |
|
|
|
|
|
extern unsigned int sys_humidity; |
|
|
|
|
|
|
|
|
while (1) |
|
|
while (1) |
|
|
{ |
|
|
{ |
|
|
@ -162,11 +164,7 @@ static void aht20_thread_entry(void *parameter) |
|
|
continue; |
|
|
continue; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
aht20_parse_data(raw_data, &temperature, &humidity); |
|
|
aht20_parse_data(raw_data, &sys_temperature, &sys_humidity); |
|
|
|
|
|
|
|
|
LOG_I("Temp: %d.%dC, Humidity: %d.%dRH", |
|
|
|
|
|
temperature / 10, temperature % 10, |
|
|
|
|
|
humidity / 10, humidity % 10); |
|
|
|
|
|
|
|
|
|
|
|
rt_thread_mdelay(5000); // 每 2 秒读取一次
|
|
|
rt_thread_mdelay(5000); // 每 2 秒读取一次
|
|
|
} |
|
|
} |
|
|
|