mirror of
https://github.com/RIOT-OS/RIOT.git
synced 2024-12-29 04:50:03 +01:00
cpu/nrf52: add CPU specific sleep function
This function is supposed to be used for putting the CPU into sleep mode for short amounts of time (e.g. in typical polling loops used in periph drivers).
This commit is contained in:
parent
959e838836
commit
787d69c676
@ -78,6 +78,9 @@ void cpu_init(void)
|
||||
NVIC_SetPriority(SWI0_EGU0_IRQn, 6);
|
||||
#endif
|
||||
|
||||
/* enable wake up on events for __WFE CPU sleep */
|
||||
SCB->SCR |= SCB_SCR_SEVONPEND_Msk;
|
||||
|
||||
/* trigger static peripheral initialization */
|
||||
periph_init();
|
||||
}
|
||||
|
@ -75,6 +75,16 @@ extern "C" {
|
||||
#endif /* SOFTDEVICE_PRESENT */
|
||||
/** @} */
|
||||
|
||||
/**
|
||||
* @brief Put the CPU in the low-power 'wait for event' state
|
||||
*/
|
||||
static inline void nrf52_sleep(void)
|
||||
{
|
||||
__SEV();
|
||||
__WFE();
|
||||
__asm("nop");
|
||||
}
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
Loading…
Reference in New Issue
Block a user