stm32l[01]: flash common: add flash_unlock_acr, allowing to unlock FLASH_ACR RUN_PD bit.

flash_unlock_acr allows to unlock RUN_PD bit from FLASH_ACR register. Relock is done automatically
when writing 0 to RUN_PD, so no flash_lock_acr method.
This commit is contained in:
Guillaume Revaillot 2019-01-08 14:26:38 +01:00 committed by Karl Palsson
parent 74f460feac
commit 7afd86db30
2 changed files with 9 additions and 0 deletions

View File

@ -119,6 +119,7 @@ void flash_lock_pecr(void);
void flash_unlock_progmem(void);
void flash_lock_progmem(void);
void flash_lock_option_bytes(void);
void flash_unlock_acr(void);
void eeprom_program_word(uint32_t address, uint32_t data);
void eeprom_program_words(uint32_t address, uint32_t *data, int length_in_words);

View File

@ -89,6 +89,14 @@ void flash_lock(void)
flash_lock_pecr();
}
/** @brief Unlock RUN_PD bit from FLASH_ACR register.
*/
void flash_unlock_acr(void)
{
FLASH_PDKEYR = FLASH_PDKEYR_PDKEY1;
FLASH_PDKEYR = FLASH_PDKEYR_PDKEY2;
}
/** @brief Write a word to eeprom
*
* @param address assumed to be in the eeprom space, no checking