diff --git a/examples/schedule.rs b/examples/schedule.rs index 97818e36a1..a1c41ca574 100644 --- a/examples/schedule.rs +++ b/examples/schedule.rs @@ -20,6 +20,7 @@ const APP: () = { cx.core.DWT.enable_cycle_counter(); // 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 hprintln!("init @ {:?}", now).unwrap(); diff --git a/src/cyccnt.rs b/src/cyccnt.rs index 86969cb1a3..4b12408724 100644 --- a/src/cyccnt.rs +++ b/src/cyccnt.rs @@ -30,6 +30,10 @@ pub struct Instant { impl Instant { /// Returns an instant corresponding to "now" + /// + /// *HEADS UP* this function can, and will, return nonsensical values if called within `init`. + /// Only use it in `idle` and tasks. In `init`, use the `init::Context.start` field, or the + /// `CYCCNT::zero` function, instead of this function pub fn now() -> Self { Instant { inner: DWT::get_cycle_count() as i32,