2021-11-24 03:18:30 +01:00
|
|
|
#![macro_use]
|
|
|
|
|
2021-12-07 05:00:35 +01:00
|
|
|
use defmt_rtt as _;
|
|
|
|
#[allow(unused)]
|
|
|
|
use embassy_stm32::time::Hertz;
|
|
|
|
use embassy_stm32::Config;
|
2021-11-24 03:18:30 +01:00
|
|
|
use panic_probe as _;
|
|
|
|
|
|
|
|
pub use defmt::*;
|
|
|
|
|
|
|
|
use core::sync::atomic::{AtomicUsize, Ordering};
|
|
|
|
|
|
|
|
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
|
|
|
|
}
|
|
|
|
}
|
2021-12-07 05:00:35 +01:00
|
|
|
|
|
|
|
pub fn config() -> Config {
|
|
|
|
#[allow(unused_mut)]
|
|
|
|
let mut config = Config::default();
|
|
|
|
|
|
|
|
#[cfg(feature = "stm32h755zi")]
|
|
|
|
{
|
|
|
|
config.rcc.sys_ck = Some(Hertz(400_000_000));
|
|
|
|
config.rcc.pll1.q_ck = Some(Hertz(100_000_000));
|
|
|
|
}
|
|
|
|
|
|
|
|
config
|
|
|
|
}
|