App Loading via Loader (#1)

* app loading wip

* various improvements

irq/isr stuff is now working
lvgl locking where needed
hello world now uses proper mutex for app unlocking
etc?

* various improvements

* cmsis_esp improvements

* implement interrupts
This commit is contained in:
Ken Van Hoeylandt
2023-12-30 12:39:07 +01:00
committed by GitHub
parent 60372076d5
commit b9427d4eba
83 changed files with 1180 additions and 623 deletions
+24 -16
View File
@@ -1,22 +1,16 @@
#include "hello_world.h"
#include "applications/services/gui/gui.h"
#include "esp_log.h"
#include "furi.h"
#include "apps/services/gui/gui.h"
#include "esp_lvgl_port.h"
#include "graphics.h"
#include "record.h"
static const char* TAG = "app_helloworld";
static const char* TAG = "app_hello_world";
ViewPort* view_port = NULL;
FuriSemaphore* quit_lock = NULL;
static void on_button_click(lv_event_t _Nonnull* event) {
ESP_LOGI(TAG, "button clicked");
FURI_RECORD_TRANSACTION(RECORD_GUI, gui, {
gui_remove_view_port(gui, view_port);
view_port_free(view_port);
view_port = NULL;
});
furi_semaphore_give(quit_lock);
}
// Main entry point for LVGL widget creation
@@ -48,18 +42,32 @@ static int32_t app_main(void* param) {
view_port_draw_callback_set(view_port, &app_lvgl, view_port);
// The transaction automatically calls furi_record_open() and furi_record_close()
FURI_RECORD_TRANSACTION(RECORD_GUI, gui, {
FURI_RECORD_TRANSACTION(RECORD_GUI, Gui*, gui, {
gui_add_view_port(gui, view_port, GuiLayerFullscreen);
})
// Wait for the button click to release the mutex (lock)
quit_lock = furi_semaphore_alloc(1, 0);
while (!furi_semaphore_take(quit_lock, UINT32_MAX)) {
// Do nothing
}
furi_semaphore_free(quit_lock);
quit_lock = NULL;
FURI_RECORD_TRANSACTION(RECORD_GUI, Gui*, gui, {
gui_remove_view_port(gui, view_port);
view_port_free(view_port);
view_port = NULL;
});
return 0;
}
const App hello_world_app = {
const AppManifest hello_world_app = {
.id = "helloworld",
.name = "Hello World",
.type = USER,
.icon = NULL,
.type = AppTypeUser,
.entry_point = &app_main,
.stack_size = NB_TASK_STACK_SIZE_DEFAULT,
.priority = NB_TASK_PRIORITY_DEFAULT
.stack_size = AppStackSizeNormal,
};
+2 -2
View File
@@ -1,5 +1,5 @@
#pragma once
#include "app.h"
#include "app_manifest.h"
extern const App hello_world_app;
extern const AppManifest hello_world_app;
+9
View File
@@ -1,4 +1,6 @@
#include "nanobake.h"
#include "record.h"
#include "apps/services/loader/loader.h"
// Hardware
#include "board_2432s024.h"
@@ -17,4 +19,11 @@ __attribute__((unused)) void app_main(void) {
};
nanobake_start(&config);
FURI_RECORD_TRANSACTION(RECORD_LOADER, Loader*, loader, {
FuriString* error_message = furi_string_alloc();
if (loader_start(loader, hello_world_app.id, NULL, error_message) != LoaderStatusOk) {
FURI_LOG_E(hello_world_app.id, "%s\r\n", furi_string_get_cstr(error_message));
}
});
}