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.cpp
- Revision:
- 6:6d5bb4ad7d6e
- Parent:
- 5:d4cf0fa1a182
--- a/TCS3472_I2C.cpp Wed Apr 16 10:57:46 2014 +0000 +++ b/TCS3472_I2C.cpp Thu Apr 24 09:14:25 2014 +0000 @@ -5,6 +5,10 @@ enablePowerAndRGBC(); } +TCS3472_I2C::~TCS3472_I2C(){ + +} + int TCS3472_I2C::writeSingleRegister( char address, char data ){ char tx[2] = { address | 160, data }; //0d160 = 0b10100000 int ack = i2c.write( SLAVE_ADDRESS << 1, tx, 2 ); @@ -36,7 +40,7 @@ return ack; } -int TCS3472_I2C::getAllColours( int* readings ){ +void TCS3472_I2C::getAllColors( int* readings ){ char buffer[8] = { 0 }; readMultipleRegisters( CDATA, buffer, 8 ); @@ -45,8 +49,6 @@ readings[1] = (int)buffer[3] << 8 | (int)buffer[2]; readings[2] = (int)buffer[5] << 8 | (int)buffer[4]; readings[3] = (int)buffer[7] << 8 | (int)buffer[6]; - - return 0; } int TCS3472_I2C::getClearData(){