GPIO extender LED driver API.
More...
GPIO extender LED driver API.
The GPIO extender LED driver status codes.
Enumerator |
---|
DRV_EXT_LIGHT_STATUS_CODE_SUCCESS |
Successful.
|
DRV_EXT_LIGHT_STATUS_CODE_INVALID_PARAM |
Invalid parameters.
|
DRV_EXT_LIGHT_STATUS_CODE_NOT_SUPPORTED |
Not supported.
|
DRV_EXT_LIGHT_STATUS_CODE_INVALID_LIGHT_TYPE |
The type of light is not supported.
|
DRV_EXT_LIGHT_STATUS_CODE_INVALID_TIMER_VALUE |
The desired time is too long. Increase the ClkX divider.
|
The state of the IO extender oscillator for each light.
Enumerator |
---|
EXTENDER_OSC_UNUSED |
Ext osc not used for this light.
|
EXTENDER_OSC_USED_RUNNING |
Ext osc running (Light currently on).
|
EXTENDER_OSC_USED_PAUSED |
Ext osc paused (Light currently off).
|
EXTENDER_OSC_USED_PERM |
Ext osc used on a permanent basis (light dimmed).
|
IOEXT_OSC_STATUS_T_SIZE |
Number of different possible IO extender oscillator statuses.
|
Monochrome (single) or RGB light.
Enumerator |
---|
DRV_EXT_LIGHT_TYPE_MONO |
Monochrome (single) LED.
|
DRV_EXT_LIGHT_TYPE_RGB |
RGB LED (three IOs used).
|
Function for initializing the drv_ext_light driver.
- Parameters
-
[in] | p_init | Contains the full configuration struct sent to drv_ext_light_init drv_ext_light_init_t. |
[in] | on_init_reset | If true, the io extender will be reset on init. This will put the io extender in a known state, but will delete any previous configurations, even from other drivers. |
- Note
- Make sure that APP_SCHED_INIT and APP_TIMER_APPSH_INIT have been run prior to this function call. Also note that this driver will take full control of the IO extender oscillator. This may influence other HW connected to the extender on other pins. p_init->p_light_conf->p_data must reside in RAM.
- Returns
- Status codes from this function. (Return codes may originate from other underlying modules/drivers as well which are not listed below).
- Return values
-
DRV_EXT_LIGHT_STATUS_CODE_SUCCESS | |
DRV_EXT_LIGHT_STATUS_CODE_INVALID_PARAM | |
ret_code_t drv_ext_light_intensity_set |
( |
uint32_t |
id, |
|
|
uint8_t |
intensity |
|
) |
| |
Function for setting intensity of monochrome light.
- Parameters
-
[in] | id | Specifies the ID of the given light. (Has to be in the range [0, num_lights-1]). |
[in] | intensity | (0-255). |
- Returns
- Status codes from this function. (Return codes may originate from other underlying modules/drivers as well which are not listed below).
- Return values
-
DRV_EXT_LIGHT_STATUS_CODE_SUCCESS | |
DRV_EXT_LIGHT_STATUS_CODE_INVALID_PARAM | |
ret_code_t drv_ext_light_off |
( |
uint32_t |
id | ) |
|
Turn a given light off.
- Parameters
-
[in] | id | Valid light ID (Has to be in the range [0, num_lights-1]). |
- Note
- In case the given LED ID corresponds to a RGB light, all colors will be set to 0 intensity.
- Returns
- Status codes from this function. (Return codes may originate from other underlying modules/drivers as well which are not listed below).
- Return values
-
DRV_EXT_LIGHT_STATUS_CODE_SUCCESS | |
DRV_EXT_LIGHT_STATUS_CODE_INVALID_PARAM | |
ret_code_t drv_ext_light_on |
( |
uint32_t |
id | ) |
|
Turn a given light on.
- Parameters
-
- Note
- In case the given LED ID corresponds to an RGB light, all colors will be set to max intensity.
- Returns
- Status codes from this function. (Return codes may originate from other underlying modules/drivers as well which are not listed below).
- Return values
-
DRV_EXT_LIGHT_STATUS_CODE_SUCCESS | |
DRV_EXT_LIGHT_STATUS_CODE_INVALID_PARAM | |
ret_code_t drv_ext_light_reset |
( |
void |
| ) |
|
Function for resetting all the registers of the IO extender to their default values.
- Warning
- This reset applies to all registers, regardless if they were set by another driver outside of drv_ext_light.
- Returns
- Status codes from this function. (Return codes may originate from other underlying modules/drivers as well which are not listed below).
- Return values
-
DRV_EXT_LIGHT_STATUS_CODE_SUCCESS | |
Function for setting color for RGB LEDs.
- Parameters
-
[in] | id | Specifies the ID of the given light. (Has to be in the range [0, num_lights-1]). |
[in] | intensity | (0-255). |
- Returns
- Status codes from this function. (Return codes may originate from other underlying modules/drivers as well which are not listed below).
- Return values
-
DRV_EXT_LIGHT_STATUS_CODE_SUCCESS | |
DRV_EXT_LIGHT_STATUS_CODE_INVALID_PARAM | |
Set color for a given light through the GPIO extender.
- Parameters
-
[in] | id | Specifies the ID of the given light. (Has to be in the range [0, num_lights-1]). |
[in,out] | p_sequence | RGB sequence struct. *s |
- Note
- The actual timings in milliseconds will not necessarily correspond to the supplied times. The underlying functionality will choose register values to obtain timings as close as possible. Adjusting drv_ext_light_clkx_div_t::clkx_div supplied to drv_ext_light_init will influence the accuracy of this function. Also note that for the remaining intenstiry and fade parameters, values will be set as close as possible to the desired values. The user may read back p_sequence, which will be populated with the actual values.
- Returns
- Status codes from this function. (Return codes may originate from other underlying modules/drivers as well which are not listed below).
- Return values
-
DRV_EXT_LIGHT_STATUS_CODE_SUCCESS | |
DRV_EXT_LIGHT_STATUS_CODE_INVALID_PARAM | |
ret_code_t drv_ext_light_sequence |
( |
uint32_t |
id, |
|
|
drv_ext_light_sequence_t *const |
p_sequence |
|
) |
| |
Set color for a given light through the GPIO extender.
- Parameters
-
[in] | id | Specifies the ID of the given light. (Has to be in the range [0, num_lights-1]). |
[in,out] | p_sequence | Sequence struct. |
- Note
- The actual timings in milliseconds will not necessarily correspond to the supplied times. The underlying functionality will choose register values to obtain timings as close as possible. Adjusting DRV_EXT_LIGHT_CLKX_DIV will influence the accuracy of this function. Also note that for the remaining intenstiry and fade parameters, values will be set as close as possible to the desired values. The user may read back p_sequence, which will be populated with the actual values.
- Returns
- Status codes from this function. (Return codes may originate from other underlying modules/drivers as well which are not listed below).
- Return values
-
DRV_EXT_LIGHT_STATUS_CODE_SUCCESS | |
DRV_EXT_LIGHT_STATUS_CODE_INVALID_PARAM | |