From 36db47624b6f50c02727c54f1e2ecf93f069da23 Mon Sep 17 00:00:00 2001 From: Ken Van Hoeylandt Date: Tue, 17 Mar 2026 20:33:55 +0100 Subject: [PATCH 1/9] Fix for LilyGO T-HMI SD card --- Devices/lilygo-thmi/lilygo,thmi.dts | 2 ++ .../bindings/espressif,esp32-sdmmc.yaml | 10 +++++++++- .../include/tactility/drivers/esp32_sdmmc.h | 2 ++ .../source/drivers/esp32_sdmmc_fs.cpp | 20 +++++++++++-------- 4 files changed, 25 insertions(+), 9 deletions(-) diff --git a/Devices/lilygo-thmi/lilygo,thmi.dts b/Devices/lilygo-thmi/lilygo,thmi.dts index a83a31db2..301f52553 100644 --- a/Devices/lilygo-thmi/lilygo,thmi.dts +++ b/Devices/lilygo-thmi/lilygo,thmi.dts @@ -28,6 +28,8 @@ pin-clk = <&gpio0 12 GPIO_FLAG_NONE>; pin-cmd = <&gpio0 11 GPIO_FLAG_NONE>; pin-d0 = <&gpio0 13 GPIO_FLAG_NONE>; + pin-d3 = <&gpio0 10 GPIO_FLAG_NONE>; bus-width = <1>; + pullups; }; }; diff --git a/Platforms/platform-esp32/bindings/espressif,esp32-sdmmc.yaml b/Platforms/platform-esp32/bindings/espressif,esp32-sdmmc.yaml index 7dbdabef9..e2acf679f 100644 --- a/Platforms/platform-esp32/bindings/espressif,esp32-sdmmc.yaml +++ b/Platforms/platform-esp32/bindings/espressif,esp32-sdmmc.yaml @@ -50,4 +50,12 @@ properties: enable-uhs: type: boolean default: false - description: Enable UHS mode \ No newline at end of file + description: Enable UHS mode + pullups: + type: boolean + default: false + description: Enable internal pullups for SDMMC pins + on-chip-ldo-chan: + type: int + default: -1 + description: On-chip LDO channel for SD power (e.g. 4 for LDO4). Set to -1 to disable. \ No newline at end of file diff --git a/Platforms/platform-esp32/include/tactility/drivers/esp32_sdmmc.h b/Platforms/platform-esp32/include/tactility/drivers/esp32_sdmmc.h index 152b42559..40beb383f 100644 --- a/Platforms/platform-esp32/include/tactility/drivers/esp32_sdmmc.h +++ b/Platforms/platform-esp32/include/tactility/drivers/esp32_sdmmc.h @@ -28,6 +28,8 @@ struct Esp32SdmmcConfig { uint8_t bus_width; bool wp_active_high; bool enable_uhs; + bool pullups; + int32_t on_chip_ldo_chan; }; /** diff --git a/Platforms/platform-esp32/source/drivers/esp32_sdmmc_fs.cpp b/Platforms/platform-esp32/source/drivers/esp32_sdmmc_fs.cpp index 9387d7568..664d9b917 100644 --- a/Platforms/platform-esp32/source/drivers/esp32_sdmmc_fs.cpp +++ b/Platforms/platform-esp32/source/drivers/esp32_sdmmc_fs.cpp @@ -78,20 +78,23 @@ static error_t mount(void* data) { sdmmc_host_t host = SDMMC_HOST_DEFAULT(); #if SOC_SD_PWR_CTRL_SUPPORTED - sd_pwr_ctrl_ldo_config_t ldo_config = { - .ldo_chan_id = 4, // LDO4 is typically used for SDMMC on ESP32-S3 - }; - esp_err_t pwr_err = sd_pwr_ctrl_new_on_chip_ldo(&ldo_config, &fs_data->pwr_ctrl_handle); - if (pwr_err != ESP_OK) { - LOG_E(TAG, "Failed to create SD power control driver, err=0x%x", pwr_err); - return ERROR_NOT_SUPPORTED; + if (config->on_chip_ldo_chan != -1) { + sd_pwr_ctrl_ldo_config_t ldo_config = { + .ldo_chan_id = (uint32_t)config->on_chip_ldo_chan, + }; + esp_err_t pwr_err = sd_pwr_ctrl_new_on_chip_ldo(&ldo_config, &fs_data->pwr_ctrl_handle); + if (pwr_err != ESP_OK) { + LOG_E(TAG, "Failed to create SD power control driver, err=0x%x", pwr_err); + return ERROR_NOT_SUPPORTED; + } + host.pwr_ctrl_handle = fs_data->pwr_ctrl_handle; } - host.pwr_ctrl_handle = fs_data->pwr_ctrl_handle; #endif uint32_t slot_config_flags = 0; if (config->enable_uhs) slot_config_flags |= SDMMC_SLOT_FLAG_UHS1; if (config->wp_active_high) slot_config_flags |= SDMMC_SLOT_FLAG_WP_ACTIVE_HIGH; + if (config->pullups) slot_config_flags |= SDMMC_SLOT_FLAG_INTERNAL_PULLUP; sdmmc_slot_config_t slot_config = { .clk = to_native_pin(config->pin_clk), @@ -124,6 +127,7 @@ static error_t mount(void* data) { fs_data->pwr_ctrl_handle = nullptr; } #endif + sdmmc_card_print_info(stdout, fs_data->card); return ERROR_UNDEFINED; } From 1a6cc814a5fcb493b1eb2136bf5d5c4d34234776 Mon Sep 17 00:00:00 2001 From: Ken Van Hoeylandt Date: Tue, 17 Mar 2026 20:47:29 +0100 Subject: [PATCH 2/9] Fixes --- Platforms/platform-esp32/source/drivers/esp32_sdmmc_fs.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/Platforms/platform-esp32/source/drivers/esp32_sdmmc_fs.cpp b/Platforms/platform-esp32/source/drivers/esp32_sdmmc_fs.cpp index 664d9b917..6dbcb3785 100644 --- a/Platforms/platform-esp32/source/drivers/esp32_sdmmc_fs.cpp +++ b/Platforms/platform-esp32/source/drivers/esp32_sdmmc_fs.cpp @@ -78,7 +78,8 @@ static error_t mount(void* data) { sdmmc_host_t host = SDMMC_HOST_DEFAULT(); #if SOC_SD_PWR_CTRL_SUPPORTED - if (config->on_chip_ldo_chan != -1) { + // Treat non-positive values as disabled to remain safe with zero-initialized configs. + if (config->on_chip_ldo_chan > 0) { sd_pwr_ctrl_ldo_config_t ldo_config = { .ldo_chan_id = (uint32_t)config->on_chip_ldo_chan, }; @@ -127,10 +128,10 @@ static error_t mount(void* data) { fs_data->pwr_ctrl_handle = nullptr; } #endif - sdmmc_card_print_info(stdout, fs_data->card); return ERROR_UNDEFINED; } + sdmmc_card_print_info(stdout, fs_data->card); LOG_I(TAG, "Mounted %s", fs_data->mount_path.c_str()); return ERROR_NONE; From e7e8c5040674a9bc084081ae2c26d1c3cc46fd8b Mon Sep 17 00:00:00 2001 From: Ken Van Hoeylandt Date: Wed, 25 Mar 2026 20:10:15 +0100 Subject: [PATCH 3/9] Revert incorrect pin --- Devices/lilygo-thmi/lilygo,thmi.dts | 1 - 1 file changed, 1 deletion(-) diff --git a/Devices/lilygo-thmi/lilygo,thmi.dts b/Devices/lilygo-thmi/lilygo,thmi.dts index 301f52553..94b415c8d 100644 --- a/Devices/lilygo-thmi/lilygo,thmi.dts +++ b/Devices/lilygo-thmi/lilygo,thmi.dts @@ -28,7 +28,6 @@ pin-clk = <&gpio0 12 GPIO_FLAG_NONE>; pin-cmd = <&gpio0 11 GPIO_FLAG_NONE>; pin-d0 = <&gpio0 13 GPIO_FLAG_NONE>; - pin-d3 = <&gpio0 10 GPIO_FLAG_NONE>; bus-width = <1>; pullups; }; From aa954da8a92d95aa1e349f41ce4b0f0401b6127b Mon Sep 17 00:00:00 2001 From: Ken Van Hoeylandt Date: Wed, 25 Mar 2026 21:35:42 +0100 Subject: [PATCH 4/9] Add modules to SDK and improve SDK scripting --- Buildscripts/TactilitySDK/CMakeLists.txt | 22 +++++++-- Buildscripts/release-sdk.py | 59 +++++++++++++++++++++--- Devices/generic-esp32/devicetree.yaml | 7 +++ Devices/generic-esp32c6/devicetree.yaml | 7 +++ Devices/generic-esp32p4/devicetree.yaml | 7 +++ Devices/generic-esp32s3/devicetree.yaml | 7 +++ 6 files changed, 99 insertions(+), 10 deletions(-) diff --git a/Buildscripts/TactilitySDK/CMakeLists.txt b/Buildscripts/TactilitySDK/CMakeLists.txt index ac48c94f6..6118eb0d7 100644 --- a/Buildscripts/TactilitySDK/CMakeLists.txt +++ b/Buildscripts/TactilitySDK/CMakeLists.txt @@ -2,18 +2,32 @@ idf_component_register( INCLUDE_DIRS "Libraries/TactilityC/include" "Libraries/TactilityKernel/include" - "Libraries/TactilityFreeRtos/include" "Libraries/lvgl/include" - "Libraries/lvgl-module/include" REQUIRES esp_timer ) +set(EXTRA_COMPONENT_DIRS + "Libraries/TactilityFreeRtos" + "Modules" + "Drivers" +) + +set(COMPONENTS + TactilityFreeRtos + bm8563-module + bm8563-module + bmi270-module + mpu6886-module + pi4ioe5v6408-module + qmi8658-module + rx8130ce-module +) + +# Regular and core features add_prebuilt_library(TactilityC Libraries/TactilityC/binary/libTactilityC.a) add_prebuilt_library(TactilityKernel Libraries/TactilityKernel/binary/libTactilityKernel.a) add_prebuilt_library(lvgl Libraries/lvgl/binary/liblvgl.a) -add_prebuilt_library(lvgl-module Libraries/lvgl-module/binary/liblvgl-module.a) target_link_libraries(${COMPONENT_LIB} INTERFACE TactilityC) target_link_libraries(${COMPONENT_LIB} INTERFACE TactilityKernel) target_link_libraries(${COMPONENT_LIB} INTERFACE lvgl) -target_link_libraries(${COMPONENT_LIB} INTERFACE lvgl-module) diff --git a/Buildscripts/release-sdk.py b/Buildscripts/release-sdk.py index d1a155d87..8fa7d1e7b 100644 --- a/Buildscripts/release-sdk.py +++ b/Buildscripts/release-sdk.py @@ -5,6 +5,7 @@ import glob import subprocess import sys +from textwrap import dedent def map_copy(mappings, target_base): """ @@ -59,6 +60,45 @@ def map_copy(mappings, target_base): os.makedirs(os.path.dirname(final_dst), exist_ok=True) shutil.copy2(src, final_dst) + +def get_driver_mappings(driver_name): + return [ + {'src': f'Drivers/{driver_name}/include/**', 'dst': f'Drivers/{driver_name}/include/'}, + {'src': f'Drivers/{driver_name}/*.md', 'dst': f'Drivers/{driver_name}/'}, + {'src': f'build/esp-idf/{driver_name}/lib{driver_name}.a', 'dst': f'Drivers/{driver_name}/binary/lib{driver_name}.a'}, + ] + +def get_module_mappings(module_name): + return [ + {'src': f'Modules/{module_name}/include/**', 'dst': f'Modules/{module_name}/include/'}, + {'src': f'Modules/{module_name}/*.md', 'dst': f'Modules/{module_name}/'}, + {'src': f'build/esp-idf/{module_name}/lib{module_name}.a', 'dst': f'Drivers/{module_name}/binary/lib{module_name}.a'}, + ] + +def create_module_cmakelists(module_name): + return dedent(f''' + cmake_minimum_required(VERSION 3.20) + idf_component_register( + INCLUDE_DIRS "include" + ) + add_prebuilt_library({module_name} "binary/lib{module_name}.a") + '''.format(module_name=module_name)) + +def write_module_cmakelists(path, content): + with open(path, 'w') as f: + f.write(content) + +def add_driver(target_path, driver_name): + mappings = get_driver_mappings(driver_name) + map_copy(mappings, target_path) + cmakelists_content = create_module_cmakelists(driver_name) + write_module_cmakelists(os.path.join(target_path, f"Drivers/{driver_name}/CMakeLists.txt"), cmakelists_content) + +def add_module(target_path, module_name): + mappings = get_module_mappings(module_name) + map_copy(mappings, target_path) + cmakelists_content = create_module_cmakelists(module_name) + write_module_cmakelists(os.path.join(target_path, f"Modules/{module_name}/CMakeLists.txt"), cmakelists_content) def main(): if len(sys.argv) < 2: @@ -85,12 +125,7 @@ def main(): {'src': 'build/esp-idf/TactilityKernel/libTactilityKernel.a', 'dst': 'Libraries/TactilityKernel/binary/'}, {'src': 'TactilityKernel/include/**', 'dst': 'Libraries/TactilityKernel/include/'}, {'src': 'TactilityKernel/CMakeLists.txt', 'dst': 'Libraries/TactilityKernel/'}, - {'src': 'TactilityKernel/LICENSE*.*', 'dst': 'Libraries/TactilityKernel/'}, - # lvgl-module - {'src': 'build/esp-idf/lvgl-module/liblvgl-module.a', 'dst': 'Libraries/lvgl-module/binary/'}, - {'src': 'Modules/lvgl-module/include/**', 'dst': 'Libraries/lvgl-module/include/'}, - {'src': 'Modules/lvgl-module/CMakeLists.txt', 'dst': 'Libraries/lvgl-module/'}, - {'src': 'Modules/lvgl-module/LICENSE*.*', 'dst': 'Libraries/lvgl-module/'}, + {'src': 'TactilityKernel/*.md', 'dst': 'Libraries/TactilityKernel/'}, # lvgl (basics) {'src': 'build/esp-idf/lvgl__lvgl/liblvgl__lvgl.a', 'dst': 'Libraries/lvgl/binary/liblvgl.a'}, {'src': 'Libraries/lvgl/lvgl.h', 'dst': 'Libraries/lvgl/include/'}, @@ -108,6 +143,18 @@ def main(): map_copy(mappings, target_path) + # Modules + add_module(target_path, "lvgl-module") + + # Drivers + add_driver(target_path, "bm8563-module") + add_driver(target_path, "bm8563-module") + add_driver(target_path, "bmi270-module") + add_driver(target_path, "mpu6886-module") + add_driver(target_path, "pi4ioe5v6408-module") + add_driver(target_path, "qmi8658-module") + add_driver(target_path, "rx8130ce-module") + # Output ESP-IDF SDK version to file esp_idf_version = os.environ.get("ESP_IDF_VERSION", "") with open(os.path.join(target_path, "idf-version.txt"), "a") as f: diff --git a/Devices/generic-esp32/devicetree.yaml b/Devices/generic-esp32/devicetree.yaml index 6a9f8cbbe..577f8a6e3 100644 --- a/Devices/generic-esp32/devicetree.yaml +++ b/Devices/generic-esp32/devicetree.yaml @@ -1,3 +1,10 @@ dependencies: - Platforms/platform-esp32 + # Add all driver modules because the generic devices are used to build the SDK + - Drivers/bm8563-module + - Drivers/bmi270-module + - Drivers/mpu6886-module + - Drivers/pi4ioe5v6408-module + - Drivers/qmi8658-module + - Drivers/rx8130ce-module dts: generic,esp32.dts diff --git a/Devices/generic-esp32c6/devicetree.yaml b/Devices/generic-esp32c6/devicetree.yaml index 3b5ab4d4c..574c81953 100644 --- a/Devices/generic-esp32c6/devicetree.yaml +++ b/Devices/generic-esp32c6/devicetree.yaml @@ -1,3 +1,10 @@ dependencies: - Platforms/platform-esp32 + # Add all driver modules because the generic devices are used to build the SDK + - Drivers/bm8563-module + - Drivers/bmi270-module + - Drivers/mpu6886-module + - Drivers/pi4ioe5v6408-module + - Drivers/qmi8658-module + - Drivers/rx8130ce-module dts: generic,esp32c6.dts diff --git a/Devices/generic-esp32p4/devicetree.yaml b/Devices/generic-esp32p4/devicetree.yaml index 4c31671aa..9f5e26586 100644 --- a/Devices/generic-esp32p4/devicetree.yaml +++ b/Devices/generic-esp32p4/devicetree.yaml @@ -1,3 +1,10 @@ dependencies: - Platforms/platform-esp32 + # Add all driver modules because the generic devices are used to build the SDK + - Drivers/bm8563-module + - Drivers/bmi270-module + - Drivers/mpu6886-module + - Drivers/pi4ioe5v6408-module + - Drivers/qmi8658-module + - Drivers/rx8130ce-module dts: generic,esp32p4.dts diff --git a/Devices/generic-esp32s3/devicetree.yaml b/Devices/generic-esp32s3/devicetree.yaml index 1a525a8ad..7dac4215e 100644 --- a/Devices/generic-esp32s3/devicetree.yaml +++ b/Devices/generic-esp32s3/devicetree.yaml @@ -1,3 +1,10 @@ dependencies: - Platforms/platform-esp32 + # Add all driver modules because the generic devices are used to build the SDK + - Drivers/bm8563-module + - Drivers/bmi270-module + - Drivers/mpu6886-module + - Drivers/pi4ioe5v6408-module + - Drivers/qmi8658-module + - Drivers/rx8130ce-module dts: generic,esp32s3.dts From 4d245d42cfe0efdc2c9e5ffdc8e83069c84f14cb Mon Sep 17 00:00:00 2001 From: Ken Van Hoeylandt Date: Wed, 25 Mar 2026 22:13:12 +0100 Subject: [PATCH 5/9] SDK improvements --- Buildscripts/TactilitySDK/CMakeLists.txt | 26 ------------------- Buildscripts/TactilitySDK/TactilitySDK.cmake | 27 ++++++++++++++++++++ Buildscripts/release-sdk.py | 2 +- Tests/SdkIntegration/CMakeLists.txt | 6 ++--- Tests/SdkIntegration/main/CMakeLists.txt | 7 +++++ Tests/SdkIntegration/main/Source/main.c | 8 ++++++ 6 files changed, 46 insertions(+), 30 deletions(-) diff --git a/Buildscripts/TactilitySDK/CMakeLists.txt b/Buildscripts/TactilitySDK/CMakeLists.txt index 6118eb0d7..bd6825ee4 100644 --- a/Buildscripts/TactilitySDK/CMakeLists.txt +++ b/Buildscripts/TactilitySDK/CMakeLists.txt @@ -5,29 +5,3 @@ idf_component_register( "Libraries/lvgl/include" REQUIRES esp_timer ) - -set(EXTRA_COMPONENT_DIRS - "Libraries/TactilityFreeRtos" - "Modules" - "Drivers" -) - -set(COMPONENTS - TactilityFreeRtos - bm8563-module - bm8563-module - bmi270-module - mpu6886-module - pi4ioe5v6408-module - qmi8658-module - rx8130ce-module -) - -# Regular and core features -add_prebuilt_library(TactilityC Libraries/TactilityC/binary/libTactilityC.a) -add_prebuilt_library(TactilityKernel Libraries/TactilityKernel/binary/libTactilityKernel.a) -add_prebuilt_library(lvgl Libraries/lvgl/binary/liblvgl.a) - -target_link_libraries(${COMPONENT_LIB} INTERFACE TactilityC) -target_link_libraries(${COMPONENT_LIB} INTERFACE TactilityKernel) -target_link_libraries(${COMPONENT_LIB} INTERFACE lvgl) diff --git a/Buildscripts/TactilitySDK/TactilitySDK.cmake b/Buildscripts/TactilitySDK/TactilitySDK.cmake index 71afdc009..9a427ef8f 100644 --- a/Buildscripts/TactilitySDK/TactilitySDK.cmake +++ b/Buildscripts/TactilitySDK/TactilitySDK.cmake @@ -14,4 +14,31 @@ macro(tactility_project project_name) if (NOT "$ENV{ESP_IDF_VERSION}" STREQUAL "${TACTILITY_SDK_IDF_VERSION}") message(FATAL_ERROR "ESP-IDF version of Tactility SDK (${TACTILITY_SDK_IDF_VERSION}) does not match current ESP-IDF version ($ENV{ESP_IDF_VERSION})") endif() + + set(EXTRA_COMPONENT_DIRS + "Libraries/TactilityFreeRtos" + "Modules" + "Drivers" + ) + + set(COMPONENTS + TactilityFreeRtos + bm8563-module + bm8563-module + bmi270-module + mpu6886-module + pi4ioe5v6408-module + qmi8658-module + rx8130ce-module + ) + + # Regular and core features + add_prebuilt_library(TactilityC Libraries/TactilityC/binary/libTactilityC.a) + add_prebuilt_library(TactilityKernel Libraries/TactilityKernel/binary/libTactilityKernel.a) + add_prebuilt_library(lvgl Libraries/lvgl/binary/liblvgl.a) + + target_link_libraries(${COMPONENT_LIB} INTERFACE TactilityC) + target_link_libraries(${COMPONENT_LIB} INTERFACE TactilityKernel) + target_link_libraries(${COMPONENT_LIB} INTERFACE lvgl) + endmacro() diff --git a/Buildscripts/release-sdk.py b/Buildscripts/release-sdk.py index 8fa7d1e7b..b2a8b0e5c 100644 --- a/Buildscripts/release-sdk.py +++ b/Buildscripts/release-sdk.py @@ -72,7 +72,7 @@ def get_module_mappings(module_name): return [ {'src': f'Modules/{module_name}/include/**', 'dst': f'Modules/{module_name}/include/'}, {'src': f'Modules/{module_name}/*.md', 'dst': f'Modules/{module_name}/'}, - {'src': f'build/esp-idf/{module_name}/lib{module_name}.a', 'dst': f'Drivers/{module_name}/binary/lib{module_name}.a'}, + {'src': f'build/esp-idf/{module_name}/lib{module_name}.a', 'dst': f'Modules/{module_name}/binary/lib{module_name}.a'}, ] def create_module_cmakelists(module_name): diff --git a/Tests/SdkIntegration/CMakeLists.txt b/Tests/SdkIntegration/CMakeLists.txt index 046853f6b..980270d3e 100644 --- a/Tests/SdkIntegration/CMakeLists.txt +++ b/Tests/SdkIntegration/CMakeLists.txt @@ -5,12 +5,12 @@ include($ENV{IDF_PATH}/tools/cmake/project.cmake) if (DEFINED ENV{TACTILITY_SDK_PATH}) set(TACTILITY_SDK_PATH $ENV{TACTILITY_SDK_PATH}) else() - set(TACTILITY_SDK_PATH "../../release/TactilitySDK") - message(WARNING "⚠️ TACTILITY_SDK_PATH environment variable is not set, defaulting to ${TACTILITY_SDK_PATH}") + set(TACTILITY_SDK_PATH ../../release/TactilitySDK) + message(WARNING "TACTILITY_SDK_PATH environment variable is not set, defaulting to ${TACTILITY_SDK_PATH}") endif() include("${TACTILITY_SDK_PATH}/TactilitySDK.cmake") -set(EXTRA_COMPONENT_DIRS ${TACTILITY_SDK_PATH}) +set(EXTRA_COMPONENT_DIRS ${TACTILITY_SDK_PATH} ${TACTILITY_SDK_PATH}/Modules ${TACTILITY_SDK_PATH}/Drivers) project(SdkTest) tactility_project(SdkTest) diff --git a/Tests/SdkIntegration/main/CMakeLists.txt b/Tests/SdkIntegration/main/CMakeLists.txt index db2068e9b..3e247cf3d 100644 --- a/Tests/SdkIntegration/main/CMakeLists.txt +++ b/Tests/SdkIntegration/main/CMakeLists.txt @@ -3,4 +3,11 @@ file(GLOB_RECURSE SOURCE_FILES Source/*.c) idf_component_register( SRCS ${SOURCE_FILES} REQUIRES TactilitySDK + lvgl-module + bm8563-module + bmi270-module + mpu6886-module + pi4ioe5v6408-module + qmi8658-module + rx8130ce-module ) diff --git a/Tests/SdkIntegration/main/Source/main.c b/Tests/SdkIntegration/main/Source/main.c index 13c029597..230587741 100644 --- a/Tests/SdkIntegration/main/Source/main.c +++ b/Tests/SdkIntegration/main/Source/main.c @@ -24,6 +24,14 @@ #include +#include +#include +#include +#include +#include +#include +#include + static void onShowApp(AppHandle app, void* data, lv_obj_t* parent) { lv_obj_t* toolbar = tt_lvgl_toolbar_create_for_app(parent, app); lv_obj_align(toolbar, LV_ALIGN_TOP_MID, 0, 0); From 48f9ed4d737195d33c253238304ee92cbfad3079 Mon Sep 17 00:00:00 2001 From: Ken Van Hoeylandt Date: Wed, 25 Mar 2026 22:57:34 +0100 Subject: [PATCH 6/9] Fix --- Buildscripts/TactilitySDK/CMakeLists.txt | 9 +++++++++ Buildscripts/TactilitySDK/TactilitySDK.cmake | 9 --------- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/Buildscripts/TactilitySDK/CMakeLists.txt b/Buildscripts/TactilitySDK/CMakeLists.txt index bd6825ee4..7fd6e152b 100644 --- a/Buildscripts/TactilitySDK/CMakeLists.txt +++ b/Buildscripts/TactilitySDK/CMakeLists.txt @@ -5,3 +5,12 @@ idf_component_register( "Libraries/lvgl/include" REQUIRES esp_timer ) + +# Regular and core features +add_prebuilt_library(TactilityC Libraries/TactilityC/binary/libTactilityC.a) +add_prebuilt_library(TactilityKernel Libraries/TactilityKernel/binary/libTactilityKernel.a) +add_prebuilt_library(lvgl Libraries/lvgl/binary/liblvgl.a) + +target_link_libraries(${COMPONENT_LIB} INTERFACE TactilityC) +target_link_libraries(${COMPONENT_LIB} INTERFACE TactilityKernel) +target_link_libraries(${COMPONENT_LIB} INTERFACE lvgl) diff --git a/Buildscripts/TactilitySDK/TactilitySDK.cmake b/Buildscripts/TactilitySDK/TactilitySDK.cmake index 9a427ef8f..54e05c824 100644 --- a/Buildscripts/TactilitySDK/TactilitySDK.cmake +++ b/Buildscripts/TactilitySDK/TactilitySDK.cmake @@ -32,13 +32,4 @@ macro(tactility_project project_name) rx8130ce-module ) - # Regular and core features - add_prebuilt_library(TactilityC Libraries/TactilityC/binary/libTactilityC.a) - add_prebuilt_library(TactilityKernel Libraries/TactilityKernel/binary/libTactilityKernel.a) - add_prebuilt_library(lvgl Libraries/lvgl/binary/liblvgl.a) - - target_link_libraries(${COMPONENT_LIB} INTERFACE TactilityC) - target_link_libraries(${COMPONENT_LIB} INTERFACE TactilityKernel) - target_link_libraries(${COMPONENT_LIB} INTERFACE lvgl) - endmacro() From 60120c7ff9fbcd227e2d30d944ccbf3945de4b6b Mon Sep 17 00:00:00 2001 From: Ken Van Hoeylandt Date: Tue, 28 Apr 2026 15:29:37 +0200 Subject: [PATCH 7/9] Fix for SpiSdCardDevice --- Tactility/Source/hal/sdcard/SpiSdCardDevice.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/Tactility/Source/hal/sdcard/SpiSdCardDevice.cpp b/Tactility/Source/hal/sdcard/SpiSdCardDevice.cpp index 7cfa0b1c2..7cdcc52bc 100644 --- a/Tactility/Source/hal/sdcard/SpiSdCardDevice.cpp +++ b/Tactility/Source/hal/sdcard/SpiSdCardDevice.cpp @@ -21,11 +21,16 @@ static const auto LOGGER = Logger("SpiSdCardDevice"); bool SpiSdCardDevice::applyGpioWorkAround() { LOGGER.info("applyGpioWorkAround"); - uint64_t pin_bit_mask = BIT64(config->spiPinCs); + uint64_t pin_bit_mask = config->spiPinCs != GPIO_NUM_NC ? BIT64(config->spiPinCs) : 0; for (auto const& pin: config->csPinWorkAround) { pin_bit_mask |= BIT64(pin); } + // Nothing to do + if (pin_bit_mask == 0) { + return true; + } + if (!gpio::configureWithPinBitmask(pin_bit_mask, gpio::Mode::Output, false, false)) { LOGGER.error("GPIO work-around failed"); return false; From d8b8b77793aadb640a32d2e43374e39fa4d4b59b Mon Sep 17 00:00:00 2001 From: Ken Van Hoeylandt Date: Tue, 28 Apr 2026 16:32:20 +0200 Subject: [PATCH 8/9] Fix boolean parsing and add tests --- .../DevicetreeCompiler/source/generator.py | 13 ++++- .../tests/data/bindings/test,bool-device.yaml | 16 ++++++ ...t,device.yaml => test,generic-device.yaml} | 6 +- .../tests/data/expected_devicetree.c | 57 +++++++++++++++++++ .../tests/data/expected_devicetree.h | 17 ++++++ .../DevicetreeCompiler/tests/data/test.dts | 9 ++- .../tests/test_integration.py | 22 +++++-- 7 files changed, 125 insertions(+), 15 deletions(-) create mode 100644 Buildscripts/DevicetreeCompiler/tests/data/bindings/test,bool-device.yaml rename Buildscripts/DevicetreeCompiler/tests/data/bindings/{test,device.yaml => test,generic-device.yaml} (53%) create mode 100644 Buildscripts/DevicetreeCompiler/tests/data/expected_devicetree.c create mode 100644 Buildscripts/DevicetreeCompiler/tests/data/expected_devicetree.h diff --git a/Buildscripts/DevicetreeCompiler/source/generator.py b/Buildscripts/DevicetreeCompiler/source/generator.py index 0e6db71df..9f7d79171 100644 --- a/Buildscripts/DevicetreeCompiler/source/generator.py +++ b/Buildscripts/DevicetreeCompiler/source/generator.py @@ -64,7 +64,10 @@ def property_to_string(property: DeviceProperty, devices: list[Device]) -> str: if type == "value" or type == "int": return property.value elif type == "boolean" or type == "bool": - return "true" + if property.value is None or not property.value: + return "false" + else: + return "true" elif type == "text": return f"\"{property.value}\"" elif type == "values": @@ -120,6 +123,7 @@ def resolve_parameters_from_bindings(device: Device, bindings: list[Binding], de result = [0] * len(binding_properties) for index, binding_property in enumerate(binding_properties): device_property = find_device_property(device, binding_property.name) + # No property specified in DTS, use binding defaults if device_property is None: if binding_property.default is not None: temp_prop = DeviceProperty( @@ -130,8 +134,11 @@ def resolve_parameters_from_bindings(device: Device, bindings: list[Binding], de result[index] = property_to_string(temp_prop, devices) elif binding_property.required: raise DevicetreeException(f"device {device.node_name} doesn't have property '{binding_property.name}'") - elif binding_property.type == "bool": - result[index] = "false" + elif binding_property.type == "bool" or binding_property.type == "boolean": + if binding_property.default == "true" or binding_property.default == None: + result[index] = "true" + else: # Explicit or implied false + result[index] = "false" else: raise DevicetreeException(f"Device {device.node_name} doesn't have property '{binding_property.name}' and no default value is set") else: diff --git a/Buildscripts/DevicetreeCompiler/tests/data/bindings/test,bool-device.yaml b/Buildscripts/DevicetreeCompiler/tests/data/bindings/test,bool-device.yaml new file mode 100644 index 000000000..3d2f8efb2 --- /dev/null +++ b/Buildscripts/DevicetreeCompiler/tests/data/bindings/test,bool-device.yaml @@ -0,0 +1,16 @@ +description: Boolean test device binding +compatible: "test,bool-device" +properties: + binding-default-true-setting-implied: + type: boolean + default: true + binding-default-false-setting-implied: + type: boolean + default: false + binding-default-false-setting-direct: + type: boolean + default: false + binding-implied-true-setting-direct: + type: boolean + binding-implied-true-setting-implied: + type: boolean \ No newline at end of file diff --git a/Buildscripts/DevicetreeCompiler/tests/data/bindings/test,device.yaml b/Buildscripts/DevicetreeCompiler/tests/data/bindings/test,generic-device.yaml similarity index 53% rename from Buildscripts/DevicetreeCompiler/tests/data/bindings/test,device.yaml rename to Buildscripts/DevicetreeCompiler/tests/data/bindings/test,generic-device.yaml index 03942daa4..e2a203516 100644 --- a/Buildscripts/DevicetreeCompiler/tests/data/bindings/test,device.yaml +++ b/Buildscripts/DevicetreeCompiler/tests/data/bindings/test,generic-device.yaml @@ -1,11 +1,9 @@ -description: Test device binding -compatible: "test,device" +description: Generic test device binding +compatible: "test,generic-device" properties: reg: type: int required: true - boolean-prop: - type: boolean int-prop: type: int string-prop: diff --git a/Buildscripts/DevicetreeCompiler/tests/data/expected_devicetree.c b/Buildscripts/DevicetreeCompiler/tests/data/expected_devicetree.c new file mode 100644 index 000000000..28448359f --- /dev/null +++ b/Buildscripts/DevicetreeCompiler/tests/data/expected_devicetree.c @@ -0,0 +1,57 @@ +// Default headers +#include +#include +#include +// DTS headers +#include + +static const root_config_dt root_config = { + "Test Model" +}; + +static struct Device root = { + .name = "/", + .config = &root_config, + .parent = NULL, + .internal = NULL +}; + +static const generic_device_config_dt test_device@0_config = { + 0, + 42, + "hello" +}; + +static struct Device test_device@0 = { + .name = "test-device@0", + .config = &test_device@0_config, + .parent = &root, + .internal = NULL +}; + +static const bool_device_config_dt bool_test_device_config = { + true, + false, + true, + true, + true +}; + +static struct Device bool_test_device = { + .name = "bool-test-device", + .config = &bool_test_device_config, + .parent = &root, + .internal = NULL +}; + +struct DtsDevice dts_devices[] = { + { &root, "test,root", DTS_DEVICE_STATUS_OKAY }, + { &test_device@0, "test,generic-device", DTS_DEVICE_STATUS_OKAY }, + { &bool_test_device, "test,bool-device", DTS_DEVICE_STATUS_OKAY }, + DTS_DEVICE_TERMINATOR +}; + + +struct Module* dts_modules[] = { + NULL +}; diff --git a/Buildscripts/DevicetreeCompiler/tests/data/expected_devicetree.h b/Buildscripts/DevicetreeCompiler/tests/data/expected_devicetree.h new file mode 100644 index 000000000..7c56f34b0 --- /dev/null +++ b/Buildscripts/DevicetreeCompiler/tests/data/expected_devicetree.h @@ -0,0 +1,17 @@ +#pragma once +#include +#include + +#ifdef __cplusplus +extern "C" { +#endif + +// Array of device tree modules terminated with DTS_MODULE_TERMINATOR +extern struct DtsDevice dts_devices[]; + +// Array of module symbols terminated with NULL +extern struct Module* dts_modules[]; + +#ifdef __cplusplus +} +#endif diff --git a/Buildscripts/DevicetreeCompiler/tests/data/test.dts b/Buildscripts/DevicetreeCompiler/tests/data/test.dts index 741283694..4d828b020 100644 --- a/Buildscripts/DevicetreeCompiler/tests/data/test.dts +++ b/Buildscripts/DevicetreeCompiler/tests/data/test.dts @@ -7,11 +7,16 @@ model = "Test Model"; test_device1: test-device@0 { - compatible = "test,device"; + compatible = "test,generic-device"; reg = <0>; status = "okay"; - boolean-prop; int-prop = <42>; string-prop = "hello"; }; + + bool-test-device { + compatible = "test,bool-device"; + binding-default-false-setting-direct; + binding-implied-true-setting-direct; + }; }; diff --git a/Buildscripts/DevicetreeCompiler/tests/test_integration.py b/Buildscripts/DevicetreeCompiler/tests/test_integration.py index c444a069b..1e9308da3 100644 --- a/Buildscripts/DevicetreeCompiler/tests/test_integration.py +++ b/Buildscripts/DevicetreeCompiler/tests/test_integration.py @@ -30,13 +30,23 @@ def test_compile_success(): print(f"FAILED: Compilation failed: {result.stderr} {result.stdout}") return False - if not os.path.exists(os.path.join(output_dir, "devicetree.c")): - print("FAILED: devicetree.c not generated") - return False + for filename in ["devicetree.c", "devicetree.h"]: + generated_path = os.path.join(output_dir, filename) + expected_path = os.path.join(TEST_DATA_DIR, f"expected_{filename}") - if not os.path.exists(os.path.join(output_dir, "devicetree.h")): - print("FAILED: devicetree.h not generated") - return False + if not os.path.exists(generated_path): + print(f"FAILED: {filename} not generated") + return False + + if not os.path.exists(expected_path): + print(f"FAILED: {os.path.basename(expected_path)} not found in test data") + return False + + diff_result = subprocess.run(["diff", "-u", expected_path, generated_path], capture_output=True, text=True) + if diff_result.returncode != 0: + print(f"FAILED: {filename} does not match expected_{filename}") + print(diff_result.stdout) + return False print("PASSED") return True From 2e6025ffbb2b37596831dee411edac5a43833418 Mon Sep 17 00:00:00 2001 From: Ken Van Hoeylandt Date: Tue, 28 Apr 2026 16:35:10 +0200 Subject: [PATCH 9/9] Cleanup --- Buildscripts/release-sdk.py | 1 - Tests/SdkIntegration/main/Source/main.c | 1 - 2 files changed, 2 deletions(-) diff --git a/Buildscripts/release-sdk.py b/Buildscripts/release-sdk.py index b2a8b0e5c..4ec8031dd 100644 --- a/Buildscripts/release-sdk.py +++ b/Buildscripts/release-sdk.py @@ -148,7 +148,6 @@ def main(): # Drivers add_driver(target_path, "bm8563-module") - add_driver(target_path, "bm8563-module") add_driver(target_path, "bmi270-module") add_driver(target_path, "mpu6886-module") add_driver(target_path, "pi4ioe5v6408-module") diff --git a/Tests/SdkIntegration/main/Source/main.c b/Tests/SdkIntegration/main/Source/main.c index 230587741..24a7b29cd 100644 --- a/Tests/SdkIntegration/main/Source/main.c +++ b/Tests/SdkIntegration/main/Source/main.c @@ -27,7 +27,6 @@ #include #include #include -#include #include #include #include