30 #include <mraa/i2c.hpp> 
   34 #define TCS37727_NAME "TCS37727" 
   35 #define TCS37727_I2C_ADDRESS   0x29 
   36 #define TCS37727_DEVICE_ID     0x49 
   37 #define TCS37727_DEVICE_ID_REG 0x92 
   39 #define TCS37727_ATIME_DEFAULT     200000   
   40 #define TCS37727_AG_THRESHOLD_LOW  200 
   41 #define TCS37727_AG_THRESHOLD_HIGH (65535 - TCS37727_AG_THRESHOLD_LOW) 
   45 #define TCS37727_ENABLE  0x80  
   46 #define TCS37727_ATIME   0x81  
   47 #define TCS37727_PTIME   0x82  
   48 #define TCS37727_WTIME   0x83  
   49 #define TCS37727_AILTL   0x04  
   50 #define TCS37727_AILTH   0x05  
   51 #define TCS37727_AIHTL   0x06  
   52 #define TCS37727_AIHTH   0x07  
   53 #define TCS37727_PILTL   0x08  
   54 #define TCS37727_PILTH   0x09  
   55 #define TCS37727_PIHTL   0x0A  
   56 #define TCS37727_PIHTH   0x0B  
   57 #define TCS37727_PERS    0x8C  
   58 #define TCS37727_CONFIG  0x8D  
   59 #define TCS37727_PPULSE  0x8E  
   60 #define TCS37727_CONTROL 0x8F  
   61 #define TCS37727_STATUS  0x93  
   62 #define TCS37727_CDATA   0x14  
   63 #define TCS37727_CDATAH  0x15  
   64 #define TCS37727_RDATA   0x16  
   65 #define TCS37727_RDATAH  0x17  
   66 #define TCS37727_GDATA   0x18  
   67 #define TCS37727_GDATAH  0x19  
   68 #define TCS37727_BDATA   0x1A  
   69 #define TCS37727_BDATAH  0x1B  
   70 #define TCS37727_PDATA   0x1C  
   71 #define TCS37727_PDATAH  0x1D  
   74 #define TCS37727_BYTE_TRANS 0x80  
   75 #define TCS37727_INC_TRANS  0xA0  
   76 #define TCS37727_SF_PICLR   0xE5  
   77 #define TCS37727_SF_CICLR   0xE6  
   78 #define TCS37727_SF_PCICLR  0xE7  
   81 #define TCS37727_ENABLE_PIEN (1 << 5)  
   82 #define TCS37727_ENABLE_AIEN (1 << 4)  
   83 #define TCS37727_ENABLE_WEN  (1 << 3)  
   84 #define TCS37727_ENABLE_PEN  (1 << 2)  
   85 #define TCS37727_ENABLE_AEN  (1 << 1)  
   86 #define TCS37727_ENABLE_PON  (1 << 0)  
   89 #define TCS37727_CONTROL_PDRIVE_100  0x00  
   90 #define TCS37727_CONTROL_PDRIVE_50   0x04  
   91 #define TCS37727_CONTROL_PDRIVE_25   0x08  
   92 #define TCS37727_CONTROL_PDRIVE_12   0x0C  
   93 #define TCS37727_CONTROL_PDRIVE_MASK 0x0C  
   94 #define TCS37727_CONTROL_AGAIN_1     0x00  
   95 #define TCS37727_CONTROL_AGAIN_4     0x01  
   96 #define TCS37727_CONTROL_AGAIN_16    0x02  
   97 #define TCS37727_CONTROL_AGAIN_60    0x03  
   98 #define TCS37727_CONTROL_AGAIN_MASK  0x03  
  101 #define TCS37727_ATIME_MIN 2400    
  102 #define TCS37727_ATIME_MAX 614000  
  104 #define TCS37727_ATIME_TO_REG(val) (256 - (uint8_t)((val) / 2400)) 
  105 #define TCS37727_ATIME_TO_US(reg)  ((256 - (uint8_t)(reg)) * 2400) 
  110 #define R_COEF_IF     136 
  111 #define G_COEF_IF    1000 
  112 #define B_COEF_IF    -444 
  113 #define CT_COEF_IF   3810 
  114 #define CT_OFFSET_IF 1391 
  169         TCS37727 (
int bus, 
int atime_us=TCS37727_ATIME_DEFAULT,
 
  170                                int devAddr=TCS37727_I2C_ADDRESS);
 
  200         uint8_t trimGain(
int rawc);
 
  254         uint32_t 
getLux(
int bSampleData = 0);
 
  281         mraa::I2c m_i2ControlCtx;
 
int setStandby(void)
Definition: tcs37727.cpp:114
 
uint32_t getColorTemperature(int bSampleData=0)
Definition: tcs37727.cpp:319
 
uint32_t ct
Definition: tcs37727.hpp:124
 
uint32_t blue
Definition: tcs37727.hpp:121
 
int getData(tcs37727_data_t *data, int bSampleData=0)
Definition: tcs37727.cpp:332
 
uint32_t red
Definition: tcs37727.hpp:119
 
uint32_t green
Definition: tcs37727.hpp:120
 
int setActive(void)
Definition: tcs37727.cpp:96
 
Definition: tcs37727.hpp:118
 
uint32_t clear
Definition: tcs37727.hpp:122
 
uint32_t getChannelGreen(int bSampleData=0)
Definition: tcs37727.cpp:267
 
uint32_t getChannelBlue(int bSampleData=0)
Definition: tcs37727.cpp:280
 
uint32_t lux
Definition: tcs37727.hpp:123
 
API for the TCS37727 Color Light-To-Digital Converter. 
Definition: tcs37727.hpp:158
 
int checkID(void)
Definition: tcs37727.cpp:82
 
uint32_t getChannelRed(int bSampleData=0)
Definition: tcs37727.cpp:254
 
uint32_t getLux(int bSampleData=0)
Definition: tcs37727.cpp:306
 
TCS37727(int bus, int atime_us=TCS37727_ATIME_DEFAULT, int devAddr=TCS37727_I2C_ADDRESS)
Definition: tcs37727.cpp:39
 
int sampleData(void)
Definition: tcs37727.cpp:208
 
uint32_t getChannelClear(int bSampleData=0)
Definition: tcs37727.cpp:293