ISL29125 RGB light sensor

Device driver for the ISL29125 RGB light sensor. More...

Detailed Description

Description

The device supports level conversion in 12, and 16 bit depth per channel. Selecting a higher precision results in a longer conversion time.

The driver uses the color_rgb_t color definition from color.h for value representation. It does not depend on the color module however.

Usage

Examine tests/driver_isr29125 for an exemplary application using this driver.

Caveats

A GPIO pin definition has been included in the interface for future compatibility only.

Files

file  isl29125.h
 Device driver interface for the ISL29125 RGB light sensor.
 

Data Structures

struct  isl29125_rgb_t
 data type for storing lux RGB sensor readings More...
 
struct  isl29125_t
 Device descriptor for ISL29125 sensors. More...
 

Enumerations

enum  isl29125_mode_t {
  ISL29125_MODE_DOWN = 0x00, ISL29125_MODE_STANDBY = 0x04, ISL29125_MODE_RGB = 0x05, ISL29125_MODE_R = 0x02,
  ISL29125_MODE_G = 0x01, ISL29125_MODE_B = 0x03, ISL29125_MODE_RG = 0x06, ISL29125_MODE_GB = 0x07
}
 supported operation modes of the ISL29125 sensor's AD conversion More...
 
enum  isl29125_range_t { ISL29125_RANGE_375 = 0x00, ISL29125_RANGE_10K = 0x08 }
 supported RGB sensing range values of the ISL29125 sensor More...
 
enum  isl29125_resolution_t { ISL29125_RESOLUTION_12 = 0x10, ISL29125_RESOLUTION_16 = 0x00 }
 supported color resolutions of the ISL29125 sensor's AD conversion More...
 
enum  isl29125_interrupt_status_t { ISL29125_INTERRUPT_STATUS_NONE = 0x00, ISL29125_INTERRUPT_STATUS_GREEN = 0x01, ISL29125_INTERRUPT_STATUS_RED = 0x02, ISL29125_INTERRUPT_STATUS_BLUE = 0x03 }
 Configuration-3 Register 0x03 B1:0. More...
 
enum  isl29125_interrupt_persist_t { ISL29125_INTERRUPT_PERSIST_1 = (0x00 << 2), ISL29125_INTERRUPT_PERSIST_2 = (0x01 << 2), ISL29125_INTERRUPT_PERSIST_4 = (0x02 << 2), ISL29125_INTERRUPT_PERSIST_8 = (0x03 << 2) }
 Configuration-3 Register 0x03 B3:2. More...
 
enum  isl29125_interrupt_conven_t { ISL29125_INTERRUPT_CONV_DIS = (0x0 << 4), ISL29125_INTERRUPT_CONV_EN = (0x1 << 4) }
 Configuration-3 Register 0x03 B4. More...
 

Functions

int isl29125_init (isl29125_t *dev, i2c_t i2c, gpio_t gpio, isl29125_mode_t mode, isl29125_range_t range, isl29125_resolution_t resolution)
 initialize a new ISL29125 device More...
 
int isl29125_init_int (isl29125_t *dev, isl29125_interrupt_status_t interrupt_status, isl29125_interrupt_persist_t interrupt_persist, isl29125_interrupt_conven_t interrupt_conven, uint16_t lower_threshold, uint16_t higher_threshold, gpio_cb_t cb, void *arg)
 initialize interrupts More...
 
void isl29125_read_rgb_lux (isl29125_t *dev, isl29125_rgb_t *dest)
 read RGB values from device More...
 
void isl29125_read_rgb_color (isl29125_t *dev, color_rgb_t *dest)
 read color values from device More...
 
void isl29125_set_mode (isl29125_t *dev, isl29125_mode_t mode)
 set the device's operation mode More...
 
int isl29125_read_irq_status (isl29125_t *dev)
 read isl29125 interrupt status More...
 

Enumeration Type Documentation

Enumerator
ISL29125_INTERRUPT_CONV_DIS 

RGB Conversion done to ~INT Control disable.

ISL29125_INTERRUPT_CONV_EN 

RGB Conversion done to ~INT Control enable.

Definition at line 135 of file isl29125.h.

Enumerator
ISL29125_INTERRUPT_PERSIST_1 

Int.

Persist: Number of integration cycle 1

ISL29125_INTERRUPT_PERSIST_2 

Int.

Persist: Number of integration cycle 2

ISL29125_INTERRUPT_PERSIST_4 

Int.

Persist: Number of integration cycle 4

ISL29125_INTERRUPT_PERSIST_8 

Int.

Persist: Number of integration cycle 8

Definition at line 125 of file isl29125.h.

Enumerator
ISL29125_INTERRUPT_STATUS_NONE 

No interrupt.

ISL29125_INTERRUPT_STATUS_GREEN 

GREEN interrupt.

ISL29125_INTERRUPT_STATUS_RED 

RED interrupt.

ISL29125_INTERRUPT_STATUS_BLUE 

BLUE interrupt.

Definition at line 115 of file isl29125.h.

Enumerator
ISL29125_MODE_DOWN 

ADC powered down.

ISL29125_MODE_STANDBY 

AD conversion not performed.

ISL29125_MODE_RGB 

RGB conversion.

ISL29125_MODE_R 

red conversion only

ISL29125_MODE_G 

green conversion only

ISL29125_MODE_B 

blue conversion only

ISL29125_MODE_RG 

red and green conversion only

ISL29125_MODE_GB 

green and blue conversion only

Definition at line 74 of file isl29125.h.

Enumerator
ISL29125_RANGE_375 

range: 5.7m - 375 lux

ISL29125_RANGE_10K 

range: 0.152 - 10,000 lux

Definition at line 88 of file isl29125.h.

Enumerator
ISL29125_RESOLUTION_12 

resolution: 12 bit

ISL29125_RESOLUTION_16 

resolution: 16 bit

Definition at line 97 of file isl29125.h.

Function Documentation

int isl29125_init ( isl29125_t dev,
i2c_t  i2c,
gpio_t  gpio,
isl29125_mode_t  mode,
isl29125_range_t  range,
isl29125_resolution_t  resolution 
)
Parameters
[in]devdevice descriptor of an ISL29125 device
[in]i2cI2C device the sensor is connected to
[in]gpioGPIO pin for interrupt/sync mode (currently unused)
[in]modeoperation mode
[in]rangemeasurement range
[in]resolutionAD conversion resolution
Returns
0 on success
-1 on error
int isl29125_init_int ( isl29125_t dev,
isl29125_interrupt_status_t  interrupt_status,
isl29125_interrupt_persist_t  interrupt_persist,
isl29125_interrupt_conven_t  interrupt_conven,
uint16_t  lower_threshold,
uint16_t  higher_threshold,
gpio_cb_t  cb,
void *  arg 
)
Parameters
[in]devdevice descriptor of an ISL29125 device
[in]interrupt_statusInterrupt status
[in]interrupt_persistInterrupt persistency
[in]interrupt_convenRGB conversion done to interrupt control, enable
[in]lower_thresholdLower interrupt threshold
[in]higher_thresholdHigher interrupt threshold
[in]cbCallback function on interrupts
[in]argArgument passed to the callback function
Returns
0 on success
-1 on error
int isl29125_read_irq_status ( isl29125_t dev)
Parameters
[in]devdevice descriptor of an ISL29125 device
Returns
interrupt status
void isl29125_read_rgb_color ( isl29125_t dev,
color_rgb_t dest 
)
Parameters
[in]devdevice descriptor of an ISL29125 device
[in]destpointer to RGB color object data is written to
void isl29125_read_rgb_lux ( isl29125_t dev,
isl29125_rgb_t dest 
)
Parameters
[in]devdevice descriptor of an ISL29125 device
[in]destpointer to lux RGB color object data is written to
void isl29125_set_mode ( isl29125_t dev,
isl29125_mode_t  mode 
)
Parameters
[in]devdevice descriptor of an ISL29125 device
[in]modeoperation mode