From b04103f6df712233b7659f2a845461f4db682e32 Mon Sep 17 00:00:00 2001 From: Jorge Aparicio Date: Tue, 21 Jan 2020 22:23:20 +0100 Subject: docs: do not use Instant::now in #[init] --- src/cyccnt.rs | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'src') diff --git a/src/cyccnt.rs b/src/cyccnt.rs index 86969cb..4b12408 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, -- cgit v1.2.3