TCS37727 RGB Light Sensor

Driver for the AMS TCS37727 Color Light-To-Digital Converter. More...

Detailed Description


file  tcs37727.h
 Interface definition for the TCS37727 sensor driver.
file  tcs37727-internal.h
 Register definitions for the TCS37727 driver.

Data Structures

struct  tcs37727_data_t
 Struct for storing TCS37727 sensor data. More...
struct  tcs37727_params_t
 TCS37727 configuration parameters. More...
struct  tcs37727_t
 Device descriptor for TCS37727 sensors. More...


#define TCS37727_I2C_ADDRESS   0x29
 Default Device Address.
#define TCS37727_ATIME_DEFAULT   200000
 Default RGBC integration time.


enum  { TCS37727_OK = 0, TCS37727_NOBUS = -1, TCS37727_NODEV = -2 }
 Possible TCS27737 return values. More...


int tcs37727_init (tcs37727_t *dev, const tcs37727_params_t *params)
 Initialize the given TCS37727 sensor. More...
void tcs37727_set_rgbc_active (const tcs37727_t *dev)
 Set RGBC enable, this activates periodic RGBC measurements. More...
void tcs37727_set_rgbc_standby (const tcs37727_t *dev)
 Set RGBC disable, this deactivates periodic RGBC measurements. More...
void tcs37727_read (const tcs37727_t *dev, tcs37727_data_t *data)
 Read sensor's data. More...


const saul_driver_t tcs37727_saul_driver
 Export the sensor's SAUL interface.

Enumeration Type Documentation

◆ anonymous enum

anonymous enum

everything worked as expected


access to the configured I2C bus failed


no TCS37727 device found on the bus

Definition at line 79 of file tcs37727.h.

Function Documentation

◆ tcs37727_init()

int tcs37727_init ( tcs37727_t dev,
const tcs37727_params_t params 

The sensor is initialized in RGBC only mode with proximity detection turned off.

The gain will be initially set to 4x, but it will be adjusted

The gain value will be initially set to 4x, but it will be automatically adjusted during runtime.

[out]devdevice descriptor of sensor to initialize
[in]paramsstatic configuration parameters
TCS27737_OK on success
TCS37727_NOBUS if initialization of I2C bus fails
TCS37727_NODEV if no sensor can be found

◆ tcs37727_read()

void tcs37727_read ( const tcs37727_t dev,
tcs37727_data_t data 

Besides an Autogain routine is called. If a maximum or minimum threshold value of the channel clear is reached, then the gain will be changed correspond to max or min threshold.

[in]devdevice descriptor of sensor
[out]datadevice sensor data, MUST not be NULL

◆ tcs37727_set_rgbc_active()

void tcs37727_set_rgbc_active ( const tcs37727_t dev)
[out]devdevice descriptor of sensor

◆ tcs37727_set_rgbc_standby()

void tcs37727_set_rgbc_standby ( const tcs37727_t dev)

Also turns off the sensor when proximity measurement is disabled.

[in]devdevice descriptor of sensor