From ed2d0cc78a00df8940d670e6450911b4645301be Mon Sep 17 00:00:00 2001 From: Ken Van Hoeylandt Date: Mon, 22 Jan 2024 00:27:17 +0100 Subject: [PATCH] Move FreeRTOSConfig.h to app-sim (#17) * Move FreeRTOSConfig.h to app-sim * improved docs * updated ideas.md and removed finished todos --- CMakeLists.txt | 22 +++++++++++-------- README.md | 4 ++-- .../include => app-sim/src}/FreeRTOSConfig.h | 12 ++++++++-- docs/ideas.md | 12 +++++++++- tactility-esp/src/tactility-esp.c | 2 +- tactility/src/services/loader/loader.c | 1 - 6 files changed, 37 insertions(+), 16 deletions(-) rename {libs/freertos-kernel/include => app-sim/src}/FreeRTOSConfig.h (91%) diff --git a/CMakeLists.txt b/CMakeLists.txt index cfbd8df3..a3bbec67 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -37,12 +37,23 @@ add_subdirectory(tactility-core) if (NOT ESP_PLATFORM) add_subdirectory(libs/freertos-kernel) + target_include_directories(freertos-kernel + PUBLIC app-sim/src # for FreeRTOSConfig.h + ) + add_subdirectory(libs/mbedtls) add_subdirectory(app-sim) - # region LVGL + # region SDL & LVGL + + find_package(SDL2 REQUIRED CONFIG) add_subdirectory(libs/lvgl) # Added as idf component for ESP and as library for other targets + target_include_directories(lvgl + PUBLIC ${SDL2_INCLUDE_DIRS} + PUBLIC app-sim/src # for lv_conf.h and lv_drv_conf.h + ) + add_subdirectory(libs/lv_drivers) option(LV_USE_DRAW_SDL "Use SDL draw unit" OFF) @@ -57,18 +68,11 @@ if (NOT ESP_PLATFORM) set(EXECUTABLE_OUTPUT_PATH ${PROJECT_SOURCE_DIR}/bin) - find_package(SDL2 REQUIRED CONFIG) - add_compile_definitions($<$:LV_USE_DRAW_SDL=1>) add_compile_definitions($<$:LV_USE_LIBPNG=1>) add_compile_definitions($<$:LV_USE_LIBJPEG_TURBO=1>) add_compile_definitions($<$:LV_USE_FFMPEG=1>) - target_include_directories(lvgl - PUBLIC ${SDL2_INCLUDE_DIRS} - PUBLIC app-sim/src # for lv_conf.h and lv_drv_conf.h - ) - if (LV_USE_DRAW_SDL) set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/cmake") # Need to install libsdl2-image-dev @@ -104,5 +108,5 @@ if (NOT ESP_PLATFORM) target_include_directories(lvgl PUBLIC ${FREETYPE_INCLUDE_DIRS}) endif(LV_USE_FREETYPE) - #endregion + # endregion SDL & LVGL endif() diff --git a/README.md b/README.md index bcb10723..23ed83f5 100644 --- a/README.md +++ b/README.md @@ -3,6 +3,8 @@ Tactility is a front-end application platform for ESP32. It is mainly intended for touchscreen devices. It provides an application framework that is based on code from the [Flipper Zero](https://github.com/flipperdevices/flipperzero-firmware/) project. +**Status: Alpha** + ![Tactility shown on a Lilygo T-Deck device and on PC](docs/pics/tactility-showcase.jpg) Tactility features: @@ -15,8 +17,6 @@ Requirements: - ESP32 (any?) with a display (connected via SPI or I2C) - [esp-idf 5.1.2](https://docs.espressif.com/projects/esp-idf/en/v5.1.2/esp32/get-started/index.html) or a newer v5.1.x -**Status: Alpha** - ## Technologies UI is created with [lvgl](https://github.com/lvgl/lvgl) via [esp_lvgl_port](https://github.com/espressif/esp-bsp/tree/master/components/esp_lvgl_port). diff --git a/libs/freertos-kernel/include/FreeRTOSConfig.h b/app-sim/src/FreeRTOSConfig.h similarity index 91% rename from libs/freertos-kernel/include/FreeRTOSConfig.h rename to app-sim/src/FreeRTOSConfig.h index be1fb81e..30e56da5 100644 --- a/libs/freertos-kernel/include/FreeRTOSConfig.h +++ b/app-sim/src/FreeRTOSConfig.h @@ -1,3 +1,10 @@ +/** + * This configuration follows the ESP32 config closely. + * Some parameters are explicitly marked as important, + * but most parameters should match. + * + * See $IDF_PATH/components/freertos/esp_additions/include/freertos/FreeRTOSConfig.h + */ #ifndef FREERTOS_CONFIG_H #define FREERTOS_CONFIG_H @@ -6,7 +13,7 @@ #define configUSE_TICKLESS_IDLE 0 #define configCPU_CLOCK_HZ 60000000 #define configSYSTICK_CLOCK_HZ 1000000 -#define configTICK_RATE_HZ 1000 +#define configTICK_RATE_HZ 1000 // Must be the same as ESP32! #define configMAX_PRIORITIES 10 #define configMINIMAL_STACK_SIZE 128 #define configMAX_TASK_NAME_LEN 16 @@ -14,7 +21,7 @@ #define configTICK_TYPE_WIDTH_IN_BITS TICK_TYPE_WIDTH_16_BITS #define configIDLE_SHOULD_YIELD 1 #define configUSE_TASK_NOTIFICATIONS 1 -#define configTASK_NOTIFICATION_ARRAY_ENTRIES 2 +#define configTASK_NOTIFICATION_ARRAY_ENTRIES 2 // Must be the same as ESP32! #define configUSE_MUTEXES 1 #define configUSE_RECURSIVE_MUTEXES 1 #define configUSE_COUNTING_SEMAPHORES 1 @@ -89,6 +96,7 @@ #define secureconfigMAX_SECURE_CONTEXTS 5 /* Optional functions - most linkers will remove unused functions anyway. */ +/* Ensure these are closely match ESP32: you can activate more features, but not less. */ #define INCLUDE_vTaskPrioritySet 1 #define INCLUDE_uxTaskPriorityGet 1 #define INCLUDE_vTaskDelete 1 diff --git a/docs/ideas.md b/docs/ideas.md index aa4a08ea..83b53eaa 100644 --- a/docs/ideas.md +++ b/docs/ideas.md @@ -1,6 +1,16 @@ +# TODOs +- Make `desktop` app listen to changes in `app_manifest_registry` +- Update `view_port` to use `ViewPort` as handle externally and `ViewPortData` internally +- Replace FreeRTOS semaphore from `Loader` with internal `Mutex` +- Create unit tests for `tactility-core` and `tactility` (PC-only for now) + +# Core Ideas +- Support for displays with different DPI. Consider the layer-based system like on Android. + # App Ideas - Chip 8 emulator - Discord bot - BadUSB +- IR transceiver app - GPIO status viewer - +- BlueTooth keyboard app \ No newline at end of file diff --git a/tactility-esp/src/tactility-esp.c b/tactility-esp/src/tactility-esp.c index c38e4e44..1e7cd4a9 100644 --- a/tactility-esp/src/tactility-esp.c +++ b/tactility-esp/src/tactility-esp.c @@ -4,7 +4,7 @@ #include "esp_lvgl_port.h" #include "esp_netif.h" #include "graphics_i.h" -#include "hardware_i.h" // TODO: Rename to hardware*.* +#include "hardware_i.h" #include "nvs_flash.h" #include "partitions.h" #include "services/loader/loader.h" diff --git a/tactility/src/services/loader/loader.c b/tactility/src/services/loader/loader.c index 7e099f21..9530496b 100644 --- a/tactility/src/services/loader/loader.c +++ b/tactility/src/services/loader/loader.c @@ -272,7 +272,6 @@ static int32_t loader_main(TT_UNUSED void* parameter) { TT_LOG_I(TAG, "Processing message of type %d", message.type); switch (message.type) { case LoaderMessageTypeAppStart: - // TODO: add bundle message.status_value->value = loader_do_start_by_id( message.start.id, message.start.bundle