[FL-944] Preliminary BLE fix: leave PC4 unconfigured. Cleanup code. (#381)

* GPIO: disable CC1101 GD0 pin configuration. API HAL OS: enable sleep. Cleanup interrupts and gpio code.

* API HAL: disable deep sleep, add light sleep, use it instead.
This commit is contained in:
あく
2021-03-19 17:23:53 +03:00
committed by GitHub
parent 799bc89870
commit 4ae5bd3d75
9 changed files with 543 additions and 1141 deletions

View File

@@ -42,6 +42,10 @@ bool api_hal_power_deep_available() {
return api_hal_bt_is_alive() && api_hal_power_insomnia == 0;
}
void api_hal_power_light_sleep() {
__WFI();
}
void api_hal_power_deep_sleep() {
while( LL_HSEM_1StepLock(HSEM, CFG_HW_RCC_SEMID));
@@ -86,6 +90,15 @@ void api_hal_power_deep_sleep() {
LL_HSEM_ReleaseLock(HSEM, CFG_HW_RCC_SEMID, 0);
}
void api_hal_power_sleep() {
if(api_hal_power_deep_available()) {
api_hal_power_deep_sleep();
} else {
api_hal_power_light_sleep();
}
}
uint8_t api_hal_power_get_pct() {
return bq27220_get_state_of_charge();
}
@@ -203,4 +216,4 @@ void api_hal_power_enable_external_3_3v(){
void api_hal_power_disable_external_3_3v(){
LL_GPIO_ResetOutputPin(PERIPH_POWER_GPIO_Port, PERIPH_POWER_Pin);
}
}