POWER driver

group nrfx_power

POWER peripheral driver.

Callback types

Defined types of callback functions.

typedef void (*nrfx_power_pofwarn_event_handler_t)(void)

Event handler for power failure warning.

typedef void (*nrfx_power_sleep_event_handler_t)(nrfx_power_sleep_evt_t event)

Event handler for the sleep events.

Param event:

Event type

typedef void (*nrfx_power_usb_event_handler_t)(nrfx_power_usb_evt_t event)

Event handler for the USB-related power events.

Param event:

Event type

Defines

NRFX_POWER_SUPPORTS_POFCON

Symbol indicating whether the power failure comparator is supported.

NRFX_POWER_SUPPORTS_POFCON_VDDH

Symbol indicating whether the power failure comparator for VDDH is supported.

NRFX_POWER_SUPPORTS_DCDCEN_VDDH

Symbol indicating whether the VDDH regulator is supported.

Enums

enum nrfx_power_mode_t

Power mode possible configurations.

Values:

enumerator NRFX_POWER_MODE_CONSTLAT

Constant latency mode

enumerator NRFX_POWER_MODE_LOWPWR

Low power mode

enum nrfx_power_sleep_evt_t

Events from power system.

Values:

enumerator NRFX_POWER_SLEEP_EVT_ENTER

CPU entered WFI/WFE sleep

                        Keep in mind that if this interrupt is enabled,
                        it means that CPU was waken up just after WFI by this interrupt.

enumerator NRFX_POWER_SLEEP_EVT_EXIT

CPU exited WFI/WFE sleep

enum nrfx_power_usb_evt_t

Events from USB power system.

Values:

enumerator NRFX_POWER_USB_EVT_DETECTED

USB power detected on the connector (plugged in).

enumerator NRFX_POWER_USB_EVT_REMOVED

USB power removed from the connector.

enumerator NRFX_POWER_USB_EVT_READY

USB power regulator ready.

enum nrfx_power_usb_state_t

USB power state.

The single enumerator that holds all data about current state of USB related POWER.

Organized this way that higher power state has higher numeric value

Values:

enumerator NRFX_POWER_USB_STATE_DISCONNECTED

No power on USB lines detected.

enumerator NRFX_POWER_USB_STATE_CONNECTED

The USB power is detected, but USB power regulator is not ready.

enumerator NRFX_POWER_USB_STATE_READY

From the power viewpoint, USB is ready for working.

Functions

nrfx_power_pofwarn_event_handler_t nrfx_power_pof_handler_get(void)

Function for getting the handler of the power failure comparator.

Returns:

Handler of the power failure comparator.

nrfx_power_usb_event_handler_t nrfx_power_usb_handler_get(void)

Function for getting the handler of the USB power.

Returns:

Handler of the USB power.

nrfx_err_t nrfx_power_init(nrfx_power_config_t const *p_config)

Function for initializing the power module driver.

Enabled power module driver processes all the interrupts from the power system.

Parameters:
  • p_config[in] Pointer to the structure with the initial configuration.

Return values:
  • NRFX_SUCCESS – Successfully initialized.

  • NRFX_ERROR_ALREADY_INITIALIZED – Module was already initialized.

void nrfx_power_uninit(void)

Function for unintializing the power module driver.

Disables all the interrupt handling in the module.

See also

nrfx_power_init

void nrfx_power_pof_init(nrfx_power_pofwarn_config_t const *p_config)

Function for initializing the power failure comparator.

Configures the power failure comparator. This function does not set it up and enable it. These steps can be done with functions nrfx_power_pof_enable and nrfx_power_pof_disable or with the SoftDevice API (when in use).

Parameters:
  • p_config[in] Configuration with values and event handler. If event handler is set to NULL, the interrupt will be disabled.

void nrfx_power_pof_enable(nrfx_power_pofwarn_config_t const *p_config)

Function for enabling the power failure comparator. Sets and enables the interrupt of the power failure comparator. This function cannot be in use when SoftDevice is enabled. If the event handler set in the init function is set to NULL, the interrupt will be disabled.

Parameters:
  • p_config[in] Configuration with values and event handler.

void nrfx_power_pof_disable(void)

Function for disabling the power failure comparator.

Disables the power failure comparator interrupt.

void nrfx_power_pof_uninit(void)

Function for clearing the power failure comparator settings.

Clears the settings of the power failure comparator.

void nrfx_power_sleepevt_init(nrfx_power_sleepevt_config_t const *p_config)

Function for initializing the processing of the sleep events.

Configures and sets up the sleep event processing.

Parameters:
  • p_config[in] Configuration with values and event handler.

void nrfx_power_sleepevt_enable(nrfx_power_sleepevt_config_t const *p_config)

Function for enabling the processing of the sleep events.

Parameters:
  • p_config[in] Configuration with values and event handler.

void nrfx_power_sleepevt_disable(void)

Function for disabling the processing of the sleep events.

void nrfx_power_sleepevt_uninit(void)

Function for uninitializing the processing of the sleep events.

void nrfx_power_usbevt_init(nrfx_power_usbevt_config_t const *p_config)

Function for initializing the processing of USB power event.

Configures and sets up the USB power event processing.

Parameters:
  • p_config[in] Configuration with values and event handler.

void nrfx_power_usbevt_enable(void)

Function for enabling the processing of USB power event.

void nrfx_power_usbevt_disable(void)

Function for disabling the processing of USB power event.

void nrfx_power_usbevt_uninit(void)

Function for uninitalizing the processing of USB power event.

NRFX_STATIC_INLINE nrfx_power_usb_state_t nrfx_power_usbstatus_get(void)

Function for getting the status of USB power.

Returns:

Current USB power status.

struct nrfx_power_config_t
#include <nrfx_power.h>

General power configuration.

Parameters required to initialize power driver.

Public Members

bool dcdcen

Enable main DCDC regulator.

This bit only informs the driver that elements for DCDC regulator are installed and the regulator can be used. The regulator will be enabled or disabled automatically by the hardware, basing on current power requirement.

bool dcdcenhv

Enable HV DCDC regulator.

This bit only informs the driver that elements for DCDC regulator are installed and the regulator can be used. The regulator will be enabled or disabled automatically by the hardware, basing on current power requirement.

struct nrfx_power_pofwarn_config_t
#include <nrfx_power.h>

The configuration for power failure comparator.

Configuration used to enable and configure the power failure comparator.

Public Members

nrfx_power_pofwarn_event_handler_t handler

Event handler.

nrf_power_pof_thr_t thr

Threshold for power failure detection.

nrf_power_pof_thrvddh_t thrvddh

Threshold for power failure detection on the VDDH pin.

struct nrfx_power_sleepevt_config_t
#include <nrfx_power.h>

The configuration of sleep event processing.

Configuration used to enable and configure sleep event handling.

Public Members

nrfx_power_sleep_event_handler_t handler

Event handler.

bool en_enter

Enable event on sleep entering.

bool en_exit

Enable event on sleep exiting.

struct nrfx_power_usbevt_config_t
#include <nrfx_power.h>

The configuration of the USB-related power events.

Configuration used to enable and configure USB power event handling.

Public Members

nrfx_power_usb_event_handler_t handler

Event processing.