Browse Source

stm32:l4: pwr: Add en/disable_backup_domain_write_protect()

pull/550/merge
Bruno Randolf 7 years ago
committed by Karl Palsson
parent
commit
2c1823f7bb
  1. 2
      include/libopencm3/stm32/l4/pwr.h
  2. 20
      lib/stm32/l4/pwr.c

2
include/libopencm3/stm32/l4/pwr.h

@ -170,6 +170,8 @@ enum pwr_vos_scale {
BEGIN_DECLS
void pwr_set_vos_scale(enum pwr_vos_scale scale);
void pwr_disable_backup_domain_write_protect(void);
void pwr_enable_backup_domain_write_protect(void);
END_DECLS

20
lib/stm32/l4/pwr.c

@ -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;
}
/**@}*/

Loading…
Cancel
Save