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

Detailed Description

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

This driver provides [S]ensor [A]ctuator [U]ber [L]ayer capabilities.

Modules

 TCS37727 RGB Light Sensor driver compile configuration
 

Files

file  tcs37727.h
 Interface definition for the TCS37727 sensor driver.
 
file  tcs37727-internal.h
 Register definitions for the TCS37727 driver.
 
file  tcs37727_params.h
 Default configuration for TCS37727 devices.
 

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

Macros

#define TCS37727_I2C_ADDRESS   0x29
 Default Device Address.
 

Enumerations

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

Functions

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

Enumeration Type Documentation

◆ anonymous enum

anonymous enum

Possible TCS27737 return values.

Enumerator
TCS37727_OK 

everything worked as expected

TCS37727_NOBUS 

access to the configured I2C bus failed

TCS37727_NODEV 

no TCS37727 device found on the bus

Definition at line 93 of file tcs37727.h.

Function Documentation

◆ tcs37727_init()

int tcs37727_init ( tcs37727_t dev,
const tcs37727_params_t params 
)

Initialize the given TCS37727 sensor.

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.

Parameters
[out]devdevice descriptor of sensor to initialize
[in]paramsstatic configuration parameters
Returns
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 
)

Read sensor's 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.

Parameters
[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)

Set RGBC enable, this activates periodic RGBC measurements.

Parameters
[out]devdevice descriptor of sensor

◆ tcs37727_set_rgbc_standby()

void tcs37727_set_rgbc_standby ( const tcs37727_t dev)

Set RGBC disable, this deactivates periodic RGBC measurements.

Also turns off the sensor when proximity measurement is disabled.

Parameters
[in]devdevice descriptor of sensor