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
Revision 8:2a240f6ca27a, committed 2014-09-08
- Comitter:
- janekm
- Date:
- Mon Sep 08 23:16:40 2014 +0000
- Parent:
- 7:fbc4c6f3be5b
- Commit message:
- N/A
Changed in this revision
TCS3472_I2C.cpp | Show annotated file Show diff for this revision Revisions of this file |
TCS3472_I2C.h | Show annotated file Show diff for this revision Revisions of this file |
diff -r fbc4c6f3be5b -r 2a240f6ca27a TCS3472_I2C.cpp --- 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 );
diff -r fbc4c6f3be5b -r 2a240f6ca27a TCS3472_I2C.h --- a/TCS3472_I2C.h Thu Sep 04 21:18:50 2014 +0000 +++ b/TCS3472_I2C.h Mon Sep 08 23:16:40 2014 +0000 @@ -11,7 +11,7 @@ #define AILTL 0x04 #define AIHTL 0x06 #define PERS 0x0C -#define CONFIG 0x0D +#define TCS_CONFIG 0x0D #define CONTROL 0x0F #define ID 0x12 #define STATUS 0x13