embassy/examples/stm32f4/src/example_common.rs

18 lines
418 B
Rust
Raw Normal View History

2020-09-22 18:03:43 +02:00
#![macro_use]
use defmt_rtt as _; // global logger
use panic_probe as _;
2020-11-27 18:42:59 +01:00
pub use defmt::*;
2020-09-22 18:03:43 +02:00
use core::sync::atomic::{AtomicUsize, Ordering};
2021-02-24 08:44:23 +01:00
defmt::timestamp! {"{=u64}", {
static COUNT: AtomicUsize = AtomicUsize::new(0);
// NOTE(no-CAS) `timestamps` runs with interrupts disabled
let n = COUNT.load(Ordering::Relaxed);
COUNT.store(n + 1, Ordering::Relaxed);
n as u64
}
2020-09-22 18:03:43 +02:00
}