Skip to content

Commit bb55c36

Browse files
committed
Use backup register API
Signed-off-by: Frederic.Pillon <[email protected]>
1 parent 78eaceb commit bb55c36

File tree

1 file changed

+3
-10
lines changed

1 file changed

+3
-10
lines changed

cores/arduino/stm32/clock.c

+3-10
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@
3535
*
3636
******************************************************************************
3737
*/
38+
#include "backup.h"
3839
#include "clock.h"
3940
#include "stm32yyxx_ll_cortex.h"
4041

@@ -98,6 +99,8 @@ void enableClock(sourceClock_t source)
9899
RCC_OscInitTypeDef RCC_OscInitStruct = {0};
99100
RCC_OscInitStruct.PLL.PLLState = RCC_PLL_NONE;
100101

102+
enableBackupRegister();
103+
101104
switch (source) {
102105
case LSI_CLOCK:
103106
if (__HAL_RCC_GET_FLAG(RCC_FLAG_LSIRDY) == RESET) {
@@ -113,16 +116,6 @@ void enableClock(sourceClock_t source)
113116
}
114117
break;
115118
case LSE_CLOCK:
116-
/* Enable Power Clock */
117-
#ifndef STM32H7xx
118-
if (__HAL_RCC_PWR_IS_CLK_DISABLED()) {
119-
__HAL_RCC_PWR_CLK_ENABLE();
120-
}
121-
#endif
122-
#ifdef HAL_PWR_MODULE_ENABLED
123-
/* Allow access to Backup domain */
124-
HAL_PWR_EnableBkUpAccess();
125-
#endif
126119
if (__HAL_RCC_GET_FLAG(RCC_FLAG_LSERDY) == RESET) {
127120
#ifdef __HAL_RCC_LSEDRIVE_CONFIG
128121
__HAL_RCC_LSEDRIVE_CONFIG(RCC_LSEDRIVE_LOW);

0 commit comments

Comments
 (0)