[FL-1228] FuriHal: add charge suppress API. (#743)

* FuriHal: add charge suppress API.

* FuriHal: add guards to insomnia and charge suppress routines.

* FuriHal: proper API for scheduler in power.

* FuriHal: move charging control from critical section, fix deadlock.

* Gui: use FreeRTOS native timers controls for IconAnimation, fix crash on animation start stop
This commit is contained in:
あく
2021-10-04 10:01:41 +03:00
committed by GitHub
parent a7edebce69
commit 832fb1b795
9 changed files with 151 additions and 28 deletions

View File

@@ -91,6 +91,16 @@ bool bq25896_is_charging() {
return bq25896_regs.r0B.CHRG_STAT != ChrgStatNo;
}
void bq25896_enable_charging() {
bq25896_regs.r03.CHG_CONFIG = 1;
bq25896_write_reg(0x03, (uint8_t*)&bq25896_regs.r03);
}
void bq25896_disable_charging() {
bq25896_regs.r03.CHG_CONFIG = 0;
bq25896_write_reg(0x03, (uint8_t*)&bq25896_regs.r03);
}
void bq25896_enable_otg() {
bq25896_regs.r03.OTG_CONFIG = 1;
bq25896_write_reg(0x03, (uint8_t*)&bq25896_regs.r03);

View File

@@ -12,6 +12,12 @@ void bq25896_poweroff();
/** Is currently charging */
bool bq25896_is_charging();
/** Enable charging */
void bq25896_enable_charging();
/** Disable charging */
void bq25896_disable_charging();
/** Enable otg */
void bq25896_enable_otg();