For use with STM32L746RG . Class which provides functions to control a TAOS TCS3472 Color Light-to-Digital Converter with IR Filter via I2C.
Fork of TCS3472_I2C by
Revision 8:764a98777c11, committed 2017-06-01
- Comitter:
- Allar
- Date:
- Thu Jun 01 08:04:39 2017 +0000
- Parent:
- 7:ab9ff8738826
- Commit message:
- night;
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 ab9ff8738826 -r 764a98777c11 TCS3472_I2C.cpp --- a/TCS3472_I2C.cpp Sun Apr 30 08:00:52 2017 +0000 +++ b/TCS3472_I2C.cpp Thu Jun 01 08:04:39 2017 +0000 @@ -9,6 +9,12 @@ } +bool TCS3472_I2C::verifyConnection(void) { + uint8_t part_id = readSingleRegister(0x12);//ID + if (part_id == 0x44) + return true; + return false; +} 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 );
diff -r ab9ff8738826 -r 764a98777c11 TCS3472_I2C.h --- a/TCS3472_I2C.h Sun Apr 30 08:00:52 2017 +0000 +++ b/TCS3472_I2C.h Thu Jun 01 08:04:39 2017 +0000 @@ -336,6 +336,8 @@ char readStatusRegister(); int calculateColorTemperature(int r, int g, int b); + + bool verifyConnection(void); float calculateChromaticityX(int r, int g, int b); float calculateChromaticityY(int r, int g, int b);