[riot-notifications] [RIOT-OS/RIOT] cpu/sam0_common/../rtt: correcly clear flags. (#12188)

benpicco notifications at github.com
Tue Sep 10 15:15:30 CEST 2019


Good catch!
But there is more:

```patch
diff --git a/cpu/sam0_common/periph/rtt.c b/cpu/sam0_common/periph/rtt.c
index 3f7de9049..34f05e52f 100644
--- a/cpu/sam0_common/periph/rtt.c
+++ b/cpu/sam0_common/periph/rtt.c
@@ -98,7 +98,7 @@ void rtt_init(void)
     _wait_syncbusy();
 
     /* initially clear flag */
-    RTC->MODE0.INTFLAG.reg |= RTC_MODE0_INTFLAG_CMP0
+    RTC->MODE0.INTFLAG.reg = RTC_MODE0_INTFLAG_CMP0
                            |  RTC_MODE0_INTFLAG_OVF;
 
     NVIC_EnableIRQ(RTC_IRQn);
@@ -116,12 +116,12 @@ void rtt_set_overflow_cb(rtt_cb_t cb, void *arg)
     _overflow_arg = arg;
 
     /* enable overflow interrupt */
-    RTC->MODE0.INTENSET.bit.OVF = 1;
+    RTC->MODE0.INTENSET.reg = RTC_MODE0_INTENSET_OVF;
 }
 void rtt_clear_overflow_cb(void)
 {
     /* disable overflow interrupt */
-    RTC->MODE0.INTENCLR.bit.OVF = 1;
+    RTC->MODE0.INTENCLR.reg = RTC_MODE0_INTENCLR_OVF;
 }
 
 uint32_t rtt_get_counter(void)
@@ -158,14 +158,14 @@ void rtt_set_alarm(uint32_t alarm, rtt_cb_t cb, void *arg)
     _wait_syncbusy();
 
     /* enable compare interrupt and clear flag */
-    RTC->MODE0.INTFLAG.reg |= RTC_MODE0_INTFLAG_CMP0;
-    RTC->MODE0.INTENSET.reg |= RTC_MODE0_INTENSET_CMP0;
+    RTC->MODE0.INTFLAG.reg  = RTC_MODE0_INTFLAG_CMP0;
+    RTC->MODE0.INTENSET.reg = RTC_MODE0_INTENSET_CMP0;
 }
 
 void rtt_clear_alarm(void)
 {
     /* clear compare interrupt */
-    RTC->MODE0.INTENCLR.bit.CMP0 = 1;
+    RTC->MODE0.INTENCLR.reg = RTC_MODE0_INTENCLR_CMP0;
 }
 
 void rtt_poweron(void)
```

Tested on `samr21-xpro` and `same54-xpro`.


-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/RIOT-OS/RIOT/pull/12188#issuecomment-529928957
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.riot-os.org/pipermail/notifications/attachments/20190910/6db81a07/attachment-0001.htm>


More information about the notifications mailing list