72 #define SLEEP_NUMOF_LOW_ENERGY_MODES 2U
98 static uint8_t sleepBlockCnt[SLEEP_NUMOF_LOW_ENERGY_MODES];
134 sleepCallback = pSleepCb;
135 wakeUpCallback = pWakeUpCb;
138 sleepBlockCnt[0U] = 0U;
139 sleepBlockCnt[1U] = 0U;
141 #if (SLEEP_EM4_WAKEUP_CALLBACK_ENABLED == true) \
142 && (defined(RMU_RSTCAUSE_EM4WURST) || defined(RMU_RSTCAUSE_EM4RST))
144 #if defined(RMU_RSTCAUSE_EM4WURST)
146 #elif defined(RMU_RSTCAUSE_EM4RST)
153 if (NULL != wakeUpCallback)
216 #if (SLEEP_HW_LOW_ENERGY_BLOCK_ENABLED == true)
252 EFM_ASSERT((sleepBlockCnt[eMode - 2U]) < 255U);
257 sleepBlockCnt[eMode - 2U]++;
259 #if (SLEEP_HW_LOW_ENERGY_BLOCK_ENABLED == true)
302 if (sleepBlockCnt[eMode - 2U] > 0U)
304 sleepBlockCnt[eMode - 2U]--;
307 #if (SLEEP_HW_LOW_ENERGY_BLOCK_ENABLED == true)
309 if (0U == sleepBlockCnt[
sleepEM2 - 2U])
336 if (0U == sleepBlockCnt[
sleepEM2 - 2U])
339 if (0U == sleepBlockCnt[
sleepEM3 - 2U])
377 if (NULL != sleepCallback)
380 sleepCallback(eMode);
408 if (NULL != wakeUpCallback)
410 wakeUpCallback(eMode);
void SLEEP_SleepBlockEnd(SLEEP_EnergyMode_t eMode)
End sleep block in the requested energy mode.
uint32_t RMU_ResetCauseGet(void)
Get the cause of the last reset.
#define CORE_DECLARE_IRQ_STATE
Emlib peripheral API "assert" implementation.
void EMU_EnterEM4(void)
Enter energy mode 4 (EM4).
void EMU_EnterEM3(bool restore)
Enter energy mode 3 (EM3).
void EMU_EnterEM2(bool restore)
Enter energy mode 2 (EM2).
CMSIS Cortex-M Peripheral Access Layer for Silicon Laboratories microcontroller devices.
void SLEEP_SleepBlockBegin(SLEEP_EnergyMode_t eMode)
Begin sleep block in the requested energy mode.
#define SLEEP_LOWEST_ENERGY_MODE_DEFAULT
void SLEEP_Init(SLEEP_CbFuncPtr_t pSleepCb, SLEEP_CbFuncPtr_t pWakeUpCb)
Initialize the Sleep module.
__STATIC_INLINE void EMU_EnterEM1(void)
Enter energy mode 1 (EM1).
__STATIC_INLINE void EMU_EM2UnBlock(void)
Unblock entering EM2 or higher number energy modes.
Core interrupt handling API.
SLEEP_EnergyMode_t SLEEP_Sleep(void)
Sets the system to sleep into the lowest possible energy mode.
Reset Management Unit (RMU) peripheral API.
Energy management unit (EMU) peripheral API.
#define RMU_RSTCAUSE_EM4RST
#define CORE_EXIT_CRITICAL()
void(* SLEEP_CbFuncPtr_t)(SLEEP_EnergyMode_t)
#define CORE_ENTER_CRITICAL()
void SLEEP_ForceSleepInEM4(void)
Force the device to go to EM4 without doing any checks.
void RMU_ResetCauseClear(void)
Clear the reset cause register.
SLEEP_EnergyMode_t SLEEP_LowestEnergyModeGet(void)
Gets the lowest energy mode that the system is allowed to be set to.
__STATIC_INLINE void EMU_EM2Block(void)
Block entering EM2 or higher number energy modes.
Energy Modes management driver.