Small improvements of using FLASH memory in STM32F1XX

This commit is contained in:
millerd
2013-04-22 17:37:47 +02:00
committed by Piotr Esden-Tempski
parent b2df978eae
commit 6313af8869
3 changed files with 8 additions and 2 deletions

View File

@@ -93,6 +93,11 @@ void flash_clear_status_flags(void)
flash_clear_bsy_flag();
}
u32 flash_get_status_flags(void)
{
return (FLASH_SR &= (FLASH_SR_PGERR | FLASH_SR_EOP | FLASH_SR_WRPRTERR | FLASH_SR_BSY));
}
void flash_unlock_option_bytes(void)
{
/* F1 uses same keys for flash and option */
@@ -102,8 +107,7 @@ void flash_unlock_option_bytes(void)
void flash_wait_for_last_operation(void)
{
while ((FLASH_SR & FLASH_SR_BSY) == FLASH_SR_BSY)
;
while ((FLASH_SR & FLASH_SR_BSY) == FLASH_SR_BSY);
}
void flash_program_word(u32 address, u32 data)