MatrixMiniR4 1.1.4
Matrix Mini R4 Arduino Library API Documentation
Loading...
Searching...
No Matches
Adafruit_TCS34725 Class Reference

Class that stores state and functions for interacting with TCS34725 Color Sensor. More...

#include <MiniR4TCS34725.h>

Public Member Functions

 Adafruit_TCS34725 (uint8_t=TCS34725_INTEGRATIONTIME_2_4MS, tcs34725Gain_t=TCS34725_GAIN_1X, uint8_t addr=TCS34725_ADDRESS, TwoWire *theWire=&Wire, uint8_t mux=-1)
 Constructor.
 
boolean begin ()
 Initializes I2C and configures the sensor.
 
boolean init ()
 Part of begin.
 
void setIntegrationTime (uint8_t it)
 Sets the integration time for the TC34725.
 
void setGain (tcs34725Gain_t gain)
 Adjusts the gain on the TCS34725.
 
void getRawData (uint16_t *r, uint16_t *g, uint16_t *b, uint16_t *c)
 Reads the raw red, green, blue and clear channel values.
 
void getRGB (float *r, float *g, float *b)
 Read the RGB color detected by the sensor.
 
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)
 
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.
 
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).
 
uint16_t calculateLux (uint16_t r, uint16_t g, uint16_t b)
 Converts the raw R/G/B values to lux.
 
void write8 (uint8_t reg, uint8_t value)
 Writes a register and an 8 bit value over I2C.
 
uint8_t read8 (uint8_t reg)
 Reads an 8 bit value over I2C.
 
uint16_t read16 (uint8_t reg)
 Reads a 16 bit values over I2C.
 
void setInterrupt (boolean flag)
 Sets interrupt for TCS34725.
 
void clearInterrupt ()
 Clears inerrupt for TCS34725.
 
void setIntLimits (uint16_t l, uint16_t h)
 Sets inerrupt limits.
 
void enable ()
 Enables the device.
 
void disable ()
 Disables the device (putting it in lower power sleep mode)
 

Detailed Description

Class that stores state and functions for interacting with TCS34725 Color Sensor.

Definition at line 141 of file MiniR4TCS34725.h.

Constructor & Destructor Documentation

◆ Adafruit_TCS34725()

Adafruit_TCS34725::Adafruit_TCS34725 ( uint8_t it = TCS34725_INTEGRATIONTIME_2_4MS,
tcs34725Gain_t gain = TCS34725_GAIN_1X,
uint8_t addr = TCS34725_ADDRESS,
TwoWire * theWire = &Wire,
uint8_t mux_ch = -1 )

Constructor.

Parameters
itIntegration Time
gainGain

Definition at line 94 of file MiniR4TCS34725.cpp.

Member Function Documentation

◆ begin()

boolean Adafruit_TCS34725::begin ( )

Initializes I2C and configures the sensor.

Parameters
addri2c address
*theWireThe Wire object
Returns
True if initialization was successful, otherwise false.

Definition at line 112 of file MiniR4TCS34725.cpp.

◆ calculateColorTemperature()

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.

Parameters
rRed value
gGreen value
bBlue value
Returns
Color temperature in degrees Kelvin

Definition at line 257 of file MiniR4TCS34725.cpp.

◆ calculateColorTemperature_dn40()

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).

Parameters
rRed value
gGreen value
bBlue value
cClear channel value
Returns
Color temperature in degrees Kelvin

Color temp coefficient.

Color temp offset.

Definition at line 303 of file MiniR4TCS34725.cpp.

◆ calculateLux()

uint16_t Adafruit_TCS34725::calculateLux ( uint16_t r,
uint16_t g,
uint16_t b )

Converts the raw R/G/B values to lux.

Parameters
rRed value
gGreen value
bBlue value
Returns
Lux value

Definition at line 392 of file MiniR4TCS34725.cpp.

◆ clearInterrupt()

void Adafruit_TCS34725::clearInterrupt ( )

Clears inerrupt for TCS34725.

Definition at line 422 of file MiniR4TCS34725.cpp.

◆ disable()

void Adafruit_TCS34725::disable ( )

Disables the device (putting it in lower power sleep mode)

Definition at line 79 of file MiniR4TCS34725.cpp.

◆ enable()

void Adafruit_TCS34725::enable ( )

Enables the device.

Definition at line 61 of file MiniR4TCS34725.cpp.

◆ getRawData()

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.

Parameters
*rRed value
*gGreen value
*bBlue value
*cClear channel value

Definition at line 185 of file MiniR4TCS34725.cpp.

◆ getRawDataOneShot()

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)

Parameters
*rRed value
*gGreen value
*bBlue value
*cClear channel value

Definition at line 212 of file MiniR4TCS34725.cpp.

◆ getRGB()

void Adafruit_TCS34725::getRGB ( float * r,
float * g,
float * b )

Read the RGB color detected by the sensor.

Parameters
*rRed value normalized to 0-255
*gGreen value normalized to 0-255
*bBlue value normalized to 0-255

Definition at line 230 of file MiniR4TCS34725.cpp.

◆ init()

boolean Adafruit_TCS34725::init ( )

Part of begin.

Returns
True if initialization was successful, otherwise false.

Definition at line 121 of file MiniR4TCS34725.cpp.

◆ read16()

uint16_t Adafruit_TCS34725::read16 ( uint8_t reg)

Reads a 16 bit values over I2C.

Parameters
reg
Returns
value

Definition at line 51 of file MiniR4TCS34725.cpp.

◆ read8()

uint8_t Adafruit_TCS34725::read8 ( uint8_t reg)

Reads an 8 bit value over I2C.

Parameters
reg
Returns
value

Definition at line 39 of file MiniR4TCS34725.cpp.

◆ setGain()

void Adafruit_TCS34725::setGain ( tcs34725Gain_t gain)

Adjusts the gain on the TCS34725.

Parameters
gainGain (sensitivity to light)

Definition at line 163 of file MiniR4TCS34725.cpp.

◆ setIntegrationTime()

void Adafruit_TCS34725::setIntegrationTime ( uint8_t it)

Sets the integration time for the TC34725.

Parameters
itIntegration Time

Definition at line 147 of file MiniR4TCS34725.cpp.

◆ setInterrupt()

void Adafruit_TCS34725::setInterrupt ( boolean i)

Sets interrupt for TCS34725.

Parameters
iInterrupt (True/False)

Definition at line 408 of file MiniR4TCS34725.cpp.

◆ setIntLimits()

void Adafruit_TCS34725::setIntLimits ( uint16_t low,
uint16_t high )

Sets inerrupt limits.

Parameters
lowLow limit
highHigh limit

Definition at line 435 of file MiniR4TCS34725.cpp.

◆ write8()

void Adafruit_TCS34725::write8 ( uint8_t reg,
uint8_t value )

Writes a register and an 8 bit value over I2C.

Parameters
reg
value

Definition at line 28 of file MiniR4TCS34725.cpp.


The documentation for this class was generated from the following files: