pub static TICK_OVERFLOW_COUNT: AtomicU32 = AtomicU32::new(0); /// Example use, to get seconds since start: `tick_count_fm_overflows_s() + /// tick_timer.time_elapsed().as_secs()` fn tick_count_fm_overflows_s() -> f32 { crate::TICK_OVERFLOW_COUNT.load(Ordering::Acquire) as f32 * crate::TICK_TIMER_PERIOD } /// Hard-coded to use our tick timer directly. pub fn get_timestamp(timer: &mut Timer) -> f32 { let elapsed = timer.time_elapsed().as_secs(); tick_count_fm_overflows_s() + elapsed } #[task(binds = TIM3, shared = [tick_timer], priority = 1)] /// Increments the tick overflow. fn tick_isr(_cx: tick_isr::Context) { cx.shared.tick_timer.lock(|timer| timer.clear_interrupt(TimerInterrupt::Update) TICK_OVERFLOW_COUNT.fetch_add(1, Ordering::Relaxed); }