summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorQMK Bot <hello@qmk.fm>2021-08-02 04:28:52 +0000
committerQMK Bot <hello@qmk.fm>2021-08-02 04:28:52 +0000
commit83bd56e68c6d1d7765b0577439b3fbda43d5e234 (patch)
tree1d49a83c05472bd4032473c390472659ff5eec1a
parentee3c138385a2644b162807ef05261936858a7e25 (diff)
parent720c676403660eacb880528f04a5c1d328b84650 (diff)
Merge remote-tracking branch 'origin/master' into develop
-rw-r--r--tmk_core/common/chibios/flash_stm32.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/tmk_core/common/chibios/flash_stm32.c b/tmk_core/common/chibios/flash_stm32.c
index e8b3dc4bc9..66f2b13768 100644
--- a/tmk_core/common/chibios/flash_stm32.c
+++ b/tmk_core/common/chibios/flash_stm32.c
@@ -161,9 +161,11 @@ FLASH_Status FLASH_ProgramHalfWord(uint32_t Address, uint16_t Data) {
* @retval None
*/
void FLASH_Unlock(void) {
- /* Authorize the FPEC Access */
- FLASH->KEYR = FLASH_KEY1;
- FLASH->KEYR = FLASH_KEY2;
+ if (FLASH->CR & FLASH_CR_LOCK) {
+ /* Authorize the FPEC Access */
+ FLASH->KEYR = FLASH_KEY1;
+ FLASH->KEYR = FLASH_KEY2;
+ }
}
/**