224d0aefe4
* First part of multitarget porting * Delete firmware/targets/f7/Inc directory * Delete firmware/targets/f7/Src directory * gpio: cli fixes; about: using version from HAL * sdk: path fixes * gui: include fixes * applications: more include fixes * gpio: ported to new apis * hal: introduced furi_hal_target_hw.h; libs: added one_wire * hal: f18 target * github: also build f18 by default * typo fix * fbt: removed extra checks on app list * api: explicitly bundling select mlib headers with sdk * hal: f18: changed INPUT_DEBOUNCE_TICKS to match f7 * cleaned up commented out code * docs: added info on hw targets * docs: targets: formatting fixes * f18: fixed link error * f18: fixed API version to match f7 * docs: hardware: minor wording fixes * faploader: added fw target check * docs: typo fixes * github: not building komi target by default * fbt: support for `targets` field for built-in apps * github: reworked build flow to exclude app_set; fbt: removed komi-specific appset; added additional target buildset check * github: fixed build; nfc: fixed pvs warnings * attempt to fix target id * f7, f18: removed certain HAL function from public API * apps: debug: enabled bt_debug_app for f18 * Targets: backport input pins configuration routine from F7 to F18 Co-authored-by: Aleksandr Kutuzov <alleteam@gmail.com>
75 lines
1.8 KiB
C
75 lines
1.8 KiB
C
#include <furi.h>
|
|
#include <furi_hal.h>
|
|
#include <flipper.h>
|
|
#include <alt_boot.h>
|
|
#include <semphr.h>
|
|
#include <update_util/update_operation.h>
|
|
|
|
#define TAG "Main"
|
|
|
|
int32_t init_task(void* context) {
|
|
UNUSED(context);
|
|
|
|
// Flipper FURI HAL
|
|
furi_hal_init();
|
|
|
|
// Init flipper
|
|
flipper_init();
|
|
|
|
return 0;
|
|
}
|
|
|
|
int main() {
|
|
// Initialize FURI layer
|
|
furi_init();
|
|
|
|
// Flipper critical FURI HAL
|
|
furi_hal_init_early();
|
|
|
|
FuriThread* main_thread = furi_thread_alloc_ex("Init", 4096, init_task, NULL);
|
|
|
|
#ifdef FURI_RAM_EXEC
|
|
furi_thread_start(main_thread);
|
|
#else
|
|
furi_hal_light_sequence("RGB");
|
|
|
|
// Delay is for button sampling
|
|
furi_delay_ms(100);
|
|
|
|
FuriHalRtcBootMode boot_mode = furi_hal_rtc_get_boot_mode();
|
|
if(boot_mode == FuriHalRtcBootModeDfu || !furi_hal_gpio_read(&gpio_button_left)) {
|
|
furi_hal_light_sequence("rgb WB");
|
|
furi_hal_rtc_set_boot_mode(FuriHalRtcBootModeNormal);
|
|
flipper_boot_dfu_exec();
|
|
furi_hal_power_reset();
|
|
} else if(boot_mode == FuriHalRtcBootModeUpdate) {
|
|
furi_hal_light_sequence("rgb BR");
|
|
flipper_boot_update_exec();
|
|
// if things go nice, we shouldn't reach this point.
|
|
// But if we do, abandon to avoid bootloops
|
|
furi_hal_rtc_set_boot_mode(FuriHalRtcBootModeNormal);
|
|
furi_hal_power_reset();
|
|
} else if(!furi_hal_gpio_read(&gpio_button_up)) {
|
|
furi_hal_light_sequence("rgb WR");
|
|
flipper_boot_recovery_exec();
|
|
furi_hal_power_reset();
|
|
} else {
|
|
furi_hal_light_sequence("rgb G");
|
|
furi_thread_start(main_thread);
|
|
}
|
|
#endif
|
|
|
|
// Run Kernel
|
|
furi_run();
|
|
|
|
furi_crash("Kernel is Dead");
|
|
}
|
|
|
|
void Error_Handler(void) {
|
|
furi_crash("ErrorHandler");
|
|
}
|
|
|
|
void abort() {
|
|
furi_crash("AbortHandler");
|
|
}
|