Library which provides functions to control a TAOS TSL2561 Light-To-Digital Converter via I2C.
Fork of TSL2561_I2C by
TCS3472_I2C.h
- Committer:
- karlmaxwell67
- Date:
- 2014-03-19
- Revision:
- 2:38d5187a4e7b
- Parent:
- 1:70d7d9f1af01
- Child:
- 3:6a89ac4a1979
File content as of revision 2:38d5187a4e7b:
#ifndef TCS3472_I2C_H #define TCS3472_I2C_H #include "mbed.h" //Defines #define SLAVE_ADDRESS 0x29 #define ENABLE_REGISTER 0x00 #define ATIME 0x01 #define WTIME 0x03 #define CONFIGURATION_REGISTER 0x0D #define CDATA 0x14 #define RDATA 0x16 #define GDATA 0x18 #define BDATA 0x1A class TCS3472_I2C { public: TCS3472_I2C( PinName sda, PinName scl ); int getAllColours( int* readings ); int getClearData(); int getRedData(); int getGreenData(); int getBlueData(); int setIntegrationTime( const float itime ); // itime (in ms) should be in the range 2.4 - 614.4ms. int enableWait(); int disableWait(); int enableInterrupt(); int disableInterrupt(); int setWaitTime( const float wtime ); // wtime (in ms) should be in the range 2.4 - 7400ms. private: I2C i2c_; int enableRGBC(); char readEnableRegister(); int writeSingleRegister( char address, char data ); char readSingleRegister( char address ); int readMultipleRegisters( char address, char* output, int quantity ); }; #endif