mirror of
https://github.com/ByteWelder/Tactility.git
synced 2026-02-18 19:03:16 +00:00
parent
3b9986fcef
commit
e842e30ab3
@ -10,20 +10,11 @@ extern "C" {
|
||||
typedef struct _lv_obj_t lv_obj_t;
|
||||
|
||||
typedef enum {
|
||||
AppTypeService,
|
||||
AppTypeSystem,
|
||||
AppTypeDesktop,
|
||||
AppTypeSettings,
|
||||
AppTypeUser
|
||||
} AppType;
|
||||
|
||||
typedef enum {
|
||||
AppStackSizeTiny = 512,
|
||||
AppStackSizeSmall = 1024,
|
||||
AppStackSizeNormal = 2048,
|
||||
AppStackSizeLarge = 4096,
|
||||
AppStackSizeHuge = 8192,
|
||||
} AppStackSize;
|
||||
|
||||
typedef void (*AppOnStart)(void _Nonnull* parameter);
|
||||
typedef void (*AppOnStop)();
|
||||
typedef void (*AppOnShow)(lv_obj_t* parent, void* context);
|
||||
|
||||
@ -6,10 +6,6 @@
|
||||
|
||||
#define TAG "app_registry"
|
||||
|
||||
typedef struct {
|
||||
const AppManifest* manifest;
|
||||
} AppEntry;
|
||||
|
||||
DICT_DEF2(AppManifestDict, const char*, M_CSTR_DUP_OPLIST, const AppManifest*, M_PTR_OPLIST)
|
||||
|
||||
#define APP_REGISTRY_FOR_EACH(manifest_var_name, code_to_execute) \
|
||||
@ -17,7 +13,7 @@ DICT_DEF2(AppManifestDict, const char*, M_CSTR_DUP_OPLIST, const AppManifest*, M
|
||||
app_registry_lock(); \
|
||||
AppManifestDict_it_t it; \
|
||||
for (AppManifestDict_it(it, app_manifest_dict); !AppManifestDict_end_p(it); AppManifestDict_next(it)) { \
|
||||
const AppManifest* (manifest_var_name) = AppManifestDict_cref(it)->value; \
|
||||
const AppManifest*(manifest_var_name) = AppManifestDict_cref(it)->value; \
|
||||
code_to_execute; \
|
||||
} \
|
||||
app_registry_unlock(); \
|
||||
|
||||
@ -37,7 +37,7 @@ FURI_NORETURN void __furi_halt_implementation();
|
||||
/** Crash system with message. */
|
||||
#define __furi_crash(message) \
|
||||
do { \
|
||||
ESP_LOGE("crash", "%s\n\tat %s:%d", ((message) ? ((const char*)message) : ""), __FILE__, __LINE__); \
|
||||
ESP_LOGE("crash", "%s\n\tat %s:%d", ((message) ? (message) : ""), __FILE__, __LINE__); \
|
||||
__furi_crash_implementation(); \
|
||||
} while (0)
|
||||
|
||||
@ -50,7 +50,7 @@ FURI_NORETURN void __furi_halt_implementation();
|
||||
/** Halt system with message. */
|
||||
#define __furi_halt(message) \
|
||||
do { \
|
||||
ESP_LOGE("halt", "%s\n\tat %s:%d", ((message) ? ((const char*)message) : ""), __FILE__, __LINE__); \
|
||||
ESP_LOGE("halt", "%s\n\tat %s:%d", ((message) ? (message) : ""), __FILE__, __LINE__); \
|
||||
__furi_halt_implementation(); \
|
||||
} while (0)
|
||||
|
||||
|
||||
@ -1,19 +1,18 @@
|
||||
#include "furi.h"
|
||||
#include "app_manifest_registry.h"
|
||||
#include <string.h>
|
||||
|
||||
#include "freertos/FreeRTOS.h"
|
||||
#include "freertos/queue.h"
|
||||
|
||||
#define TAG "furi"
|
||||
|
||||
void furi_init() {
|
||||
FURI_LOG_I(TAG, "init start");
|
||||
furi_assert(!furi_kernel_is_irq());
|
||||
|
||||
if (xTaskGetSchedulerState() == taskSCHEDULER_RUNNING) {
|
||||
vTaskSuspendAll();
|
||||
}
|
||||
|
||||
furi_record_init();
|
||||
|
||||
xTaskResumeAll();
|
||||
|
||||
#if defined(__ARM_ARCH_7A__) && (__ARM_ARCH_7A__ == 0U)
|
||||
@ -24,4 +23,5 @@ void furi_init() {
|
||||
#endif
|
||||
|
||||
app_manifest_registry_init();
|
||||
FURI_LOG_I(TAG, "init complete");
|
||||
}
|
||||
|
||||
@ -10,7 +10,6 @@
|
||||
#include "message_queue.h"
|
||||
#include "mutex.h"
|
||||
#include "pubsub.h"
|
||||
#include "record.h"
|
||||
#include "semaphore.h"
|
||||
#include "stream_buffer.h"
|
||||
#include "string.h"
|
||||
|
||||
@ -1,151 +0,0 @@
|
||||
#include "record.h"
|
||||
#include "check.h"
|
||||
#include "event_flag.h"
|
||||
#include "mutex.h"
|
||||
#include "m-dict.h"
|
||||
#include "m_cstr_dup.h"
|
||||
#include "log.h"
|
||||
|
||||
#define TAG "record"
|
||||
|
||||
#define FURI_RECORD_FLAG_READY (0x1)
|
||||
|
||||
typedef struct {
|
||||
FuriEventFlag* flags;
|
||||
void* data;
|
||||
size_t holders_count;
|
||||
} FuriRecordData;
|
||||
|
||||
DICT_DEF2(FuriRecordDataDict, const char*, M_CSTR_DUP_OPLIST, FuriRecordData, M_POD_OPLIST)
|
||||
|
||||
typedef struct {
|
||||
FuriMutex* mutex;
|
||||
FuriRecordDataDict_t records;
|
||||
} FuriRecord;
|
||||
|
||||
static FuriRecord* furi_record = NULL;
|
||||
|
||||
static FuriRecordData* furi_record_get(const char* name) {
|
||||
return FuriRecordDataDict_get(furi_record->records, name);
|
||||
}
|
||||
|
||||
static void furi_record_put(const char* name, FuriRecordData* record_data) {
|
||||
FuriRecordDataDict_set_at(furi_record->records, name, *record_data);
|
||||
}
|
||||
|
||||
static void furi_record_erase(const char* name, FuriRecordData* record_data) {
|
||||
furi_event_flag_free(record_data->flags);
|
||||
FuriRecordDataDict_erase(furi_record->records, name);
|
||||
}
|
||||
|
||||
void furi_record_init() {
|
||||
furi_record = malloc(sizeof(FuriRecord));
|
||||
furi_record->mutex = furi_mutex_alloc(FuriMutexTypeRecursive);
|
||||
furi_check(furi_record->mutex);
|
||||
FuriRecordDataDict_init(furi_record->records);
|
||||
}
|
||||
|
||||
static FuriRecordData* furi_record_data_get_or_create(const char* name) {
|
||||
furi_assert(furi_record);
|
||||
FuriRecordData* record_data = furi_record_get(name);
|
||||
if (!record_data) {
|
||||
FuriRecordData new_record;
|
||||
new_record.flags = furi_event_flag_alloc();
|
||||
new_record.data = NULL;
|
||||
new_record.holders_count = 0;
|
||||
furi_record_put(name, &new_record);
|
||||
record_data = furi_record_get(name);
|
||||
}
|
||||
return record_data;
|
||||
}
|
||||
|
||||
static void furi_record_lock() {
|
||||
furi_check(furi_mutex_acquire(furi_record->mutex, FuriWaitForever) == FuriStatusOk);
|
||||
}
|
||||
|
||||
static void furi_record_unlock() {
|
||||
furi_check(furi_mutex_release(furi_record->mutex) == FuriStatusOk);
|
||||
}
|
||||
|
||||
bool furi_record_exists(const char* name) {
|
||||
furi_assert(furi_record);
|
||||
furi_assert(name);
|
||||
|
||||
bool ret = false;
|
||||
|
||||
furi_record_lock();
|
||||
ret = (furi_record_get(name) != NULL);
|
||||
furi_record_unlock();
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
void furi_record_create(const char* name, void* data) {
|
||||
furi_assert(furi_record);
|
||||
|
||||
furi_record_lock();
|
||||
|
||||
// Get record data and fill it
|
||||
FuriRecordData* record_data = furi_record_data_get_or_create(name);
|
||||
furi_assert(record_data->data == NULL);
|
||||
record_data->data = data;
|
||||
furi_event_flag_set(record_data->flags, FURI_RECORD_FLAG_READY);
|
||||
|
||||
furi_record_unlock();
|
||||
}
|
||||
|
||||
bool furi_record_destroy(const char* name) {
|
||||
furi_assert(furi_record);
|
||||
|
||||
bool ret = false;
|
||||
|
||||
furi_record_lock();
|
||||
|
||||
FuriRecordData* record_data = furi_record_get(name);
|
||||
furi_assert(record_data);
|
||||
if (record_data->holders_count == 0) {
|
||||
furi_record_erase(name, record_data);
|
||||
ret = true;
|
||||
}
|
||||
|
||||
furi_record_unlock();
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
void* furi_record_open(const char* name) {
|
||||
furi_assert(name);
|
||||
furi_assert(furi_record);
|
||||
|
||||
furi_record_lock();
|
||||
|
||||
FuriRecordData* record_data = furi_record_data_get_or_create(name);
|
||||
record_data->holders_count++;
|
||||
|
||||
furi_record_unlock();
|
||||
|
||||
// Wait for record to become ready
|
||||
furi_check(
|
||||
furi_event_flag_wait(
|
||||
record_data->flags,
|
||||
FURI_RECORD_FLAG_READY,
|
||||
FuriFlagWaitAny | FuriFlagNoClear,
|
||||
FuriWaitForever
|
||||
) == FURI_RECORD_FLAG_READY
|
||||
);
|
||||
|
||||
return record_data->data;
|
||||
}
|
||||
|
||||
void furi_record_close(const char* name) {
|
||||
furi_assert(name);
|
||||
furi_assert(furi_record);
|
||||
|
||||
furi_record_lock();
|
||||
|
||||
FuriRecordData* record_data = furi_record_get(name);
|
||||
furi_assert(record_data);
|
||||
record_data->holders_count--;
|
||||
|
||||
furi_record_unlock();
|
||||
}
|
||||
@ -1,80 +0,0 @@
|
||||
/**
|
||||
* @file record.h
|
||||
* Furi: record API
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "furi_extra_defines.h"
|
||||
#include <stdbool.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/**
|
||||
* Opens a record, calls the code and then closes the record.
|
||||
* @param record_name const char* that contains the name of the record
|
||||
* @param variable_name the name of the variable that is used in the `code`
|
||||
* @param code the code to execute: consider putting it between {}
|
||||
*/
|
||||
#define FURI_RECORD_TRANSACTION(record_name, variable_type, variable_name, code) \
|
||||
{ \
|
||||
variable_type (variable_name) = (variable_type)furi_record_open(record_name); \
|
||||
code; \
|
||||
furi_record_close(record_name); \
|
||||
}
|
||||
|
||||
/** Initialize record storage For internal use only.
|
||||
*/
|
||||
void furi_record_init();
|
||||
|
||||
/** Check if record exists
|
||||
*
|
||||
* @param name record name
|
||||
* @note Thread safe. Create and destroy must be executed from the same
|
||||
* thread.
|
||||
*/
|
||||
bool furi_record_exists(const char* name);
|
||||
|
||||
/** Create record
|
||||
*
|
||||
* @param name record name
|
||||
* @param data data pointer
|
||||
* @note Thread safe. Create and destroy must be executed from the same
|
||||
* thread.
|
||||
*/
|
||||
void furi_record_create(const char* name, void* data);
|
||||
|
||||
/** Destroy record
|
||||
*
|
||||
* @param name record name
|
||||
*
|
||||
* @return true if successful, false if still have holders or thread is not
|
||||
* owner.
|
||||
* @note Thread safe. Create and destroy must be executed from the same
|
||||
* thread.
|
||||
*/
|
||||
bool furi_record_destroy(const char* name);
|
||||
|
||||
/** Open record
|
||||
*
|
||||
* @param name record name
|
||||
*
|
||||
* @return pointer to the record
|
||||
* @note Thread safe. Open and close must be executed from the same
|
||||
* thread. Suspends caller thread till record is available
|
||||
*/
|
||||
FURI_RETURNS_NONNULL void* furi_record_open(const char* name);
|
||||
|
||||
/** Close record
|
||||
*
|
||||
* @param name record name
|
||||
* @note Thread safe. Open and close must be executed from the same
|
||||
* thread.
|
||||
*/
|
||||
void furi_record_close(const char* name);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
32
components/furi/src/service_manifest.h
Normal file
32
components/furi/src/service_manifest.h
Normal file
@ -0,0 +1,32 @@
|
||||
#pragma once
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
typedef void (*ServiceOnStart)(void _Nonnull* parameter);
|
||||
typedef void (*ServiceOnStop)();
|
||||
|
||||
typedef struct {
|
||||
/**
|
||||
* The identifier by which the app is launched by the system and other apps.
|
||||
*/
|
||||
const char* _Nonnull id;
|
||||
|
||||
/**
|
||||
* Non-blocking method to call when service is started.
|
||||
*/
|
||||
const ServiceOnStart _Nullable on_start;
|
||||
|
||||
/**
|
||||
* Non-blocking method to call when service is stopped.
|
||||
*/
|
||||
const ServiceOnStop _Nullable on_stop;
|
||||
|
||||
} ServiceManifest;
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
@ -1,10 +1,10 @@
|
||||
idf_component_register(
|
||||
SRC_DIRS "src"
|
||||
"src/apps/system/system_info"
|
||||
"src/apps/services/desktop"
|
||||
"src/apps/services/loader"
|
||||
"src/apps/services/gui"
|
||||
"src/apps/services/gui/widgets"
|
||||
"src/services/desktop"
|
||||
"src/services/loader"
|
||||
"src/services/gui"
|
||||
"src/services/gui/widgets"
|
||||
INCLUDE_DIRS "src"
|
||||
REQUIRES esp_lvgl_port esp_lcd esp_lcd_touch driver mlib cmsis_core furi nvs_flash spiffs fatfs
|
||||
)
|
||||
|
||||
@ -1,13 +0,0 @@
|
||||
#pragma once
|
||||
|
||||
#include "app_manifest.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
extern const AppManifest desktop_app;
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
@ -4,52 +4,66 @@
|
||||
#include "furi.h"
|
||||
#include "graphics_i.h"
|
||||
#include "partitions.h"
|
||||
#include "apps/services/gui/gui.h"
|
||||
#include "services/gui/gui.h"
|
||||
|
||||
#define TAG "nanobake"
|
||||
|
||||
Gui* gui_alloc();
|
||||
|
||||
// System services
|
||||
extern const AppManifest gui_app;
|
||||
extern const AppManifest loader_app;
|
||||
|
||||
// Desktop
|
||||
extern const AppManifest desktop_app;
|
||||
extern const ServiceManifest gui_service;
|
||||
extern const ServiceManifest loader_service;
|
||||
extern const ServiceManifest desktop_service;
|
||||
|
||||
// System apps
|
||||
extern const AppManifest system_info_app;
|
||||
|
||||
void start_service(const AppManifest* _Nonnull manifest, void* _Nullable context) {
|
||||
UNUSED(context);
|
||||
FURI_LOG_I(TAG, "Starting service %s", manifest->name);
|
||||
void start_service(const ServiceManifest* _Nonnull manifest) {
|
||||
FURI_LOG_I(TAG, "Starting service %s", manifest->id);
|
||||
furi_check(manifest->on_start, "service must define on_start");
|
||||
manifest->on_start(NULL);
|
||||
// TODO: keep track of running services
|
||||
}
|
||||
|
||||
static void register_apps(Config* _Nonnull config) {
|
||||
FURI_LOG_I(TAG, "Registering core apps");
|
||||
app_manifest_registry_add(&gui_app);
|
||||
app_manifest_registry_add(&desktop_app);
|
||||
app_manifest_registry_add(&loader_app);
|
||||
static void register_system_apps() {
|
||||
FURI_LOG_I(TAG, "Registering default apps");
|
||||
app_manifest_registry_add(&system_info_app);
|
||||
}
|
||||
|
||||
static void register_user_apps(const Config* _Nonnull config) {
|
||||
FURI_LOG_I(TAG, "Registering user apps");
|
||||
for (size_t i = 0; i < config->apps_count; i++) {
|
||||
app_manifest_registry_add(config->apps[i]);
|
||||
for (size_t i = 0; i < CONFIG_APPS_LIMIT; i++) {
|
||||
const AppManifest* manifest = config->apps[i];
|
||||
if (manifest != NULL) {
|
||||
app_manifest_registry_add(manifest);
|
||||
} else {
|
||||
// reached end of list
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void start_services() {
|
||||
FURI_LOG_I(TAG, "Starting services");
|
||||
app_manifest_registry_for_each_of_type(AppTypeService, NULL, start_service);
|
||||
FURI_LOG_I(TAG, "Startup complete");
|
||||
static void start_system_services() {
|
||||
FURI_LOG_I(TAG, "Starting system services");
|
||||
start_service(&gui_service);
|
||||
start_service(&loader_service);
|
||||
start_service(&desktop_service);
|
||||
FURI_LOG_I(TAG, "System services started");
|
||||
}
|
||||
|
||||
static void start_desktop() {
|
||||
FURI_LOG_I(TAG, "Starting desktop");
|
||||
desktop_app.on_start(NULL);
|
||||
FURI_LOG_I(TAG, "Startup complete");
|
||||
static void start_user_services(const Config* _Nonnull config) {
|
||||
FURI_LOG_I(TAG, "Starting user services");
|
||||
for (size_t i = 0; i < CONFIG_SERVICES_LIMIT; i++) {
|
||||
const ServiceManifest* manifest = config->services[i];
|
||||
if (manifest != NULL) {
|
||||
// TODO: keep track of running services
|
||||
manifest->on_start(NULL);
|
||||
} else {
|
||||
// reached end of list
|
||||
break;
|
||||
}
|
||||
}
|
||||
FURI_LOG_I(TAG, "User services started");
|
||||
}
|
||||
|
||||
__attribute__((unused)) extern void nanobake_start(const Config* _Nonnull config) {
|
||||
@ -60,8 +74,11 @@ __attribute__((unused)) extern void nanobake_start(const Config* _Nonnull config
|
||||
Hardware hardware = nb_hardware_init(config->hardware);
|
||||
/*NbLvgl lvgl =*/nb_graphics_init(&hardware);
|
||||
|
||||
register_apps(config);
|
||||
// Register all apps
|
||||
register_system_apps();
|
||||
register_user_apps(config);
|
||||
|
||||
start_services();
|
||||
start_desktop();
|
||||
// Start all services
|
||||
start_system_services();
|
||||
start_user_services(config);
|
||||
}
|
||||
|
||||
@ -3,11 +3,15 @@
|
||||
#include "app_manifest.h"
|
||||
#include "devices.h"
|
||||
#include "furi_extra_defines.h"
|
||||
#include "service_manifest.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#define CONFIG_APPS_LIMIT 32
|
||||
#define CONFIG_SERVICES_LIMIT 32
|
||||
|
||||
// Forward declarations
|
||||
typedef void* FuriThreadId;
|
||||
typedef void (*Bootstrap)();
|
||||
@ -26,8 +30,8 @@ typedef struct {
|
||||
typedef struct {
|
||||
const HardwareConfig* hardware;
|
||||
// List of user applications
|
||||
const size_t apps_count;
|
||||
const AppManifest* const apps[];
|
||||
const AppManifest* const apps[CONFIG_APPS_LIMIT];
|
||||
const ServiceManifest* const services[CONFIG_SERVICES_LIMIT];
|
||||
} Config;
|
||||
|
||||
__attribute__((unused)) extern void nanobake_start(const Config _Nonnull* config);
|
||||
|
||||
@ -1,10 +1,9 @@
|
||||
#include "desktop.h"
|
||||
#include "lvgl.h"
|
||||
#include "check.h"
|
||||
#include "apps/services/loader/loader.h"
|
||||
#include "apps/services/gui/gui.h"
|
||||
#include "apps/services/gui/view_port.h"
|
||||
#include "app_manifest_registry.h"
|
||||
#include "check.h"
|
||||
#include "lvgl.h"
|
||||
#include "services/gui/gui.h"
|
||||
#include "services/gui/view_port.h"
|
||||
#include "services/loader/loader.h"
|
||||
|
||||
static void on_open_app(lv_event_t* e) {
|
||||
lv_event_code_t code = lv_event_get_code(e);
|
||||
@ -42,12 +41,8 @@ static void desktop_stop() {
|
||||
furi_crash("desktop_stop is not implemented");
|
||||
}
|
||||
|
||||
const AppManifest desktop_app = {
|
||||
const ServiceManifest desktop_service = {
|
||||
.id = "desktop",
|
||||
.name = "Desktop",
|
||||
.icon = NULL,
|
||||
.type = AppTypeDesktop,
|
||||
.on_start = &desktop_start,
|
||||
.on_stop = &desktop_stop,
|
||||
.on_show = NULL
|
||||
.on_stop = &desktop_stop
|
||||
};
|
||||
@ -3,7 +3,6 @@
|
||||
#include "furi_extra_defines.h"
|
||||
#include "gui_i.h"
|
||||
#include "log.h"
|
||||
#include "record.h"
|
||||
#include "kernel.h"
|
||||
|
||||
#define TAG "gui"
|
||||
@ -21,7 +20,7 @@ Gui* gui_alloc() {
|
||||
furi_check(instance != NULL);
|
||||
instance->thread = furi_thread_alloc_ex(
|
||||
"gui",
|
||||
AppStackSizeLarge, // Last known minimum was 2800 for launching desktop
|
||||
4096, // Last known minimum was 2800 for launching desktop
|
||||
&gui_main,
|
||||
NULL
|
||||
);
|
||||
@ -165,14 +164,10 @@ static void gui_stop() {
|
||||
gui_free(gui);
|
||||
}
|
||||
|
||||
const AppManifest gui_app = {
|
||||
const ServiceManifest gui_service = {
|
||||
.id = "gui",
|
||||
.name = "GUI",
|
||||
.icon = NULL,
|
||||
.type = AppTypeService,
|
||||
.on_start = &gui_start,
|
||||
.on_stop = &gui_stop,
|
||||
.on_show = NULL
|
||||
.on_stop = &gui_stop
|
||||
};
|
||||
|
||||
// endregion
|
||||
@ -1,20 +1,18 @@
|
||||
#pragma once
|
||||
|
||||
#include "app_manifest.h"
|
||||
#include "service_manifest.h"
|
||||
#include "view_port.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
extern const AppManifest gui_app;
|
||||
|
||||
/** Gui layers */
|
||||
typedef enum {
|
||||
GuiLayerDesktop, /**< Desktop layer for internal use. Like fullscreen but with status bar */
|
||||
GuiLayerWindow, /**< Window layer, status bar is shown */
|
||||
GuiLayerDesktop, /**< Desktop layer for internal use. Like fullscreen but with status bar */
|
||||
GuiLayerWindow, /**< Window layer, status bar is shown */
|
||||
GuiLayerFullscreen, /**< Fullscreen layer, no status bar */
|
||||
GuiLayerMAX /**< Don't use or move, special value */
|
||||
GuiLayerMAX /**< Don't use or move, special value */
|
||||
} GuiLayer;
|
||||
|
||||
typedef struct Gui Gui;
|
||||
@ -1,10 +1,9 @@
|
||||
#include "check.h"
|
||||
#include "esp_lvgl_port.h"
|
||||
#include "gui_i.h"
|
||||
#include "log.h"
|
||||
#include "record.h"
|
||||
#include "esp_lvgl_port.h"
|
||||
#include "apps/services/gui/widgets/widgets.h"
|
||||
#include "apps/services/loader/loader.h"
|
||||
#include "services/gui/widgets/widgets.h"
|
||||
#include "services/loader/loader.h"
|
||||
|
||||
#define TAG "gui"
|
||||
|
||||
@ -1,8 +1,7 @@
|
||||
#include "apps/services/gui/widgets/widgets.h"
|
||||
#include "check.h"
|
||||
#include "esp_lvgl_port.h"
|
||||
#include "gui.h"
|
||||
#include "gui_i.h"
|
||||
#include "services/gui/widgets/widgets.h"
|
||||
#include "view_port_i.h"
|
||||
|
||||
#define TAG "viewport"
|
||||
@ -1,7 +1,6 @@
|
||||
#include "toolbar.h"
|
||||
#include "record.h"
|
||||
#include "apps/services/gui/widgets/widgets.h"
|
||||
#include "apps/services/loader/loader.h"
|
||||
#include "services/gui/widgets/widgets.h"
|
||||
#include "services/loader/loader.h"
|
||||
|
||||
static void app_toolbar_close(lv_event_t* event) {
|
||||
loader_stop_app();
|
||||
@ -19,7 +18,7 @@ void toolbar(lv_obj_t* parent, lv_coord_t offset_y, const AppManifest* manifest)
|
||||
lv_obj_t* close_button = lv_btn_create(toolbar);
|
||||
lv_obj_set_size(close_button, TOOLBAR_HEIGHT - 4, TOOLBAR_HEIGHT - 4);
|
||||
lv_obj_set_style_no_padding(close_button);
|
||||
lv_obj_add_event_cb(close_button, &app_toolbar_close,LV_EVENT_CLICKED, NULL);
|
||||
lv_obj_add_event_cb(close_button, &app_toolbar_close, LV_EVENT_CLICKED, NULL);
|
||||
lv_obj_t* close_button_image = lv_img_create(close_button);
|
||||
lv_img_set_src(close_button_image, LV_SYMBOL_CLOSE);
|
||||
lv_obj_align(close_button_image, LV_ALIGN_CENTER, 0, 0);
|
||||
@ -1,12 +1,13 @@
|
||||
#include "loader.h"
|
||||
#include "app_i.h"
|
||||
#include "app_manifest.h"
|
||||
#include "app_manifest_registry.h"
|
||||
#include "loader_i.h"
|
||||
#include <sys/cdefs.h>
|
||||
#include "esp_heap_caps.h"
|
||||
#include "apps/services/gui/gui.h"
|
||||
#include "freertos/FreeRTOS.h"
|
||||
#include "freertos/semphr.h"
|
||||
#include "loader_i.h"
|
||||
#include "service_manifest.h"
|
||||
#include "services/gui/gui.h"
|
||||
#include <sys/cdefs.h>
|
||||
|
||||
#define TAG "Loader"
|
||||
|
||||
@ -22,7 +23,7 @@ static Loader* loader_alloc() {
|
||||
loader->queue = furi_message_queue_alloc(1, sizeof(LoaderMessage));
|
||||
loader->thread = furi_thread_alloc_ex(
|
||||
"loader",
|
||||
AppStackSizeLarge, // Last known minimum was 2400 for starting Hello World app
|
||||
4096, // Last known minimum was 2400 for starting Hello World app
|
||||
&loader_main,
|
||||
NULL
|
||||
);
|
||||
@ -307,14 +308,10 @@ static void loader_stop() {
|
||||
loader = NULL;
|
||||
}
|
||||
|
||||
const AppManifest loader_app = {
|
||||
const ServiceManifest loader_service = {
|
||||
.id = "loader",
|
||||
.name = "Loader",
|
||||
.icon = NULL,
|
||||
.type = AppTypeService,
|
||||
.on_start = &loader_start,
|
||||
.on_stop = &loader_stop,
|
||||
.on_show = NULL
|
||||
.on_stop = &loader_stop
|
||||
};
|
||||
|
||||
// endregion
|
||||
@ -1,8 +1,9 @@
|
||||
#pragma once
|
||||
#include "app_manifest.h"
|
||||
#include "furi_core.h"
|
||||
#include "furi_string.h"
|
||||
#include "pubsub.h"
|
||||
#include "app_manifest.h"
|
||||
#include "service_manifest.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
@ -1,12 +1,13 @@
|
||||
#pragma once
|
||||
|
||||
#include "api_lock.h"
|
||||
#include "app_manifest.h"
|
||||
#include "apps/services/gui/view_port.h"
|
||||
#include "freertos/FreeRTOS.h"
|
||||
#include "freertos/semphr.h"
|
||||
#include "loader.h"
|
||||
#include "message_queue.h"
|
||||
#include "pubsub.h"
|
||||
#include "services/gui/view_port.h"
|
||||
#include "thread.h"
|
||||
|
||||
typedef struct {
|
||||
@ -1,6 +1,6 @@
|
||||
#include "hello_world.h"
|
||||
#include "apps/services/gui/gui.h"
|
||||
#include "apps/services/loader/loader.h"
|
||||
#include "services/gui/gui.h"
|
||||
#include "services/loader/loader.h"
|
||||
|
||||
static void app_show(lv_obj_t* parent, void* context) {
|
||||
UNUSED(context);
|
||||
|
||||
@ -8,9 +8,12 @@ __attribute__((unused)) void app_main(void) {
|
||||
static const Config config = {
|
||||
.hardware = NB_BOARD_HARDWARE,
|
||||
.apps = {
|
||||
&hello_world_app
|
||||
&hello_world_app,
|
||||
NULL // NULL terminator - do not remove
|
||||
},
|
||||
.services = {
|
||||
NULL // NULL terminator - do not remove
|
||||
},
|
||||
.apps_count = 1
|
||||
};
|
||||
|
||||
nanobake_start(&config);
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user