mirror of
https://github.com/rtic-rs/rtic.git
synced 2024-11-27 14:04:56 +01:00
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
This commit is contained in:
parent
7406f77a4e
commit
7266ffe3a6
1 changed files with 1 additions and 1 deletions
|
@ -18,7 +18,7 @@ const APP: () = {
|
||||||
fn init(cx: init::Context) {
|
fn init(cx: init::Context) {
|
||||||
// omitted: initialization of `CYCCNT`
|
// omitted: initialization of `CYCCNT`
|
||||||
|
|
||||||
cx.schedule.foo(Instant::now() + PERIOD.cycles()).unwrap();
|
cx.schedule.foo(cx.start + PERIOD.cycles()).unwrap();
|
||||||
}
|
}
|
||||||
|
|
||||||
#[task(schedule = [foo])]
|
#[task(schedule = [foo])]
|
||||||
|
|
Loading…
Reference in a new issue