mirror of
https://github.com/RIOT-OS/RIOT.git
synced 2024-12-29 04:50:03 +01:00
Merge pull request #16258 from maribu/cpu/sam3/periph_rtt
cpu/sam3/periph_rtt: fix rtt_get_alarm()
This commit is contained in:
commit
ca8641c213
@ -75,7 +75,8 @@ void rtt_set_alarm(uint32_t alarm, rtt_cb_t cb, void *arg)
|
||||
uint32_t rtt_get_alarm(void)
|
||||
{
|
||||
if (RTT->RTT_MR & RTT_MR_ALMIEN) {
|
||||
return RTT->RTT_AR;
|
||||
/* the alarm value is RTT_AR + 1, see rtt_set_alarm() */
|
||||
return RTT->RTT_AR + 1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
@ -93,8 +93,10 @@ int main(void)
|
||||
printf("Setting initial alarm to now + 5 s (%" PRIu32 ")\n", last);
|
||||
rtt_set_alarm(last, cb, 0);
|
||||
|
||||
if (rtt_get_alarm() != last) {
|
||||
puts("Error: rtt_get_alarm() not working");
|
||||
uint32_t tmp = rtt_get_alarm();
|
||||
if (tmp != last) {
|
||||
printf("Error: rtt_get_alarm() not working (expected %" PRIu32 " but got %" PRIu32 ")\n",
|
||||
last, tmp);
|
||||
return 1;
|
||||
}
|
||||
else {
|
||||
|
Loading…
Reference in New Issue
Block a user