aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar Russell Sim <russell.sim@gmail.com> 2020-05-26 07:33:18 +0200
committerGravatar GitHub <noreply@github.com> 2020-05-26 07:33:18 +0200
commit7266ffe3a655f87f8c55d6db6f138c569b31b74a (patch)
treee4fd7578270991a29fcc860d91853912333c61f6
parent7406f77a4ec163165fa2f89e8e9351b792e305e3 (diff)
downloadrtic-7266ffe3a655f87f8c55d6db6f138c569b31b74a.tar.gz
rtic-7266ffe3a655f87f8c55d6db6f138c569b31b74a.tar.zst
rtic-7266ffe3a655f87f8c55d6db6f138c569b31b74a.zip
Update example to use better initial value
The example above this in the documentation states ``` // semantically, the monotonic timer is frozen at time "zero" during `init` // NOTE do *not* call `Instant::now` in this context; it will return a nonsense value let now = cx.start; // the start time of the system ``` It results in weird scheduling issues, but still eventually works. `cx.start` is much more reliable. Relates to https://github.com/rtfm-rs/cortex-m-rtfm/issues/196
-rw-r--r--examples/periodic.rs2
1 files changed, 1 insertions, 1 deletions
diff --git a/examples/periodic.rs b/examples/periodic.rs
index dca0ad56..3d32bc21 100644
--- a/examples/periodic.rs
+++ b/examples/periodic.rs
@@ -18,7 +18,7 @@ const APP: () = {
fn init(cx: init::Context) {
// omitted: initialization of `CYCCNT`
- cx.schedule.foo(Instant::now() + PERIOD.cycles()).unwrap();
+ cx.schedule.foo(cx.start + PERIOD.cycles()).unwrap();
}
#[task(schedule = [foo])]