[riot-notifications] [RIOT-OS/RIOT] sys/ztimer: add modules to Kconfig (#15716)

Marian Buschsieweke notifications at github.com
Thu Jan 7 21:09:28 CET 2021


@maribu commented on this pull request.

Looks good to me. Two comments inline.

> +config HAVE_ZTIMER_BACKEND
+    bool
+    help
+        Indicates that a ztimer backend is provided.
+
+endmenu # Backends
+
+menu "Clocks"
+
+config MODULE_ZTIMER_USEC
+    bool "Microseconds"
+    depends on MODULE_ZTIMER_PERIPH_TIMER
+
+config MODULE_ZTIMER_MSEC
+    bool "Milliseconds"
+    depends on HAVE_ZTIMER_BACKEND

This can run on RTT and `periph_timer`, but not on RTC. But `MODULE_ZTIMER_PERIPH_RTC` provides `HAVE_ZTIMER_BACKEND`.

> +config MODULE_ZTIMER_CONVERT_MULDIV64
+    bool "64-bits arithmetic conversion"
+    select MODULE_ZTIMER_CONVERT
+
+config MODULE_ZTIMER_CONVERT_FRAC
+    bool "Fractional conversion"
+    select MODULE_ZTIMER_CONVERT
+    select MODULE_FRAC
+
+config MODULE_ZTIMER_CONVERT_SHIFT
+    bool "Shift conversion"
+    select MODULE_ZTIMER_CONVERT

Maybe some help would be needed here.

- shift conversion is both fast and super precise, but cannot work for arbitrary frequencies. It's kind of a software prescaler for the underlying clock. So if the hardware clock frequency and the target clock frequency differ by a factor that is a power of two, this is the best choice - otherwise it is simply not usable.
- frac can be used for arbitrary frequency conversions, but trades in precision to gain speed. In cases where shift conversion cannot be used, this is likely the best trade off.
- muldiv64 is very precise, but the overhead is the highest. On MCUs without hardware division this might not be a good choice.

@kaspar030: Care to check above statements?

-- 
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/15716#pullrequestreview-563784557
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.riot-os.org/pipermail/notifications/attachments/20210107/cb371830/attachment.htm>


More information about the notifications mailing list