VBUSIN

group npmx_vbusin

VBUS input (VBUSIN) peripheral driver.

Enums

enum npmx_vbusin_task_t

VBUSIN tasks.

Values:

enumerator NPMX_VBUSIN_TASK_APPLY_CURRENT_LIMIT

Applying the selected current limit set with npmx_vbusin_current_limit_set().

enumerator NPMX_VBUSIN_TASK_COUNT

VBUSIN tasks count.

enum npmx_vbusin_current_t

Available current limits for VBUS.

Values:

enumerator NPMX_VBUSIN_CURRENT_100_MA

100 mA.

enumerator NPMX_VBUSIN_CURRENT_500_MA

500 mA.

enumerator NPMX_VBUSIN_CURRENT_600_MA

600 mA.

enumerator NPMX_VBUSIN_CURRENT_700_MA

700 mA.

enumerator NPMX_VBUSIN_CURRENT_800_MA

800 mA.

enumerator NPMX_VBUSIN_CURRENT_900_MA

900 mA.

enumerator NPMX_VBUSIN_CURRENT_1000_MA

1000 mA.

enumerator NPMX_VBUSIN_CURRENT_1100_MA

1100 mA.

enumerator NPMX_VBUSIN_CURRENT_1200_MA

1200 mA.

enumerator NPMX_VBUSIN_CURRENT_1300_MA

1300 mA.

enumerator NPMX_VBUSIN_CURRENT_1400_MA

1400 mA.

enumerator NPMX_VBUSIN_CURRENT_1500_MA

1500 mA.

enumerator NPMX_VBUSIN_CURRENT_COUNT

Available currents count.

enumerator NPMX_VBUSIN_CURRENT_DEFAULT

Default current.

enumerator NPMX_VBUSIN_CURRENT_MAX

Maximum current.

enumerator NPMX_VBUSIN_CURRENT_INVALID

Invalid current.

enum npmx_vbusin_cc_t

Available CCx pins status connections.

Values:

enumerator NPMX_VBUSIN_CC_NOT_CONNECTED

No CCx connection.

enumerator NPMX_VBUSIN_CC_DEFAULT

Default USB 100/500 mA.

enumerator NPMX_VBUSIN_CC_HIGH_POWER_1A5

1.5 A High Power.

enumerator NPMX_VBUSIN_CC_HIGH_POWER_3A0

3.0 A High Power.

enumerator NPMX_VBUSIN_CC_COUNT

Pins status connections count.

enumerator NPMX_VBUSIN_CC_INVALID

Invalid CCx pins status connection.

enum npmx_vbusin_status_mask_t

VBUS status flag mask.

Values:

enumerator NPMX_VBUSIN_STATUS_CONNECTED_MASK

VBUS detected.

enumerator NPMX_VBUSIN_STATUS_CURRENT_LIMIT_MASK

VBUS current limit detected.

enumerator NPMX_VBUSIN_STATUS_OVER_VOLTAGE_MASK

VBUS over voltage protection active.

enumerator NPMX_VBUSIN_STATUS_UNDER_VOLTAGE_MASK

VBUS under voltage detected.

enumerator NPMX_VBUSIN_STATUS_SUSPEND_MODE_MASK

VBUS suspended.

Functions

npmx_vbusin_t *npmx_vbusin_get(npmx_instance_t *p_pmic, uint8_t idx)

Function for returning VBUSIN instance based on index.

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

  • idx[in] Index of the VBUSIN instance.

Returns:

Pointer to the VBUSIN instance.

npmx_vbusin_current_t npmx_vbusin_current_convert(uint32_t milliamperes)

Function for converting milliamperes to npmx_vbusin_current_t enumeration.

Parameters:
Returns:

Result of conversion. NPMX_VBUSIN_CURRENT_INVALID if given current is not represented in enumeration.

bool npmx_vbusin_current_convert_to_ma(npmx_vbusin_current_t enum_value, uint32_t *p_val)

Function for converting npmx_vbusin_current_t enumeration to milliamperes.

Parameters:
  • enum_value[in] Current defined as npmx_vbusin_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.

const char *const npmx_vbusin_cc_status_map_to_string(npmx_vbusin_cc_t enum_value)

Function for mapping npmx_vbusin_cc_t enumeration values to string.

Parameters:
  • enum_value[in] CC status defined as npmx_vbusin_cc_t enumeration to be mapped to string.

Returns:

Result of conversion.

npmx_error_t npmx_vbusin_task_trigger(npmx_vbusin_t const *p_instance, npmx_vbusin_task_t task)

Function for activating the specified VBUSIN task.

Parameters:
  • p_instance – Pointer to the VBUSIN instance.

  • task – Task to be activated.

Return values:
  • NPMX_SUCCESS – Operation performed successfully.

  • NPMX_ERROR_IO – Error using IO bus line.

npmx_error_t npmx_vbusin_current_limit_set(npmx_vbusin_t const *p_instance, npmx_vbusin_current_t current_limit)

Function for setting the current limit for VBUS.

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

  • current_limit[in] Current limit to set.

Return values:
  • NPMX_SUCCESS – Operation performed successfully.

  • NPMX_ERROR_IO – Error using IO bus line.

npmx_error_t npmx_vbusin_current_limit_get(npmx_vbusin_t const *p_instance, npmx_vbusin_current_t *p_current_limit)

Function for getting the current limit for VBUS.

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

  • p_current_limit[out] Pointer to the current limit variable.

Return values:
  • NPMX_SUCCESS – Operation performed successfully.

  • NPMX_ERROR_IO – Error using IO bus line.

npmx_error_t npmx_vbusin_suspend_mode_enable_set(npmx_vbusin_t const *p_instance, bool enable)

Function for enabling and disabling the suspend mode.

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

  • enable[in] True if device is to enter the suspend mode, false if it is to exit from the suspend mode.

Return values:
  • NPMX_SUCCESS – Operation performed successfully.

  • NPMX_ERROR_IO – Error using IO bus line.

npmx_error_t npmx_vbusin_suspend_mode_enable_get(npmx_vbusin_t const *p_instance, bool *p_enable)

Function for reading the suspend mode.

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

  • p_enable[out] Pointer to the suspend mode variable.

Return values:
  • NPMX_SUCCESS – Operation performed successfully.

  • NPMX_ERROR_IO – Error using IO bus line.

npmx_error_t npmx_vbusin_cc_status_get(npmx_vbusin_t const *p_instance, npmx_vbusin_cc_t *p_cc1, npmx_vbusin_cc_t *p_cc2)

Function for reading status of USB CCx pins.

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

  • p_cc1[out] Pointer to the CC1 status variable.

  • p_cc2[out] Pointer to the CC2 status variable.

Return values:
  • NPMX_SUCCESS – Operation performed successfully.

  • NPMX_ERROR_IO – Error using IO bus line.

npmx_error_t npmx_vbusin_vbus_status_get(npmx_vbusin_t const *p_instance, uint8_t *p_status_mask)

Function for reading VBUS status register.

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

  • p_status_mask[out] Pointer to the VBUS status mask composed of values from npmx_vbusin_status_mask_t.

Return values:
  • NPMX_SUCCESS – Operation performed successfully.

  • NPMX_ERROR_IO – Error using IO bus line.

struct npmx_vbusin_t
#include <npmx_vbusin.h>

Data structure of the VBUSIN driver instance.

Public Members

npmx_backend_t *p_backend

Pointer to backend instance.