TCS37727 RGB Light Sensor¶
Driver for the AMS TCS37727 Color Light-To-Digital Converter.
This driver provides [S]ensor [A]ctuator [U]ber [L]ayer capabilities.
-
enum
@165
¶ - TCS37727_OK
= 0
- everything worked as expected
- TCS37727_NOBUS
= -1
- access to the configured I2C bus failed
- TCS37727_NODEV
= -2
- no TCS37727 device found on the bus
- TCS37727_OK
-
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
dev: device descriptor of sensor to initialize params: static configuration parameters Return values
- TCS27737_OK on success
- TCS37727_NOBUS if initialization of I2C bus fails
- TCS37727_NODEV if no sensor can be found
-
void
tcs37727_set_rgbc_active
(const tcs37727_t * dev)¶ Set RGBC enable, this activates periodic RGBC measurements.
Parameters
dev: device descriptor of sensor
-
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
dev: device descriptor of sensor
-
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
dev: device descriptor of sensor data: device sensor data, MUST not be NULL
-
TCS37727_I2C_ADDRESS
¶ Default Device Address.
1
0x29
-
TCS37727_ATIME_DEFAULT
¶ Default RGBC integration time.
1
200000
-
struct
tcs37727_data_t
¶ Struct for storing TCS37727 sensor data.
-
uint32_t
red
¶ IR compensated channels red.
-
uint32_t
green
¶ IR compensated channels green.
-
uint32_t
blue
¶ IR compensated channels blue.
-
uint32_t
clear
¶ channels clear
-
uint32_t
lux
¶ Lux.
-
uint32_t
ct
¶ Color temperature.
-
uint32_t
-
struct
tcs37727_params_t
¶ TCS37727 configuration parameters.
-
i2c.h::i2c_t
i2c
¶ I2C bus the sensor is connected to.
-
uint8_t
addr
¶ the sensors address on the I2C bus
-
uint32_t
atime
¶ conversion time in microseconds
-
-
struct
tcs37727_t
¶ Device descriptor for TCS37727 sensors.
-
tcs37727_params_t
p
¶ device configuration
-
int
again
¶ amount of gain
-
tcs37727_params_t