nRF5 SDK v13.0.0
Modules | Macros | Typedefs | Enumerations | Functions
Power management

This module handles power management features. More...

Modules

 Power management module configuration
 

Macros

#define NRF_PWR_MGMT_HANDLER_REGISTER(_handler, _priority)
 Macro for registering a shutdown handler. Modules that want to get events from this module must register the handler using this macro. More...
 

Typedefs

typedef bool(* nrf_pwr_mgmt_shutdown_handler_t )(nrf_pwr_mgmt_evt_t event)
 Shutdown callback. More...
 

Enumerations

enum  nrf_pwr_mgmt_shutdown_t {
  NRF_PWR_MGMT_SHUTDOWN_GOTO_SYSOFF,
  NRF_PWR_MGMT_SHUTDOWN_STAY_IN_SYSOFF,
  NRF_PWR_MGMT_SHUTDOWN_GOTO_DFU,
  NRF_PWR_MGMT_SHUTDOWN_RESET,
  NRF_PWR_MGMT_SHUTDOWN_CONTINUE
}
 Power management shutdown types. More...
 
enum  nrf_pwr_mgmt_evt_t {
  NRF_PWR_MGMT_EVT_PREPARE_WAKEUP,
  NRF_PWR_MGMT_EVT_PREPARE_SYSOFF,
  NRF_PWR_MGMT_EVT_PREPARE_DFU,
  NRF_PWR_MGMT_EVT_PREPARE_RESET
}
 Shutdown event types. More...
 

Functions

ret_code_t nrf_pwr_mgmt_init (void)
 Function for initializing power management. More...
 
void nrf_pwr_mgmt_run (void)
 Function for running power management. Should run in the main loop.
 
void nrf_pwr_mgmt_feed (void)
 Function for indicating activity. More...
 
void nrf_pwr_mgmt_shutdown (nrf_pwr_mgmt_shutdown_t shutdown_type)
 Function for shutting down the system. More...
 

Detailed Description

This module handles power management features.

Macro Definition Documentation

#define NRF_PWR_MGMT_HANDLER_REGISTER (   _handler,
  _priority 
)
Value:
NRF_SECTION_SET_ITEM_REGISTER(pwr_mgmt_data, \
_priority, \

Macro for registering a shutdown handler. Modules that want to get events from this module must register the handler using this macro.

This macro places the handler in a section named "pwr_mgmt_data".

Parameters
[in]_handlerEvent handler (nrf_pwr_mgmt_shutdown_handler_t).
[in]_priorityPriority of the given handler.

Typedef Documentation

typedef bool(* nrf_pwr_mgmt_shutdown_handler_t)(nrf_pwr_mgmt_evt_t event)

Shutdown callback.

Parameters
[in]eventType of shutdown process.
Return values
trueSystem OFF / Enter DFU preparation successful. Process will be continued.
falseSystem OFF / Enter DFU preparation failed. NRF_PWR_MGMT_SHUTDOWN_CONTINUE should be used to continue the shutdown process.

Enumeration Type Documentation

Shutdown event types.

Enumerator
NRF_PWR_MGMT_EVT_PREPARE_WAKEUP 

Application will prepare the wakeup mechanism.

NRF_PWR_MGMT_EVT_PREPARE_SYSOFF 

Application will prepare to stay in System OFF state.

NRF_PWR_MGMT_EVT_PREPARE_DFU 

Application will prepare to enter DFU mode.

NRF_PWR_MGMT_EVT_PREPARE_RESET 

Application will prepare to chip reset.

Power management shutdown types.

Enumerator
NRF_PWR_MGMT_SHUTDOWN_GOTO_SYSOFF 

Go to System OFF.

NRF_PWR_MGMT_SHUTDOWN_STAY_IN_SYSOFF 

Go to System OFF and stay there.

Useful when battery level is dangerously low, for example.

NRF_PWR_MGMT_SHUTDOWN_GOTO_DFU 

Go to DFU mode.

NRF_PWR_MGMT_SHUTDOWN_RESET 

Reset chip.

NRF_PWR_MGMT_SHUTDOWN_CONTINUE 

Continue shutdown.

This should be used by modules that block the shutdown process, when they become ready for shutdown.

Function Documentation

void nrf_pwr_mgmt_feed ( void  )

Function for indicating activity.

Call this function whenever doing something that constitutes "activity". For example, whenever sending data, call this function to indicate that the application is active and should not disconnect any ongoing communication links.

ret_code_t nrf_pwr_mgmt_init ( void  )

Function for initializing power management.

Warning
Depending on configuration, this function sets SEVONPEND in System Control Block (SCB). This operation is unsafe with the SoftDevice from interrupt priority higher than SVC.
Return values
NRF_SUCCESS
void nrf_pwr_mgmt_shutdown ( nrf_pwr_mgmt_shutdown_t  shutdown_type)

Function for shutting down the system.

Parameters
[in]shutdown_typeType of operation.

All callbacks will be executed prior to shutdown.


Documentation feedback | Developer Zone | Subscribe | Updated