/** @file pwr.c * Module handling the power management's control * * The module provides functions to enter the different sleep states, control * and filter wakeup events (WKUP and RTC) and configure power voltage * detection */ //--includes-------------------------------------------------------------------- #include "pwr.h" #include "pwr_regs.h" #include "scb.h" //--local definitions----------------------------------------------------------- //--local variables------------------------------------------------------------- static volatile struct PWR* regs = (struct PWR*)PWR_BASE_ADDRESS; //--public functions------------------------------------------------------------ void pwr_sleep(void) { scb_configure_deepsleep(false); __asm("wfi"); } void pwr_stop(enum PwrWakeupSpeed speed) { scb_configure_deepsleep(true); regs->CR.PDDS = 0; regs->CR.LPDS = speed; __asm("wfi"); } void pwr_standby(void) { scb_configure_deepsleep(true); regs->CR.PDDS = 1; __asm("wfi"); } //--local functions------------------------------------------------------------- //--ISRs------------------------------------------------------------------------