Unified AppEsp and AppSim into a single App module (#94)
This commit is contained in:
committed by
GitHub
parent
d7b151ab88
commit
03d14ef74b
@@ -0,0 +1,44 @@
|
||||
cmake_minimum_required(VERSION 3.16)
|
||||
|
||||
if (DEFINED ENV{ESP_IDF_VERSION})
|
||||
set(BOARD_COMPONENTS Tactility)
|
||||
|
||||
if("${IDF_TARGET}" STREQUAL "esp32")
|
||||
list(APPEND BOARD_COMPONENTS
|
||||
YellowBoard
|
||||
M5stackCore2
|
||||
)
|
||||
endif()
|
||||
|
||||
# T-Deck is an S3 platform
|
||||
if("${IDF_TARGET}" STREQUAL "esp32s3")
|
||||
list(APPEND BOARD_COMPONENTS
|
||||
LilygoTdeck
|
||||
M5stackCoreS3
|
||||
WaveshareS3Touch
|
||||
)
|
||||
endif()
|
||||
|
||||
idf_component_register(
|
||||
SRC_DIRS "Source"
|
||||
"Source/HelloWorld"
|
||||
REQUIRES ${BOARD_COMPONENTS}
|
||||
)
|
||||
else()
|
||||
|
||||
file(GLOB_RECURSE SOURCES "Source/*.c*")
|
||||
add_executable(AppSim ${SOURCES})
|
||||
target_link_libraries(AppSim
|
||||
PRIVATE Tactility
|
||||
PRIVATE TactilityCore
|
||||
PRIVATE TactilityHeadless
|
||||
PRIVATE Simulator
|
||||
)
|
||||
|
||||
find_package(SDL2 REQUIRED CONFIG)
|
||||
target_link_libraries(AppSim PRIVATE ${SDL2_LIBRARIES})
|
||||
include_directories(${SDL2_INCLUDE_DIRS})
|
||||
|
||||
add_definitions(-D_Nullable=)
|
||||
add_definitions(-D_Nonnull=)
|
||||
endif()
|
||||
+20
@@ -0,0 +1,20 @@
|
||||
# Kconfig file for Tactility example app
|
||||
menu "Tactility App"
|
||||
choice
|
||||
prompt "Board"
|
||||
default TT_BOARD_CUSTOM
|
||||
|
||||
config TT_BOARD_CUSTOM
|
||||
bool "Custom"
|
||||
config TT_BOARD_YELLOW_BOARD_24_CAP
|
||||
bool "Yellow Board (2.4\" capacitive)"
|
||||
config TT_BOARD_LILYGO_TDECK
|
||||
bool "LilyGo T-Deck"
|
||||
config TT_BOARD_M5STACK_CORE2
|
||||
bool "M5Stack Core2"
|
||||
config TT_BOARD_M5STACK_CORES3
|
||||
bool "M5Stack CoreS3"
|
||||
config TT_BOARD_WAVESHARE_S3_TOUCH
|
||||
bool "Waveshare S3 Touch LCD 4.3\""
|
||||
endchoice
|
||||
endmenu
|
||||
@@ -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
|
||||
@@ -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,
|
||||
};
|
||||
@@ -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
|
||||
@@ -0,0 +1,6 @@
|
||||
dependencies:
|
||||
espressif/esp_lcd_ili9341: "2.0.0"
|
||||
espressif/esp_lcd_touch_cst816s: "1.0.3"
|
||||
espressif/esp_lcd_touch_gt911: "1.1.1"
|
||||
espressif/esp_lcd_touch: "1.1.2"
|
||||
idf: '5.3.1'
|
||||
Reference in New Issue
Block a user