FuriHal: RTC recovery routine and ext3v3 enabled on start (#1357)

* FuriHal: leave ext3v3 enabled on start
* FuriHal: RTC recovery routine, cleanup resources

Co-authored-by: SG <who.just.the.doctor@gmail.com>
This commit is contained in:
あく
2022-07-04 17:26:02 +03:00
committed by GitHub
parent b95cd2df14
commit c495677eb5
4 changed files with 88 additions and 40 deletions

View File

@@ -1,5 +1,6 @@
#include <furi_hal_power.h>
#include <furi_hal_clock.h>
#include <furi_hal_delay.h>
#include <furi_hal_bt.h>
#include <furi_hal_resources.h>
#include <furi_hal_uart.h>
@@ -299,6 +300,10 @@ void furi_hal_power_shutdown() {
}
void furi_hal_power_off() {
// Crutch: shutting down with ext 3V3 off is causing LSE to stop
furi_hal_power_enable_external_3_3v();
furi_hal_delay_us(1000);
// Send poweroff to charger
furi_hal_i2c_acquire(&furi_hal_i2c_handle_power);
bq25896_poweroff(&furi_hal_i2c_handle_power);
furi_hal_i2c_release(&furi_hal_i2c_handle_power);
@@ -482,11 +487,11 @@ void furi_hal_power_dump_state() {
}
void furi_hal_power_enable_external_3_3v() {
LL_GPIO_SetOutputPin(PERIPH_POWER_GPIO_Port, PERIPH_POWER_Pin);
furi_hal_gpio_write(&periph_power, 1);
}
void furi_hal_power_disable_external_3_3v() {
LL_GPIO_ResetOutputPin(PERIPH_POWER_GPIO_Port, PERIPH_POWER_Pin);
furi_hal_gpio_write(&periph_power, 0);
}
void furi_hal_power_suppress_charge_enter() {