STM32 LOW_POWER_TIMER update : rtc_init procedure

pull/5459/head
jeromecoutant 2017-11-17 12:11:22 +01:00
parent c13ffaf477
commit 85c337d0b9
1 changed files with 5 additions and 5 deletions

View File

@ -55,8 +55,13 @@ void rtc_init(void)
RCC_PeriphCLKInitTypeDef PeriphClkInitStruct = {0};
// Enable access to Backup domain
__HAL_RCC_PWR_CLK_ENABLE();
HAL_PWR_EnableBkUpAccess();
if (rtc_isenabled()) {
return;
}
#if !RTC_LSI /* => LSE */
RCC_OscInitStruct.OscillatorType = RCC_OSCILLATORTYPE_LSE;
RCC_OscInitStruct.PLL.PLLState = RCC_PLL_NONE; // Mandatory, otherwise the PLL is reconfigured!
@ -76,12 +81,7 @@ void rtc_init(void)
error("PeriphClkInitStruct RTC failed with LSE\n");
}
if (rtc_isenabled()) return;
#else /* => RTC_LSI */
if (rtc_isenabled()) return;
__HAL_RCC_PWR_CLK_ENABLE();
// Reset Backup domain
__HAL_RCC_BACKUPRESET_FORCE();
__HAL_RCC_BACKUPRESET_RELEASE();