[FL-2627] Flipper applications: SDK, build and debug system (#1387)
* Added support for running applications from SD card (FAPs - Flipper Application Packages) * Added plugin_dist target for fbt to build FAPs * All apps of type FlipperAppType.EXTERNAL and FlipperAppType.PLUGIN are built as FAPs by default * Updated VSCode configuration for new fbt features - re-deploy stock configuration to use them * Added debugging support for FAPs with fbt debug & VSCode * Added public firmware API with automated versioning Co-authored-by: hedger <hedger@users.noreply.github.com> Co-authored-by: SG <who.just.the.doctor@gmail.com> Co-authored-by: あく <alleteam@gmail.com>
This commit is contained in:
@@ -0,0 +1,44 @@
|
||||
#include "../lfrfid_debug_i.h"
|
||||
|
||||
typedef enum {
|
||||
SubmenuIndexTune,
|
||||
} SubmenuIndex;
|
||||
|
||||
static void lfrfid_debug_scene_start_submenu_callback(void* context, uint32_t index) {
|
||||
LfRfidDebug* app = context;
|
||||
|
||||
view_dispatcher_send_custom_event(app->view_dispatcher, index);
|
||||
}
|
||||
|
||||
void lfrfid_debug_scene_start_on_enter(void* context) {
|
||||
LfRfidDebug* app = context;
|
||||
Submenu* submenu = app->submenu;
|
||||
|
||||
submenu_add_item(
|
||||
submenu, "Tune", SubmenuIndexTune, lfrfid_debug_scene_start_submenu_callback, app);
|
||||
|
||||
submenu_set_selected_item(
|
||||
submenu, scene_manager_get_scene_state(app->scene_manager, LfRfidDebugSceneStart));
|
||||
|
||||
view_dispatcher_switch_to_view(app->view_dispatcher, LfRfidDebugViewSubmenu);
|
||||
}
|
||||
|
||||
bool lfrfid_debug_scene_start_on_event(void* context, SceneManagerEvent event) {
|
||||
LfRfidDebug* app = context;
|
||||
bool consumed = false;
|
||||
|
||||
if(event.type == SceneManagerEventTypeCustom) {
|
||||
if(event.event == SubmenuIndexTune) {
|
||||
scene_manager_next_scene(app->scene_manager, LfRfidDebugSceneTune);
|
||||
consumed = true;
|
||||
}
|
||||
}
|
||||
|
||||
return consumed;
|
||||
}
|
||||
|
||||
void lfrfid_debug_scene_start_on_exit(void* context) {
|
||||
LfRfidDebug* app = context;
|
||||
|
||||
submenu_reset(app->submenu);
|
||||
}
|
@@ -0,0 +1,48 @@
|
||||
#include "../lfrfid_debug_i.h"
|
||||
#include <furi_hal.h>
|
||||
|
||||
static void comparator_trigger_callback(bool level, void* comp_ctx) {
|
||||
UNUSED(comp_ctx);
|
||||
furi_hal_gpio_write(&gpio_ext_pa7, !level);
|
||||
}
|
||||
|
||||
void lfrfid_debug_scene_tune_on_enter(void* context) {
|
||||
LfRfidDebug* app = context;
|
||||
|
||||
furi_hal_gpio_init_simple(&gpio_ext_pa7, GpioModeOutputPushPull);
|
||||
|
||||
furi_hal_rfid_comp_set_callback(comparator_trigger_callback, app);
|
||||
furi_hal_rfid_comp_start();
|
||||
|
||||
furi_hal_rfid_pins_read();
|
||||
furi_hal_rfid_tim_read(125000, 0.5);
|
||||
furi_hal_rfid_tim_read_start();
|
||||
|
||||
view_dispatcher_switch_to_view(app->view_dispatcher, LfRfidDebugViewTune);
|
||||
}
|
||||
|
||||
bool lfrfid_debug_scene_tune_on_event(void* context, SceneManagerEvent event) {
|
||||
UNUSED(event);
|
||||
|
||||
LfRfidDebug* app = context;
|
||||
bool consumed = false;
|
||||
|
||||
if(lfrfid_debug_view_tune_is_dirty(app->tune_view)) {
|
||||
furi_hal_rfid_set_read_period(lfrfid_debug_view_tune_get_arr(app->tune_view));
|
||||
furi_hal_rfid_set_read_pulse(lfrfid_debug_view_tune_get_ccr(app->tune_view));
|
||||
}
|
||||
|
||||
return consumed;
|
||||
}
|
||||
|
||||
void lfrfid_debug_scene_tune_on_exit(void* context) {
|
||||
UNUSED(context);
|
||||
|
||||
furi_hal_rfid_comp_stop();
|
||||
furi_hal_rfid_comp_set_callback(NULL, NULL);
|
||||
|
||||
furi_hal_gpio_init_simple(&gpio_ext_pa7, GpioModeAnalog);
|
||||
furi_hal_rfid_tim_read_stop();
|
||||
furi_hal_rfid_tim_reset();
|
||||
furi_hal_rfid_pins_reset();
|
||||
}
|
30
applications/debug/lfrfid_debug/scenes/lfrfid_debug_scene.c
Normal file
30
applications/debug/lfrfid_debug/scenes/lfrfid_debug_scene.c
Normal file
@@ -0,0 +1,30 @@
|
||||
#include "lfrfid_debug_scene.h"
|
||||
|
||||
// Generate scene on_enter handlers array
|
||||
#define ADD_SCENE(prefix, name, id) prefix##_scene_##name##_on_enter,
|
||||
void (*const lfrfid_debug_on_enter_handlers[])(void*) = {
|
||||
#include "lfrfid_debug_scene_config.h"
|
||||
};
|
||||
#undef ADD_SCENE
|
||||
|
||||
// Generate scene on_event handlers array
|
||||
#define ADD_SCENE(prefix, name, id) prefix##_scene_##name##_on_event,
|
||||
bool (*const lfrfid_debug_on_event_handlers[])(void* context, SceneManagerEvent event) = {
|
||||
#include "lfrfid_debug_scene_config.h"
|
||||
};
|
||||
#undef ADD_SCENE
|
||||
|
||||
// Generate scene on_exit handlers array
|
||||
#define ADD_SCENE(prefix, name, id) prefix##_scene_##name##_on_exit,
|
||||
void (*const lfrfid_debug_on_exit_handlers[])(void* context) = {
|
||||
#include "lfrfid_debug_scene_config.h"
|
||||
};
|
||||
#undef ADD_SCENE
|
||||
|
||||
// Initialize scene handlers configuration structure
|
||||
const SceneManagerHandlers lfrfid_debug_scene_handlers = {
|
||||
.on_enter_handlers = lfrfid_debug_on_enter_handlers,
|
||||
.on_event_handlers = lfrfid_debug_on_event_handlers,
|
||||
.on_exit_handlers = lfrfid_debug_on_exit_handlers,
|
||||
.scene_num = LfRfidDebugSceneNum,
|
||||
};
|
29
applications/debug/lfrfid_debug/scenes/lfrfid_debug_scene.h
Normal file
29
applications/debug/lfrfid_debug/scenes/lfrfid_debug_scene.h
Normal file
@@ -0,0 +1,29 @@
|
||||
#pragma once
|
||||
|
||||
#include <gui/scene_manager.h>
|
||||
|
||||
// Generate scene id and total number
|
||||
#define ADD_SCENE(prefix, name, id) LfRfidDebugScene##id,
|
||||
typedef enum {
|
||||
#include "lfrfid_debug_scene_config.h"
|
||||
LfRfidDebugSceneNum,
|
||||
} LfRfidDebugScene;
|
||||
#undef ADD_SCENE
|
||||
|
||||
extern const SceneManagerHandlers lfrfid_debug_scene_handlers;
|
||||
|
||||
// Generate scene on_enter handlers declaration
|
||||
#define ADD_SCENE(prefix, name, id) void prefix##_scene_##name##_on_enter(void*);
|
||||
#include "lfrfid_debug_scene_config.h"
|
||||
#undef ADD_SCENE
|
||||
|
||||
// Generate scene on_event handlers declaration
|
||||
#define ADD_SCENE(prefix, name, id) \
|
||||
bool prefix##_scene_##name##_on_event(void* context, SceneManagerEvent event);
|
||||
#include "lfrfid_debug_scene_config.h"
|
||||
#undef ADD_SCENE
|
||||
|
||||
// Generate scene on_exit handlers declaration
|
||||
#define ADD_SCENE(prefix, name, id) void prefix##_scene_##name##_on_exit(void* context);
|
||||
#include "lfrfid_debug_scene_config.h"
|
||||
#undef ADD_SCENE
|
@@ -0,0 +1,2 @@
|
||||
ADD_SCENE(lfrfid_debug, start, Start)
|
||||
ADD_SCENE(lfrfid_debug, tune, Tune)
|
Reference in New Issue
Block a user