Unified AppEsp and AppSim into a single App module (#94)

This commit is contained in:
Ken Van Hoeylandt
2024-11-27 00:06:59 +01:00
committed by GitHub
parent d7b151ab88
commit 03d14ef74b
27 changed files with 140 additions and 100 deletions
+45
View File
@@ -0,0 +1,45 @@
#pragma once
#ifdef ESP_PLATFORM
#include "sdkconfig.h"
// Supported hardware:
#if defined(CONFIG_TT_BOARD_LILYGO_TDECK)
#include "lilygo_tdeck.h"
#define TT_BOARD_HARDWARE &lilygo_tdeck
#elif defined(CONFIG_TT_BOARD_YELLOW_BOARD_24_CAP)
#include "yellow_board.h"
#define TT_BOARD_HARDWARE &yellow_board_24inch_cap
#elif defined(CONFIG_TT_BOARD_M5STACK_CORE2)
#include "M5stackCore2.h"
#define TT_BOARD_HARDWARE &m5stack_core2
#elif defined(CONFIG_TT_BOARD_M5STACK_CORES3)
#include "M5stackCoreS3.h"
#define TT_BOARD_HARDWARE &m5stack_cores3
#elif defined(CONFIG_TT_BOARD_WAVESHARE_S3_TOUCH)
#include "waveshare_s3_touch.h"
#define TT_BOARD_HARDWARE &waveshare_s3_touch
#else
#define TT_BOARD_HARDWARE NULL
#error Replace TT_BOARD_HARDWARE in main.c with your own. Or copy one of the ./sdkconfig.board.* files into ./sdkconfig.
#endif
#else // else simulator
#include "Simulator.h"
#define TT_BOARD_HARDWARE &sim_hardware
extern "C" {
void app_main();
}
int main_stub(); // Main function logic from Simulator board project
// Actual main that passes on app_main (to be executed in a FreeRTOS task) and bootstraps FreeRTOS
int main() {
setMainForSim(app_main);
return main_stub();
}
#endif // ESP_PLATFORM
+18
View File
@@ -0,0 +1,18 @@
#include "lvgl.h"
#include "lvgl/Toolbar.h"
static void app_show(tt::app::App& app, lv_obj_t* parent) {
lv_obj_t* toolbar = tt::lvgl::toolbar_create(parent, app);
lv_obj_align(toolbar, LV_ALIGN_TOP_MID, 0, 0);
lv_obj_t* label = lv_label_create(parent);
lv_label_set_text(label, "Hello, world!");
lv_obj_align(label, LV_ALIGN_CENTER, 0, 0);
}
extern const tt::app::Manifest hello_world_app = {
.id = "HelloWorld",
.name = "Hello World",
.type = tt::app::TypeUser,
.onShow = &app_show,
};
+33
View File
@@ -0,0 +1,33 @@
#include "Boards.h"
// Apps
#include "Tactility.h"
namespace tt::service::wifi {
extern void wifi_main(void*);
}
extern const tt::app::Manifest hello_world_app;
extern "C" {
void app_main() {
static const tt::Configuration config = {
/**
* Auto-select a board based on the ./sdkconfig.board.* file
* that you copied to ./sdkconfig before you opened this project.
*/
.hardware = TT_BOARD_HARDWARE,
.apps = {
&hello_world_app,
},
.services = {},
.auto_start_app_id = nullptr
};
tt::init(&config);
tt::service::wifi::wifi_main(nullptr);
}
} // extern