Skip to content

Commit

Permalink
Change tcs34725IntegrationTime_t to uint8_t.
Browse files Browse the repository at this point in the history
  • Loading branch information
itsayellow committed May 7, 2020
1 parent bb7bd40 commit 4b82ab1
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 23 deletions.
4 changes: 2 additions & 2 deletions Adafruit_TCS34725.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ void Adafruit_TCS34725::disable() {
* @param gain
* Gain
*/
Adafruit_TCS34725::Adafruit_TCS34725(tcs34725IntegrationTime_t it,
Adafruit_TCS34725::Adafruit_TCS34725(uint8_t it,
tcs34725Gain_t gain) {
_tcs34725Initialised = false;
_tcs34725IntegrationTime = it;
Expand Down Expand Up @@ -221,7 +221,7 @@ boolean Adafruit_TCS34725::init() {
* @param it
* Integration Time
*/
void Adafruit_TCS34725::setIntegrationTime(tcs34725IntegrationTime_t it) {
void Adafruit_TCS34725::setIntegrationTime(uint8_t it) {
if (!_tcs34725Initialised)
begin();

Expand Down
32 changes: 11 additions & 21 deletions Adafruit_TCS34725.h
Original file line number Diff line number Diff line change
Expand Up @@ -138,24 +138,14 @@
#define TCS34725_BDATAH (0x1B) /**< Blue channel data high byte */

/** Integration time settings for TCS34725 */
typedef enum {
TCS34725_INTEGRATIONTIME_2_4MS =
0xFF, /**< 2.4ms - 1 cycle - Max Count: 1024 */
TCS34725_INTEGRATIONTIME_24MS =
0xF6, /**< 24ms - 10 cycles - Max Count: 10240 */
TCS34725_INTEGRATIONTIME_48MS =
0xEB, /**< 48ms - 20 cycles - Max Count: 20480 */
TCS34725_INTEGRATIONTIME_50MS =
0xEB, /**< WRONG BUT INCLUDED FOR LEGACY CODE */
TCS34725_INTEGRATIONTIME_101MS =
0xD5, /**< 100.8ms - 42 cycles - Max Count: 43008 */
TCS34725_INTEGRATIONTIME_154MS =
0xC0, /**< 153.6ms - 64 cycles - Max Count: 65535 */
TCS34725_INTEGRATIONTIME_615MS =
0x00, /**< 614.4ms - 256 cycles - Max Count: 65535 */
TCS34725_INTEGRATIONTIME_700MS =
0x00 /**< WRONG BUT INCLUDED FOR LEGACY CODE */
} tcs34725IntegrationTime_t;
#define TCS34725_INTEGRATIONTIME_2_4MS (0xFF)/* 2.4ms - 1 cycle - Max Count: 1024 */
#define TCS34725_INTEGRATIONTIME_24MS (0xF6) /* 24ms - 10 cycles - Max Count: 10240 */
#define TCS34725_INTEGRATIONTIME_48MS (0xEB) /* 48ms - 20 cycles - Max Count: 20480 */
#define TCS34725_INTEGRATIONTIME_50MS (0xEB) /* WRONG BUT INCLUDED FOR LEGACY CODE */
#define TCS34725_INTEGRATIONTIME_101MS (0xD5)/* 100.8ms - 42 cycles - Max Count: 43008 */
#define TCS34725_INTEGRATIONTIME_154MS (0xC0)/* 153.6ms - 64 cycles - Max Count: 65535 */
#define TCS34725_INTEGRATIONTIME_615MS (0x00)/* 614.4ms - 256 cycles - Max Count: 65535 */
#define TCS34725_INTEGRATIONTIME_700MS (0x00)/* WRONG BUT INCLUDED FOR LEGACY CODE */

/** Gain settings for TCS34725 */
typedef enum {
Expand All @@ -171,15 +161,15 @@ typedef enum {
*/
class Adafruit_TCS34725 {
public:
Adafruit_TCS34725(tcs34725IntegrationTime_t = TCS34725_INTEGRATIONTIME_2_4MS,
Adafruit_TCS34725(uint8_t = TCS34725_INTEGRATIONTIME_2_4MS,
tcs34725Gain_t = TCS34725_GAIN_1X);

boolean begin(uint8_t addr, TwoWire *theWire);
boolean begin(uint8_t addr);
boolean begin();
boolean init();

void setIntegrationTime(tcs34725IntegrationTime_t it);
void setIntegrationTime(uint8_t it);
void setGain(tcs34725Gain_t gain);
void getRawData(uint16_t *r, uint16_t *g, uint16_t *b, uint16_t *c);
void getRGB(float *r, float *g, float *b);
Expand All @@ -202,7 +192,7 @@ class Adafruit_TCS34725 {
uint8_t _i2caddr;
boolean _tcs34725Initialised;
tcs34725Gain_t _tcs34725Gain;
tcs34725IntegrationTime_t _tcs34725IntegrationTime;
uint8_t _tcs34725IntegrationTime;
};

#endif

0 comments on commit 4b82ab1

Please sign in to comment.