From 3271ba36e439b037a9f775ccc9b7de8511cbcf7a Mon Sep 17 00:00:00 2001 From: chemicstry Date: Mon, 11 Jul 2022 04:07:28 +0300 Subject: [PATCH] Fix cfg flags --- embassy-stm32/src/flash/f4.rs | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) diff --git a/embassy-stm32/src/flash/f4.rs b/embassy-stm32/src/flash/f4.rs index 0afa9e82..f6dc7e95 100644 --- a/embassy-stm32/src/flash/f4.rs +++ b/embassy-stm32/src/flash/f4.rs @@ -15,14 +15,7 @@ unsafe fn is_dual_bank() -> bool { match FLASH_SIZE / 1024 { // 1 MB devices depend on configuration 1024 => { - if cfg!(any( - feature = "stm32f427", - feature = "stm32f429", - feature = "stm32f437", - feature = "stm32f439", - feature = "stm32f469", - feature = "stm32f479", - )) { + if cfg!(any(stm32f427, stm32f429, stm32f437, stm32f439, stm32f469, stm32f479)) { pac::FLASH.optcr().read().db1m() } else { false @@ -119,7 +112,7 @@ pub(crate) unsafe fn blocking_erase(from: u32, to: u32) -> Result<(), Error> { } unsafe fn erase_sector(sector: u8) -> Result<(), Error> { - let bank = (sector >= SECOND_BANK_SECTOR_START) as u8; + let bank = sector / SECOND_BANK_SECTOR_START as u8; let snb = (bank << 4) + (sector % SECOND_BANK_SECTOR_START as u8); pac::FLASH.cr().modify(|w| {