C++ refactoring (#91)

This commit is contained in:
Ken Van Hoeylandt
2024-11-26 17:51:05 +01:00
committed by GitHub
parent d06137ba76
commit ca5d4b8226
159 changed files with 904 additions and 1086 deletions
-33
View File
@@ -1,33 +0,0 @@
#pragma once
#include "App.h"
#include "AppManifest.h"
#include "Mutex.h"
namespace tt {
class AppData {
public:
Mutex* mutex;
const AppManifest* manifest;
AppState state = AppStateInitial;
/** @brief Memory marker at start of app, to detect memory leaks */
size_t memory = 0;
AppFlags flags = {
.flags = 0
};
/** @brief Optional parameters to start the app with
* When these are stored in the app struct, the struct takes ownership.
* Do not mutate after app creation.
*/
Bundle parameters;
/** @brief @brief Contextual data related to the running app's instance
* The app can attach its data to this.
* The lifecycle is determined by the on_start and on_stop methods in the AppManifest.
* These manifest methods can optionally allocate/free data that is attached here.
*/
void* _Nullable data = nullptr;
};
} // namespace
-9
View File
@@ -1,9 +0,0 @@
#pragma once
#include "Hal/Configuration.h"
namespace tt {
void lvgl_init(const hal::Configuration* config);
} // namespace
@@ -3,9 +3,9 @@
#include "MessageQueue.h"
#include "Mutex.h"
#include "Pubsub.h"
#include "Services/Gui/Gui.h"
#include "Services/Gui/ViewPort.h"
#include "Services/Gui/ViewPort_i.h"
#include "service/gui/Gui.h"
#include "service/gui/ViewPort.h"
#include "service/gui/ViewPort_i.h"
#include <cstdio>
namespace tt::service::gui {
@@ -1,6 +1,6 @@
#pragma once
#include "Services/Gui/ViewPort.h"
#include "service/gui/ViewPort.h"
namespace tt::service::gui {
@@ -1,12 +1,11 @@
#pragma once
#include "ApiLock.h"
#include "AppManifest.h"
#include "app/Manifest.h"
#include "MessageQueue.h"
#include "Pubsub.h"
#include "Thread.h"
#include "Services/Gui/ViewPort.h"
#include "Services/Loader/Loader.h"
#include "service/gui/ViewPort.h"
#include "service/loader/Loader.h"
#ifdef ESP_PLATFORM
#include "freertos/FreeRTOS.h"
@@ -53,8 +52,7 @@ public:
// This lock blocks anyone from starting an app as long
// as an app is already running via loader_start()
// This lock's lifecycle is not owned by this class.
// TODO: Convert to smart pointer
ApiLock api_lock;
EventFlag* _Nullable api_lock;
LoaderMessageType type;
struct {
@@ -93,8 +91,8 @@ public:
result = { .raw_value = nullptr };
}
void setLock(ApiLock lock) {
api_lock = lock;
void setApiLock(EventFlag* eventFlag) {
api_lock = eventFlag;
}
void cleanup() {
@@ -111,7 +109,7 @@ struct Loader {
MessageQueue queue = MessageQueue(1, sizeof(LoaderMessage));
Mutex* mutex;
int8_t app_stack_index;
App app_stack[APP_STACK_SIZE];
app::App app_stack[APP_STACK_SIZE];
};
} // namespace
+9
View File
@@ -0,0 +1,9 @@
#pragma once
#include "hal/Configuration.h"
namespace tt::ui {
void initLvgl(const hal::Configuration* config);
} // namespace