mirror of
https://github.com/RIOT-OS/RIOT.git
synced 2025-12-25 14:33:52 +01:00
cpu/sam0_common: add rtc_tamper_pin_mask()
This commit is contained in:
parent
9d482c4448
commit
13fbb7c1a0
@ -1153,6 +1153,18 @@ void rtc_tamper_enable(void);
|
||||
* pin index inside the @ref rtc_tamper_pins array.
|
||||
*/
|
||||
uint8_t rtc_get_tamper_event(void);
|
||||
|
||||
/**
|
||||
* @brief Get the tamper event mask for a certain pin.
|
||||
* Can be used together with @ref rtc_get_tamper_event to
|
||||
* check which RTC pin caused the tamper event.
|
||||
*
|
||||
* @param pin Pin to query
|
||||
*
|
||||
* @return Bit mask with the bit corresponding to @p pin set
|
||||
* 0 if @p pin is no RTC tamper pin
|
||||
*/
|
||||
uint8_t rtc_tamper_pin_mask(gpio_t pin);
|
||||
/** @} */
|
||||
|
||||
/**
|
||||
|
||||
@ -394,6 +394,16 @@ uint8_t rtc_get_tamper_event(void)
|
||||
|
||||
return ret & RTC_TAMPID_TAMPID_Msk;
|
||||
}
|
||||
|
||||
uint8_t rtc_tamper_pin_mask(gpio_t pin)
|
||||
{
|
||||
int idx = _rtc_pin(pin);
|
||||
if (idx < 0) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
return 1 << idx;
|
||||
}
|
||||
#endif /* RTC_NUM_OF_TAMPERS */
|
||||
|
||||
void rtt_set_overflow_cb(rtt_cb_t cb, void *arg)
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user