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:
Russell Sim 2020-05-26 07:33:18 +02:00 committed by GitHub
parent 7406f77a4e
commit 7266ffe3a6
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -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])]