File tree 1 file changed +12
-10
lines changed
libraries/mbed/targets/hal/TARGET_STM/TARGET_STM32F7
1 file changed +12
-10
lines changed Original file line number Diff line number Diff line change @@ -46,16 +46,6 @@ void rtc_init(void)
46
46
47
47
RtcHandle .Instance = RTC ;
48
48
49
- // Enable Power clock
50
- __PWR_CLK_ENABLE ();
51
-
52
- // Enable access to Backup domain
53
- HAL_PWR_EnableBkUpAccess ();
54
-
55
- // Reset Backup domain
56
- __HAL_RCC_BACKUPRESET_FORCE ();
57
- __HAL_RCC_BACKUPRESET_RELEASE ();
58
-
59
49
#if !DEVICE_RTC_LSI
60
50
// Enable LSE Oscillator
61
51
RCC_OscInitStruct .OscillatorType = RCC_OSCILLATORTYPE_LSE ;
@@ -71,6 +61,16 @@ void rtc_init(void)
71
61
error ("Cannot initialize RTC with LSE\n" );
72
62
}
73
63
#else
64
+ // Enable Power clock
65
+ __PWR_CLK_ENABLE ();
66
+
67
+ // Enable access to Backup domain
68
+ HAL_PWR_EnableBkUpAccess ();
69
+
70
+ // Reset Backup domain
71
+ __HAL_RCC_BACKUPRESET_FORCE ();
72
+ __HAL_RCC_BACKUPRESET_RELEASE ();
73
+
74
74
// Enable LSI clock
75
75
RCC_OscInitStruct .OscillatorType = RCC_OSCILLATORTYPE_LSI | RCC_OSCILLATORTYPE_LSE ;
76
76
RCC_OscInitStruct .PLL .PLLState = RCC_PLL_NONE ; // Mandatory, otherwise the PLL is reconfigured!
@@ -103,6 +103,7 @@ void rtc_init(void)
103
103
104
104
void rtc_free (void )
105
105
{
106
+ #if DEVICE_RTC_LSI
106
107
// Enable Power clock
107
108
__PWR_CLK_ENABLE ();
108
109
@@ -115,6 +116,7 @@ void rtc_free(void)
115
116
116
117
// Disable access to Backup domain
117
118
HAL_PWR_DisableBkUpAccess ();
119
+ #endif
118
120
119
121
// Disable LSI and LSE clocks
120
122
RCC_OscInitTypeDef RCC_OscInitStruct ;
You can’t perform that action at this time.
0 commit comments