diff options
| author | datdenkikniet <jcdra1@gmail.com> | 2023-04-22 18:34:30 +0200 |
|---|---|---|
| committer | datdenkikniet <jcdra1@gmail.com> | 2023-05-11 19:20:58 +0200 |
| commit | 825b2c2c3a565920a31a87328caa82442a44d209 (patch) | |
| tree | fb1877a5948b0f81838acb297181fee03eb3a8e0 /book/en | |
| parent | 6c91ff2d7f83bbba81d8fc24ad9760b5cf6b394e (diff) | |
Update tips on Monotonic implemenations
Diffstat (limited to 'book/en')
| -rw-r--r-- | book/en/src/by-example/tips_monotonic_impl.md | 22 |
1 files changed, 17 insertions, 5 deletions
diff --git a/book/en/src/by-example/tips_monotonic_impl.md b/book/en/src/by-example/tips_monotonic_impl.md index 57b0a01..85b5709 100644 --- a/book/en/src/by-example/tips_monotonic_impl.md +++ b/book/en/src/by-example/tips_monotonic_impl.md @@ -1,14 +1,23 @@ # Implementing a `Monotonic` timer for scheduling -The framework is flexible because it can use any timer which has compare-match and optionally supporting overflow interrupts for scheduling. The single requirement to make a timer usable with RTIC is implementing the [`rtic-time::Monotonic`] trait. +The framework is flexible because it can use any timer which has compare-match and optionally supporting overflow interrupts for scheduling. The single requirement to make a timer usable with RTIC is implementing the `rtic-time::Monotonic` trait. -For RTIC 1.0 and 2.0 we instead assume the user has a time library, e.g. [`fugit`] or [`embedded_time`], as the basis for all time-based operations when implementing `Monotonic`. These libraries make it much easier to correctly implement the `Monotonic` trait, allowing the use of -almost any timer in the system for scheduling. +For RTIC 1.0 and 2.0 we instead assume the user has a time library, e.g. [`fugit`] or [`embedded_time`], as the basis for all time-based operations when implementing `Monotonic`. These libraries make it much easier to correctly implement the `Monotonic` trait, allowing the use of almost any timer in the system for scheduling. -The trait documents the requirements for each method, and for inspiration -there is a reference implementation based on the `SysTick` timer available on all ARM Cortex M MCUs. +The trait documents the requirements for each method. There are reference implementations available in [`rtic-monotonics`](https://github.com/rtic-rs/rtic/tree/master/rtic-monotonics/src) that can be used for inspriation. - [`Systick based`], runs at a fixed interrupt (tick) rate - with some overhead but simple and provides support for large time spans +- [`RP2040 Timer`], a "proper" implementation with support for waiting for long periods without interrupts. Clearly demonstrates how to use the `TimerQueue` to handle scheduling. +- [`nRF52 timers`] implements monotonic & Timer Queue for the RTC and normal timers in nRF52's + +## Contributing + +Contributing new implementations of `Monotonic` can be done in multiple ways: +* Implement the trait behind a feature flag in [`rtic-monotonics`], and create a PR for them to be included in the main RTIC repository. This way, the implementations of are in-tree, and RTIC can guarantee their correctness, and can update them in the case of a new release. +* Implement the changes in an external repository. + +<!-- TODO: remove 1.0.x examples? --> +# V1.0.x Here is a list of `Monotonic` implementations for RTIC 1.0: @@ -27,3 +36,6 @@ If you know of more implementations feel free to add them to this list. [`Nordic nRF52 series RTC`]: https://gist.github.com/korken89/fe94a475726414dd1bce031c76adc3dd [`Systick based`]: https://github.com/rtic-monotonics [`DWT and Systick based`]: https://github.com/rtic-rs/dwt-systick-monotonic +[`rtic-monotonics`]: https://github.com/rtic-rs/rtic/blob/master/rtic-monotonics +[`RP2040 Timer`]: https://github.com/rtic-rs/rtic/blob/master/rtic-monotonics/src/rp2040.rs +[`nRF52 timers`]: https://github.com/rtic-rs/rtic/blob/master/rtic-monotonics/src/nrf.rs
\ No newline at end of file |
