Load switch (LDSW) peripheral driver. More...
Data Structures | |
struct | npmx_ldsw_t |
Data structure of the LDSW driver instance. More... | |
struct | npmx_ldsw_gpio_config_t |
Configuration structure for GPIO used as input signal for LDSW. More... | |
struct | npmx_ldsw_soft_start_config_t |
Configuration structure for soft start. More... | |
Enumerations | |
enum | npmx_ldsw_task_t { NPMX_LDSW_TASK_ENABLE , NPMX_LDSW_TASK_DISABLE , NPMX_LDSW_TASK_COUNT } |
LDSW tasks. More... | |
enum | npmx_ldsw_gpio_t { NPMX_LDSW_GPIO_NC = LDSW_LDSW1GPISEL_LDSW1GPISEL_NOTUSED1 , NPMX_LDSW_GPIO_0 = LDSW_LDSW1GPISEL_LDSW1GPISEL_GPIO0 , NPMX_LDSW_GPIO_1 = LDSW_LDSW1GPISEL_LDSW1GPISEL_GPIO1 , NPMX_LDSW_GPIO_2 = LDSW_LDSW1GPISEL_LDSW1GPISEL_GPIO2 , NPMX_LDSW_GPIO_3 = LDSW_LDSW1GPISEL_LDSW1GPISEL_GPIO3 , NPMX_LDSW_GPIO_4 = LDSW_LDSW1GPISEL_LDSW1GPISEL_GPIO4 , NPMX_LDSW_GPIO_COUNT , NPMX_LDSW_GPIO_INVALID = NPMX_INVALID_ENUM_VALUE } |
Possible GPIO to be selected with LDSW configurations. More... | |
enum | npmx_ldsw_status_mask_t { NPMX_LDSW_STATUS_POWERUP_LDSW_1_MASK = LDSW_LDSWSTATUS_LDSW1PWRUPLDSW_Msk , NPMX_LDSW_STATUS_POWERUP_LDO_1_MASK = LDSW_LDSWSTATUS_LDSW1PWRUPLDO_Msk , NPMX_LDSW_STATUS_POWERUP_LDSW_2_MASK = LDSW_LDSWSTATUS_LDSW2PWRUPLDSW_Msk , NPMX_LDSW_STATUS_POWERUP_LDO_2_MASK = LDSW_LDSWSTATUS_LDSW2PWRUPLDO_Msk , NPMX_LDSW_STATUS_DEEPSLEEP_MASK = LDSW_LDSWSTATUS_LDSWENABLE_Msk } |
LDSW status fields. More... | |
enum | npmx_ldsw_soft_start_current_t { NPMX_LDSW_SOFT_START_CURRENT_10_MA = LDSW_LDSWCONFIG_LDSW1SOFTSTARTSEL_10MA , NPMX_LDSW_SOFT_START_CURRENT_20_MA = LDSW_LDSWCONFIG_LDSW1SOFTSTARTSEL_20MA , NPMX_LDSW_SOFT_START_CURRENT_35_MA = LDSW_LDSWCONFIG_LDSW1SOFTSTARTSEL_35MA , NPMX_LDSW_SOFT_START_CURRENT_50_MA = LDSW_LDSWCONFIG_LDSW1SOFTSTARTSEL_50MA , NPMX_LDSW_SOFT_START_CURRENT_COUNT , NPMX_LDSW_SOFT_START_CURRENT_DEFAULT = NPMX_LDSW_SOFT_START_CURRENT_10_MA , NPMX_LDSW_SOFT_START_CURRENT_MAX = NPMX_LDSW_SOFT_START_CURRENT_50_MA , NPMX_LDSW_SOFT_START_CURRENT_INVALID = NPMX_INVALID_ENUM_VALUE } |
Possible LDSW soft start current levels. More... | |
enum | npmx_ldsw_voltage_t { NPMX_LDSW_VOLTAGE_1V0 = LDSW_LDSW1VOUTSEL_LDSW1VOUTSEL_1V , NPMX_LDSW_VOLTAGE_1V1 = LDSW_LDSW1VOUTSEL_LDSW1VOUTSEL_1V1 , NPMX_LDSW_VOLTAGE_1V2 = LDSW_LDSW1VOUTSEL_LDSW1VOUTSEL_1V2 , NPMX_LDSW_VOLTAGE_1V3 = LDSW_LDSW1VOUTSEL_LDSW1VOUTSEL_1V3 , NPMX_LDSW_VOLTAGE_1V4 = LDSW_LDSW1VOUTSEL_LDSW1VOUTSEL_1V4 , NPMX_LDSW_VOLTAGE_1V5 = LDSW_LDSW1VOUTSEL_LDSW1VOUTSEL_1V5 , NPMX_LDSW_VOLTAGE_1V6 = LDSW_LDSW1VOUTSEL_LDSW1VOUTSEL_1V6 , NPMX_LDSW_VOLTAGE_1V7 = LDSW_LDSW1VOUTSEL_LDSW1VOUTSEL_1V7 , NPMX_LDSW_VOLTAGE_1V8 = LDSW_LDSW1VOUTSEL_LDSW1VOUTSEL_1V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PMX_INVALID_ENUM_VALUE } |
Possible LDO output voltages to be set. More... | |
enum | npmx_ldsw_mode_t { NPMX_LDSW_MODE_LOAD_SWITCH = LDSW_LDSW1LDOSEL_LDSW1LDOSEL_LDSW , NPMX_LDSW_MODE_LDO = LDSW_LDSW1LDOSEL_LDSW1LDOSEL_LDO , NPMX_LDSW_MODE_COUNT , NPMX_LDSW_MODE_INVALID = NPMX_INVALID_ENUM_VALUE } |
Possible LDSW modes. More... | |
Functions | |
npmx_ldsw_t * | npmx_ldsw_get (npmx_instance_t *p_pmic, uint8_t idx) |
Function for returning LDSW instance based on index. | |
npmx_ldsw_voltage_t | npmx_ldsw_voltage_convert (uint32_t millivolts) |
Function for converting millivolts to npmx_ldsw_voltage_t enumeration. | |
bool | npmx_ldsw_voltage_convert_to_mv (npmx_ldsw_voltage_t enum_value, uint32_t *p_val) |
Function for converting npmx_ldsw_voltage_t enumeration to millivolts. | |
npmx_ldsw_soft_start_current_t | npmx_ldsw_soft_start_current_convert (uint32_t milliamperes) |
Function for converting milliamperes to npmx_ldsw_soft_start_current_t enumeration. | |
bool | npmx_ldsw_soft_start_current_convert_to_ma (npmx_ldsw_soft_start_current_t enum_value, uint32_t *p_val) |
Function for converting npmx_ldsw_soft_start_current_t enumeration to milliamperes. | |
npmx_error_t | npmx_ldsw_task_trigger (npmx_ldsw_t const *p_instance, npmx_ldsw_task_t task) |
Function for activating the specified LDSW task. | |
npmx_error_t | npmx_ldsw_enable_gpio_set (npmx_ldsw_t const *p_instance, npmx_ldsw_gpio_config_t const *p_config) |
Function for setting the GPIO pin which will be used for enabling and disabling the specified LDSW instance. | |
npmx_error_t | npmx_ldsw_enable_gpio_get (npmx_ldsw_t const *p_instance, npmx_ldsw_gpio_config_t *p_config) |
Function for reading which GPIO pin will be used for enabling and disabling the specified LDSW instance. | |
npmx_error_t | npmx_ldsw_status_get (npmx_ldsw_t const *p_instance, uint8_t *p_status_mask) |
Function for getting status for specified LDSW instance. | |
npmx_error_t | npmx_ldsw_soft_start_config_set (npmx_ldsw_t const *p_instance, npmx_ldsw_soft_start_config_t const *p_config) |
Function for configuring soft start for given instance of LDSW. | |
npmx_error_t | npmx_ldsw_soft_start_config_get (npmx_ldsw_t const *p_instance, npmx_ldsw_soft_start_config_t *p_config) |
Function for reading configuration of soft start for given instance of LDSW. | |
npmx_error_t | npmx_ldsw_active_discharge_enable_set (npmx_ldsw_t const *p_instance, bool enable) |
Function for enabling and disabling active discharge for given instance of LDSW. | |
npmx_error_t | npmx_ldsw_active_discharge_enable_get (npmx_ldsw_t const *p_instance, bool *p_enable) |
Function for reading if active discharge is enabled for given instance of LDSW. | |
npmx_error_t | npmx_ldsw_mode_set (npmx_ldsw_t const *p_instance, npmx_ldsw_mode_t mode) |
Function for configuring given instance of LDSW to work as LDO or load switch. | |
npmx_error_t | npmx_ldsw_mode_get (npmx_ldsw_t const *p_instance, npmx_ldsw_mode_t *p_mode) |
Function for reading if a given instance of LDSW works as LDO or load switch. | |
npmx_error_t | npmx_ldsw_ldo_voltage_set (npmx_ldsw_t const *p_instance, npmx_ldsw_voltage_t voltage) |
Function for setting the output voltage of LDO for given instance of LDSW. | |
npmx_error_t | npmx_ldsw_ldo_voltage_get (npmx_ldsw_t const *p_instance, npmx_ldsw_voltage_t *p_voltage) |
Function for getting the output voltage of LDO for given instance of LDSW. | |
Load switch (LDSW) peripheral driver.
enum npmx_ldsw_gpio_t |
Possible GPIO to be selected with LDSW configurations.
enum npmx_ldsw_mode_t |
Possible LDSW soft start current levels.
LDSW status fields.
enum npmx_ldsw_task_t |
enum npmx_ldsw_voltage_t |
Possible LDO output voltages to be set.
npmx_error_t npmx_ldsw_active_discharge_enable_get | ( | npmx_ldsw_t const * | p_instance, |
bool * | p_enable ) |
Function for reading if active discharge is enabled for given instance of LDSW.
[in] | p_instance | Pointer to the LDSW instance. |
[out] | p_enable | Pointer to active discharge enable variable. |
NPMX_SUCCESS | Operation performed successfully. |
NPMX_ERROR_IO | Error using IO bus line. |
npmx_error_t npmx_ldsw_active_discharge_enable_set | ( | npmx_ldsw_t const * | p_instance, |
bool | enable ) |
Function for enabling and disabling active discharge for given instance of LDSW.
[in] | p_instance | Pointer to the LDSW instance. |
[in] | enable | True to enable active discharge, false to disable active discharge. |
NPMX_SUCCESS | Operation performed successfully. |
NPMX_ERROR_IO | Error using IO bus line. |
npmx_error_t npmx_ldsw_enable_gpio_get | ( | npmx_ldsw_t const * | p_instance, |
npmx_ldsw_gpio_config_t * | p_config ) |
Function for reading which GPIO pin will be used for enabling and disabling the specified LDSW instance.
[in] | p_instance | Pointer to the LDSW instance. |
[out] | p_config | Pointer to the configuration of GPIO used as the enable signal. |
NPMX_SUCCESS | Operation performed successfully. |
NPMX_ERROR_IO | Error using IO bus line. |
npmx_error_t npmx_ldsw_enable_gpio_set | ( | npmx_ldsw_t const * | p_instance, |
npmx_ldsw_gpio_config_t const * | p_config ) |
Function for setting the GPIO pin which will be used for enabling and disabling the specified LDSW instance.
[in] | p_instance | Pointer to the LDSW instance. |
[in] | p_config | Pointer to the configuration of specified GPIO to be used as the enable signal. |
NPMX_SUCCESS | Operation performed successfully. |
NPMX_ERROR_IO | Error using IO bus line. |
npmx_ldsw_t * npmx_ldsw_get | ( | npmx_instance_t * | p_pmic, |
uint8_t | idx ) |
Function for returning LDSW instance based on index.
[in] | p_pmic | Pointer to the PMIC instance. |
[in] | idx | Index of the LDSW instance. |
npmx_error_t npmx_ldsw_ldo_voltage_get | ( | npmx_ldsw_t const * | p_instance, |
npmx_ldsw_voltage_t * | p_voltage ) |
Function for getting the output voltage of LDO for given instance of LDSW.
[in] | p_instance | Pointer to the LDSW instance. |
[out] | p_voltage | Pointer to buck voltage variable. |
NPMX_SUCCESS | Operation performed successfully. |
NPMX_ERROR_IO | Error using IO bus line. |
npmx_error_t npmx_ldsw_ldo_voltage_set | ( | npmx_ldsw_t const * | p_instance, |
npmx_ldsw_voltage_t | voltage ) |
Function for setting the output voltage of LDO for given instance of LDSW.
[in] | p_instance | Pointer to the LDSW instance. |
[in] | voltage | Voltage to set the LDO to. |
NPMX_SUCCESS | Operation performed successfully. |
NPMX_ERROR_IO | Error using IO bus line. |
npmx_error_t npmx_ldsw_mode_get | ( | npmx_ldsw_t const * | p_instance, |
npmx_ldsw_mode_t * | p_mode ) |
Function for reading if a given instance of LDSW works as LDO or load switch.
[in] | p_instance | Pointer to the LDSW instance. |
[out] | p_mode | Pointer to the LDSW mode variable. |
NPMX_SUCCESS | Operation performed successfully. |
NPMX_ERROR_IO | Error using IO bus line. |
npmx_error_t npmx_ldsw_mode_set | ( | npmx_ldsw_t const * | p_instance, |
npmx_ldsw_mode_t | mode ) |
Function for configuring given instance of LDSW to work as LDO or load switch.
[in] | p_instance | Pointer to the LDSW instance. |
[in] | mode | LDSW mode to be set. |
NPMX_SUCCESS | Operation performed successfully. |
NPMX_ERROR_IO | Error using IO bus line. |
npmx_error_t npmx_ldsw_soft_start_config_get | ( | npmx_ldsw_t const * | p_instance, |
npmx_ldsw_soft_start_config_t * | p_config ) |
Function for reading configuration of soft start for given instance of LDSW.
[in] | p_instance | Pointer to the LDSW instance. |
[out] | p_config | Pointer to the configuration of soft start. |
NPMX_SUCCESS | Operation performed successfully. |
NPMX_ERROR_IO | Error using IO bus line. |
npmx_error_t npmx_ldsw_soft_start_config_set | ( | npmx_ldsw_t const * | p_instance, |
npmx_ldsw_soft_start_config_t const * | p_config ) |
Function for configuring soft start for given instance of LDSW.
[in] | p_instance | Pointer to the LDSW instance. |
[in] | p_config | Pointer to the configuration of soft start to apply. |
NPMX_SUCCESS | Operation performed successfully. |
NPMX_ERROR_IO | Error using IO bus line. |
npmx_ldsw_soft_start_current_t npmx_ldsw_soft_start_current_convert | ( | uint32_t | milliamperes | ) |
Function for converting milliamperes to npmx_ldsw_soft_start_current_t enumeration.
[in] | milliamperes | Current in milliamperes to be converted into npmx_ldsw_soft_start_current_t enumeration. |
bool npmx_ldsw_soft_start_current_convert_to_ma | ( | npmx_ldsw_soft_start_current_t | enum_value, |
uint32_t * | p_val ) |
Function for converting npmx_ldsw_soft_start_current_t enumeration to milliamperes.
[in] | enum_value | Current defined as npmx_ldsw_soft_start_current_t enumeration to be converted into milliamperes. |
[out] | p_val | Pointer to the variable that stores the conversion result. |
true | Conversion is valid. |
false | Conversion is invalid - an invalid argument was passed to the function. |
npmx_error_t npmx_ldsw_status_get | ( | npmx_ldsw_t const * | p_instance, |
uint8_t * | p_status_mask ) |
Function for getting status for specified LDSW instance.
[in] | p_instance | Pointer to the LDSW instance. |
[out] | p_status_mask | Pointer to the LDSW status mask composed of values from npmx_ldsw_status_mask_t. |
NPMX_SUCCESS | Operation performed successfully. |
NPMX_ERROR_IO | Error using IO bus line. |
npmx_error_t npmx_ldsw_task_trigger | ( | npmx_ldsw_t const * | p_instance, |
npmx_ldsw_task_t | task ) |
Function for activating the specified LDSW task.
[in] | p_instance | Pointer to the LDSW instance. |
[in] | task | Task to be activated. |
NPMX_SUCCESS | Operation performed successfully. |
NPMX_ERROR_IO | Error using IO bus line. |
npmx_ldsw_voltage_t npmx_ldsw_voltage_convert | ( | uint32_t | millivolts | ) |
Function for converting millivolts to npmx_ldsw_voltage_t enumeration.
[in] | millivolts | Voltage in millivolts to be converted into npmx_ldsw_voltage_t enumeration. |
bool npmx_ldsw_voltage_convert_to_mv | ( | npmx_ldsw_voltage_t | enum_value, |
uint32_t * | p_val ) |
Function for converting npmx_ldsw_voltage_t enumeration to millivolts.
[in] | enum_value | Voltage defined as npmx_ldsw_voltage_t enumeration to be converted into millivolts. |
[out] | p_val | Pointer to the variable that stores the conversion result. |
true | Conversion is valid. |
false | Conversion is invalid - an invalid argument was passed to the function. |