Gradually migrate to FreeRTOS

This commit is contained in:
2024-06-04 09:54:09 +08:00
parent db774bfd76
commit 92c0ee6bd8
15 changed files with 143 additions and 161 deletions

View File

@@ -1,7 +1,6 @@
#include "MHZ14B.hpp"
#include "common.hpp"
void MH_Z14B_INIT()
{
// 初始化UART
@@ -16,7 +15,6 @@ void MH_Z14B_INIT()
static uint16_t MH_Z14B(int *MH_Z14B_DATA_IS_OK)
{
// 0x86 读气体浓度值
uint8_t CMD[9] = { 0xFF, 0x01, 0x86, 0x00, 0x00, 0x00, 0x00, 0x00, 0x79 };
uart_write_blocking(UART1, CMD, 9);
@@ -60,15 +58,13 @@ void CO2(void *pvParameters)
int MH_Z14B_DATA_IS_OK = 0;
MH_Z14B_INIT();
_printTaskStackHighWaterMark("MH_Z14B");
while(1)
{
while (1) {
CO2_DATA = MH_Z14B(&MH_Z14B_DATA_IS_OK);
if (CO2_DATA != -1 && MH_Z14B_DATA_IS_OK == 1) {
printf("CO2 Concentration: %d ppm\n", CO2_DATA);
}
_printTaskStackHighWaterMark("MH_Z14B");
//_printTaskStackHighWaterMark("MH_Z14B");
vTaskDelay(pdMS_TO_TICKS(3000)); // 非阻塞延时
}
}
}