diff --git a/os/hal/platforms/STM32/rtc_lld.c b/os/hal/platforms/STM32/rtc_lld.c index 4f404ab27..62e114e66 100644 --- a/os/hal/platforms/STM32/rtc_lld.c +++ b/os/hal/platforms/STM32/rtc_lld.c @@ -112,7 +112,7 @@ CH_IRQ_HANDLER(RTC_IRQHandler) { * @notapi */ void rtc_lld_init(void){ - RCC->APB1ENR |= (RCC_APB1ENR_PWREN | RCC_APB1ENR_BKPEN); /* enable clocking */ + rccEnableBKP(FALSE); /* enable interface clocking */ PWR->CR |= PWR_CR_DBP; /* enable access */ if (!(RCC->BDCR & (RCC_BDCR_RTCEN | RCC_BDCR_LSEON))){ /* BKP domain was reseted */ diff --git a/os/hal/platforms/STM32F1xx/stm32_rcc.h b/os/hal/platforms/STM32F1xx/stm32_rcc.h index 56fa0905c..7735b2034 100644 --- a/os/hal/platforms/STM32F1xx/stm32_rcc.h +++ b/os/hal/platforms/STM32F1xx/stm32_rcc.h @@ -202,6 +202,38 @@ #define rccResetADC1() rccResetAPB2(RCC_APB2RSTR_ADC1RST) /** @} */ +/** + * @brief Bakup domain interface specific RCC operations + * @{ + */ +/** + * @brief Enables the BKP interface clock. + * @note The @p lp parameter is ignored in this family. + * + * @param[in] lp low power enable flag + * + * @api + */ +#define rccEnableBKP(lp) rccEnableAPB1(RCC_APB1ENR_BKPEN, lp); + +/** + * @brief Disables BKP interface clock. + * @note The @p lp parameter is ignored in this family. + * + * @param[in] lp low power enable flag + * + * @api + */ +#define rccDisableBKP(lp) rccDisableAPB1(RCC_APB1ENR_BKPEN, lp); + +/** + * @brief Resets the Backup Domain. + * + * @api + */ +#define rccResetBKP(lp) rccResetAPB1(RCC_APB1ENR_BKPRST); +/** @} */ + /** * @brief CAN peripherals specific RCC operations * @{