Class which provides functions to control a TAOS TCS3472 Color Light-to-Digital Converter with IR Filter via I2C.
Dependents: Chipin_Main Test_Color LAB_10_control FINAL_PROJECT ... more
Diff: TCS3472_I2C.h
- Revision:
- 3:6a89ac4a1979
- Parent:
- 2:38d5187a4e7b
- Child:
- 4:5d1f8d7d81ff
diff -r 38d5187a4e7b -r 6a89ac4a1979 TCS3472_I2C.h --- a/TCS3472_I2C.h Wed Mar 19 18:48:12 2014 +0000 +++ b/TCS3472_I2C.h Thu Mar 20 16:56:56 2014 +0000 @@ -5,10 +5,16 @@ //Defines #define SLAVE_ADDRESS 0x29 -#define ENABLE_REGISTER 0x00 +#define ENABLE 0x00 #define ATIME 0x01 #define WTIME 0x03 -#define CONFIGURATION_REGISTER 0x0D +#define AILTL 0x04 +#define AIHTL 0x06 +#define PERS 0x0C +#define CONFIG 0x0D +#define CONTROL 0x0F +#define ID 0x12 +#define STATUS 0x13 #define CDATA 0x14 #define RDATA 0x16 #define GDATA 0x18 @@ -23,20 +29,38 @@ int getRedData(); int getGreenData(); int getBlueData(); - - int setIntegrationTime( const float itime ); // itime (in ms) should be in the range 2.4 - 614.4ms. + + int enablePower(); + int disablePower(); + int enableRGBC(); + int disableRGBC(); + int enablePowerAndRGBC(); + int disablePowerAndRGBC(); int enableWait(); int disableWait(); int enableInterrupt(); int disableInterrupt(); int setWaitTime( const float wtime ); // wtime (in ms) should be in the range 2.4 - 7400ms. + int setIntegrationTime( const float itime ); // itime (in ms) should be in the range 2.4 - 614.4ms. + + char readEnableRegister(); + int readLowInterruptThreshold(); + int readHighInterruptThreshold(); + int setLowInterruptThreshold( const int threshold ); + int setHighInterruptThreshold( const int threshold ); + int readInterruptPersistence(); + int setInterruptPersistence( const int persistence ); // persistence must be 0, 1, 2, 3, 5, 10, 15, 20, 25, 30, 35, 40, 45, 50, 55 or 60 + int clearInterrupt(); + int readRGBCGain(); + int setRGBCGain( const int gain ); // gain must be 1, 4, 16 or 60 + char getDeviceID(); + char readStatusRegister(); private: - I2C i2c_; + I2C i2c; - int enableRGBC(); - char readEnableRegister(); int writeSingleRegister( char address, char data ); + int writeMultipleRegisters( char address, char* data, int quantity ); char readSingleRegister( char address ); int readMultipleRegisters( char address, char* output, int quantity ); };