diff --git a/embassy-stm32/src/flash/h7.rs b/embassy-stm32/src/flash/h7.rs index 49ba8ef3..3178b3be 100644 --- a/embassy-stm32/src/flash/h7.rs +++ b/embassy-stm32/src/flash/h7.rs @@ -199,6 +199,3 @@ pub(crate) unsafe fn blocking_wait_ready(bank: pac::flash::Bank) -> Result<(), E } } } - -// safety: must be called only once at startup -pub(crate) unsafe fn init() {} diff --git a/embassy-stm32/src/flash/l.rs b/embassy-stm32/src/flash/l.rs index e6c1826a..5048a331 100644 --- a/embassy-stm32/src/flash/l.rs +++ b/embassy-stm32/src/flash/l.rs @@ -185,12 +185,3 @@ pub(crate) unsafe fn blocking_wait_ready() -> Result<(), Error> { } } } - -// safety: must be called only once at startup -pub(crate) unsafe fn init() { - crate::pac::FLASH.acr().modify(|w| { - w.set_dcen(true); - w.set_icen(true); - w.set_prften(true); - }); -} diff --git a/embassy-stm32/src/flash/mod.rs b/embassy-stm32/src/flash/mod.rs index b491f7dc..3bba828d 100644 --- a/embassy-stm32/src/flash/mod.rs +++ b/embassy-stm32/src/flash/mod.rs @@ -181,5 +181,6 @@ cfg_if::cfg_if! { // safety: must be called only once at startup pub(crate) unsafe fn init() { + #[cfg(any(flash_f3, flash_f4, flash_f7))] family::init(); }