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

Marian Buschsieweke notifications at github.com
Wed May 27 22:26:42 CEST 2020


@maribu commented on this pull request.



> +
+    *succeeded = false;
+    return "ERROR";
+}
+
+int main(void)
+{
+    mutex_t lock = MUTEX_INIT_LOCKED;
+    const unsigned timer_hz = 62500;
+    const unsigned steps = (250UL * timer_hz) / 1000; /* 250 ms */
+
+    printf("\nRunning Timer %d at %u Hz.\n", TIMER_CYCL, timer_hz);
+    printf("One counter cycle is %u ticks or 250 ms\n", steps);
+    puts("Will print 'tick' every second / every 4 cycles.\n");
+
+    assert(timer_init(TIMER_CYCL, timer_hz, cb, &lock) == 0);

Note that with `NDEBUG`, the timer ends up being uninitialized. That what `expect()` is for

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


More information about the notifications mailing list