From 3293913be24735ad5e59a5c82f95b1211729c3dd Mon Sep 17 00:00:00 2001 From: Karl Palsson Date: Wed, 25 Jul 2018 23:27:08 +0000 Subject: [PATCH] stm32f3: flash: add clear write protect flag Could actually move to flash_common_f, but they have different names for the same bit at present. --- include/libopencm3/stm32/f3/flash.h | 1 + lib/stm32/f3/flash.c | 6 ++++++ 2 files changed, 7 insertions(+) diff --git a/include/libopencm3/stm32/f3/flash.h b/include/libopencm3/stm32/f3/flash.h index 3de23cd6..ca561efb 100644 --- a/include/libopencm3/stm32/f3/flash.h +++ b/include/libopencm3/stm32/f3/flash.h @@ -98,6 +98,7 @@ BEGIN_DECLS void flash_clear_pgerr_flag(void); +void flash_clear_wrprterr_flag(void); END_DECLS diff --git a/lib/stm32/f3/flash.c b/lib/stm32/f3/flash.c index f8aba91b..ffd03c30 100644 --- a/lib/stm32/f3/flash.c +++ b/lib/stm32/f3/flash.c @@ -51,6 +51,11 @@ void flash_clear_pgerr_flag(void) FLASH_SR |= FLASH_SR_PGERR; } +void flash_clear_wrprterr_flag(void) +{ + FLASH_SR |= FLASH_SR_WRPRTERR; +} + /*---------------------------------------------------------------------------*/ /** @brief Clear All Status Flags @@ -60,6 +65,7 @@ Clears program error, end of operation, busy flags. void flash_clear_status_flags(void) { flash_clear_pgerr_flag(); + flash_clear_wrprterr_flag(); flash_clear_eop_flag(); }