Adafruit TCS34725 Library
|
Class that stores state and functions for interacting with TCS34725 Color Sensor. More...
#include <Adafruit_TCS34725.h>
Public Member Functions | |
Adafruit_TCS34725 (uint8_t=TCS34725_INTEGRATIONTIME_2_4MS, tcs34725Gain_t=TCS34725_GAIN_1X) | |
Constructor. More... | |
boolean | begin (uint8_t addr=TCS34725_ADDRESS, TwoWire *theWire=&Wire) |
Initializes I2C and configures the sensor. More... | |
boolean | init () |
Part of begin. More... | |
void | setIntegrationTime (uint8_t it) |
Sets the integration time for the TC34725. More... | |
void | setGain (tcs34725Gain_t gain) |
Adjusts the gain on the TCS34725. More... | |
void | getRawData (uint16_t *r, uint16_t *g, uint16_t *b, uint16_t *c) |
Reads the raw red, green, blue and clear channel values. More... | |
void | getRGB (float *r, float *g, float *b) |
Read the RGB color detected by the sensor. More... | |
void | getRawDataOneShot (uint16_t *r, uint16_t *g, uint16_t *b, uint16_t *c) |
Reads the raw red, green, blue and clear channel values in one-shot mode (e.g., wakes from sleep, takes measurement, enters sleep) More... | |
uint16_t | calculateColorTemperature (uint16_t r, uint16_t g, uint16_t b) |
Converts the raw R/G/B values to color temperature in degrees Kelvin. More... | |
uint16_t | calculateColorTemperature_dn40 (uint16_t r, uint16_t g, uint16_t b, uint16_t c) |
Converts the raw R/G/B values to color temperature in degrees Kelvin using the algorithm described in DN40 from Taos (now AMS). More... | |
uint16_t | calculateLux (uint16_t r, uint16_t g, uint16_t b) |
Converts the raw R/G/B values to lux. More... | |
void | write8 (uint8_t reg, uint8_t value) |
Writes a register and an 8 bit value over I2C. More... | |
uint8_t | read8 (uint8_t reg) |
Reads an 8 bit value over I2C. More... | |
uint16_t | read16 (uint8_t reg) |
Reads a 16 bit values over I2C. More... | |
void | setInterrupt (boolean flag) |
Sets interrupt for TCS34725. More... | |
void | clearInterrupt () |
Clears inerrupt for TCS34725. | |
void | setIntLimits (uint16_t l, uint16_t h) |
Sets inerrupt limits. More... | |
void | enable () |
Enables the device. | |
void | disable () |
Disables the device (putting it in lower power sleep mode) | |
Class that stores state and functions for interacting with TCS34725 Color Sensor.
Adafruit_TCS34725::Adafruit_TCS34725 | ( | uint8_t | it = TCS34725_INTEGRATIONTIME_2_4MS , |
tcs34725Gain_t | gain = TCS34725_GAIN_1X |
||
) |
Constructor.
it | Integration Time |
gain | Gain |
boolean Adafruit_TCS34725::begin | ( | uint8_t | addr = TCS34725_ADDRESS , |
TwoWire * | theWire = &Wire |
||
) |
Initializes I2C and configures the sensor.
addr | i2c address |
*theWire | The Wire object |
boolean Adafruit_TCS34725::init | ( | ) |
Part of begin.
void Adafruit_TCS34725::setIntegrationTime | ( | uint8_t | it | ) |
Sets the integration time for the TC34725.
it | Integration Time |
void Adafruit_TCS34725::setGain | ( | tcs34725Gain_t | gain | ) |
Adjusts the gain on the TCS34725.
gain | Gain (sensitivity to light) |
void Adafruit_TCS34725::getRawData | ( | uint16_t * | r, |
uint16_t * | g, | ||
uint16_t * | b, | ||
uint16_t * | c | ||
) |
Reads the raw red, green, blue and clear channel values.
*r | Red value |
*g | Green value |
*b | Blue value |
*c | Clear channel value |
void Adafruit_TCS34725::getRGB | ( | float * | r, |
float * | g, | ||
float * | b | ||
) |
Read the RGB color detected by the sensor.
*r | Red value normalized to 0-255 |
*g | Green value normalized to 0-255 |
*b | Blue value normalized to 0-255 |
void Adafruit_TCS34725::getRawDataOneShot | ( | uint16_t * | r, |
uint16_t * | g, | ||
uint16_t * | b, | ||
uint16_t * | c | ||
) |
Reads the raw red, green, blue and clear channel values in one-shot mode (e.g., wakes from sleep, takes measurement, enters sleep)
*r | Red value |
*g | Green value |
*b | Blue value |
*c | Clear channel value |
uint16_t Adafruit_TCS34725::calculateColorTemperature | ( | uint16_t | r, |
uint16_t | g, | ||
uint16_t | b | ||
) |
Converts the raw R/G/B values to color temperature in degrees Kelvin.
r | Red value |
g | Green value |
b | Blue value |
uint16_t Adafruit_TCS34725::calculateColorTemperature_dn40 | ( | uint16_t | r, |
uint16_t | g, | ||
uint16_t | b, | ||
uint16_t | c | ||
) |
Converts the raw R/G/B values to color temperature in degrees Kelvin using the algorithm described in DN40 from Taos (now AMS).
r | Red value |
g | Green value |
b | Blue value |
c | Clear channel value |
Color temp coefficient.
Color temp offset.
uint16_t Adafruit_TCS34725::calculateLux | ( | uint16_t | r, |
uint16_t | g, | ||
uint16_t | b | ||
) |
Converts the raw R/G/B values to lux.
r | Red value |
g | Green value |
b | Blue value |
void Adafruit_TCS34725::write8 | ( | uint8_t | reg, |
uint8_t | value | ||
) |
Writes a register and an 8 bit value over I2C.
reg | |
value |
uint8_t Adafruit_TCS34725::read8 | ( | uint8_t | reg | ) |
Reads an 8 bit value over I2C.
reg |
uint16_t Adafruit_TCS34725::read16 | ( | uint8_t | reg | ) |
Reads a 16 bit values over I2C.
reg |
void Adafruit_TCS34725::setInterrupt | ( | boolean | i | ) |
Sets interrupt for TCS34725.
i | Interrupt (True/False) |
void Adafruit_TCS34725::setIntLimits | ( | uint16_t | low, |
uint16_t | high | ||
) |
Sets inerrupt limits.
low | Low limit |
high | High limit |