mirror of
https://github.com/rtic-rs/rtic.git
synced 2025-12-19 06:15:45 +01:00
Merge #295
295: docs: do not use Instant::now in #[init] r=korken89 a=japaric Co-authored-by: Jorge Aparicio <jorge@japaric.io>
This commit is contained in:
commit
03ac76a0a2
2 changed files with 5 additions and 0 deletions
|
|
@ -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,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue