Class which provides functions to control a TAOS TCS3472 Color Light-to-Digital Converter with IR Filter via I2C. (Tidied up)
Dependents: openwear-lifelogger-example
Fork of TCS3472_I2C by
Diff: TCS3472_I2C.cpp
- Revision:
- 8:2a240f6ca27a
- Parent:
- 7:fbc4c6f3be5b
--- a/TCS3472_I2C.cpp Thu Sep 04 21:18:50 2014 +0000 +++ b/TCS3472_I2C.cpp Mon Sep 08 23:16:40 2014 +0000 @@ -195,11 +195,11 @@ int ack = 1; char wtime = 0; if ( time >= 2.39 && time <= 614.4 ){ // 2.39 instead of 2.4 to allow for float accuracy errors - ack = writeSingleRegister( CONFIG, 0 ); // sets WLONG to 0 + ack = writeSingleRegister( TCS_CONFIG, 0 ); // sets WLONG to 0 wtime = 256 - roundTowardsZero( time / 2.4 ); } else if ( time > 614.4 && time <= 7400.1 ){ // 7400.1 instead of 7400 to allow for float accuracy errors - ack = writeSingleRegister( CONFIG, 2 ); // sets WLONG to 1 + ack = writeSingleRegister( TCS_CONFIG, 2 ); // sets WLONG to 1 wtime = 256 - roundTowardsZero( time / 28.8 ); } ack = ack || writeSingleRegister( WTIME, wtime ); @@ -209,7 +209,7 @@ float TCS3472_I2C::readWaitTime(){ float time = 0; char wtime = readSingleRegister( WTIME ); - char config = readSingleRegister( CONFIG ); + char config = readSingleRegister( TCS_CONFIG ); int wlong = ( config << 6 ) >> 7; // gets WLONG (bit 1) from CONFIG register byte if ( wlong == 0 ){ time = 2.4 * ( 256 - wtime );