mirror of
https://github.com/ByteWelder/Tactility.git
synced 2026-02-18 10:53:17 +00:00
cleanup filenames and extern usage
This commit is contained in:
parent
1cafa1ec1a
commit
60372076d5
@ -1,6 +1,6 @@
|
||||
#pragma once
|
||||
|
||||
#include "nb_display.h"
|
||||
#include "display.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
#pragma once
|
||||
|
||||
#include "nb_touch.h"
|
||||
#include "touch.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
#include "app_i.h"
|
||||
#include "check.h"
|
||||
#include "nb_app_i.h"
|
||||
|
||||
const char* prv_type_service = "service";
|
||||
const char* prv_type_system = "system";
|
||||
@ -1,12 +1,12 @@
|
||||
#pragma once
|
||||
|
||||
#include "nb_app.h"
|
||||
#include "app.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
extern const char* nb_app_type_to_string(AppType type);
|
||||
const char* nb_app_type_to_string(AppType type);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
28
components/nanobake/src/applications/applications.c
Normal file
28
components/nanobake/src/applications/applications.c
Normal file
@ -0,0 +1,28 @@
|
||||
#include "applications_i.h"
|
||||
|
||||
// System services
|
||||
extern const App desktop_app;
|
||||
extern const App gui_app;
|
||||
extern const App loader_app;
|
||||
|
||||
// System apps
|
||||
extern const App system_info_app;
|
||||
|
||||
const App* const NANOBAKE_SERVICES[] = {
|
||||
&desktop_app,
|
||||
&gui_app,
|
||||
&loader_app
|
||||
};
|
||||
|
||||
const size_t NANOBAKE_SERVICES_COUNT = sizeof(NANOBAKE_SERVICES) / sizeof(App*);
|
||||
|
||||
const App* const NANOBAKE_SYSTEM_APPS[] = {
|
||||
&system_info_app
|
||||
};
|
||||
|
||||
const size_t NANOBAKE_SYSTEM_APPS_COUNT = sizeof(NANOBAKE_SYSTEM_APPS) / sizeof(App*);
|
||||
|
||||
const OnSystemStart NANOBAKE_ON_SYSTEM_START[] = {
|
||||
};
|
||||
|
||||
const size_t NANOBAKE_ON_SYSTEM_START_COUNT = sizeof(NANOBAKE_ON_SYSTEM_START) / sizeof(OnSystemStart);
|
||||
23
components/nanobake/src/applications/applications_i.h
Normal file
23
components/nanobake/src/applications/applications_i.h
Normal file
@ -0,0 +1,23 @@
|
||||
#pragma once
|
||||
|
||||
#include "app.h"
|
||||
#include "devices.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
typedef void (*OnSystemStart)(Devices* hardware);
|
||||
|
||||
extern const App* const NANOBAKE_SERVICES[];
|
||||
extern const size_t NANOBAKE_SERVICES_COUNT;
|
||||
|
||||
extern const App* const NANOBAKE_SYSTEM_APPS[];
|
||||
extern const size_t NANOBAKE_SYSTEM_APPS_COUNT;
|
||||
|
||||
extern const OnSystemStart NANOBAKE_ON_SYSTEM_START[];
|
||||
extern const size_t NANOBAKE_ON_SYSTEM_START_COUNT;
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
@ -1,28 +0,0 @@
|
||||
#include "nb_applications.h"
|
||||
|
||||
// System services
|
||||
extern const App desktop_app;
|
||||
extern const App gui_app;
|
||||
extern const App loader_app;
|
||||
|
||||
// System apps
|
||||
extern const App system_info_app;
|
||||
|
||||
const App* const FLIPPER_SERVICES[] = {
|
||||
&desktop_app,
|
||||
&gui_app,
|
||||
&loader_app
|
||||
};
|
||||
|
||||
const size_t FLIPPER_SERVICES_COUNT = sizeof(FLIPPER_SERVICES) / sizeof(App*);
|
||||
|
||||
const App* const FLIPPER_SYSTEM_APPS[] = {
|
||||
&system_info_app
|
||||
};
|
||||
|
||||
const size_t FLIPPER_SYSTEM_APPS_COUNT = sizeof(FLIPPER_SYSTEM_APPS) / sizeof(App*);
|
||||
|
||||
const OnSystemStart FLIPPER_ON_SYSTEM_START[] = {
|
||||
};
|
||||
|
||||
const size_t FLIPPER_ON_SYSTEM_START_COUNT = sizeof(FLIPPER_ON_SYSTEM_START) / sizeof(OnSystemStart);
|
||||
@ -1,23 +0,0 @@
|
||||
#pragma once
|
||||
|
||||
#include "devices.h"
|
||||
#include "nb_app.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
typedef void (*OnSystemStart)(Devices* hardware);
|
||||
|
||||
extern const App* const FLIPPER_SERVICES[];
|
||||
extern const size_t FLIPPER_SERVICES_COUNT;
|
||||
|
||||
extern const App* const FLIPPER_SYSTEM_APPS[];
|
||||
extern const size_t FLIPPER_SYSTEM_APPS_COUNT;
|
||||
|
||||
extern const OnSystemStart FLIPPER_ON_SYSTEM_START[];
|
||||
extern const size_t FLIPPER_ON_SYSTEM_START_COUNT;
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
@ -1,6 +1,6 @@
|
||||
#pragma once
|
||||
|
||||
#include "nb_app.h"
|
||||
#include "app.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
#pragma once
|
||||
|
||||
#include "app.h"
|
||||
#include "lvgl.h"
|
||||
#include "nb_app.h"
|
||||
#include "view_port.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
#pragma once
|
||||
|
||||
#include "nb_app.h"
|
||||
#include "app.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
#pragma once
|
||||
|
||||
#include "nb_app.h"
|
||||
#include "app.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
|
||||
@ -1,12 +1,11 @@
|
||||
#include "check.h"
|
||||
#include "devices_i.h"
|
||||
#include "esp_check.h"
|
||||
#include "esp_err.h"
|
||||
#include "nb_hardware_i.h"
|
||||
|
||||
#define TAG "hardware"
|
||||
|
||||
Devices nb_hardware_create(Config _Nonnull* config) {
|
||||
|
||||
Devices nb_devices_create(Config _Nonnull* config) {
|
||||
furi_check(config->display_driver != NULL, "no display driver configured");
|
||||
DisplayDriver display_driver = config->display_driver();
|
||||
ESP_LOGI(TAG, "display with driver %s", display_driver.name);
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
#pragma once
|
||||
|
||||
#include "nb_display.h"
|
||||
#include "nb_touch.h"
|
||||
#include "display.h"
|
||||
#include "touch.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
|
||||
13
components/nanobake/src/devices_i.h
Normal file
13
components/nanobake/src/devices_i.h
Normal file
@ -0,0 +1,13 @@
|
||||
#pragma once
|
||||
|
||||
#include "nanobake.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
Devices nb_devices_create(Config _Nonnull* config);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
@ -1,5 +1,5 @@
|
||||
#include "nb_display.h"
|
||||
#include "check.h"
|
||||
#include "display.h"
|
||||
|
||||
DisplayDevice _Nonnull* nb_display_alloc(DisplayDriver _Nonnull* driver) {
|
||||
DisplayDevice _Nonnull* display = malloc(sizeof(DisplayDevice));
|
||||
@ -1,10 +1,10 @@
|
||||
#include "check.h"
|
||||
#include "esp_lvgl_port.h"
|
||||
#include "nb_lvgl_i.h"
|
||||
#include "graphics_i.h"
|
||||
|
||||
#define TAG "lvgl"
|
||||
|
||||
Lvgl nb_lvgl_init(Devices _Nonnull* hardware) {
|
||||
Lvgl nb_graphics_init(Devices _Nonnull* hardware) {
|
||||
const lvgl_port_cfg_t lvgl_cfg = {
|
||||
.task_priority = 4,
|
||||
.task_stack = 4096,
|
||||
@ -1,14 +1,13 @@
|
||||
#pragma once
|
||||
|
||||
#include "devices.h"
|
||||
#include "nb_lvgl.h"
|
||||
#include "graphics.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
extern Lvgl nb_lvgl_init(Devices _Nonnull* hardware);
|
||||
|
||||
Lvgl nb_graphics_init(Devices _Nonnull* hardware);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
@ -1,10 +1,10 @@
|
||||
#include "nanobake.h"
|
||||
#include "applications/nb_applications.h"
|
||||
#include "app_i.h"
|
||||
#include "applications/applications_i.h"
|
||||
#include "devices_i.h"
|
||||
#include "esp_log.h"
|
||||
#include "graphics_i.h"
|
||||
#include "m-list.h"
|
||||
#include "nb_app_i.h"
|
||||
#include "nb_hardware_i.h"
|
||||
#include "nb_lvgl_i.h"
|
||||
// Furi
|
||||
#include "kernel.h"
|
||||
#include "record.h"
|
||||
@ -60,21 +60,21 @@ static void prv_start_app(const App _Nonnull* app) {
|
||||
__attribute__((unused)) extern void nanobake_start(Config _Nonnull* config) {
|
||||
prv_furi_init();
|
||||
|
||||
Devices hardware = nb_hardware_create(config);
|
||||
/*NbLvgl lvgl =*/nb_lvgl_init(&hardware);
|
||||
Devices hardware = nb_devices_create(config);
|
||||
/*NbLvgl lvgl =*/nb_graphics_init(&hardware);
|
||||
|
||||
thread_ids_init(prv_thread_ids);
|
||||
|
||||
ESP_LOGI(TAG, "Starting apps");
|
||||
|
||||
// Services
|
||||
for (size_t i = 0; i < FLIPPER_SERVICES_COUNT; i++) {
|
||||
prv_start_app(FLIPPER_SERVICES[i]);
|
||||
for (size_t i = 0; i < NANOBAKE_SERVICES_COUNT; i++) {
|
||||
prv_start_app(NANOBAKE_SERVICES[i]);
|
||||
}
|
||||
|
||||
// System
|
||||
for (size_t i = 0; i < FLIPPER_SYSTEM_APPS_COUNT; i++) {
|
||||
prv_start_app(FLIPPER_SYSTEM_APPS[i]);
|
||||
for (size_t i = 0; i < NANOBAKE_SYSTEM_APPS_COUNT; i++) {
|
||||
prv_start_app(NANOBAKE_SYSTEM_APPS[i]);
|
||||
}
|
||||
|
||||
// User
|
||||
|
||||
@ -1,8 +1,9 @@
|
||||
#pragma once
|
||||
|
||||
#include "app.h"
|
||||
#include "devices.h"
|
||||
#include "nb_app.h"
|
||||
#include "nb_config.h"
|
||||
#include "core_defines.h"
|
||||
#include "base.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
@ -10,11 +11,23 @@ extern "C" {
|
||||
|
||||
// Forward declarations
|
||||
typedef void* FuriThreadId;
|
||||
typedef TouchDriver (*CreateTouchDriver)();
|
||||
typedef DisplayDriver (*CreateDisplayDriver)();
|
||||
|
||||
typedef struct {
|
||||
// Required driver for display
|
||||
const CreateDisplayDriver _Nonnull display_driver;
|
||||
// Optional driver for touch input
|
||||
const CreateTouchDriver _Nullable touch_driver;
|
||||
// List of user applications
|
||||
const size_t apps_count;
|
||||
const App* const apps[];
|
||||
} Config;
|
||||
|
||||
__attribute__((unused)) extern void nanobake_start(Config _Nonnull* config);
|
||||
|
||||
extern FuriThreadId nanobake_get_app_thread_id(size_t index);
|
||||
extern size_t nanobake_get_app_thread_count();
|
||||
FuriThreadId nanobake_get_app_thread_id(size_t index);
|
||||
size_t nanobake_get_app_thread_count();
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
||||
@ -1,26 +0,0 @@
|
||||
#pragma once
|
||||
|
||||
#include "nb_app.h"
|
||||
#include "nb_display.h"
|
||||
#include "nb_touch.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
typedef TouchDriver (*CreateTouchDriver)();
|
||||
typedef DisplayDriver (*CreateDisplayDriver)();
|
||||
|
||||
typedef struct {
|
||||
// Required driver for display
|
||||
const CreateDisplayDriver _Nonnull display_driver;
|
||||
// Optional driver for touch input
|
||||
const CreateTouchDriver _Nullable touch_driver;
|
||||
// List of user applications
|
||||
const size_t apps_count;
|
||||
const App* const apps[];
|
||||
} Config;
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
@ -1,14 +0,0 @@
|
||||
#pragma once
|
||||
|
||||
#include "devices.h"
|
||||
#include "nb_config.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
extern Devices nb_hardware_create(Config _Nonnull* config);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
@ -1,5 +1,5 @@
|
||||
#include "nb_touch.h"
|
||||
#include "check.h"
|
||||
#include "touch.h"
|
||||
|
||||
TouchDevice _Nonnull* nb_touch_alloc(TouchDriver _Nonnull* driver) {
|
||||
TouchDevice _Nonnull* touch = malloc(sizeof(TouchDevice));
|
||||
@ -1,9 +1,9 @@
|
||||
#include "hello_world.h"
|
||||
#include "record.h"
|
||||
#include "nb_lvgl.h"
|
||||
#include "applications/services/gui/gui.h"
|
||||
#include "esp_lvgl_port.h"
|
||||
#include "esp_log.h"
|
||||
#include "esp_lvgl_port.h"
|
||||
#include "graphics.h"
|
||||
#include "record.h"
|
||||
|
||||
static const char* TAG = "app_helloworld";
|
||||
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
#pragma once
|
||||
|
||||
#include "nb_app.h"
|
||||
#include "app.h"
|
||||
|
||||
extern const App hello_world_app;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user