mirror of
https://github.com/micropython/micropython.git
synced 2026-01-09 05:30:27 +01:00
stm32/rtc: Fix rtc_info flags when LSE fails and falls back to LSI.
Previously, if LSE is selected but fails and the RTC falls back to LSI, then the rtc_info flags would incorrectly state that LSE is used. This patch fixes that by setting the bit in rtc_info only after the clock is ready.
This commit is contained in:
@@ -162,7 +162,7 @@ void rtc_init_finalise() {
|
||||
return;
|
||||
}
|
||||
|
||||
rtc_info = 0x20000000 | (rtc_use_lse << 28);
|
||||
rtc_info = 0x20000000;
|
||||
if (PYB_RTC_Init(&RTCHandle) != HAL_OK) {
|
||||
if (rtc_use_lse) {
|
||||
// fall back to LSI...
|
||||
@@ -182,6 +182,9 @@ void rtc_init_finalise() {
|
||||
}
|
||||
}
|
||||
|
||||
// record if LSE or LSI is used
|
||||
rtc_info |= (rtc_use_lse << 28);
|
||||
|
||||
// record how long it took for the RTC to start up
|
||||
rtc_info |= (HAL_GetTick() - rtc_startup_tick) & 0xffff;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user