LDSW

group npmx_ldsw

Load switch (LDSW) peripheral driver.

Enums

enum npmx_ldsw_task_t

LDSW tasks.

Values:

enumerator NPMX_LDSW_TASK_ENABLE

Enable LDSW.

enumerator NPMX_LDSW_TASK_DISABLE

Disable LDSW.

enumerator NPMX_LDSW_TASK_COUNT

LDSW tasks count.

enum npmx_ldsw_gpio_t

Possible GPIO to be selected with LDSW configurations.

Values:

enumerator NPMX_LDSW_GPIO_NC

No GPIO selected.

enumerator NPMX_LDSW_GPIO_0

GPIO_0 selected.

enumerator NPMX_LDSW_GPIO_1

GPIO_1 selected.

enumerator NPMX_LDSW_GPIO_2

GPIO_2 selected.

enumerator NPMX_LDSW_GPIO_3

GPIO_3 selected.

enumerator NPMX_LDSW_GPIO_4

GPIO_4 selected.

enumerator NPMX_LDSW_GPIO_COUNT

GPIOs count.

enumerator NPMX_LDSW_GPIO_INVALID

Invalid GPIO.

enum npmx_ldsw_status_mask_t

LDSW status fields.

Values:

enumerator NPMX_LDSW_STATUS_POWERUP_LDSW_1_MASK

LDSW 1 Power Up signal.

enumerator NPMX_LDSW_STATUS_POWERUP_LDO_1_MASK

LDO 1 Power Up signal.

enumerator NPMX_LDSW_STATUS_POWERUP_LDSW_2_MASK

LDSW 1 Power Up signal.

enumerator NPMX_LDSW_STATUS_POWERUP_LDO_2_MASK

LDO 1 Power Up signal.

enumerator NPMX_LDSW_STATUS_DEEPSLEEP_MASK

LDSW/LDO Enable Deep Sleep signal.

enum npmx_ldsw_soft_start_current_t

Possible LDSW soft start current levels.

Values:

enumerator NPMX_LDSW_SOFT_START_CURRENT_10_MA

LDSW soft start level 10 mA.

enumerator NPMX_LDSW_SOFT_START_CURRENT_20_MA

LDSW soft start level 20 mA.

enumerator NPMX_LDSW_SOFT_START_CURRENT_35_MA

LDSW soft start level 35 mA.

enumerator NPMX_LDSW_SOFT_START_CURRENT_50_MA

LDSW soft start level 50 mA.

enumerator NPMX_LDSW_SOFT_START_CURRENT_COUNT

Current levels count.

enumerator NPMX_LDSW_SOFT_START_CURRENT_DEFAULT

Default LDSW soft start level.

enumerator NPMX_LDSW_SOFT_START_CURRENT_MAX

Maximum LDSW soft start level.

enumerator NPMX_LDSW_SOFT_START_CURRENT_INVALID

Invalid LDSW soft start level.

enum npmx_ldsw_voltage_t

Possible LDO output voltages to be set.

Values:

enumerator NPMX_LDSW_VOLTAGE_1V0

1.0 V

enumerator NPMX_LDSW_VOLTAGE_1V1

1.1 V

enumerator NPMX_LDSW_VOLTAGE_1V2

1.2 V

enumerator NPMX_LDSW_VOLTAGE_1V3

1.3 V

enumerator NPMX_LDSW_VOLTAGE_1V4

1.4 V

enumerator NPMX_LDSW_VOLTAGE_1V5

1.5 V

enumerator NPMX_LDSW_VOLTAGE_1V6

1.6 V

enumerator NPMX_LDSW_VOLTAGE_1V7

1.7 V

enumerator NPMX_LDSW_VOLTAGE_1V8

1.8 V

enumerator NPMX_LDSW_VOLTAGE_1V9

1.9 V

enumerator NPMX_LDSW_VOLTAGE_2V0

2.0 V

enumerator NPMX_LDSW_VOLTAGE_2V1

2.1 V

enumerator NPMX_LDSW_VOLTAGE_2V2

2.2 V

enumerator NPMX_LDSW_VOLTAGE_2V3

2.3 V

enumerator NPMX_LDSW_VOLTAGE_2V4

2.4 V

enumerator NPMX_LDSW_VOLTAGE_2V5

2.5 V

enumerator NPMX_LDSW_VOLTAGE_2V6

2.6 V

enumerator NPMX_LDSW_VOLTAGE_2V7

2.7 V

enumerator NPMX_LDSW_VOLTAGE_2V8

2.8 V

enumerator NPMX_LDSW_VOLTAGE_2V9

2.9 V

enumerator NPMX_LDSW_VOLTAGE_3V0

3.0 V

enumerator NPMX_LDSW_VOLTAGE_3V1

3.1 V

enumerator NPMX_LDSW_VOLTAGE_3V2

3.2 V

enumerator NPMX_LDSW_VOLTAGE_3V3

3.3 V

enumerator NPMX_LDSW_VOLTAGE_COUNT

LDO voltages count.

enumerator NPMX_LDSW_VOLTAGE_DEFAULT

Default LDO voltage.

enumerator NPMX_LDSW_VOLTAGE_MAX

Maximum LDO voltage.

enumerator NPMX_LDSW_VOLTAGE_INVALID

Invalid LDO voltage.

enum npmx_ldsw_mode_t

Possible LDSW modes.

Values:

enumerator NPMX_LDSW_MODE_LOAD_SWITCH

LDSW configured as load switch.

enumerator NPMX_LDSW_MODE_LDO

LDSW configured as LDO.

enumerator NPMX_LDSW_MODE_COUNT

LDSW modes count.

enumerator NPMX_LDSW_MODE_INVALID

Invalid LDSW mode.

Functions

npmx_ldsw_t *npmx_ldsw_get(npmx_instance_t *p_pmic, uint8_t idx)

Function for returning LDSW instance based on index.

Parameters:
  • p_pmic[in] Pointer to the PMIC instance.

  • idx[in] Index of the LDSW instance.

Returns:

Pointer to the LDSW instance.

npmx_ldsw_voltage_t npmx_ldsw_voltage_convert(uint32_t millivolts)

Function for converting millivolts to npmx_ldsw_voltage_t enumeration.

Parameters:
  • millivolts[in] Voltage in millivolts to be converted into npmx_ldsw_voltage_t enumeration.

Returns:

Result of conversion. NPMX_LDSW_VOLTAGE_INVALID if given voltage is not represented in 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.

Parameters:
  • enum_value[in] Voltage defined as npmx_ldsw_voltage_t enumeration to be converted into millivolts.

  • p_val[out] Pointer to the variable that stores the conversion result.

Return values:
  • true – Conversion is valid.

  • false – Conversion is invalid - an invalid argument was passed to the function.

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.

Parameters:
Returns:

Result of conversion. NPMX_LDSW_SOFT_START_CURRENT_INVALID if given current is not represented in 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.

Parameters:
  • enum_value[in] Current defined as npmx_ldsw_soft_start_current_t enumeration to be converted into milliamperes.

  • p_val[out] Pointer to the variable that stores the conversion result.

Return values:
  • true – Conversion is valid.

  • false – Conversion is invalid - an invalid argument was passed to the function.

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.

Parameters:
  • p_instance[in] Pointer to the LDSW instance.

  • task[in] Task to be activated.

Return values:
  • 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.

Note

Selected GPIO should be configured as input using GPIO driver.

Parameters:
  • p_instance[in] Pointer to the LDSW instance.

  • p_config[in] Pointer to the configuration of specified GPIO to be used as the enable signal.

Return values:
  • 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.

Note

Selected GPIO should be configured as input using GPIO driver.

Parameters:
  • p_instance[in] Pointer to the LDSW instance.

  • p_config[out] Pointer to the configuration of GPIO used as the enable signal.

Return values:
  • NPMX_SUCCESS – Operation performed successfully.

  • NPMX_ERROR_IO – Error using IO bus line.

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.

Parameters:
  • p_instance[in] Pointer to the LDSW instance.

  • p_status_mask[out] Pointer to the LDSW status mask composed of values from npmx_ldsw_status_mask_t.

Return values:
  • 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.

Parameters:
  • p_instance[in] Pointer to the LDSW instance.

  • p_config[in] Pointer to the configuration of soft start to apply.

Return values:
  • 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.

Parameters:
  • p_instance[in] Pointer to the LDSW instance.

  • p_config[out] Pointer to the configuration of soft start.

Return values:
  • 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.

Parameters:
  • p_instance[in] Pointer to the LDSW instance.

  • enable[in] True to enable active discharge, false to disable active discharge.

Return values:
  • NPMX_SUCCESS – Operation performed successfully.

  • NPMX_ERROR_IO – Error using IO bus line.

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.

Parameters:
  • p_instance[in] Pointer to the LDSW instance.

  • p_enable[out] Pointer to active discharge enable variable.

Return values:
  • 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.

Parameters:
  • p_instance[in] Pointer to the LDSW instance.

  • mode[in] LDSW mode to be set.

Return values:
  • 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.

Parameters:
  • p_instance[in] Pointer to the LDSW instance.

  • p_mode[out] Pointer to the LDSW mode variable.

Return values:
  • 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.

Parameters:
  • p_instance[in] Pointer to the LDSW instance.

  • voltage[in] Voltage to set the LDO to.

Return values:
  • NPMX_SUCCESS – Operation performed successfully.

  • NPMX_ERROR_IO – Error using IO bus line.

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.

Parameters:
  • p_instance[in] Pointer to the LDSW instance.

  • p_voltage[out] Pointer to buck voltage variable.

Return values:
  • NPMX_SUCCESS – Operation performed successfully.

  • NPMX_ERROR_IO – Error using IO bus line.

struct npmx_ldsw_t
#include <npmx_ldsw.h>

Data structure of the LDSW driver instance.

Public Members

npmx_backend_t *p_backend

Pointer to backend instance.

uint8_t hw_index

Hardware index of LDSW instance.

struct npmx_ldsw_gpio_config_t
#include <npmx_ldsw.h>

Configuration structure for GPIO used as input signal for LDSW.

Public Members

npmx_ldsw_gpio_t gpio

The GPIO to be used as the signal.

bool inverted

If true, the input state will be inverted, and logical low state will activate the signal.

struct npmx_ldsw_soft_start_config_t
#include <npmx_ldsw.h>

Configuration structure for soft start.

Public Members

bool enable

Soft start enable status.

npmx_ldsw_soft_start_current_t current

Soft start current level.