From d816666d84025b55a1b9aef569ed82c5034d6d8f Mon Sep 17 00:00:00 2001 From: Marian Buschsieweke Date: Tue, 30 Mar 2021 14:49:11 +0200 Subject: [PATCH] cpu/sam3/periph_rtt: fix rtt_get_alarm() Previously, the return value was off by one. --- cpu/sam3/periph/rtt.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/cpu/sam3/periph/rtt.c b/cpu/sam3/periph/rtt.c index 2c7d0da245..2da87e712c 100644 --- a/cpu/sam3/periph/rtt.c +++ b/cpu/sam3/periph/rtt.c @@ -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; }