[riot-notifications] [RIOT-OS/RIOT] cpu/atmega_common: Fix periph_timer (#14098)

Marian Buschsieweke notifications at github.com
Wed May 27 21:12:40 CEST 2020


@maribu commented on this pull request.



>      ctx[tim].dev->OCR[channel] = (uint16_t)value;
     *ctx[tim].flag &= ~(1 << (channel + OCF1A));
     *ctx[tim].mask |= (1 << (channel + OCIE1A));
+    irq_restore(state);
+
+    return 0;
+}
+
+int timer_set(tim_t tim, int channel, unsigned int timeout)
+{
+    if (channel >= TIMER_CHANNELS) {
+        return -1;
+    }
+
+    unsigned state = irq_disable();
+    unsigned absolute = ctx[tim].dev->CNT + timeout;
+    ctx[tim].dev->OCR[channel] = absolute;
+    *ctx[tim].mask |= (1 << (channel + OCIE1A));

Done

-- 
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/14098#discussion_r431381188
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.riot-os.org/pipermail/notifications/attachments/20200527/2ac220c2/attachment.htm>


More information about the notifications mailing list