HAL Power Modes Function Documentation
Sys_PowerModes_AppProcessingRequired
void Sys_PowerModes_AppProcessingRequired()
Location: power_modes.h:383
Sys_PowerModes_SetWakeupConfig
void Sys_PowerModes_SetWakeupConfig(uint32_t wakeup_cfg)
Location: power_modes.h:396
Parameters
Direction | Name | Description |
---|---|---|
in |
wakeup_cfg |
(uint32_t) The wakeup configuration contained in the LowPowerModeCfg_t instance. |
NOTE: This function will modify the ACS_WAKEUP_CFG register.
Example Code for Sys_PowerModes_SetWakeupConfig |
// Using the default configuration, update wakeup sources app_lowpower_mode_cfg.wakeup_cfg = WAKEUP_DELAY_2 | WAKEUP_GPIO0_ENABLE | WAKEUP_GPIO0_FALLING | WAKEUP_GPIO1_ENABLE | WAKEUP_GPIO1_FALLING | WAKEUP_DCDC_OVERLOAD_DISABLE | WAKEUP_FIFO_ENABLE; // Initialize wakeup configuration before entering sleep Sys_PowerModes_SetWakeupConfig(app_lowpower_mode_cfg.wakeup_cfg); |
Sys_PowerModes_EnableWakeupSources
void Sys_PowerModes_EnableWakeupSources(uint32_t wakeup_src, uint32_t * p_wakeup_cfg)
Location: power_modes.h:418
Parameters
Direction | Name | Description |
---|---|---|
in |
wakeup_src |
(uint32_t) The wakeup sources to enable. Use the defined constants WAKEUP_DCDC_OVERLOAD_ENABLE, WAKEUP_GPIO*_FALLING, WAKEUP_GPIO*_ENABLE, WAKEUP_RTC_OVERFLOW_ENABLE, WAKEUP_FIFO_ENABLE. |
in |
p_wakeup_cfg |
(uint32_t *) A pointer to the wakeup configuration in the LowPowerModeCfg_t instance. |
NOTE: This function will only modify the corresponding source enable bits. The wakeup event flags are not cleared in the process.
Example Code for Sys_PowerModes_EnableWakeupSources |
// Power Mode wakeup configuration enable Sys_PowerModes_EnableWakeupSources((WAKEUP_FIFO_ENABLE | WAKEUP_GPIO1_ENABLE), &app_lowpower_mode_cfg->wakeup_cfg); |
Sys_PowerModes_DisableWakeupSources
void Sys_PowerModes_DisableWakeupSources(uint32_t wakeup_src, uint32_t * p_wakeup_cfg)
Location: power_modes.h:440
Parameters
Direction | Name | Description |
---|---|---|
|
wakeup_src |
|
in |
p_wakeup_cfg |
(uint32_t *) A pointer to the wakeup configuration in the LowPowerModeCfg_t instance. |
NOTE: This function will only modify the corresponding source enable bits. The wakeup event flags are not cleared in the process.
Example Code for Sys_PowerModes_DisableWakeupSources |
// Power Mode wakeup configuration disable Sys_PowerModes_DisableWakeupSources(WAKEUP_FIFO_ENABLE | WAKEUP_GPIO1_ENABLE), &app_lowpower_mode_cfg->wakeup_cfg); |
Sys_PowerModes_EnterPowerMode
void Sys_PowerModes_EnterPowerMode(LowPowerModeCfg_t * p_power_mode_cfg)
Location: power_modes.h:455
Parameters
Direction | Name | Description |
---|---|---|
in |
p_power_mode_cfg |
(LowPowerModeCfg_t *) A pointer to the LowPowerModeCfg_t instance. |
NOTE: This function will enter a low-power mode if there are no wakeup events or NVIC interrupts pending, otherwise it will continue to RUN mode and service pending events and interrupts. This function will modify the ACS_BOOT_CFG register.
Example Code for Sys_PowerModes_EnterPowerMode |
// Define variables to store GPIO register states during sleep static uint32_t gpio_cfg[GPIO_PAD_COUNT] = {0}; static uint32_t gpio_output = 0; static uint32_t gpio_jtag_sw_pad_cfg = 0; // Define a function to save the GPIO register states static void App_GPIOSaveStates(void) { for (uint8_t i = 0; i < GPIO_PAD_COUNT; i++) { gpio_cfg[i] = GPIO->CFG[i]; } gpio_output = GPIO->OUTPUT_DATA; gpio_jtag_sw_pad_cfg = GPIO->JTAG_SW_PAD_CFG; } // Define a function to restore the GPIO register states static void App_GPIORestoreStates(void) { for (uint8_t i = 0; i < GPIO_PAD_COUNT; i++) { GPIO->CFG[i] = gpio_cfg[i]; } GPIO->OUTPUT_DATA = gpio_output; GPIO->JTAG_SW_PAD_CFG = gpio_jtag_sw_pad_cfg; } // Use the default low-power configuration and provide a resume address app_lowpower_mode_cfg.p_app_resume = App_MainLoop; // Add the peripheral (GPIO) save & restore functions to the config app_lowpower_mode_cfg.p_save_peripherals = App_GPIOSaveStates; app_lowpower_mode_cfg.p_save_peripherals = App_GPIORestoreStates; // Power Mode enter sleep with memory retention |
Sys_PowerModes_WakeupWithReset
void Sys_PowerModes_WakeupWithReset(LowPowerModeCfg_t * p_power_mode_cfg)
Location: power_modes.h:466
Parameters
Direction | Name | Description |
---|---|---|
in |
p_power_mode_cfg |
(LowPowerModeCfg_t *) A pointer to the LowPowerModeCfg_t instance. |
NOTE: This function initializes the system after a wakeup with reset.
Example Code for Sys_PowerModes_WakeupWithReset |
// Initialize the system after a wakeup where the system was reset (no retention). |
Sys_PowerModes_IdleUntilBBAwake
void Sys_PowerModes_IdleUntilBBAwake()
Location: power_modes.h:474