1
0
mirror of https://github.com/RIOT-OS/RIOT.git synced 2024-12-29 04:50:03 +01:00

Merge pull request #17370 from kaspar030/ztimer_best_practices

sys/ztimer: add some best practices
This commit is contained in:
Koen Zandberg 2021-12-10 08:47:55 +01:00 committed by GitHub
commit ca74a57870
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -68,6 +68,23 @@
* ```
*
*
* # ztimer best practices
*
* 1. Don't use ZTIMER_USEC unless the increased resolution is really needed.
* ZTIMER_USEC will, on most platforms, prevent low-power sleep modes.
*
* 2. Clear ztimer_t structs before use. Example:
*
* ztimer_t foo = { 0 };
*
* This ensures ztimer knows the timer is not already set, possibly preventing
* an unnecessary full ztimer list traversal.
* (ztimer will ensure that a removed timer is sufficiently cleared.)
*
* 3. Don't compare ztimer_now() values from different clocks. The clocks are
* almost certainly not synchronized.
*
*
* # Design
*
* ## clocks, virtual timers, chaining