73 #define SLEEP_NUMOF_LOW_ENERGY_MODES 3U
103 static uint8_t sleepBlockCnt[SLEEP_NUMOF_LOW_ENERGY_MODES];
140 sleepCallback = pSleepCb;
141 wakeUpCallback = pWakeUpCb;
144 sleepBlockCnt[0U] = 0U;
145 sleepBlockCnt[1U] = 0U;
146 sleepBlockCnt[2U] = 0U;
148 #if (SLEEP_EM4_WAKEUP_CALLBACK_ENABLED == true) && defined(RMU_RSTCAUSE_EM4WURST)
155 if (NULL != wakeUpCallback)
193 SLEEP_EnterEMx(allowedEM);
221 #if (SLEEP_HW_LOW_ENERGY_BLOCK_ENABLED == true)
258 EFM_ASSERT((sleepBlockCnt[(uint8_t) eMode - 1U]) < 255U);
261 sleepBlockCnt[(uint8_t) eMode - 1U]++;
263 #if (SLEEP_HW_LOW_ENERGY_BLOCK_ENABLED == true)
304 if (sleepBlockCnt[(uint8_t) eMode - 1U] > 0U)
306 sleepBlockCnt[(uint8_t) eMode - 1U]--;
309 #if (SLEEP_HW_LOW_ENERGY_BLOCK_ENABLED == true)
311 if (0U == sleepBlockCnt[(uint8_t)
sleepEM2 - 1U])
338 if (0U == sleepBlockCnt[(uint8_t)
sleepEM1 - 1U])
341 if (0U == sleepBlockCnt[(uint8_t)
sleepEM2 - 1U])
344 if (0U == sleepBlockCnt[(uint8_t)
sleepEM3 - 1U])
383 if (NULL != sleepCallback)
386 sleepCallback(eMode);
419 if (NULL != wakeUpCallback)
421 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.
Emlib peripheral API "assert" implementation.
void EMU_EnterEM4(void)
Enter energy mode 4 (EM4).
void EMU_EnterEM3(bool restore)
Enter energy mode 3 (EM3).
__STATIC_INLINE uint32_t INT_Enable(void)
Enable interrupts.
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.
Interrupt enable/disable unit API.
__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.
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.
__STATIC_INLINE uint32_t INT_Disable(void)
Disable interrupts.
void(* SLEEP_CbFuncPtr_t)(SLEEP_EnergyMode_t)
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.