WxBox/include/CCS811Sensor.h
2024-04-13 01:03:37 +03:00

24 lines
688 B
C++

// CCS811Sensor.h
#ifndef CCS811SENSOR_H
#define CCS811SENSOR_H
#define CCS811_WAK 23
#include <ccs811.h> // Include CCS811 library
class CCS811Sensor {
public:
CCS811Sensor(uint8_t wakePin = CCS811_WAK); // Constructor
void init(double* temperature, double* humidity); // temp and hum needed to correct env
void init(); // Initialize without temperature and humidity
void read_values(uint16_t* eco2, uint16_t* etvoc, uint16_t* errstat, uint16_t* raw);
private:
uint8_t _wakePin; // CCS811 wake pin
CCS811 ccs811; // CCS811 object
double* _temperaturePtr; // Pointer to temperature value
double* _humidityPtr; // Pointer to humidity value
};
#endif // CCS811SENSOR_H