POWER driver

nRF5 SDK v15.0.0

POWER peripheral driver. More...

Data Structures

struct nrfx_power_config_t
General power configuration. More...
struct nrfx_power_pofwarn_config_t
The configuration for power failure comparator. More...
struct nrfx_power_sleepevt_config_t
The configuration of sleep event processing. More...
struct nrfx_power_usbevt_config_t
The configuration of USB related power events. More...

Functions

nrfx_power_pofwarn_event_handler_t nrfx_power_pof_handler_get (void)
Function for getting the handler of the power failure comparator. More...
nrfx_power_usb_event_handler_t nrfx_power_usb_handler_get (void)
Function for getting the handler of the USB power. More...
nrfx_err_t nrfx_power_init ( nrfx_power_config_t const *p_config)
Initialize power module driver. More...
void nrfx_power_uninit (void)
Unintialize power module driver. More...
void nrfx_power_pof_init ( nrfx_power_pofwarn_config_t const *p_config)
Initialize power failure comparator. More...
void nrfx_power_pof_enable ( nrfx_power_pofwarn_config_t const *p_config)
Enable power failure comparator Sets and enables interrupt of the power failure comparator. This functions cannot be using when Softdevice is enabled. If event handler set in init function is set to NULL, interrupt would be disabled. More...
void nrfx_power_pof_disable (void)
Disable the power failure comparator. More...
void nrfx_power_pof_uninit (void)
Clear the power failure comparator settings. More...
void nrfx_power_sleepevt_init ( nrfx_power_sleepevt_config_t const *p_config)
Initialize sleep entering and exiting events processing. More...
void nrfx_power_sleepevt_enable ( nrfx_power_sleepevt_config_t const *p_config)
Enable sleep entering and exiting events processing. More...
void nrfx_power_sleepevt_disable (void)
Disable sleep entering and exiting events processing.
void nrfx_power_sleepevt_uninit (void)
Uninitialize sleep entering and exiting events processing. More...
void nrfx_power_usbevt_init ( nrfx_power_usbevt_config_t const *p_config)
Initialize USB power event processing. More...
void nrfx_power_usbevt_enable (void)
Enable USB power event processing.
void nrfx_power_usbevt_disable (void)
Disable USB power event processing.
void nrfx_power_usbevt_uninit (void)
Uninitalize USB power event processing. More...
__STATIC_INLINE
nrfx_power_usb_state_t
nrfx_power_usbstatus_get (void)
Get the status of USB power. More...
void nrfx_power_irq_handler (void)

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 entering/exiting sleep. More...
typedef void(* nrfx_power_usb_event_handler_t )( nrfx_power_usb_evt_t event)
Event handler for USB related power events. More...

Detailed Description

POWER peripheral driver.

Typedef Documentation

typedef void(* nrfx_power_sleep_event_handler_t)( nrfx_power_sleep_evt_t event)

Event handler for entering/exiting sleep.

Parameters
event Event type
typedef void(* nrfx_power_usb_event_handler_t)( nrfx_power_usb_evt_t event)

Event handler for USB related power events.

Parameters
event Event type

Enumeration Type Documentation

Power mode possible configurations.

Enumerator
NRFX_POWER_MODE_CONSTLAT

Constant latency mode

NRFX_POWER_MODE_LOWPWR

Low power mode

Events from power system.

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.
NRFX_POWER_SLEEP_EVT_EXIT

CPU exited WFI/WFE sleep

Events from USB power system.

Enumerator
NRFX_POWER_USB_EVT_DETECTED

USB power detected on the connector (plugged in).

NRFX_POWER_USB_EVT_REMOVED

USB power removed from the connector.

NRFX_POWER_USB_EVT_READY

USB power regulator ready.

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

Enumerator
NRFX_POWER_USB_STATE_DISCONNECTED

No power on USB lines detected

NRFX_POWER_USB_STATE_CONNECTED

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

NRFX_POWER_USB_STATE_READY

From the power point of view USB is ready for working

Function Documentation

nrfx_err_t nrfx_power_init ( nrfx_power_config_t const * p_config )

Initialize power module driver.

Enabled power module driver would process all the interrupts from power system.

Parameters
[in] p_config Pointer to the structure with initial configuration.
Return values
NRFX_SUCCESS Successfully initialized.
NRFX_ERROR_ALREADY_INITIALIZED Module was already initialized.
void nrfx_power_pof_disable ( void )

Disable the power failure comparator.

Disables the power failure comparator interrupt.

void nrfx_power_pof_enable ( nrfx_power_pofwarn_config_t const * p_config )

Enable power failure comparator Sets and enables interrupt of the power failure comparator. This functions cannot be using when Softdevice is enabled. If event handler set in init function is set to NULL, interrupt would be disabled.

Parameters
[in] p_config Configuration with values and event handler.
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.
void nrfx_power_pof_init ( nrfx_power_pofwarn_config_t const * p_config )

Initialize power failure comparator.

Configures the power failure comparator. This function does not setup and enable it. Those steps can be done with functions nrfx_power_pof_enable and nrfx_power_pof_disable or with Softdevice API (when Softdevice is using).

Parameters
[in] p_config Configuration with values and event handler. If event handler is set to NULL, interrupt would be disabled.
void nrfx_power_pof_uninit ( void )

Clear the power failure comparator settings.

Clears the settings of the power failure comparator.

void nrfx_power_sleepevt_enable ( nrfx_power_sleepevt_config_t const * p_config )

Enable sleep entering and exiting events processing.

Parameters
[in] p_config Configuration with values and event handler.
void nrfx_power_sleepevt_init ( nrfx_power_sleepevt_config_t const * p_config )

Initialize sleep entering and exiting events processing.

Configures and setups the sleep event processing.

Parameters
[in] p_config Configuration with values and event handler.
See Also
nrfx_power_sleepevt_uninit
void nrfx_power_sleepevt_uninit ( void )

Uninitialize sleep entering and exiting events processing.

See Also
nrfx_power_sleepevt_init
void nrfx_power_uninit ( void )

Unintialize power module driver.

Disables all the interrupt handling in the module.

See Also
nrfx_power_init
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.
void nrfx_power_usbevt_init ( nrfx_power_usbevt_config_t const * p_config )

Initialize USB power event processing.

Configures and setups the USB power event processing.

Parameters
[in] p_config Configuration with values and event handler.
See Also
nrfx_power_usbevt_uninit
void nrfx_power_usbevt_uninit ( void )

Uninitalize USB power event processing.

See Also
nrfx_power_usbevt_init
__STATIC_INLINE nrfx_power_usb_state_t nrfx_power_usbstatus_get ( void )

Get the status of USB power.

Returns
Current USB power status