[stm32] Make flash config per-family

This commit is contained in:
Erik Henriksson 2022-12-07 23:32:04 +01:00
parent b3fc0aa93d
commit 0f32a67e38
6 changed files with 40 additions and 5 deletions

View File

@ -99,3 +99,12 @@ 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);
});
}

View File

@ -174,3 +174,12 @@ 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);
});
}

View File

@ -133,3 +133,12 @@ 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);
});
}

View File

@ -199,3 +199,6 @@ 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() {}

View File

@ -185,3 +185,12 @@ 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);
});
}

View File

@ -181,9 +181,5 @@ cfg_if::cfg_if! {
// 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);
});
family::init();
}