Air quality sensor
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

47 lines
1003 B

* TODO file description
* Created on 2021/12/13.
#include <stdint-gcc.h>
#include <stdbool.h>
#include <freertos/FreeRTOS.h>
#include <freertos/semphr.h>
#include <freertos/task.h>
struct data_report {
bool iaq_ready;
uint32_t iaq_timestamp; // timestamp in ticks
float iaq;
float iaq_static;
float iaq_co2_ppm_equiv;
float iaq_voc_ppm_equiv;
bool thpg_ready;
uint32_t thpg_timestamp; // timestamp in ticks
float temperature;
float temperature_raw;
float pressure;
float humidity;
float humidity_raw;
float gas_raw;
bool co2_ready;
uint32_t co2_timestamp; // timestamp in ticks
float co2_ppm;
static inline uint32_t timestamp_age(uint32_t ticks) {
return xTaskGetTickCount() - ticks;
#define DATA_MAX_AGE (pdMS_TO_TICKS(60000))
extern SemaphoreHandle_t g_mux_data_report;
extern struct data_report g_data_report;