mirror of
https://github.com/DarkFlippers/unleashed-firmware.git
synced 2025-12-12 04:34:43 +04:00
Merge branch 'dev' into nestednonces
This commit is contained in:
@@ -73,18 +73,14 @@ void furi_hal_power_init(void) {
|
||||
// Find and init gauge
|
||||
size_t retry = 2;
|
||||
while(retry > 0) {
|
||||
furi_hal_power.gauge_ok = bq27220_init(&furi_hal_i2c_handle_power);
|
||||
if(furi_hal_power.gauge_ok) {
|
||||
furi_hal_power.gauge_ok = bq27220_apply_data_memory(
|
||||
&furi_hal_i2c_handle_power, furi_hal_power_gauge_data_memory);
|
||||
}
|
||||
furi_hal_power.gauge_ok =
|
||||
bq27220_init(&furi_hal_i2c_handle_power, furi_hal_power_gauge_data_memory);
|
||||
if(furi_hal_power.gauge_ok) {
|
||||
break;
|
||||
} else {
|
||||
// Normal startup time is 250ms
|
||||
// But if we try to access gauge at that stage it will become unresponsive
|
||||
// 2 seconds timeout needed to restart communication
|
||||
furi_delay_us(2020202);
|
||||
// Gauge need some time to think about it's behavior
|
||||
// We must wait, otherwise next init cycle will fail at unseal stage
|
||||
furi_delay_us(4000000);
|
||||
}
|
||||
retry--;
|
||||
}
|
||||
@@ -110,8 +106,8 @@ void furi_hal_power_init(void) {
|
||||
bool furi_hal_power_gauge_is_ok(void) {
|
||||
bool ret = true;
|
||||
|
||||
BatteryStatus battery_status;
|
||||
OperationStatus operation_status;
|
||||
Bq27220BatteryStatus battery_status;
|
||||
Bq27220OperationStatus operation_status;
|
||||
|
||||
furi_hal_i2c_acquire(&furi_hal_i2c_handle_power);
|
||||
|
||||
@@ -132,7 +128,7 @@ bool furi_hal_power_gauge_is_ok(void) {
|
||||
bool furi_hal_power_is_shutdown_requested(void) {
|
||||
bool ret = false;
|
||||
|
||||
BatteryStatus battery_status;
|
||||
Bq27220BatteryStatus battery_status;
|
||||
|
||||
furi_hal_i2c_acquire(&furi_hal_i2c_handle_power);
|
||||
|
||||
@@ -593,8 +589,8 @@ void furi_hal_power_debug_get(PropertyValueCallback out, void* context) {
|
||||
PropertyValueContext property_context = {
|
||||
.key = key, .value = value, .out = out, .sep = '.', .last = false, .context = context};
|
||||
|
||||
BatteryStatus battery_status;
|
||||
OperationStatus operation_status;
|
||||
Bq27220BatteryStatus battery_status;
|
||||
Bq27220OperationStatus operation_status;
|
||||
|
||||
furi_hal_i2c_acquire(&furi_hal_i2c_handle_power);
|
||||
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
#define TAG "FuriHalRandom"
|
||||
|
||||
static uint32_t furi_hal_random_read_rng(void) {
|
||||
while(LL_RNG_IsActiveFlag_CECS(RNG) && LL_RNG_IsActiveFlag_SECS(RNG) &&
|
||||
while(LL_RNG_IsActiveFlag_CECS(RNG) || LL_RNG_IsActiveFlag_SECS(RNG) ||
|
||||
!LL_RNG_IsActiveFlag_DRDY(RNG)) {
|
||||
/* Error handling as described in RM0434, pg. 582-583 */
|
||||
if(LL_RNG_IsActiveFlag_CECS(RNG)) {
|
||||
|
||||
Reference in New Issue
Block a user