**** WARNING **** This change may break your code!!!

Change flash_erase_sector (f2/f4) to take numerical sector argument.

As opposed to using one of the defines in the header, this is more convenient when programatically deciding which sectors to erase.
This commit is contained in:
Fergus Noble
2013-05-10 13:29:38 -07:00
committed by Piotr Esden-Tempski
parent b039504494
commit 410be2a39a
2 changed files with 5 additions and 5 deletions

View File

@@ -218,19 +218,19 @@ void flash_program_byte(u32 address, u8 data)
FLASH_CR &= ~FLASH_CR_PG; /* Disable the PG bit. */
}
void flash_erase_sector(u32 sector, u32 program_size)
void flash_erase_sector(u8 sector, u32 program_size)
{
flash_wait_for_last_operation();
flash_set_program_size(program_size);
FLASH_CR &= ~(((1 << 0) | (1 << 1) | (1 << 2) | (1 << 3)) << 3);
FLASH_CR |= sector;
FLASH_CR &= ~(0xF << 3);
FLASH_CR |= (sector << 3) & 0x78;
FLASH_CR |= FLASH_CR_SER;
FLASH_CR |= FLASH_CR_STRT;
flash_wait_for_last_operation();
FLASH_CR &= ~FLASH_CR_SER;
FLASH_CR &= ~(((1 << 0) | (1 << 1) | (1 << 2) | (1 << 3)) << 3);
FLASH_CR &= ~(0xF << 3);
}
void flash_erase_all_sectors(u32 program_size)