stm32/test: add real defmt timestamp

This commit is contained in:
Dario Nieuwenhuis
2023-05-01 18:16:29 +02:00
parent 00cde67abe
commit 1806422763
2 changed files with 2 additions and 12 deletions

View File

@ -1,22 +1,11 @@
#![macro_use]
use core::sync::atomic::{AtomicUsize, Ordering};
pub use defmt::*;
#[allow(unused)]
use embassy_stm32::time::Hertz;
use embassy_stm32::Config;
use {defmt_rtt as _, panic_probe as _};
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
}
}
pub fn config() -> Config {
#[allow(unused_mut)]
let mut config = Config::default();