diff --git a/embassy-stm32/src/lib.rs b/embassy-stm32/src/lib.rs index 8f001f03b..88683bfe4 100644 --- a/embassy-stm32/src/lib.rs +++ b/embassy-stm32/src/lib.rs @@ -280,25 +280,24 @@ pub fn init(config: Config) -> Peripherals { #[cfg(feature = "_dual-core")] mod dual_core { + use core::mem::MaybeUninit; + use core::sync::atomic::{AtomicUsize, Ordering}; + use rcc::Clocks; use super::*; - use core::{ - mem::MaybeUninit, - sync::atomic::{AtomicUsize, Ordering}, - }; /// Object containing data that embassy needs to share between cores. - /// + /// /// It cannot be initialized by the user. The intended use is: - /// + /// /// ``` /// #[link_section = ".ram_d3"] /// static SHARED_DATA: MaybeUninit = MaybeUninit::uninit(); - /// + /// /// init_secondary(&SHARED_DATA); /// ``` - /// + /// /// This static must be placed in the same position for both cores. How and where this is done is left to the user. pub struct SharedData { init_flag: AtomicUsize, @@ -314,7 +313,7 @@ mod dual_core { /// This returns the peripheral singletons that can be used for creating drivers. /// /// This should only be called once at startup, otherwise it panics. - /// + /// /// The `shared_data` is used to coordinate the init with the second core. Read the [SharedData] docs /// for more information on its requirements. pub fn init_primary(config: Config, shared_data: &'static MaybeUninit) -> Peripherals { @@ -334,7 +333,7 @@ mod dual_core { /// If the other core is not done yet, this will return `None`. /// /// This should only be called once at startup, otherwise it may panic. - /// + /// /// The `shared_data` is used to coordinate the init with the second core. Read the [SharedData] docs /// for more information on its requirements. pub fn try_init_secondary(shared_data: &'static MaybeUninit) -> Option { @@ -357,7 +356,7 @@ mod dual_core { /// If the other core is not done yet, this will spinloop wait on it. /// /// This should only be called once at startup, otherwise it may panic. - /// + /// /// The `shared_data` is used to coordinate the init with the second core. Read the [SharedData] docs /// for more information on its requirements. pub fn init_secondary(shared_data: &'static MaybeUninit) -> Peripherals { diff --git a/embassy-stm32/src/rcc/mod.rs b/embassy-stm32/src/rcc/mod.rs index 587231b0c..0656619b1 100644 --- a/embassy-stm32/src/rcc/mod.rs +++ b/embassy-stm32/src/rcc/mod.rs @@ -78,7 +78,9 @@ pub(crate) unsafe fn set_freqs(freqs: Clocks) { /// Safety: Sets a mutable global. pub(crate) unsafe fn set_freqs(freqs: Clocks) { debug!("rcc: {:?}", freqs); - CLOCK_FREQS_PTR.load(core::sync::atomic::Ordering::SeqCst).write(MaybeUninit::new(freqs)); + CLOCK_FREQS_PTR + .load(core::sync::atomic::Ordering::SeqCst) + .write(MaybeUninit::new(freqs)); } #[cfg(not(feature = "_dual-core"))] diff --git a/embassy-stm32/src/time.rs b/embassy-stm32/src/time.rs index d7337191d..802ff41ce 100644 --- a/embassy-stm32/src/time.rs +++ b/embassy-stm32/src/time.rs @@ -92,7 +92,7 @@ impl Div for Hertz { #[derive(Eq, PartialEq, Ord, PartialOrd, Clone, Copy, Debug, Default)] #[cfg_attr(feature = "defmt", derive(defmt::Format))] /// A variant on [Hertz] that acts as an `Option` that is smaller and repr C. -/// +/// /// An `Option` can be `.into()`'d into this type and back. /// The only restriction is that that [Hertz] cannot have the value 0 since that's /// seen as the `None` variant. diff --git a/examples/stm32h755cm4/src/bin/blinky.rs b/examples/stm32h755cm4/src/bin/blinky.rs index 52db326b0..f750c5db6 100644 --- a/examples/stm32h755cm4/src/bin/blinky.rs +++ b/examples/stm32h755cm4/src/bin/blinky.rs @@ -5,10 +5,8 @@ use core::mem::MaybeUninit; use defmt::*; use embassy_executor::Spawner; -use embassy_stm32::{ - gpio::{Level, Output, Speed}, - SharedData, -}; +use embassy_stm32::gpio::{Level, Output, Speed}; +use embassy_stm32::SharedData; use embassy_time::Timer; use {defmt_rtt as _, panic_probe as _}; diff --git a/examples/stm32h755cm7/src/bin/blinky.rs b/examples/stm32h755cm7/src/bin/blinky.rs index f76395326..f76a136aa 100644 --- a/examples/stm32h755cm7/src/bin/blinky.rs +++ b/examples/stm32h755cm7/src/bin/blinky.rs @@ -5,10 +5,8 @@ use core::mem::MaybeUninit; use defmt::*; use embassy_executor::Spawner; -use embassy_stm32::{ - gpio::{Level, Output, Speed}, - SharedData, -}; +use embassy_stm32::gpio::{Level, Output, Speed}; +use embassy_stm32::SharedData; use embassy_time::Timer; use {defmt_rtt as _, panic_probe as _};