File tree Expand file tree Collapse file tree 1 file changed +5
-8
lines changed
libraries/mbed/targets/hal/TARGET_STM/TARGET_STM32L4 Expand file tree Collapse file tree 1 file changed +5
-8
lines changed Original file line number Diff line number Diff line change 33
33
34
34
#include "mbed_error.h"
35
35
36
- static int rtc_inited = 0 ;
37
-
38
36
static RTC_HandleTypeDef RtcHandle ;
39
37
40
38
void rtc_init (void )
@@ -43,9 +41,6 @@ void rtc_init(void)
43
41
RCC_PeriphCLKInitTypeDef PeriphClkInitStruct = {0 };
44
42
uint32_t rtc_freq = 0 ;
45
43
46
- if (rtc_inited ) return ;
47
- rtc_inited = 1 ;
48
-
49
44
RtcHandle .Instance = RTC ;
50
45
51
46
// Enable Power clock
@@ -128,13 +123,15 @@ void rtc_free(void)
128
123
RCC_OscInitStruct .LSIState = RCC_LSI_OFF ;
129
124
RCC_OscInitStruct .LSEState = RCC_LSE_OFF ;
130
125
HAL_RCC_OscConfig (& RCC_OscInitStruct );
131
-
132
- rtc_inited = 0 ;
133
126
}
134
127
135
128
int rtc_isenabled (void )
136
129
{
137
- return rtc_inited ;
130
+ if ((RTC -> ISR & RTC_ISR_INITS ) == RTC_ISR_INITS ){
131
+ return 1 ;
132
+ } else {
133
+ return 0 ;
134
+ }
138
135
}
139
136
140
137
/*
You can’t perform that action at this time.
0 commit comments