stm32/flash: avoid pointless "if flag is set, set it".

This commit is contained in:
Dario Nieuwenhuis
2023-07-31 12:48:52 +02:00
parent 958cace36d
commit 036e00113e
7 changed files with 21 additions and 136 deletions

View File

@ -76,17 +76,9 @@ pub(crate) unsafe fn blocking_erase_sector(sector: &FlashSector) -> Result<(), E
}
pub(crate) unsafe fn clear_all_err() {
pac::FLASH.sr().modify(|w| {
if w.pgerr() {
w.set_pgerr(true);
}
if w.wrprt() {
w.set_wrprt(true)
};
if w.eop() {
w.set_eop(true);
}
});
// read and write back the same value.
// This clears all "write 0 to clear" bits.
pac::FLASH.sr().modify(|_| {});
}
unsafe fn wait_ready_blocking() -> Result<(), Error> {