Driver for managing events and the state of POWER peripheral. More...
Modules | |
POWER peripheral driver configuration | |
Data Structures | |
struct | nrf_drv_power_config_t |
General power configuration. More... | |
struct | nrf_drv_power_pofwarn_config_t |
The configuration for power failure comparator. More... | |
struct | nrf_drv_power_usbevt_config_t |
The configuration of USB related power events. More... | |
Enumerations | |
enum | nrf_drv_power_mode_t { NRF_DRV_POWER_MODE_CONSTLAT, NRF_DRV_POWER_MODE_LOWPWR } |
Power mode possible configurations. More... | |
enum | nrf_drv_power_usb_evt_t { NRF_DRV_POWER_USB_EVT_DETECTED, NRF_DRV_POWER_USB_EVT_REMOVED, NRF_DRV_POWER_USB_EVT_READY } |
Events from USB power system. More... | |
enum | nrf_drv_power_usb_state_t { NRF_DRV_POWER_USB_STATE_DISCONNECTED, NRF_DRV_POWER_USB_STATE_CONNECTED, NRF_DRV_POWER_USB_STATE_READY } |
USB power state. More... | |
Functions | |
bool | nrf_drv_power_init_check (void) |
Function for checking if driver is already initialized. More... | |
ret_code_t | nrf_drv_power_init (nrf_drv_power_config_t const *p_config) |
Initialize power module driver. More... | |
void | nrf_drv_power_uninit (void) |
Unintialize power module driver. More... | |
ret_code_t | nrf_drv_power_pof_init (nrf_drv_power_pofwarn_config_t const *p_config) |
Initialize power failure comparator. More... | |
void | nrf_drv_power_pof_uninit (void) |
Turn off the power failure comparator. More... | |
ret_code_t | nrf_drv_power_usbevt_init (nrf_drv_power_usbevt_config_t const *p_config) |
Initialize USB power event processing. More... | |
void | nrf_drv_power_usbevt_uninit (void) |
Uninitalize USB power event processing. More... | |
__STATIC_INLINE nrf_drv_power_usb_state_t | nrf_drv_power_usbstatus_get (void) |
Get the status of USB power. More... | |
Callback types | |
typedef void(* | nrf_drv_power_pofwarn_event_handler_t )(void) |
Event handler for power failure warning. | |
typedef void(* | nrf_drv_power_usb_event_handler_t )(nrf_drv_power_usb_evt_t event) |
Event handler for USB related power events. More... | |
Driver for managing events and the state of POWER peripheral.
typedef void(* nrf_drv_power_usb_event_handler_t)(nrf_drv_power_usb_evt_t event) |
Event handler for USB related power events.
event | Event type |
enum nrf_drv_power_mode_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
ret_code_t nrf_drv_power_init | ( | nrf_drv_power_config_t const * | p_config | ) |
Initialize power module driver.
Enabled power module driver would process all the interrupts from power system.
[in] | p_config | Driver configuration. Can be NULL - the default configuration from sdk_config.h file would be used then. |
NRF_ERROR_INVALID_STATE | Power driver has to be enabled before SoftDevice. |
NRF_ERROR_MODULE_ALREADY_INITIALIZED | Module is initialized already. |
NRF_SUCCESS | Successfully initialized. |
bool nrf_drv_power_init_check | ( | void | ) |
Function for checking if driver is already initialized.
This function is used to check whatever common POWER_CLOCK common interrupt should be disabled or not if Clock driver tries to disable the interrupt.
true | Driver is initialized |
false | Driver is uninitialized |
ret_code_t nrf_drv_power_pof_init | ( | nrf_drv_power_pofwarn_config_t const * | p_config | ) |
Initialize power failure comparator.
Configures and setups the power failure comparator and enables it.
[in] | p_config | Configuration with values and event handler. If event handler is set to NULL, interrupt would be disabled. |
NRF_ERROR_INVALID_STATE | POF is initialized when SD is enabled and the configuration differs from the old one and is not possible to be set using SD interface. |
NRF_SUCCESS | Successfully initialized and configured. |
void nrf_drv_power_pof_uninit | ( | void | ) |
Turn off the power failure comparator.
Disables and clears the settings of the power failure comparator.
void nrf_drv_power_uninit | ( | void | ) |
Unintialize power module driver.
Disables all the interrupt handling in the module.
ret_code_t nrf_drv_power_usbevt_init | ( | nrf_drv_power_usbevt_config_t const * | p_config | ) |
Initialize USB power event processing.
Configures and setups the USB power event processing.
[in] | p_config | Configuration with values and event handler. |
NRF_ERROR_INVALID_STATE | This event cannot be initialized when SD is enabled and SD does not support USB power events. |
NRF_SUCCESS | Successfully initialized and configured. |
void nrf_drv_power_usbevt_uninit | ( | void | ) |
Uninitalize USB power event processing.
__STATIC_INLINE nrf_drv_power_usb_state_t nrf_drv_power_usbstatus_get | ( | void | ) |
Get the status of USB power.