diff options
Diffstat (limited to 'lib/stm32/l4/pwr.c')
-rw-r--r-- | lib/stm32/l4/pwr.c | 24 |
1 files changed, 22 insertions, 2 deletions
diff --git a/lib/stm32/l4/pwr.c b/lib/stm32/l4/pwr.c index 7bfc8361..e6bd877a 100644 --- a/lib/stm32/l4/pwr.c +++ b/lib/stm32/l4/pwr.c @@ -1,6 +1,6 @@ -/** @defgroup pwr_file PWR +/** @defgroup pwr_file PWR peripheral API * - * @ingroup STM32L4xx + * @ingroup peripheral_apis * * @brief <b>libopencm3 STM32L4xx Power Control</b> * @@ -52,4 +52,24 @@ void pwr_set_vos_scale(enum pwr_vos_scale scale) } PWR_CR1 = reg32; } + +/** Disable Backup Domain Write Protection + * + * This allows backup domain registers to be changed. These registers are write + * protected after a reset. + */ +void pwr_disable_backup_domain_write_protect(void) +{ + PWR_CR1 |= PWR_CR1_DBP; +} + +/** Re-enable Backup Domain Write Protection + * + * This protects backup domain registers from inadvertent change. + */ +void pwr_enable_backup_domain_write_protect(void) +{ + PWR_CR1 &= ~PWR_CR1_DBP; +} + /**@}*/ |