2024-09-01 22:10:53 +02:00
|
|
|
#ifndef __SENSOR_MANAGER_HPP__
|
|
|
|
#define __SENSOR_MANAGER_HPP__
|
|
|
|
|
|
|
|
#include "bsec.h"
|
|
|
|
|
|
|
|
class SensorManager {
|
|
|
|
public:
|
|
|
|
// Public types
|
|
|
|
struct SensorData {
|
|
|
|
__typeof__(Bsec::iaq) iaq;
|
2024-09-07 00:03:53 +02:00
|
|
|
__typeof__(Bsec::iaqAccuracy) iaq_accuracy;
|
|
|
|
__typeof__(Bsec::staticIaq) static_iaq;
|
|
|
|
__typeof__(Bsec::co2Equivalent) co2_equivalent;
|
|
|
|
__typeof__(Bsec::breathVocEquivalent) breath_voc_equivalent;
|
|
|
|
__typeof__(Bsec::rawTemperature) raw_temperature;
|
2024-09-01 22:10:53 +02:00
|
|
|
__typeof__(Bsec::pressure) pressure;
|
2024-09-07 00:03:53 +02:00
|
|
|
__typeof__(Bsec::rawHumidity) raw_humidity;
|
|
|
|
__typeof__(Bsec::gasResistance) gas_resistance;
|
|
|
|
__typeof__(Bsec::stabStatus) stab_status;
|
|
|
|
__typeof__(Bsec::runInStatus) run_in_status;
|
2024-09-01 22:10:53 +02:00
|
|
|
__typeof__(Bsec::temperature) temperature;
|
|
|
|
__typeof__(Bsec::humidity) humidity;
|
2024-09-07 00:03:53 +02:00
|
|
|
__typeof__(Bsec::gasPercentage) gas_percentage;
|
2024-09-01 22:10:53 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
public:
|
|
|
|
// Constructor
|
|
|
|
SensorManager();
|
|
|
|
|
|
|
|
bool setup();
|
|
|
|
|
|
|
|
bool read();
|
|
|
|
|
|
|
|
public:
|
|
|
|
// Public members
|
|
|
|
SensorData data;
|
|
|
|
|
|
|
|
private:
|
|
|
|
bool checkIaqSensorStatus();
|
|
|
|
|
|
|
|
private:
|
|
|
|
// Private static members
|
2024-09-07 00:03:53 +02:00
|
|
|
constexpr static uint8_t BME_CS = 5U;
|
|
|
|
constexpr static uint8_t BSEC_CONFIG_IAQ[] = {
|
2024-09-01 22:10:53 +02:00
|
|
|
#include "config/generic_33v_3s_4d/bsec_iaq.txt"
|
|
|
|
};
|
|
|
|
|
|
|
|
private:
|
|
|
|
// Private members
|
2024-09-07 00:03:53 +02:00
|
|
|
Bsec m_iaq_sensor;
|
|
|
|
uint32_t m_next_call;
|
2024-09-01 22:10:53 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif // __SENSOR_MANAGER_HPP__
|