Nordic Thingy:52
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Groups Pages
Sx150x LED driver register calculation

Sx150x LED driver register calculation API. More...

Enumerations

enum  {
  SX150x_LED_DRC_CALC_STATUS_CODE_SUCCESS, SX150x_LED_DRV_CALC_STATUS_CODE_INACCURATE, SX150x_LED_DRV_CALC_STATUS_CODE_INVALID_PARAM, SX150x_LED_DRV_CALC_STATUS_CODE_NULL,
  SX150x_LED_DRV_CALC_STATUS_CODE_NOT_INIT
}
 The SX150x led driver calc status codes. More...
 

Functions

ret_code_t sx150x_led_drv_calc_convert (uint16_t port_mask, drv_ext_light_sequence_t *const real_vals, sx150x_led_drv_regs_vals_t *const reg_vals)
 Converts from real values (intensity (0x00-0xFF and time in milliseconds) to register values. More...
 
bool sx150x_led_drv_calc_fade_supp (uint16_t port_mask)
 Checks if all the supplied pins in port_mask supports fade. More...
 
void sx150x_led_drv_calc_init (uint16_t fade_supported_port_mask, uint32_t clkx_tics_pr_sec)
 Initializes the SX150x led driver register calculation module. More...
 

Detailed Description

Sx150x LED driver register calculation API.

Enumeration Type Documentation

anonymous enum

The SX150x led driver calc status codes.

Enumerator
SX150x_LED_DRC_CALC_STATUS_CODE_SUCCESS 

Successful.

SX150x_LED_DRV_CALC_STATUS_CODE_INACCURATE 

One or more of the set time parameters deviate by more than 20 %. Accept or try again with different values or osc divider.

SX150x_LED_DRV_CALC_STATUS_CODE_INVALID_PARAM 

Invalid parameters.

SX150x_LED_DRV_CALC_STATUS_CODE_NULL 

NULL parameter supplied.

SX150x_LED_DRV_CALC_STATUS_CODE_NOT_INIT 

The module has not been initalized. Has init been called?

Function Documentation

ret_code_t sx150x_led_drv_calc_convert ( uint16_t  port_mask,
drv_ext_light_sequence_t *const  real_vals,
sx150x_led_drv_regs_vals_t *const  reg_vals 
)

Converts from real values (intensity (0x00-0xFF and time in milliseconds) to register values.

Parameters
[in]port_mask16-bit port mask
[in,out]real_valsThe requested values. Will contain the actual set values after processing
[out]reg_valsRegister values set as close as possible to achieve the requested values
Returns
SX150x_LED_DRC_CALC_STATUS_CODE_SUCCESS
SX150x_LED_DRV_CALC_STATUS_CODE_INACCURATE
SX150x_LED_DRV_CALC_STATUS_CODE_INVALID_PARAM
SX150x_LED_DRV_CALC_STATUS_CODE_NULL
SX150x_LED_DRV_CALC_STATUS_CODE_NOT_INIT
bool sx150x_led_drv_calc_fade_supp ( uint16_t  port_mask)

Checks if all the supplied pins in port_mask supports fade.

Parameters
[in]port_mask16-bit port mask.
Note
: If port_mask = 0, false is returned.
Returns
true All the given pins support fade.
false One or more of the supplied pins does not support fade.
void sx150x_led_drv_calc_init ( uint16_t  fade_supported_port_mask,
uint32_t  clkx_tics_pr_sec 
)

Initializes the SX150x led driver register calculation module.

Parameters
[in]fade_supported_port_mask16-bit port mask holding "1" in positions corresponding to pins which supports fading.
[in]clkx_tics_pr_secNumber of ticks / sec for the internal ioext oscillatior after division.