mirror of
https://github.com/DarkFlippers/unleashed-firmware.git
synced 2024-12-22 04:41:36 +03:00
AVR ISP enable 5v power on start
This commit is contained in:
parent
dce5bfd723
commit
3d5701614f
@ -21,6 +21,13 @@ static void avr_isp_app_tick_event_callback(void* context) {
|
||||
AvrIspApp* avr_isp_app_alloc() {
|
||||
AvrIspApp* app = malloc(sizeof(AvrIspApp));
|
||||
|
||||
// Enable 5v power, multiple attempts to avoid issues with power chip protection false triggering
|
||||
uint8_t attempts = 0;
|
||||
while(!furi_hal_power_is_otg_enabled() && attempts++ < 5) {
|
||||
furi_hal_power_enable_otg();
|
||||
furi_delay_ms(10);
|
||||
}
|
||||
|
||||
app->file_path = furi_string_alloc();
|
||||
furi_string_set(app->file_path, STORAGE_APP_DATA_PATH_PREFIX);
|
||||
app->error = AvrIspErrorNoError;
|
||||
@ -152,6 +159,11 @@ void avr_isp_app_free(AvrIspApp* app) {
|
||||
// Path strings
|
||||
furi_string_free(app->file_path);
|
||||
|
||||
// Disable 5v power
|
||||
if(furi_hal_power_is_otg_enabled()) {
|
||||
furi_hal_power_disable_otg();
|
||||
}
|
||||
|
||||
free(app);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user