File tree Expand file tree Collapse file tree 1 file changed +5
-5
lines changed Expand file tree Collapse file tree 1 file changed +5
-5
lines changed Original file line number Diff line number Diff line change @@ -55,8 +55,13 @@ void rtc_init(void)
55
55
RCC_PeriphCLKInitTypeDef PeriphClkInitStruct = {0 };
56
56
57
57
// Enable access to Backup domain
58
+ __HAL_RCC_PWR_CLK_ENABLE ();
58
59
HAL_PWR_EnableBkUpAccess ();
59
60
61
+ if (rtc_isenabled ()) {
62
+ return ;
63
+ }
64
+
60
65
#if !RTC_LSI /* => LSE */
61
66
RCC_OscInitStruct .OscillatorType = RCC_OSCILLATORTYPE_LSE ;
62
67
RCC_OscInitStruct .PLL .PLLState = RCC_PLL_NONE ; // Mandatory, otherwise the PLL is reconfigured!
@@ -76,12 +81,7 @@ void rtc_init(void)
76
81
error ("PeriphClkInitStruct RTC failed with LSE\n" );
77
82
}
78
83
79
- if (rtc_isenabled ()) return ;
80
84
#else /* => RTC_LSI */
81
- if (rtc_isenabled ()) return ;
82
-
83
- __HAL_RCC_PWR_CLK_ENABLE ();
84
-
85
85
// Reset Backup domain
86
86
__HAL_RCC_BACKUPRESET_FORCE ();
87
87
__HAL_RCC_BACKUPRESET_RELEASE ();
You can’t perform that action at this time.
0 commit comments