1
0
mirror of https://github.com/RIOT-OS/RIOT.git synced 2025-01-18 12:52:44 +01:00

sam0_common: export flag that tells if the CPU woke from deep sleep

It is often useful to know whether the CPU was just powered on afresh
or if it was woken from a deep sleep state, e.g. by RTC or GPIO event.
This commit is contained in:
Benjamin Valentin 2019-05-08 13:36:56 +02:00 committed by Benjamin Valentin
parent a7cb0a4b77
commit c9b827e5d5

View File

@ -476,6 +476,18 @@ static inline void sercom_set_gen(void *sercom, uint32_t gclk)
#endif
}
/**
* @brief Returns true if the CPU woke deep sleep (backup/standby)
*/
static inline bool cpu_woke_from_backup(void)
{
#ifdef RSTC_RCAUSE_BACKUP
return RSTC->RCAUSE.bit.BACKUP;
#else
return false;
#endif
}
/**
* @brief ADC Channel Configuration
*/