objc

Data Structures | Enumerations | Functions
TCS3472 Color Sensor

Driver for the TCS3472 RGB color light-to-digital converter with IR blocking filter. More...

Collaboration diagram for TCS3472 Color Sensor:

Data Structures

struct  driver_tcs3472_rgbc_t
 TCS3472 RGBC color data. More...
 
struct  driver_tcs3472_t
 TCS3472 sensor driver structure. More...
 

Enumerations

enum  driver_tcs3472_gain_t { TCS3472_GAIN_1X = 0x00, TCS3472_GAIN_4X = 0x01, TCS3472_GAIN_16X = 0x02, TCS3472_GAIN_60X = 0x03 }
 TCS3472 gain settings. More...
 
enum  driver_tcs3472_integration_time_t {
  TCS3472_INTEGRATION_2_4MS = 0xFF, TCS3472_INTEGRATION_24MS = 0xF6, TCS3472_INTEGRATION_50MS = 0xEB, TCS3472_INTEGRATION_101MS = 0xD5,
  TCS3472_INTEGRATION_154MS = 0xC0, TCS3472_INTEGRATION_700MS = 0x00
}
 TCS3472 integration time presets. More...
 

Functions

bool driver_tcs3472_init (driver_tcs3472_t *driver, hw_i2c_t *i2c)
 Initialize the TCS3472 sensor with default settings. More...
 
bool driver_tcs3472_init_with_config (driver_tcs3472_t *driver, hw_i2c_t *i2c, driver_tcs3472_gain_t gain, driver_tcs3472_integration_time_t integration)
 Initialize the TCS3472 sensor with custom settings. More...
 
void driver_tcs3472_finalize (driver_tcs3472_t *driver)
 Finalize and power down the TCS3472 sensor. More...
 
bool driver_tcs3472_read (driver_tcs3472_t *driver, driver_tcs3472_rgbc_t *data)
 Read RGBC color data. More...
 

Detailed Description

Driver for the TCS3472 RGB color light-to-digital converter with IR blocking filter.

Enumeration Type Documentation

◆ driver_tcs3472_gain_t

TCS3472 gain settings.

Enumerator
TCS3472_GAIN_1X 

1x gain

TCS3472_GAIN_4X 

4x gain

TCS3472_GAIN_16X 

16x gain

TCS3472_GAIN_60X 

60x gain

Definition at line 22 of file drivers_tcs3472.h.

22  {
23  TCS3472_GAIN_1X = 0x00,
24  TCS3472_GAIN_4X = 0x01,
25  TCS3472_GAIN_16X = 0x02,
26  TCS3472_GAIN_60X = 0x03
driver_tcs3472_gain_t
TCS3472 gain settings.

◆ driver_tcs3472_integration_time_t

TCS3472 integration time presets.

Enumerator
TCS3472_INTEGRATION_2_4MS 

2.4ms - fastest

TCS3472_INTEGRATION_24MS 

24ms

TCS3472_INTEGRATION_50MS 

50ms

TCS3472_INTEGRATION_101MS 

101ms

TCS3472_INTEGRATION_154MS 

154ms

TCS3472_INTEGRATION_700MS 

700ms - max sensitivity

Definition at line 33 of file drivers_tcs3472.h.

Function Documentation

◆ driver_tcs3472_finalize()

void driver_tcs3472_finalize ( driver_tcs3472_t driver)

Finalize and power down the TCS3472 sensor.

Parameters
driverPointer to the TCS3472 driver structure

◆ driver_tcs3472_init()

bool driver_tcs3472_init ( driver_tcs3472_t driver,
hw_i2c_t i2c 
)

Initialize the TCS3472 sensor with default settings.

Parameters
driverPointer to the TCS3472 driver structure
i2cPointer to an initialized I2C bus handle
Returns
true if initialization was successful, false otherwise

Initializes the sensor with:

  • Power on
  • RGBC enabled
  • Default gain (1x)
  • Default integration time (154ms)

◆ driver_tcs3472_init_with_config()

bool driver_tcs3472_init_with_config ( driver_tcs3472_t driver,
hw_i2c_t i2c,
driver_tcs3472_gain_t  gain,
driver_tcs3472_integration_time_t  integration 
)

Initialize the TCS3472 sensor with custom settings.

Parameters
driverPointer to the TCS3472 driver structure
i2cPointer to an initialized I2C bus handle
gainGain setting
integrationIntegration time setting
Returns
true if initialization was successful, false otherwise

◆ driver_tcs3472_read()

bool driver_tcs3472_read ( driver_tcs3472_t driver,
driver_tcs3472_rgbc_t data 
)

Read RGBC color data.

Parameters
driverPointer to the TCS3472 driver structure
dataPointer to structure to receive RGBC data
Returns
true if read was successful, false otherwise
Note
This function checks for valid data (AVALID bit) before reading