POF

group npmx_pof

Power fail (POF) comparator peripheral driver.

Enums

enum npmx_pof_status_t

POF warning status.

Values:

enumerator NPMX_POF_STATUS_DISABLE

Disable POF warning.

enumerator NPMX_POF_STATUS_ENABLE

Enable POF warning.

enumerator NPMX_POF_STATUS_COUNT

POF warnings count.

enumerator NPMX_POF_STATUS_INVALID

Invalid POF warning.

enum npmx_pof_polarity_t

POF warning polarity.

Values:

enumerator NPMX_POF_POLARITY_LOW

Active in low state.

enumerator NPMX_POF_POLARITY_HIGH

Active in high state.

enumerator NPMX_POF_POLARITY_COUNT

POF polarity count.

enumerator NPMX_POF_POLARITY_INVALID

Invalid POF polarity.

enum npmx_pof_threshold_t

POF warning voltage threshold values.

Values:

enumerator NPMX_POF_THRESHOLD_2V6

2.6 V.

enumerator NPMX_POF_THRESHOLD_2V7

2.7 V.

enumerator NPMX_POF_THRESHOLD_2V8

2.8 V.

enumerator NPMX_POF_THRESHOLD_2V9

2.9 V.

enumerator NPMX_POF_THRESHOLD_3V0

3.0 V.

enumerator NPMX_POF_THRESHOLD_3V1

3.1 V.

enumerator NPMX_POF_THRESHOLD_3V2

3.2 V.

enumerator NPMX_POF_THRESHOLD_3V3

3.3 V.

enumerator NPMX_POF_THRESHOLD_3V4

3.4 V.

enumerator NPMX_POF_THRESHOLD_3V5

3.5 V.

enumerator NPMX_POF_THRESHOLD_COUNT

Threshold values count.

enumerator NPMX_POF_THRESHOLD_DEFAULT

Default voltage.

enumerator NPMX_POF_THRESHOLD_MAX

Maximum voltage.

enumerator NPMX_POF_THRESHOLD_INVALID

Invalid voltage.

Functions

npmx_pof_t *npmx_pof_get(npmx_instance_t *p_pmic, uint8_t idx)

Function for returning POF instance based on index.

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

  • idx[in] Index of the POF instance.

Returns:

Pointer to the POF instance.

npmx_pof_threshold_t npmx_pof_threshold_convert(uint32_t millivolts)

Function for converting millivolts to npmx_pof_threshold_t enumeration.

Parameters:
Returns:

Result of conversion. NPMX_POF_THRESHOLD_INVALID if given voltage is not represented in enumeration.

bool npmx_pof_threshold_convert_to_mv(npmx_pof_threshold_t enum_value, uint32_t *p_val)

Function for converting npmx_pof_threshold_t enumeration to millivolts.

Parameters:
  • enum_value[in] Voltage defined as npmx_pof_threshold_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_error_t npmx_pof_config_set(npmx_pof_t const *p_instance, npmx_pof_config_t const *p_config)

Function for setting configuration and enabling POF comparator.

Note

Before using this function, configure one GPIO as a power loss warning output (NPMX_GPIO_MODE_OUTPUT_PLW).

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

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

Return values:
  • NPMX_SUCCESS – Operation performed successfully.

  • NPMX_ERROR_IO – Error using IO bus line.

npmx_error_t npmx_pof_config_get(npmx_pof_t const *p_instance, npmx_pof_config_t *p_config)

Function for reading the POF configuration.

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

  • p_config[out] Pointer to the POF configuration structure.

Return values:
  • NPMX_SUCCESS – Operation performed successfully.

  • NPMX_ERROR_IO – Error using IO bus line.

npmx_error_t npmx_pof_disable_set(npmx_pof_t const *p_instance)

Function for disabling POF comparator.

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

Return values:
  • NPMX_SUCCESS – Operation performed successfully.

  • NPMX_ERROR_IO – Error using IO bus line.

struct npmx_pof_t
#include <npmx_pof.h>

Data structure of the POF driver instance.

Public Members

npmx_backend_t *p_backend

Pointer to backend instance.

struct npmx_pof_config_t
#include <npmx_pof.h>

Configuration structure for POF comparator.

Public Members

npmx_pof_status_t status

Enable status of POF.

npmx_pof_threshold_t threshold

Threshold at which the POF will trigger.

npmx_pof_polarity_t polarity

Polarity of selected GPIO POF signal trigger.