Device driver for the ISL29125 RGB light sensor. More...
Device driver for the ISL29125 RGB light sensor.
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.
Examine tests/driver_isr29125
for an exemplary application using this driver.
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. | |
file | isl29125-internal.h |
Definitions for the ISL29125 RGB light sensor. | |
file | isl29125_params.h |
Default configuration for ISL29125 devices. | |
Data Structures | |
struct | isl29125_rgb_t |
Data type for storing lux RGB sensor readings. More... | |
struct | isl29125_params_t |
Device parameters for ISL29125 sensors. More... | |
struct | isl29125_t |
Device descriptor for ISL29125 sensors. More... | |
Functions | |
int | isl29125_init (isl29125_t *dev, const isl29125_params_t *params) |
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 (const isl29125_t *dev, isl29125_rgb_t *dest) |
Read RGB values from device. More... | |
void | isl29125_read_rgb_color (const isl29125_t *dev, color_rgb_t *dest) |
Read color values from device. More... | |
void | isl29125_set_mode (const isl29125_t *dev, isl29125_mode_t mode) |
Set the device's operation mode. More... | |
int | isl29125_read_irq_status (const isl29125_t *dev) |
Read isl29125 interrupt status. More... | |
Configuration-3 Register 0x03 B4.
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 143 of file isl29125.h.
Configuration-3 Register 0x03 B3:2.
Definition at line 133 of file isl29125.h.
Configuration-3 Register 0x03 B1:0.
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 123 of file isl29125.h.
enum isl29125_mode_t |
Supported operation modes of the ISL29125 sensor's AD conversion.
Definition at line 74 of file isl29125.h.
enum isl29125_range_t |
Supported RGB sensing range values of the ISL29125 sensor.
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.
Supported color resolutions of the ISL29125 sensor's AD conversion.
Enumerator | |
---|---|
ISL29125_RESOLUTION_12 | resolution: 12 bit |
ISL29125_RESOLUTION_16 | resolution: 16 bit |
Definition at line 97 of file isl29125.h.
int isl29125_init | ( | isl29125_t * | dev, |
const isl29125_params_t * | params | ||
) |
Initialize a new ISL29125 device.
[in] | dev | device descriptor of an ISL29125 device |
[in] | params | initialization parameters |
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.
[in] | dev | device descriptor of an ISL29125 device |
[in] | interrupt_status | Interrupt status |
[in] | interrupt_persist | Interrupt persistency |
[in] | interrupt_conven | RGB conversion done to interrupt control, enable |
[in] | lower_threshold | Lower interrupt threshold |
[in] | higher_threshold | Higher interrupt threshold |
[in] | cb | Callback function on interrupts |
[in] | arg | Argument passed to the callback function |
int isl29125_read_irq_status | ( | const isl29125_t * | dev | ) |
Read isl29125 interrupt status.
[in] | dev | device descriptor of an ISL29125 device |
void isl29125_read_rgb_color | ( | const isl29125_t * | dev, |
color_rgb_t * | dest | ||
) |
Read color values from device.
[in] | dev | device descriptor of an ISL29125 device |
[in] | dest | pointer to RGB color object data is written to |
void isl29125_read_rgb_lux | ( | const isl29125_t * | dev, |
isl29125_rgb_t * | dest | ||
) |
Read RGB values from device.
[in] | dev | device descriptor of an ISL29125 device |
[in] | dest | pointer to lux RGB color object data is written to |
void isl29125_set_mode | ( | const isl29125_t * | dev, |
isl29125_mode_t | mode | ||
) |
Set the device's operation mode.
[in] | dev | device descriptor of an ISL29125 device |
[in] | mode | operation mode |