cpu/sam0_common: add rtc_get_tamper()
Add a function to query which tamper event woke the CPU from hibernation.
This commit is contained in:
parent
e768a85f62
commit
73dbda99ac
@ -1144,6 +1144,15 @@ int rtc_tamper_register(gpio_t pin, gpio_flank_t flank);
|
|||||||
* @brief Enable Tamper Detection IRQs
|
* @brief Enable Tamper Detection IRQs
|
||||||
*/
|
*/
|
||||||
void rtc_tamper_enable(void);
|
void rtc_tamper_enable(void);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Get and clear the RTC tamper event that has woken the CPU
|
||||||
|
* from Deep Sleep.
|
||||||
|
*
|
||||||
|
* @return The set bits in the return value correspond to the tamper
|
||||||
|
* pin index inside the @ref rtc_tamper_pins array.
|
||||||
|
*/
|
||||||
|
uint8_t rtc_get_tamper_event(void);
|
||||||
/** @} */
|
/** @} */
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@ -374,6 +374,16 @@ void rtc_tamper_enable(void)
|
|||||||
DEBUG("tamper enabled\n");
|
DEBUG("tamper enabled\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
uint8_t rtc_get_tamper_event(void)
|
||||||
|
{
|
||||||
|
uint32_t ret = RTC->MODE0.TAMPID.reg;
|
||||||
|
|
||||||
|
/* clear tamper event */
|
||||||
|
RTC->MODE0.INTFLAG.reg = RTC_MODE0_INTFLAG_TAMPER;
|
||||||
|
RTC->MODE0.TAMPID.reg = ret;
|
||||||
|
|
||||||
|
return ret & RTC_TAMPID_TAMPID_Msk;
|
||||||
|
}
|
||||||
#endif /* RTC_NUM_OF_TAMPERS */
|
#endif /* RTC_NUM_OF_TAMPERS */
|
||||||
|
|
||||||
void rtt_set_overflow_cb(rtt_cb_t cb, void *arg)
|
void rtt_set_overflow_cb(rtt_cb_t cb, void *arg)
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user