[STM all] Fix #1480: change location of check for RTC already initialised

Need to keep PWR_CLK_ENABLE and LSE LSI oscillator configuration.
Just skip the HAL_RTC_Init in case INITS flag is already set.
pull/1499/merge
adustm 2016-01-11 18:11:19 +01:00 committed by 0xc0170
parent 42ceddf229
commit 26e3c61983
9 changed files with 26 additions and 26 deletions

View File

@ -45,9 +45,6 @@ void rtc_init(void) {
rtc_inited = 1;
RtcHandle.Instance = RTC;
// Check if RTC is already initialized
if ((RTC->ISR & RTC_ISR_INITS) == RTC_ISR_INITS) return;
// Enable Power clock
__PWR_CLK_ENABLE();
@ -82,6 +79,9 @@ void rtc_init(void) {
rtc_freq = LSI_VALUE;
}
// Check if RTC is already initialized
if ((RTC->ISR & RTC_ISR_INITS) == RTC_ISR_INITS) return;
// Enable RTC
__HAL_RCC_RTC_ENABLE();

View File

@ -46,9 +46,6 @@ void rtc_init(void)
rtc_inited = 1;
RtcHandle.Instance = RTC;
// Check if RTC is already initialized
if ((RTC->ISR & RTC_ISR_INITS) == RTC_ISR_INITS) return;
// Enable Power clock
__PWR_CLK_ENABLE();
@ -83,6 +80,9 @@ void rtc_init(void)
rtc_freq = LSI_VALUE;
}
// Check if RTC is already initialized
if ((RTC->ISR & RTC_ISR_INITS) == RTC_ISR_INITS) return;
// Enable RTC
__HAL_RCC_RTC_ENABLE();

View File

@ -46,9 +46,6 @@ void rtc_init(void)
rtc_inited = 1;
RtcHandle.Instance = RTC;
// Check if RTC is already initialized
if ((RTC->ISR & RTC_ISR_INITS) == RTC_ISR_INITS) return;
// Enable Power clock
__PWR_CLK_ENABLE();
@ -85,6 +82,9 @@ void rtc_init(void)
rtc_freq = LSI_VALUE;
}
// Check if RTC is already initialized
if ((RTC->ISR & RTC_ISR_INITS) == RTC_ISR_INITS) return;
// Enable RTC
__HAL_RCC_RTC_ENABLE();

View File

@ -40,8 +40,6 @@ void rtc_init(void)
RCC_OscInitTypeDef RCC_OscInitStruct;
uint32_t rtc_freq = 0;
if((RTC->ISR & RTC_ISR_INITS) == RTC_ISR_INITS) { // RTC initialization and status register (RTC_ISR), cold start (with no backup domain power) RTC reset value
RtcHandle.Instance = RTC;
// Enable Power clock
@ -79,6 +77,8 @@ void rtc_init(void)
rtc_freq = LSI_VALUE;
}
if((RTC->ISR & RTC_ISR_INITS) == RTC_ISR_INITS) { // RTC initialization and status register (RTC_ISR), cold start (with no backup domain power) RTC reset value
// Enable RTC
__HAL_RCC_RTC_ENABLE();

View File

@ -54,9 +54,6 @@ void rtc_init(void)
rtc_inited = 1;
RtcHandle.Instance = RTC;
// Check if RTC is already initialized
if ((RTC->ISR & RTC_ISR_INITS) == RTC_ISR_INITS) return;
// Enable Power clock
__PWR_CLK_ENABLE();
@ -97,6 +94,9 @@ void rtc_init(void)
}
#endif
// Check if RTC is already initialized
if ((RTC->ISR & RTC_ISR_INITS) == RTC_ISR_INITS) return;
// Enable RTC
__HAL_RCC_RTC_ENABLE();

View File

@ -46,9 +46,6 @@ void rtc_init(void)
rtc_inited = 1;
RtcHandle.Instance = RTC;
// Check if RTC is already initialized
if ((RTC->ISR & RTC_ISR_INITS) == RTC_ISR_INITS) return;
// Enable Power clock
__PWR_CLK_ENABLE();
@ -85,6 +82,9 @@ void rtc_init(void)
rtc_freq = 32000;
}
// Check if RTC is already initialized
if ((RTC->ISR & RTC_ISR_INITS) == RTC_ISR_INITS) return;
// Enable RTC
__HAL_RCC_RTC_ENABLE();

View File

@ -46,9 +46,6 @@ void rtc_init(void)
rtc_inited = 1;
RtcHandle.Instance = RTC;
// Check if RTC is already initialized
if ((RTC->ISR & RTC_ISR_INITS) == RTC_ISR_INITS) return;
// Enable Power clock
__PWR_CLK_ENABLE();
@ -85,6 +82,9 @@ void rtc_init(void)
rtc_freq = 32000;
}
// Check if RTC is already initialized
if ((RTC->ISR & RTC_ISR_INITS) == RTC_ISR_INITS) return;
// Enable RTC
__HAL_RCC_RTC_ENABLE();

View File

@ -46,9 +46,6 @@ void rtc_init(void)
rtc_inited = 1;
RtcHandle.Instance = RTC;
// Check if RTC is already initialized
if ((RTC->ISR & RTC_ISR_INITS) == RTC_ISR_INITS) return;
// Enable Power clock
__PWR_CLK_ENABLE();
@ -85,6 +82,9 @@ void rtc_init(void)
rtc_freq = 40000;
}
// Check if RTC is already initialized
if ((RTC->ISR & RTC_ISR_INITS) == RTC_ISR_INITS) return;
// Enable RTC
__HAL_RCC_RTC_ENABLE();

View File

@ -48,9 +48,6 @@ void rtc_init(void)
RtcHandle.Instance = RTC;
// Check if RTC is already initialized
if ((RTC->ISR & RTC_ISR_INITS) == RTC_ISR_INITS) return;
// Enable Power clock
__HAL_RCC_PWR_CLK_ENABLE();
@ -91,6 +88,9 @@ void rtc_init(void)
rtc_freq = 40000;
}
// Check if RTC is already initialized
if ((RTC->ISR & RTC_ISR_INITS) == RTC_ISR_INITS) return;
// Enable RTC
__HAL_RCC_RTC_ENABLE();