aboutsummaryrefslogtreecommitdiff
path: root/book/en/src/by-example/monotonic.md
diff options
context:
space:
mode:
authorbors[bot] <26634292+bors[bot]@users.noreply.github.com>2023-01-25 20:11:17 +0000
committerGitHub <noreply@github.com>2023-01-25 20:11:17 +0000
commita5e18cd5294870be824f90bdd1d586586c37a153 (patch)
tree0f9a7f77be32c1438582ccafcb45837fa949f38a /book/en/src/by-example/monotonic.md
parent3240fb332a7b1b17333ac1c589b303909bde1dc9 (diff)
parent04189cc6844d7d43305a57464713defb5a46d85c (diff)
Merge #686
686: Book: Editorial review r=korken89 a=AfoHT Continuation of https://github.com/rtic-rs/cortex-m-rtic/pull/618 Better late than never... A big thanks to `@jvanderk` ! Co-authored-by: John van der Koijk <33966414+jvanderk@users.noreply.github.com>
Diffstat (limited to 'book/en/src/by-example/monotonic.md')
-rw-r--r--book/en/src/by-example/monotonic.md6
1 files changed, 5 insertions, 1 deletions
diff --git a/book/en/src/by-example/monotonic.md b/book/en/src/by-example/monotonic.md
index 094bd5d..3a23681 100644
--- a/book/en/src/by-example/monotonic.md
+++ b/book/en/src/by-example/monotonic.md
@@ -1,7 +1,7 @@
# Monotonic & spawn_{at/after}
The understanding of time is an important concept in embedded systems, and to be able to run tasks
-based on time is useful. For this use-case the framework provides the static methods
+based on time is essential. The framework provides the static methods
`task::spawn_after(/* duration */)` and `task::spawn_at(/* specific time instant */)`.
`spawn_after` is more commonly used, but in cases where it's needed to have spawns happen
without drift or to a fixed baseline `spawn_at` is available.
@@ -43,10 +43,14 @@ $ cargo run --target thumbv7m-none-eabi --example schedule
{{#include ../../../../ci/expected/schedule.run}}
```
+A key requirement of a Monotonic is that it must deal gracefully with
+hardware timer overruns.
+
## Canceling or rescheduling a scheduled task
Tasks spawned using `task::spawn_after` and `task::spawn_at` returns a `SpawnHandle`,
which allows canceling or rescheduling of the task scheduled to run in the future.
+
If `cancel` or `reschedule_at`/`reschedule_after` returns an `Err` it means that the operation was
too late and that the task is already sent for execution. The following example shows this in action: