29 lines
429 B
C++
29 lines
429 B
C++
#include "co2_task.hpp"
|
|
|
|
#include "mhz19c.hpp"
|
|
#include "co2_data.hpp"
|
|
#include "queues.hpp"
|
|
|
|
extern "C"
|
|
{
|
|
#include "usart.h"
|
|
#include "main.h"
|
|
}
|
|
|
|
extern UART_HandleTypeDef huart1;
|
|
|
|
static MHZ19C sensor(&huart1);
|
|
|
|
void CO2Task_RunOnce()
|
|
{
|
|
CO2Data data;
|
|
|
|
if(sensor.ReadCO2(data.ppm))
|
|
{
|
|
data.timestamp = HAL_GetTick();
|
|
|
|
xQueueSend(g_sdQueue, &data, 0);
|
|
xQueueSend(g_canQueue, &data, 0);
|
|
}
|
|
}
|