[FL-3226] Deep Sleep Idle (#2569)
* Improve RNG error handling * Sync RTC shadow registers on Stop mode exit * Implement working STOP2 mode * Fix formatting * FuriHal: disable SWD pins if debug is disabled * Power: cleanup battery info view, handle zero current report from gauge * Fbt: add command line argument for extra global defines * FuriHal: cleanup debug defines in power and os, drop deep_insomnia counter. * Add a setting to disable deep sleep * Clean up furi_hal_power * FuriHal,FapLoader,Debug: implement debug in stop mode, workaround resume in stop * FuriHal: document OS and power subsystems debugging * Furi: enable debug interface on crash --------- Co-authored-by: Aleksandr Kutuzov <alleteam@gmail.com>
This commit is contained in:
@@ -165,6 +165,14 @@ void furi_hal_rtc_init() {
|
||||
FURI_LOG_I(TAG, "Init OK");
|
||||
}
|
||||
|
||||
void furi_hal_rtc_sync_shadow() {
|
||||
if(!LL_RTC_IsShadowRegBypassEnabled(RTC)) {
|
||||
LL_RTC_ClearFlag_RS(RTC);
|
||||
while(!LL_RTC_IsActiveFlag_RS(RTC)) {
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
uint32_t furi_hal_rtc_get_register(FuriHalRtcRegister reg) {
|
||||
return LL_RTC_BAK_GetRegister(RTC, reg);
|
||||
}
|
||||
@@ -312,12 +320,7 @@ void furi_hal_rtc_set_datetime(FuriHalRtcDateTime* datetime) {
|
||||
/* Exit Initialization mode */
|
||||
LL_RTC_DisableInitMode(RTC);
|
||||
|
||||
/* If RTC_CR_BYPSHAD bit = 0, wait for synchro else this check is not needed */
|
||||
if(!LL_RTC_IsShadowRegBypassEnabled(RTC)) {
|
||||
LL_RTC_ClearFlag_RS(RTC);
|
||||
while(!LL_RTC_IsActiveFlag_RS(RTC)) {
|
||||
};
|
||||
}
|
||||
furi_hal_rtc_sync_shadow();
|
||||
|
||||
/* Enable write protection */
|
||||
LL_RTC_EnableWriteProtection(RTC);
|
||||
|
||||
Reference in New Issue
Block a user