sensoresp/src/tcs34725_agc.h

51 lines
1.1 KiB
C
Raw Normal View History

//copied from example code: https://github.com/adafruit/Adafruit_TCS34725/blob/master/examples/tcs34725autorange/tcs34725autorange.ino
2020-11-03 19:41:46 +00:00
#ifdef SENSOR_TCS34725
#ifndef _TCS34725_AGC_H_
#define _TCS34725_AGC_H_
#include <Wire.h>
#include "Adafruit_TCS34725.h"
#define TCS34725_R_Coef 0.136
#define TCS34725_G_Coef 1.000
#define TCS34725_B_Coef -0.444
#define TCS34725_GA 1.0
#define TCS34725_DF 310.0
#define TCS34725_CT_Coef 3810.0
#define TCS34725_CT_Offset 1391.0
// Autorange class for TCS34725
class tcs34725 {
private:
struct tcs_agc {
tcs34725Gain_t ag;
tcs34725IntegrationTime_t at;
uint16_t mincnt;
uint16_t maxcnt;
};
static const tcs_agc agc_lst[];
uint16_t agc_cur;
void setGainTime(void);
Adafruit_TCS34725 tcs;
public:
tcs34725(void);
boolean begin(void);
void getData(void);
boolean isAvailable, isSaturated;
uint16_t againx, atime, atime_ms;
uint16_t r, g, b, c;
uint16_t ir;
uint16_t r_comp, g_comp, b_comp, c_comp;
uint16_t saturation, saturation75;
float cratio, cpl, ct, lux, maxlux;
};
2020-11-03 19:41:46 +00:00
#endif
#endif