[riot-notifications] [RIOT-OS/RIOT] periph/timer: add timer_set_periodic() (#13902)

benpicco notifications at github.com
Wed May 27 21:33:54 CEST 2020


@benpicco commented on this pull request.



> +    set_oneshot(tim, channel);
+
+    return 0;
+}
+
+int timer_set_periodic(tim_t tim, int channel, unsigned int value, unsigned flags)
+{
+    if (channel >= TIMER_CHANNELS) {
+        return -1;
+    }
+
+    if (flags & TIM_FLAG_RESET_ON_SET) {
+        ctx[tim].dev->CNT = 0;
+    }
+
+    ctx[tim].dev->OCR[channel] = (uint16_t)value;

I guess I better guard the whole block then to be safe.

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


More information about the notifications mailing list