[riot-notifications] [RIOT-OS/RIOT] sam0_common: make Timer implementation common across all sam0 MCUs (#11336)

Dylan Laduranty notifications at github.com
Mon May 20 12:52:20 CEST 2019


dylad commented on this pull request.



> +    while ((dev(tim)->STATUS.reg & TC_STATUS_SYNCBUSY) != 0) {}
+#else
+#error Unsupported device
+#endif
+}
+
+/* enable timer interrupts */
+static inline void _irq_enable(tim_t tim)
+{
+    NVIC_EnableIRQ(timer_config[tim].irq);
+}
+
+/**
+ * @brief Setup the given timer
+ */
+int timer_init(tim_t tim, unsigned long freq, timer_cb_t cb, void *arg)

please add a guard in the very beginning of this function to ensure `tim < TIMER_NUMOF`
You can use an assert like other drivers or return an error.


-- 
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/11336#pullrequestreview-239424483
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.riot-os.org/pipermail/notifications/attachments/20190520/806b4eb2/attachment.html>


More information about the notifications mailing list