diff options
| author | Per Lindgren <per.lindgren@ltu.se> | 2023-02-01 19:46:58 +0100 |
|---|---|---|
| committer | Henrik Tjäder <henrik@tjaders.com> | 2023-03-01 00:35:04 +0100 |
| commit | 89632f9b22d33bef08b2f98554e263c8a1d7cfa0 (patch) | |
| tree | b17278b5507b88ea09e86d9859292d904e89b8f0 /book/en/src/by-example/delay.md | |
| parent | 14fdca130f8c3ab598b30cfb7e70f8712ea42fb8 (diff) | |
book polish
Diffstat (limited to 'book/en/src/by-example/delay.md')
| -rw-r--r-- | book/en/src/by-example/delay.md | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/book/en/src/by-example/delay.md b/book/en/src/by-example/delay.md index d35d9da..8d05d7c 100644 --- a/book/en/src/by-example/delay.md +++ b/book/en/src/by-example/delay.md @@ -4,7 +4,7 @@ A convenient way to express *miniminal* timing requirements is by means of delay This can be achieved by instantiating a monotonic timer: -```rust +``` rust ... rtic_monotonics::make_systick_timer_queue!(TIMER); @@ -17,7 +17,7 @@ fn init(cx: init::Context) -> (Shared, Local) { A *software* task can `await` the delay to expire: -```rust +``` rust #[task] async fn foo(_cx: foo::Context) { ... @@ -27,6 +27,8 @@ async fn foo(_cx: foo::Context) { Technically, the timer queue is implemented as a list based priority queue, where list-nodes are statically allocated as part of the underlying task `Future`. Thus, the timer queue is infallible at run-time (its size and allocation is determined at compile time). +Similarly the channels implementation, the timer-queue implementation relies on a global *Critical Section* (CS) for race protection. For the examples a CS implementation is provided by adding `--features test-critical-section` to the build options. + For a complete example: ``` rust @@ -35,6 +37,9 @@ For a complete example: ``` console $ cargo run --target thumbv7m-none-eabi --example async-delay --features test-critical-section +``` + +``` console {{#include ../../../../rtic/ci/expected/async-delay.run}} ``` @@ -112,5 +117,8 @@ The complete example: ``` console $ cargo run --target thumbv7m-none-eabi --example async-timeout --features test-critical-section +``` + +``` console {{#include ../../../../rtic/ci/expected/async-timeout.run}} ``` |
