42 lines
1.0 KiB
C++
42 lines
1.0 KiB
C++
#ifndef SENSOR_TCS34725_H
|
|
#define SENSOR_TCS34725_H
|
|
|
|
|
|
#include "sensordata.h"
|
|
#include <Homie.h>
|
|
|
|
#include "tcs34725_agc.h" //class code from example https://github.com/adafruit/Adafruit_TCS34725/blob/master/examples/tcs34725autorange/tcs34725autorange.ino
|
|
|
|
class Sensor_TCS34725
|
|
{
|
|
|
|
private:
|
|
tcs34725 *tcs; //wrapper class with agc
|
|
HomieNode *sensorNode; //reference to HomieNode
|
|
|
|
struct sensordata data_lux; //struct values are changed in setup()
|
|
struct sensordata data_colortemp; //struct values are changed in setup()
|
|
|
|
uint16_t value_tcs_r,value_tcs_g,value_tcs_b,value_tcs_c;
|
|
|
|
unsigned long lastread_tcs34725=0;
|
|
|
|
bool init_ok;
|
|
|
|
public:
|
|
Sensor_TCS34725();
|
|
|
|
void loop_lux();
|
|
void loop_colortemp();
|
|
|
|
void init();
|
|
void setSettings_Lux(float minchange, unsigned long senddelaymax, unsigned long readdelay);
|
|
void setSettings_Colortemp(float minchange, unsigned long senddelaymax, unsigned long readdelay);
|
|
void advertise(HomieNode& p_sensorNode);
|
|
void sensorloop();
|
|
|
|
};
|
|
|
|
#endif
|
|
|