From 4459b2412a4bbf588d8489cee8115342aa883ec1 Mon Sep 17 00:00:00 2001 From: Ken Van Hoeylandt Date: Sat, 25 Jul 2026 20:40:31 +0200 Subject: [PATCH 1/6] Updates for removal of deprecated HAL --- Apps/Diceware/main/Source/Diceware.cpp | 4 ++-- Apps/Diceware/manifest.properties | 4 ++-- Apps/EspNowBridge/main/Source/EspNowBridge.cpp | 8 ++++---- Apps/EspNowBridge/manifest.properties | 4 ++-- Apps/GPIO/main/Source/Gpio.cpp | 5 ++--- Apps/GPIO/manifest.properties | 4 ++-- Apps/MediaKeys/main/Source/MediaKeys.cpp | 10 +++++----- Apps/MediaKeys/manifest.properties | 4 ++-- Apps/SerialConsole/manifest.properties | 4 ++-- Apps/Snake/manifest.properties | 4 ++-- Apps/TwoEleven/manifest.properties | 4 ++-- .../TactilityCpp/Include/TactilityCpp/LvglLock.h | 11 +++++++---- 12 files changed, 34 insertions(+), 32 deletions(-) diff --git a/Apps/Diceware/main/Source/Diceware.cpp b/Apps/Diceware/main/Source/Diceware.cpp index a82f650..48097d7 100644 --- a/Apps/Diceware/main/Source/Diceware.cpp +++ b/Apps/Diceware/main/Source/Diceware.cpp @@ -2,7 +2,7 @@ #include #include -#include +#include #include #include @@ -87,7 +87,7 @@ void Diceware::startJob(uint32_t jobWordCount) { } void Diceware::onFinishJob(std::string result) { - tt_lvgl_lock(tt::kernel::MAX_TICKS); + lvgl_lock(); lv_label_set_text(resultLabel, result.c_str()); tt_lvgl_unlock(); } diff --git a/Apps/Diceware/manifest.properties b/Apps/Diceware/manifest.properties index 03b3b16..8ddd873 100644 --- a/Apps/Diceware/manifest.properties +++ b/Apps/Diceware/manifest.properties @@ -2,6 +2,6 @@ manifest.version=0.2 target.sdk=0.8.0-dev target.platforms=esp32,esp32s3,esp32c6,esp32p4 app.id=one.tactility.diceware -app.version.name=0.6.0 -app.version.code=6 +app.version.name=0.7.0 +app.version.code=7 app.name=Diceware diff --git a/Apps/EspNowBridge/main/Source/EspNowBridge.cpp b/Apps/EspNowBridge/main/Source/EspNowBridge.cpp index 01b495e..3e56aea 100644 --- a/Apps/EspNowBridge/main/Source/EspNowBridge.cpp +++ b/Apps/EspNowBridge/main/Source/EspNowBridge.cpp @@ -9,7 +9,7 @@ #include #include #include -#include +#include #include #include @@ -283,12 +283,12 @@ struct UiDispatchPayload { void EspNowBridge::dispatchToUi(void (*work)(EspNowBridge&, void*), void* context, void (*freeContext)(void*)) { auto* payload = new UiDispatchPayload{this, work, context, freeContext}; // lv_async_call() itself is an LVGL operation and must be lock-guarded when called from a - // non-LVGL task (see tt_lvgl_lock()'s doc comment) - the OTA worker task calls dispatchToUi() + // non-LVGL task (see lvgl_lock()'s doc comment) - the OTA worker task calls dispatchToUi() // repeatedly during the transfer, and without this lock most of those calls were silently // racing LVGL's own task and getting lost (only the very last status update, right before // esp_restart(), happened to land - everything else stayed stuck at "Waiting for // co-processor link..."). - bool locked = tt_lvgl_lock(TT_LVGL_DEFAULT_LOCK_TIME); + bool locked = lvgl_try_lock(TT_LVGL_DEFAULT_LOCK_TIME); if (!locked) { // Without the lock, lv_async_call() itself would be touching LVGL's internal timer list // unguarded - and if it happened to still enqueue successfully, the callback below would @@ -310,7 +310,7 @@ void EspNowBridge::dispatchToUi(void (*work)(EspNowBridge&, void*), void* contex } delete payload; }, payload); - tt_lvgl_unlock(); + lvgl_unlock(); if (result != LV_RESULT_OK) { if (freeContext != nullptr) { diff --git a/Apps/EspNowBridge/manifest.properties b/Apps/EspNowBridge/manifest.properties index 17009e9..2c1e956 100644 --- a/Apps/EspNowBridge/manifest.properties +++ b/Apps/EspNowBridge/manifest.properties @@ -2,7 +2,7 @@ manifest.version=0.2 target.sdk=0.8.0-dev target.platforms=esp32p4 app.id=one.tactility.espnowbridge -app.version.name=0.1.0 -app.version.code=1 +app.version.name=0.2.0 +app.version.code=2 app.name=ESP-NOW Bridge app.description=Companion app for updating P4 device C6 co-processor firmware to enable ESP-NOW bridge support. diff --git a/Apps/GPIO/main/Source/Gpio.cpp b/Apps/GPIO/main/Source/Gpio.cpp index 12915c8..c847ee8 100644 --- a/Apps/GPIO/main/Source/Gpio.cpp +++ b/Apps/GPIO/main/Source/Gpio.cpp @@ -2,7 +2,6 @@ #include -#include #include #include @@ -20,7 +19,7 @@ void Gpio::updatePinStates() { } void Gpio::updatePinWidgets() { - tt_lvgl_lock(tt::kernel::MAX_TICKS); + lvgl_lock(); for (int j = 0; j < pinStates.size(); ++j) { int level = pinStates[j]; lv_obj_t* label = pinWidgets[j]; @@ -35,7 +34,7 @@ void Gpio::updatePinWidgets() { } } } - tt_lvgl_unlock(); + lvgl_unlock(); } lv_obj_t* Gpio::createGpioRowWrapper(lv_obj_t* parent) { diff --git a/Apps/GPIO/manifest.properties b/Apps/GPIO/manifest.properties index d15e2f8..cbe5dce 100644 --- a/Apps/GPIO/manifest.properties +++ b/Apps/GPIO/manifest.properties @@ -2,6 +2,6 @@ manifest.version=0.2 target.sdk=0.8.0-dev target.platforms=esp32,esp32s3,esp32c6,esp32p4 app.id=one.tactility.gpio -app.version.name=0.7.0 -app.version.code=7 +app.version.name=0.8.0 +app.version.code=8 app.name=GPIO diff --git a/Apps/MediaKeys/main/Source/MediaKeys.cpp b/Apps/MediaKeys/main/Source/MediaKeys.cpp index 3ae6b1a..18f43b5 100644 --- a/Apps/MediaKeys/main/Source/MediaKeys.cpp +++ b/Apps/MediaKeys/main/Source/MediaKeys.cpp @@ -5,7 +5,7 @@ #include #include #include -#include +#include #include static const char* TAG = "MediaKeys"; @@ -154,24 +154,24 @@ void MediaKeys::btEventCallback(struct Device* /*device*/, void* context, struct if (event.radio_state == BT_RADIO_STATE_ON) { // Radio is now up - start HID (needs LVGL lock for UI update) - if (tt_lvgl_lock(1000)) { + if (lvgl_try_lock(1000)) { // Re-check inside lock to avoid TOCTOU race with handleSwitchToggle(false) if (self->_radioEnabling) { self->startHid(); } - tt_lvgl_unlock(); + lvgl_unlock(); } } else if (event.radio_state == BT_RADIO_STATE_OFF && self->_isEnabled) { // Radio dropped while we were active - revert UI LOG_I(TAG, "BT radio turned off, disabling HID"); - if (tt_lvgl_lock(1000)) { + if (lvgl_try_lock(1000)) { if (tt_lvgl_hardware_keyboard_is_available()) self->exitKeyMode(); self->_hidDevice = nullptr; self->_isEnabled = false; self->_radioEnabling = false; if (self->_switchWidget) lv_obj_remove_state(self->_switchWidget, LV_STATE_CHECKED); if (self->_mainWrapper) lv_obj_add_flag(self->_mainWrapper, LV_OBJ_FLAG_HIDDEN); - tt_lvgl_unlock(); + lvgl_unlock(); } } } else if (event.type == BT_EVENT_PROFILE_STATE_CHANGED && event.profile_state.profile == BT_PROFILE_HID_DEVICE) { diff --git a/Apps/MediaKeys/manifest.properties b/Apps/MediaKeys/manifest.properties index cfdf11b..3a36717 100644 --- a/Apps/MediaKeys/manifest.properties +++ b/Apps/MediaKeys/manifest.properties @@ -2,7 +2,7 @@ manifest.version=0.2 target.sdk=0.8.0-dev target.platforms=esp32s3,esp32p4 app.id=one.tactility.mediakeys -app.version.name=0.4.0 -app.version.code=4 +app.version.name=0.5.0 +app.version.code=5 app.name=Media Keys app.description=Bluetooth media keys. Touch or Physical Keyboard control\nB - previous, P - play/pause, N - next, M - mute, D - volume down, U - volume up.\nQ or ESC to exit focus. diff --git a/Apps/SerialConsole/manifest.properties b/Apps/SerialConsole/manifest.properties index 0411dc1..2d439cc 100644 --- a/Apps/SerialConsole/manifest.properties +++ b/Apps/SerialConsole/manifest.properties @@ -2,6 +2,6 @@ manifest.version=0.2 target.sdk=0.8.0-dev target.platforms=esp32,esp32s3,esp32c6,esp32p4 app.id=one.tactility.serialconsole -app.version.name=0.7.0 -app.version.code=7 +app.version.name=0.8.0 +app.version.code=8 app.name=Serial Console diff --git a/Apps/Snake/manifest.properties b/Apps/Snake/manifest.properties index 410637c..c79d87b 100644 --- a/Apps/Snake/manifest.properties +++ b/Apps/Snake/manifest.properties @@ -2,7 +2,7 @@ manifest.version=0.2 target.sdk=0.8.0-dev target.platforms=esp32,esp32s3,esp32c6,esp32p4 app.id=one.tactility.snake -app.version.name=0.8.0 -app.version.code=8 +app.version.name=0.9.0 +app.version.code=9 app.name=Snake app.description=Classic Snake game diff --git a/Apps/TwoEleven/manifest.properties b/Apps/TwoEleven/manifest.properties index 66a0261..110c25c 100644 --- a/Apps/TwoEleven/manifest.properties +++ b/Apps/TwoEleven/manifest.properties @@ -2,7 +2,7 @@ manifest.version=0.2 target.sdk=0.8.0-dev target.platforms=esp32,esp32s3,esp32c6,esp32p4 app.id=one.tactility.twoeleven -app.version.name=0.7.0 -app.version.code=7 +app.version.name=0.8.0 +app.version.code=8 app.name=2048 app.description=A fun, customizable 2048 sliding tile game for tactility!\nSlide tiles to combine numbers and reach 2048.\nChoose grid sizes: 3x3 (easy), 4x4 (classic), 5x5, or 6x6 (expert). diff --git a/Libraries/TactilityCpp/Include/TactilityCpp/LvglLock.h b/Libraries/TactilityCpp/Include/TactilityCpp/LvglLock.h index 2e71ce6..ec18510 100644 --- a/Libraries/TactilityCpp/Include/TactilityCpp/LvglLock.h +++ b/Libraries/TactilityCpp/Include/TactilityCpp/LvglLock.h @@ -1,19 +1,22 @@ #pragma once #include -#include +#include class LvglLock final : public tt::Lock { public: - bool lock(TickType_t timeout = tt::kernel::MAX_TICKS) const override { - return tt_lvgl_lock(timeout); + void lock() const override { + lvgl_lock(); } + bool try_lock(TickType_t timeout) const override { + return lvgl_try_lock(timeout); + } void unlock() const override { - tt_lvgl_unlock(); + lvgl_unlock(); } }; From 3ac4e3fe20a45e5ea9610f49cfd67034a7c6c0eb Mon Sep 17 00:00:00 2001 From: Ken Van Hoeylandt Date: Sun, 26 Jul 2026 12:02:23 +0200 Subject: [PATCH 2/6] Updated GraphicsDemo --- Apps/GraphicsDemo/main/Include/PixelBuffer.h | 32 ++++----- .../main/Include/drivers/DisplayDriver.h | 30 ++++----- .../main/Include/drivers/TouchDriver.h | 20 +++--- Apps/GraphicsDemo/main/Source/Main.cpp | 67 +++++++------------ 4 files changed, 63 insertions(+), 86 deletions(-) diff --git a/Apps/GraphicsDemo/main/Include/PixelBuffer.h b/Apps/GraphicsDemo/main/Include/PixelBuffer.h index c13b47f..1901927 100644 --- a/Apps/GraphicsDemo/main/Include/PixelBuffer.h +++ b/Apps/GraphicsDemo/main/Include/PixelBuffer.h @@ -4,17 +4,17 @@ #include "drivers/Colors.h" #include -#include +#include class PixelBuffer { uint16_t pixelWidth; uint16_t pixelHeight; - ColorFormat colorFormat; + enum DisplayColorFormat colorFormat; uint8_t* data; public: - PixelBuffer(uint16_t pixelWidth, uint16_t pixelHeight, ColorFormat colorFormat) : + PixelBuffer(uint16_t pixelWidth, uint16_t pixelHeight, enum DisplayColorFormat colorFormat) : pixelWidth(pixelWidth), pixelHeight(pixelHeight), colorFormat(colorFormat) @@ -35,7 +35,7 @@ class PixelBuffer { return pixelHeight; } - ColorFormat getColorFormat() const { + enum DisplayColorFormat getColorFormat() const { return colorFormat; } @@ -58,14 +58,14 @@ class PixelBuffer { uint8_t getPixelSize() const { switch (colorFormat) { - case COLOR_FORMAT_MONOCHROME: + case DISPLAY_COLOR_FORMAT_MONOCHROME: return 1; - case COLOR_FORMAT_BGR565: - case COLOR_FORMAT_BGR565_SWAPPED: - case COLOR_FORMAT_RGB565: - case COLOR_FORMAT_RGB565_SWAPPED: + case DISPLAY_COLOR_FORMAT_BGR565: + case DISPLAY_COLOR_FORMAT_BGR565_SWAPPED: + case DISPLAY_COLOR_FORMAT_RGB565: + case DISPLAY_COLOR_FORMAT_RGB565_SWAPPED: return 2; - case COLOR_FORMAT_RGB888: + case DISPLAY_COLOR_FORMAT_RGB888: return 3; default: // TODO: Crash with error @@ -82,13 +82,13 @@ class PixelBuffer { void setPixel(uint16_t x, uint16_t y, uint8_t r, uint8_t g, uint8_t b) const { auto address = getPixelAddress(x, y); switch (colorFormat) { - case COLOR_FORMAT_MONOCHROME: + case DISPLAY_COLOR_FORMAT_MONOCHROME: *address = (uint8_t)((uint16_t)r + (uint16_t)g + (uint16_t)b / 3); break; - case COLOR_FORMAT_BGR565: + case DISPLAY_COLOR_FORMAT_BGR565: Colors::rgb888ToBgr565(r, g, b, reinterpret_cast(address)); break; - case COLOR_FORMAT_BGR565_SWAPPED: { + case DISPLAY_COLOR_FORMAT_BGR565_SWAPPED: { // TODO: Make proper conversion function Colors::rgb888ToBgr565(r, g, b, reinterpret_cast(address)); uint8_t temp = *address; @@ -96,11 +96,11 @@ class PixelBuffer { *(address + 1) = temp; break; } - case COLOR_FORMAT_RGB565: { + case DISPLAY_COLOR_FORMAT_RGB565: { Colors::rgb888ToRgb565(r, g, b, reinterpret_cast(address)); break; } - case COLOR_FORMAT_RGB565_SWAPPED: { + case DISPLAY_COLOR_FORMAT_RGB565_SWAPPED: { // TODO: Make proper conversion function Colors::rgb888ToRgb565(r, g, b, reinterpret_cast(address)); uint8_t temp = *address; @@ -108,7 +108,7 @@ class PixelBuffer { *(address + 1) = temp; break; } - case COLOR_FORMAT_RGB888: { + case DISPLAY_COLOR_FORMAT_RGB888: { uint8_t pixel[3] = { r, g, b }; memcpy(address, pixel, 3); break; diff --git a/Apps/GraphicsDemo/main/Include/drivers/DisplayDriver.h b/Apps/GraphicsDemo/main/Include/drivers/DisplayDriver.h index 702fc59..7ce0961 100644 --- a/Apps/GraphicsDemo/main/Include/drivers/DisplayDriver.h +++ b/Apps/GraphicsDemo/main/Include/drivers/DisplayDriver.h @@ -1,49 +1,47 @@ #pragma once -#include -#include +#include +#include #include /** - * Wrapper for tt_hal_display_driver_* + * Wrapper for display_* device driver functions */ class DisplayDriver { - DisplayDriverHandle handle = nullptr; + struct Device* device; public: - explicit DisplayDriver(DeviceId id) { - assert(tt_hal_display_driver_supported(id)); - handle = tt_hal_display_driver_alloc(id); - assert(handle != nullptr); + explicit DisplayDriver(struct Device* device) : device(device) { + device_get(device); } ~DisplayDriver() { - tt_hal_display_driver_free(handle); + device_put(device); } bool lock(TickType_t timeout = tt::kernel::MAX_TICKS) const { - return tt_hal_display_driver_lock(handle, timeout); + return device_try_lock(device, timeout); } void unlock() const { - tt_hal_display_driver_unlock(handle); + device_unlock(device); } uint16_t getWidth() const { - return tt_hal_display_driver_get_pixel_width(handle); + return display_get_resolution_x(device); } uint16_t getHeight() const { - return tt_hal_display_driver_get_pixel_height(handle); + return display_get_resolution_y(device); } - ColorFormat getColorFormat() const { - return tt_hal_display_driver_get_colorformat(handle); + enum DisplayColorFormat getColorFormat() const { + return display_get_color_format(device); } void drawBitmap(int xStart, int yStart, int xEnd, int yEnd, const void* pixelData) const { - tt_hal_display_driver_draw_bitmap(handle, xStart, yStart, xEnd, yEnd, pixelData); + display_draw_bitmap(device, xStart, yStart, xEnd, yEnd, pixelData); } }; diff --git a/Apps/GraphicsDemo/main/Include/drivers/TouchDriver.h b/Apps/GraphicsDemo/main/Include/drivers/TouchDriver.h index 622f126..4181f7b 100644 --- a/Apps/GraphicsDemo/main/Include/drivers/TouchDriver.h +++ b/Apps/GraphicsDemo/main/Include/drivers/TouchDriver.h @@ -1,28 +1,28 @@ #pragma once -#include -#include +#include +#include /** - * Wrapper for tt_hal_touch_driver_* + * Wrapper for pointer_* device driver functions */ class TouchDriver { - TouchDriverHandle handle = nullptr; + struct Device* device; public: - explicit TouchDriver(DeviceId id) { - assert(tt_hal_touch_driver_supported(id)); - handle = tt_hal_touch_driver_alloc(id); - assert(handle != nullptr); + explicit TouchDriver(struct Device* device) : device(device) { + device_get(device); } ~TouchDriver() { - tt_hal_touch_driver_free(handle); + device_put(device); } bool getTouchedPoints(uint16_t* x, uint16_t* y, uint16_t* strength, uint8_t* count, uint8_t maxCount) const { - return tt_hal_touch_driver_get_touched_points(handle, x, y, strength, count, maxCount); + // Poll without blocking: perform one read attempt, then report whatever is cached. + pointer_read_data(device, 0); + return pointer_get_touched_points(device, x, y, strength, count, maxCount); } }; diff --git a/Apps/GraphicsDemo/main/Source/Main.cpp b/Apps/GraphicsDemo/main/Source/Main.cpp index c8949d9..256f4fb 100644 --- a/Apps/GraphicsDemo/main/Source/Main.cpp +++ b/Apps/GraphicsDemo/main/Source/Main.cpp @@ -6,65 +6,44 @@ #include #include -#include -constexpr auto TAG = "Main"; +#include +#include +#include +#include +#include +#include -/** Find a DisplayDevice that supports the DisplayDriver interface */ -static bool findUsableDisplay(DeviceId& deviceId) { - uint16_t display_count = 0; - if (!tt_hal_device_find(DEVICE_TYPE_DISPLAY, &deviceId, &display_count, 1)) { - ESP_LOGE(TAG, "No display device found"); - return false; - } - - if (!tt_hal_display_driver_supported(deviceId)) { - ESP_LOGE(TAG, "Display doesn't support driver mode"); - return false; - } - - return true; -} - -/** Find a TouchDevice that supports the TouchDriver interface */ -static bool findUsableTouch(DeviceId& deviceId) { - uint16_t touch_count = 0; - if (!tt_hal_device_find(DEVICE_TYPE_TOUCH, &deviceId, &touch_count, 1)) { - ESP_LOGE(TAG, "No touch device found"); - return false; - } - - if (!tt_hal_touch_driver_supported(deviceId)) { - ESP_LOGE(TAG, "Touch doesn't support driver mode"); - return false; - } - - return true; -} +constexpr auto TAG = "Main"; static void onCreate(AppHandle appHandle, void* data) { - DeviceId display_id; - if (!findUsableDisplay(display_id)) { + struct Device* display_device; + if (device_get_first_active_by_type(&DISPLAY_TYPE, &display_device) != ERROR_NONE) { + ESP_LOGE(TAG, "No display device found"); tt_app_stop(); - tt_app_alertdialog_start("Error", "The display doesn't support the required features.", nullptr, 0); + tt_app_alertdialog_start("Error", "No display device was found.", nullptr, 0); return; } - DeviceId touch_id; - if (!findUsableTouch(touch_id)) { + struct Device* touch_device; + if (device_get_first_active_by_type(&POINTER_TYPE, &touch_device) != ERROR_NONE) { + ESP_LOGE(TAG, "No touch device found"); + device_put(display_device); tt_app_stop(); - tt_app_alertdialog_start("Error", "The touch driver doesn't support the required features.", nullptr, 0); + tt_app_alertdialog_start("Error", "No touch device was found.", nullptr, 0); return; } // Stop LVGL first (because it's currently using the drivers we want to use) - tt_lvgl_stop(); + module_stop(&lvgl_module); ESP_LOGI(TAG, "Creating display driver"); - auto display = new DisplayDriver(display_id); + auto display = new DisplayDriver(display_device); + device_put(display_device); ESP_LOGI(TAG, "Creating touch driver"); - auto touch = new TouchDriver(touch_id); + auto touch = new TouchDriver(touch_device); + device_put(touch_device); // Run the main logic ESP_LOGI(TAG, "Running application"); @@ -82,9 +61,9 @@ static void onCreate(AppHandle appHandle, void* data) { static void onDestroy(AppHandle appHandle, void* data) { // Restart LVGL to resume rendering of regular apps - if (!tt_lvgl_is_started()) { + if (!module_is_started(&lvgl_module)) { ESP_LOGI(TAG, "Restarting LVGL"); - tt_lvgl_start(); + module_start(&lvgl_module); } } From 104dd741f0a8d169e78b8cd548f6b553537aacfc Mon Sep 17 00:00:00 2001 From: Ken Van Hoeylandt Date: Sun, 26 Jul 2026 12:15:45 +0200 Subject: [PATCH 3/6] Updated apps --- Apps/Breakout/main/Source/Breakout.cpp | 2 +- Apps/Breakout/manifest.properties | 4 +- Apps/Diceware/main/Source/Diceware.cpp | 4 +- .../EspNowBridge/main/Source/EspNowBridge.cpp | 2 +- Apps/GPIO/main/Source/Gpio.cpp | 2 +- Apps/MediaKeys/main/Source/MediaKeys.cpp | 2 +- Apps/MystifyDemo/main/Include/PixelBuffer.h | 32 ++++----- .../main/Include/drivers/DisplayDriver.h | 30 ++++----- .../main/Include/drivers/TouchDriver.h | 20 +++--- Apps/MystifyDemo/main/Source/Main.cpp | 67 +++++++------------ Apps/MystifyDemo/manifest.properties | 4 +- Apps/SerialConsole/main/Source/ConnectView.h | 1 - Apps/SerialConsole/main/Source/ConsoleView.h | 2 - Apps/Snake/main/Source/Snake.cpp | 2 +- Apps/TodoList/main/Source/TodoList.cpp | 2 +- Apps/TodoList/manifest.properties | 4 +- Apps/TwoEleven/main/Source/TwoEleven.cpp | 2 +- .../Include/TactilityCpp/LvglLock.h | 2 +- 18 files changed, 79 insertions(+), 105 deletions(-) diff --git a/Apps/Breakout/main/Source/Breakout.cpp b/Apps/Breakout/main/Source/Breakout.cpp index 4c9553a..c43b54b 100644 --- a/Apps/Breakout/main/Source/Breakout.cpp +++ b/Apps/Breakout/main/Source/Breakout.cpp @@ -12,7 +12,7 @@ #include #include -#include +#include #include constexpr auto* TAG = "Breakout"; diff --git a/Apps/Breakout/manifest.properties b/Apps/Breakout/manifest.properties index b4afc3c..c20e64e 100644 --- a/Apps/Breakout/manifest.properties +++ b/Apps/Breakout/manifest.properties @@ -2,7 +2,7 @@ manifest.version=0.2 target.sdk=0.8.0-dev target.platforms=esp32,esp32s3,esp32c6,esp32p4 app.id=one.tactility.breakout -app.version.name=0.5.0 -app.version.code=5 +app.version.name=0.6.0 +app.version.code=6 app.name=Breakout app.description=Classic brick-breaking arcade game diff --git a/Apps/Diceware/main/Source/Diceware.cpp b/Apps/Diceware/main/Source/Diceware.cpp index 48097d7..5830935 100644 --- a/Apps/Diceware/main/Source/Diceware.cpp +++ b/Apps/Diceware/main/Source/Diceware.cpp @@ -2,7 +2,7 @@ #include #include -#include +#include #include #include @@ -89,7 +89,7 @@ void Diceware::startJob(uint32_t jobWordCount) { void Diceware::onFinishJob(std::string result) { lvgl_lock(); lv_label_set_text(resultLabel, result.c_str()); - tt_lvgl_unlock(); + lvgl_unlock(); } void Diceware::onClickGenerate(lv_event_t* e) { diff --git a/Apps/EspNowBridge/main/Source/EspNowBridge.cpp b/Apps/EspNowBridge/main/Source/EspNowBridge.cpp index 3e56aea..903c232 100644 --- a/Apps/EspNowBridge/main/Source/EspNowBridge.cpp +++ b/Apps/EspNowBridge/main/Source/EspNowBridge.cpp @@ -9,7 +9,7 @@ #include #include #include -#include +#include #include #include diff --git a/Apps/GPIO/main/Source/Gpio.cpp b/Apps/GPIO/main/Source/Gpio.cpp index c847ee8..a41aa9e 100644 --- a/Apps/GPIO/main/Source/Gpio.cpp +++ b/Apps/GPIO/main/Source/Gpio.cpp @@ -4,7 +4,7 @@ #include -#include +#include #include #include diff --git a/Apps/MediaKeys/main/Source/MediaKeys.cpp b/Apps/MediaKeys/main/Source/MediaKeys.cpp index 18f43b5..5010852 100644 --- a/Apps/MediaKeys/main/Source/MediaKeys.cpp +++ b/Apps/MediaKeys/main/Source/MediaKeys.cpp @@ -5,7 +5,7 @@ #include #include #include -#include +#include #include static const char* TAG = "MediaKeys"; diff --git a/Apps/MystifyDemo/main/Include/PixelBuffer.h b/Apps/MystifyDemo/main/Include/PixelBuffer.h index c13b47f..1901927 100644 --- a/Apps/MystifyDemo/main/Include/PixelBuffer.h +++ b/Apps/MystifyDemo/main/Include/PixelBuffer.h @@ -4,17 +4,17 @@ #include "drivers/Colors.h" #include -#include +#include class PixelBuffer { uint16_t pixelWidth; uint16_t pixelHeight; - ColorFormat colorFormat; + enum DisplayColorFormat colorFormat; uint8_t* data; public: - PixelBuffer(uint16_t pixelWidth, uint16_t pixelHeight, ColorFormat colorFormat) : + PixelBuffer(uint16_t pixelWidth, uint16_t pixelHeight, enum DisplayColorFormat colorFormat) : pixelWidth(pixelWidth), pixelHeight(pixelHeight), colorFormat(colorFormat) @@ -35,7 +35,7 @@ class PixelBuffer { return pixelHeight; } - ColorFormat getColorFormat() const { + enum DisplayColorFormat getColorFormat() const { return colorFormat; } @@ -58,14 +58,14 @@ class PixelBuffer { uint8_t getPixelSize() const { switch (colorFormat) { - case COLOR_FORMAT_MONOCHROME: + case DISPLAY_COLOR_FORMAT_MONOCHROME: return 1; - case COLOR_FORMAT_BGR565: - case COLOR_FORMAT_BGR565_SWAPPED: - case COLOR_FORMAT_RGB565: - case COLOR_FORMAT_RGB565_SWAPPED: + case DISPLAY_COLOR_FORMAT_BGR565: + case DISPLAY_COLOR_FORMAT_BGR565_SWAPPED: + case DISPLAY_COLOR_FORMAT_RGB565: + case DISPLAY_COLOR_FORMAT_RGB565_SWAPPED: return 2; - case COLOR_FORMAT_RGB888: + case DISPLAY_COLOR_FORMAT_RGB888: return 3; default: // TODO: Crash with error @@ -82,13 +82,13 @@ class PixelBuffer { void setPixel(uint16_t x, uint16_t y, uint8_t r, uint8_t g, uint8_t b) const { auto address = getPixelAddress(x, y); switch (colorFormat) { - case COLOR_FORMAT_MONOCHROME: + case DISPLAY_COLOR_FORMAT_MONOCHROME: *address = (uint8_t)((uint16_t)r + (uint16_t)g + (uint16_t)b / 3); break; - case COLOR_FORMAT_BGR565: + case DISPLAY_COLOR_FORMAT_BGR565: Colors::rgb888ToBgr565(r, g, b, reinterpret_cast(address)); break; - case COLOR_FORMAT_BGR565_SWAPPED: { + case DISPLAY_COLOR_FORMAT_BGR565_SWAPPED: { // TODO: Make proper conversion function Colors::rgb888ToBgr565(r, g, b, reinterpret_cast(address)); uint8_t temp = *address; @@ -96,11 +96,11 @@ class PixelBuffer { *(address + 1) = temp; break; } - case COLOR_FORMAT_RGB565: { + case DISPLAY_COLOR_FORMAT_RGB565: { Colors::rgb888ToRgb565(r, g, b, reinterpret_cast(address)); break; } - case COLOR_FORMAT_RGB565_SWAPPED: { + case DISPLAY_COLOR_FORMAT_RGB565_SWAPPED: { // TODO: Make proper conversion function Colors::rgb888ToRgb565(r, g, b, reinterpret_cast(address)); uint8_t temp = *address; @@ -108,7 +108,7 @@ class PixelBuffer { *(address + 1) = temp; break; } - case COLOR_FORMAT_RGB888: { + case DISPLAY_COLOR_FORMAT_RGB888: { uint8_t pixel[3] = { r, g, b }; memcpy(address, pixel, 3); break; diff --git a/Apps/MystifyDemo/main/Include/drivers/DisplayDriver.h b/Apps/MystifyDemo/main/Include/drivers/DisplayDriver.h index 702fc59..7ce0961 100644 --- a/Apps/MystifyDemo/main/Include/drivers/DisplayDriver.h +++ b/Apps/MystifyDemo/main/Include/drivers/DisplayDriver.h @@ -1,49 +1,47 @@ #pragma once -#include -#include +#include +#include #include /** - * Wrapper for tt_hal_display_driver_* + * Wrapper for display_* device driver functions */ class DisplayDriver { - DisplayDriverHandle handle = nullptr; + struct Device* device; public: - explicit DisplayDriver(DeviceId id) { - assert(tt_hal_display_driver_supported(id)); - handle = tt_hal_display_driver_alloc(id); - assert(handle != nullptr); + explicit DisplayDriver(struct Device* device) : device(device) { + device_get(device); } ~DisplayDriver() { - tt_hal_display_driver_free(handle); + device_put(device); } bool lock(TickType_t timeout = tt::kernel::MAX_TICKS) const { - return tt_hal_display_driver_lock(handle, timeout); + return device_try_lock(device, timeout); } void unlock() const { - tt_hal_display_driver_unlock(handle); + device_unlock(device); } uint16_t getWidth() const { - return tt_hal_display_driver_get_pixel_width(handle); + return display_get_resolution_x(device); } uint16_t getHeight() const { - return tt_hal_display_driver_get_pixel_height(handle); + return display_get_resolution_y(device); } - ColorFormat getColorFormat() const { - return tt_hal_display_driver_get_colorformat(handle); + enum DisplayColorFormat getColorFormat() const { + return display_get_color_format(device); } void drawBitmap(int xStart, int yStart, int xEnd, int yEnd, const void* pixelData) const { - tt_hal_display_driver_draw_bitmap(handle, xStart, yStart, xEnd, yEnd, pixelData); + display_draw_bitmap(device, xStart, yStart, xEnd, yEnd, pixelData); } }; diff --git a/Apps/MystifyDemo/main/Include/drivers/TouchDriver.h b/Apps/MystifyDemo/main/Include/drivers/TouchDriver.h index 622f126..4181f7b 100644 --- a/Apps/MystifyDemo/main/Include/drivers/TouchDriver.h +++ b/Apps/MystifyDemo/main/Include/drivers/TouchDriver.h @@ -1,28 +1,28 @@ #pragma once -#include -#include +#include +#include /** - * Wrapper for tt_hal_touch_driver_* + * Wrapper for pointer_* device driver functions */ class TouchDriver { - TouchDriverHandle handle = nullptr; + struct Device* device; public: - explicit TouchDriver(DeviceId id) { - assert(tt_hal_touch_driver_supported(id)); - handle = tt_hal_touch_driver_alloc(id); - assert(handle != nullptr); + explicit TouchDriver(struct Device* device) : device(device) { + device_get(device); } ~TouchDriver() { - tt_hal_touch_driver_free(handle); + device_put(device); } bool getTouchedPoints(uint16_t* x, uint16_t* y, uint16_t* strength, uint8_t* count, uint8_t maxCount) const { - return tt_hal_touch_driver_get_touched_points(handle, x, y, strength, count, maxCount); + // Poll without blocking: perform one read attempt, then report whatever is cached. + pointer_read_data(device, 0); + return pointer_get_touched_points(device, x, y, strength, count, maxCount); } }; diff --git a/Apps/MystifyDemo/main/Source/Main.cpp b/Apps/MystifyDemo/main/Source/Main.cpp index c8949d9..256f4fb 100644 --- a/Apps/MystifyDemo/main/Source/Main.cpp +++ b/Apps/MystifyDemo/main/Source/Main.cpp @@ -6,65 +6,44 @@ #include #include -#include -constexpr auto TAG = "Main"; +#include +#include +#include +#include +#include +#include -/** Find a DisplayDevice that supports the DisplayDriver interface */ -static bool findUsableDisplay(DeviceId& deviceId) { - uint16_t display_count = 0; - if (!tt_hal_device_find(DEVICE_TYPE_DISPLAY, &deviceId, &display_count, 1)) { - ESP_LOGE(TAG, "No display device found"); - return false; - } - - if (!tt_hal_display_driver_supported(deviceId)) { - ESP_LOGE(TAG, "Display doesn't support driver mode"); - return false; - } - - return true; -} - -/** Find a TouchDevice that supports the TouchDriver interface */ -static bool findUsableTouch(DeviceId& deviceId) { - uint16_t touch_count = 0; - if (!tt_hal_device_find(DEVICE_TYPE_TOUCH, &deviceId, &touch_count, 1)) { - ESP_LOGE(TAG, "No touch device found"); - return false; - } - - if (!tt_hal_touch_driver_supported(deviceId)) { - ESP_LOGE(TAG, "Touch doesn't support driver mode"); - return false; - } - - return true; -} +constexpr auto TAG = "Main"; static void onCreate(AppHandle appHandle, void* data) { - DeviceId display_id; - if (!findUsableDisplay(display_id)) { + struct Device* display_device; + if (device_get_first_active_by_type(&DISPLAY_TYPE, &display_device) != ERROR_NONE) { + ESP_LOGE(TAG, "No display device found"); tt_app_stop(); - tt_app_alertdialog_start("Error", "The display doesn't support the required features.", nullptr, 0); + tt_app_alertdialog_start("Error", "No display device was found.", nullptr, 0); return; } - DeviceId touch_id; - if (!findUsableTouch(touch_id)) { + struct Device* touch_device; + if (device_get_first_active_by_type(&POINTER_TYPE, &touch_device) != ERROR_NONE) { + ESP_LOGE(TAG, "No touch device found"); + device_put(display_device); tt_app_stop(); - tt_app_alertdialog_start("Error", "The touch driver doesn't support the required features.", nullptr, 0); + tt_app_alertdialog_start("Error", "No touch device was found.", nullptr, 0); return; } // Stop LVGL first (because it's currently using the drivers we want to use) - tt_lvgl_stop(); + module_stop(&lvgl_module); ESP_LOGI(TAG, "Creating display driver"); - auto display = new DisplayDriver(display_id); + auto display = new DisplayDriver(display_device); + device_put(display_device); ESP_LOGI(TAG, "Creating touch driver"); - auto touch = new TouchDriver(touch_id); + auto touch = new TouchDriver(touch_device); + device_put(touch_device); // Run the main logic ESP_LOGI(TAG, "Running application"); @@ -82,9 +61,9 @@ static void onCreate(AppHandle appHandle, void* data) { static void onDestroy(AppHandle appHandle, void* data) { // Restart LVGL to resume rendering of regular apps - if (!tt_lvgl_is_started()) { + if (!module_is_started(&lvgl_module)) { ESP_LOGI(TAG, "Restarting LVGL"); - tt_lvgl_start(); + module_start(&lvgl_module); } } diff --git a/Apps/MystifyDemo/manifest.properties b/Apps/MystifyDemo/manifest.properties index 1ad4703..ffc5e8d 100644 --- a/Apps/MystifyDemo/manifest.properties +++ b/Apps/MystifyDemo/manifest.properties @@ -2,6 +2,6 @@ manifest.version=0.2 target.sdk=0.8.0-dev target.platforms=esp32,esp32s3,esp32c6,esp32p4 app.id=one.tactility.mystifydemo -app.version.name=0.6.0 -app.version.code=6 +app.version.name=0.7.0 +app.version.code=7 app.name=Mystify Demo diff --git a/Apps/SerialConsole/main/Source/ConnectView.h b/Apps/SerialConsole/main/Source/ConnectView.h index 86d3d85..9da0ab4 100644 --- a/Apps/SerialConsole/main/Source/ConnectView.h +++ b/Apps/SerialConsole/main/Source/ConnectView.h @@ -8,7 +8,6 @@ #include #include -#include #include #include #include diff --git a/Apps/SerialConsole/main/Source/ConsoleView.h b/Apps/SerialConsole/main/Source/ConsoleView.h index 1b898f9..28686a9 100644 --- a/Apps/SerialConsole/main/Source/ConsoleView.h +++ b/Apps/SerialConsole/main/Source/ConsoleView.h @@ -7,8 +7,6 @@ #include #include -#include - #include #include #include diff --git a/Apps/Snake/main/Source/Snake.cpp b/Apps/Snake/main/Source/Snake.cpp index 85fa840..0a13dd6 100644 --- a/Apps/Snake/main/Source/Snake.cpp +++ b/Apps/Snake/main/Source/Snake.cpp @@ -12,7 +12,7 @@ #include -#include +#include #include constexpr auto* TAG = "Snake"; diff --git a/Apps/TodoList/main/Source/TodoList.cpp b/Apps/TodoList/main/Source/TodoList.cpp index 3eb7aaa..b33a152 100644 --- a/Apps/TodoList/main/Source/TodoList.cpp +++ b/Apps/TodoList/main/Source/TodoList.cpp @@ -4,7 +4,7 @@ #include #include #include -#include +#include #include #include #include diff --git a/Apps/TodoList/manifest.properties b/Apps/TodoList/manifest.properties index 5af158c..e48ee7f 100644 --- a/Apps/TodoList/manifest.properties +++ b/Apps/TodoList/manifest.properties @@ -2,7 +2,7 @@ manifest.version=0.2 target.sdk=0.8.0-dev target.platforms=esp32,esp32s3,esp32c6,esp32p4 app.id=one.tactility.todolist -app.version.name=0.5.0 -app.version.code=5 +app.version.name=0.6.0 +app.version.code=6 app.name=Todo List app.description=Simple task list manager diff --git a/Apps/TwoEleven/main/Source/TwoEleven.cpp b/Apps/TwoEleven/main/Source/TwoEleven.cpp index 1c3b934..21ab2b5 100644 --- a/Apps/TwoEleven/main/Source/TwoEleven.cpp +++ b/Apps/TwoEleven/main/Source/TwoEleven.cpp @@ -9,7 +9,7 @@ #include #include #include -#include +#include #include #include diff --git a/Libraries/TactilityCpp/Include/TactilityCpp/LvglLock.h b/Libraries/TactilityCpp/Include/TactilityCpp/LvglLock.h index ec18510..e86a651 100644 --- a/Libraries/TactilityCpp/Include/TactilityCpp/LvglLock.h +++ b/Libraries/TactilityCpp/Include/TactilityCpp/LvglLock.h @@ -1,7 +1,7 @@ #pragma once #include -#include +#include class LvglLock final : public tt::Lock { From dd8c266ff5a05ec70db13bebbac829c7d7b3583b Mon Sep 17 00:00:00 2001 From: Ken Van Hoeylandt Date: Sun, 26 Jul 2026 12:22:37 +0200 Subject: [PATCH 4/6] More updates --- Apps/Breakout/main/Source/Breakout.cpp | 2 +- Apps/EspNowBridge/main/Source/EspNowBridge.cpp | 4 +++- Apps/MediaKeys/main/Source/MediaKeys.cpp | 2 +- Apps/SerialConsole/main/Source/ConnectView.h | 4 +++- Apps/Snake/main/Source/Snake.cpp | 2 +- Apps/TodoList/main/Source/TodoList.cpp | 2 +- Apps/TwoEleven/main/Source/TwoEleven.cpp | 2 +- Libraries/TactilityCpp/Include/TactilityCpp/LvglLock.h | 6 ++---- 8 files changed, 13 insertions(+), 11 deletions(-) diff --git a/Apps/Breakout/main/Source/Breakout.cpp b/Apps/Breakout/main/Source/Breakout.cpp index c43b54b..e7101ae 100644 --- a/Apps/Breakout/main/Source/Breakout.cpp +++ b/Apps/Breakout/main/Source/Breakout.cpp @@ -13,7 +13,7 @@ #include #include -#include +#include constexpr auto* TAG = "Breakout"; diff --git a/Apps/EspNowBridge/main/Source/EspNowBridge.cpp b/Apps/EspNowBridge/main/Source/EspNowBridge.cpp index 903c232..a56fa21 100644 --- a/Apps/EspNowBridge/main/Source/EspNowBridge.cpp +++ b/Apps/EspNowBridge/main/Source/EspNowBridge.cpp @@ -18,6 +18,8 @@ #include +constexpr TickType_t LVGL_DEFAULT_LOCK_TIME = 500; // 500 ticks = 500 ms + #include #include @@ -288,7 +290,7 @@ void EspNowBridge::dispatchToUi(void (*work)(EspNowBridge&, void*), void* contex // racing LVGL's own task and getting lost (only the very last status update, right before // esp_restart(), happened to land - everything else stayed stuck at "Waiting for // co-processor link..."). - bool locked = lvgl_try_lock(TT_LVGL_DEFAULT_LOCK_TIME); + bool locked = lvgl_try_lock(LVGL_DEFAULT_LOCK_TIME); if (!locked) { // Without the lock, lv_async_call() itself would be touching LVGL's internal timer list // unguarded - and if it happened to still enqueue successfully, the callback below would diff --git a/Apps/MediaKeys/main/Source/MediaKeys.cpp b/Apps/MediaKeys/main/Source/MediaKeys.cpp index 5010852..bd25559 100644 --- a/Apps/MediaKeys/main/Source/MediaKeys.cpp +++ b/Apps/MediaKeys/main/Source/MediaKeys.cpp @@ -4,7 +4,7 @@ #include #include #include -#include +#include #include #include diff --git a/Apps/SerialConsole/main/Source/ConnectView.h b/Apps/SerialConsole/main/Source/ConnectView.h index 9da0ab4..2bd3cb8 100644 --- a/Apps/SerialConsole/main/Source/ConnectView.h +++ b/Apps/SerialConsole/main/Source/ConnectView.h @@ -13,6 +13,8 @@ #include #include +constexpr TickType_t LVGL_DEFAULT_LOCK_TIME = 500; // 500 ticks = 500 ms + class ConnectView final : public View { public: @@ -44,7 +46,7 @@ class ConnectView final : public View { void onConnect() { auto lock = lvglLock.asScopedLock(); - if (!lock.lock(TT_LVGL_DEFAULT_LOCK_TIME)) { + if (!lock.lock(LVGL_DEFAULT_LOCK_TIME)) { return; } diff --git a/Apps/Snake/main/Source/Snake.cpp b/Apps/Snake/main/Source/Snake.cpp index 0a13dd6..619b4e1 100644 --- a/Apps/Snake/main/Source/Snake.cpp +++ b/Apps/Snake/main/Source/Snake.cpp @@ -13,7 +13,7 @@ #include #include -#include +#include constexpr auto* TAG = "Snake"; diff --git a/Apps/TodoList/main/Source/TodoList.cpp b/Apps/TodoList/main/Source/TodoList.cpp index b33a152..a7d3f9f 100644 --- a/Apps/TodoList/main/Source/TodoList.cpp +++ b/Apps/TodoList/main/Source/TodoList.cpp @@ -5,7 +5,7 @@ #include #include #include -#include +#include #include #include #include diff --git a/Apps/TwoEleven/main/Source/TwoEleven.cpp b/Apps/TwoEleven/main/Source/TwoEleven.cpp index 21ab2b5..4874b8a 100644 --- a/Apps/TwoEleven/main/Source/TwoEleven.cpp +++ b/Apps/TwoEleven/main/Source/TwoEleven.cpp @@ -10,7 +10,7 @@ #include #include #include -#include +#include #include constexpr auto* TAG = "TwoEleven"; diff --git a/Libraries/TactilityCpp/Include/TactilityCpp/LvglLock.h b/Libraries/TactilityCpp/Include/TactilityCpp/LvglLock.h index e86a651..05d7b1a 100644 --- a/Libraries/TactilityCpp/Include/TactilityCpp/LvglLock.h +++ b/Libraries/TactilityCpp/Include/TactilityCpp/LvglLock.h @@ -7,11 +7,9 @@ class LvglLock final : public tt::Lock { public: - void lock() const override { - lvgl_lock(); - } + using tt::Lock::lock; - bool try_lock(TickType_t timeout) const override { + bool lock(TickType_t timeout) const override { return lvgl_try_lock(timeout); } From 60b4eb790714c1c2ff7b7c33ff7a4bbce6612fb9 Mon Sep 17 00:00:00 2001 From: Ken Van Hoeylandt Date: Sun, 26 Jul 2026 12:27:13 +0200 Subject: [PATCH 5/6] Fix for includes --- Apps/M5UnitTest/main/Source/TestListView.cpp | 2 +- Apps/M5UnitTest/main/Source/TestListView.h | 2 +- Apps/M5UnitTest/main/Source/TestUnit8Encoder.cpp | 2 +- Apps/M5UnitTest/main/Source/TestUnitByteButton.cpp | 2 +- Apps/M5UnitTest/main/Source/TestUnitCardKB2.cpp | 2 +- Apps/M5UnitTest/main/Source/TestUnitDualButton.cpp | 2 +- Apps/M5UnitTest/main/Source/TestUnitJoystick2.cpp | 2 +- Apps/M5UnitTest/main/Source/TestUnitLcd.cpp | 2 +- Apps/M5UnitTest/main/Source/TestUnitLcdGfx.cpp | 2 +- Apps/M5UnitTest/main/Source/TestUnitMidi.cpp | 2 +- Apps/M5UnitTest/main/Source/TestUnitPaHub.cpp | 2 +- Apps/M5UnitTest/main/Source/TestUnitRfid2.cpp | 2 +- Apps/M5UnitTest/main/Source/TestUnitScroll.cpp | 2 +- Apps/M5UnitTest/main/Source/TestViewBase.cpp | 2 +- Apps/M5UnitTest/main/Source/UiScale.h | 2 +- 15 files changed, 15 insertions(+), 15 deletions(-) diff --git a/Apps/M5UnitTest/main/Source/TestListView.cpp b/Apps/M5UnitTest/main/Source/TestListView.cpp index bba1489..2eb3a05 100644 --- a/Apps/M5UnitTest/main/Source/TestListView.cpp +++ b/Apps/M5UnitTest/main/Source/TestListView.cpp @@ -2,7 +2,7 @@ #include "M5UnitTest.h" #include "UiScale.h" #include -#include +#include void TestListView::onStart(lv_obj_t* parent, AppHandle handle, M5UnitTest* app) { app_ = app; diff --git a/Apps/M5UnitTest/main/Source/TestListView.h b/Apps/M5UnitTest/main/Source/TestListView.h index 4e4dfec..54bf940 100644 --- a/Apps/M5UnitTest/main/Source/TestListView.h +++ b/Apps/M5UnitTest/main/Source/TestListView.h @@ -2,7 +2,7 @@ #include #include -#include +#include #include class M5UnitTest; diff --git a/Apps/M5UnitTest/main/Source/TestUnit8Encoder.cpp b/Apps/M5UnitTest/main/Source/TestUnit8Encoder.cpp index 8975076..8ca0b4c 100644 --- a/Apps/M5UnitTest/main/Source/TestUnit8Encoder.cpp +++ b/Apps/M5UnitTest/main/Source/TestUnit8Encoder.cpp @@ -2,7 +2,7 @@ #include "GroveLookup.h" #include "UiScale.h" #include -#include +#include #include diff --git a/Apps/M5UnitTest/main/Source/TestUnitByteButton.cpp b/Apps/M5UnitTest/main/Source/TestUnitByteButton.cpp index 6e82f15..fcef8be 100644 --- a/Apps/M5UnitTest/main/Source/TestUnitByteButton.cpp +++ b/Apps/M5UnitTest/main/Source/TestUnitByteButton.cpp @@ -2,7 +2,7 @@ #include "GroveLookup.h" #include "UiScale.h" #include -#include +#include #include void TestUnitByteButton::onStart(lv_obj_t* parent, AppHandle handle, M5UnitTest* app) { diff --git a/Apps/M5UnitTest/main/Source/TestUnitCardKB2.cpp b/Apps/M5UnitTest/main/Source/TestUnitCardKB2.cpp index 7ffb220..7f4a97c 100644 --- a/Apps/M5UnitTest/main/Source/TestUnitCardKB2.cpp +++ b/Apps/M5UnitTest/main/Source/TestUnitCardKB2.cpp @@ -3,7 +3,7 @@ #include "UiScale.h" #include #include -#include +#include #include // --------------------------------------------------------------------------- diff --git a/Apps/M5UnitTest/main/Source/TestUnitDualButton.cpp b/Apps/M5UnitTest/main/Source/TestUnitDualButton.cpp index cb5383e..fed447d 100644 --- a/Apps/M5UnitTest/main/Source/TestUnitDualButton.cpp +++ b/Apps/M5UnitTest/main/Source/TestUnitDualButton.cpp @@ -1,7 +1,7 @@ #include "TestUnitDualButton.h" #include "UiScale.h" #include -#include +#include static constexpr gpio_pin_t PIN_MIN = 0; static constexpr gpio_pin_t PIN_MAX = 57; diff --git a/Apps/M5UnitTest/main/Source/TestUnitJoystick2.cpp b/Apps/M5UnitTest/main/Source/TestUnitJoystick2.cpp index 561d8d9..2c62596 100644 --- a/Apps/M5UnitTest/main/Source/TestUnitJoystick2.cpp +++ b/Apps/M5UnitTest/main/Source/TestUnitJoystick2.cpp @@ -2,7 +2,7 @@ #include "GroveLookup.h" #include "UiScale.h" #include -#include +#include #include #include diff --git a/Apps/M5UnitTest/main/Source/TestUnitLcd.cpp b/Apps/M5UnitTest/main/Source/TestUnitLcd.cpp index 35c4b53..393ce86 100644 --- a/Apps/M5UnitTest/main/Source/TestUnitLcd.cpp +++ b/Apps/M5UnitTest/main/Source/TestUnitLcd.cpp @@ -2,7 +2,7 @@ #include "GroveLookup.h" #include "UiScale.h" #include -#include +#include void TestUnitLcd::onStart(lv_obj_t* parent, AppHandle handle, M5UnitTest* app) { app_ = app; diff --git a/Apps/M5UnitTest/main/Source/TestUnitLcdGfx.cpp b/Apps/M5UnitTest/main/Source/TestUnitLcdGfx.cpp index b02b1ff..c288f3e 100644 --- a/Apps/M5UnitTest/main/Source/TestUnitLcdGfx.cpp +++ b/Apps/M5UnitTest/main/Source/TestUnitLcdGfx.cpp @@ -2,7 +2,7 @@ #include "GroveLookup.h" #include "UiScale.h" #include -#include +#include #include #include #include diff --git a/Apps/M5UnitTest/main/Source/TestUnitMidi.cpp b/Apps/M5UnitTest/main/Source/TestUnitMidi.cpp index 672ae0c..3dc0e34 100644 --- a/Apps/M5UnitTest/main/Source/TestUnitMidi.cpp +++ b/Apps/M5UnitTest/main/Source/TestUnitMidi.cpp @@ -2,7 +2,7 @@ #include "GroveLookup.h" #include "UiScale.h" #include -#include +#include void TestUnitMidi::onStart(lv_obj_t* parent, AppHandle handle, M5UnitTest* app) { app_ = app; diff --git a/Apps/M5UnitTest/main/Source/TestUnitPaHub.cpp b/Apps/M5UnitTest/main/Source/TestUnitPaHub.cpp index 8ae9a11..f13162d 100644 --- a/Apps/M5UnitTest/main/Source/TestUnitPaHub.cpp +++ b/Apps/M5UnitTest/main/Source/TestUnitPaHub.cpp @@ -3,7 +3,7 @@ #include "UiScale.h" #include #include -#include +#include void TestUnitPaHub::onStart(lv_obj_t* parent, AppHandle handle, M5UnitTest* app) { app_ = app; diff --git a/Apps/M5UnitTest/main/Source/TestUnitRfid2.cpp b/Apps/M5UnitTest/main/Source/TestUnitRfid2.cpp index 2586d0a..617b092 100644 --- a/Apps/M5UnitTest/main/Source/TestUnitRfid2.cpp +++ b/Apps/M5UnitTest/main/Source/TestUnitRfid2.cpp @@ -2,7 +2,7 @@ #include "GroveLookup.h" #include "UiScale.h" #include -#include +#include #include #include #include diff --git a/Apps/M5UnitTest/main/Source/TestUnitScroll.cpp b/Apps/M5UnitTest/main/Source/TestUnitScroll.cpp index e057636..a5596ca 100644 --- a/Apps/M5UnitTest/main/Source/TestUnitScroll.cpp +++ b/Apps/M5UnitTest/main/Source/TestUnitScroll.cpp @@ -2,7 +2,7 @@ #include "GroveLookup.h" #include "UiScale.h" #include -#include +#include void TestUnitScroll::onStart(lv_obj_t* parent, AppHandle handle, M5UnitTest* app) { app_ = app; diff --git a/Apps/M5UnitTest/main/Source/TestViewBase.cpp b/Apps/M5UnitTest/main/Source/TestViewBase.cpp index 1ee1eb7..e3ea71c 100644 --- a/Apps/M5UnitTest/main/Source/TestViewBase.cpp +++ b/Apps/M5UnitTest/main/Source/TestViewBase.cpp @@ -2,7 +2,7 @@ #include "M5UnitTest.h" #include "UiScale.h" #include -#include +#include lv_obj_t* TestViewBase::createToolbar(lv_obj_t* parent, AppHandle handle, const char* title) { lv_obj_t* toolbar = tt_lvgl_toolbar_create_for_app(parent, handle); diff --git a/Apps/M5UnitTest/main/Source/UiScale.h b/Apps/M5UnitTest/main/Source/UiScale.h index 68a18f9..9bbb4e0 100644 --- a/Apps/M5UnitTest/main/Source/UiScale.h +++ b/Apps/M5UnitTest/main/Source/UiScale.h @@ -1,6 +1,6 @@ #pragma once #include -#include +#include // Device screen widths in default (portrait) orientation: // tiny < 200 : small OLEDs, custom breadboard devices From d926acdf5dffbfa737398cf2f14ad755f55fa73f Mon Sep 17 00:00:00 2001 From: Ken Van Hoeylandt Date: Sun, 26 Jul 2026 12:35:00 +0200 Subject: [PATCH 6/6] Updates --- .../M5UnitModules/Source/UnitDualButton.cpp | 20 ++++--------------- 1 file changed, 4 insertions(+), 16 deletions(-) diff --git a/Libraries/M5UnitModules/Source/UnitDualButton.cpp b/Libraries/M5UnitModules/Source/UnitDualButton.cpp index 74ccb9d..3deb359 100644 --- a/Libraries/M5UnitModules/Source/UnitDualButton.cpp +++ b/Libraries/M5UnitModules/Source/UnitDualButton.cpp @@ -10,13 +10,15 @@ UnitDualButton::~UnitDualButton() { bool UnitDualButton::begin(Device* controller, gpio_pin_t pinA, gpio_pin_t pinB) { if (!controller) return false; - descA_ = gpio_descriptor_acquire(controller, pinA, GPIO_OWNER_GPIO); + gpio_flags_t flags = GPIO_FLAG_DIRECTION_INPUT | GPIO_FLAG_PULL_UP; + + descA_ = gpio_descriptor_acquire(controller, pinA, flags, GPIO_OWNER_GPIO); if (!descA_) { ESP_LOGW(TAG, "Failed to acquire pin %d", (int)pinA); return false; } - descB_ = gpio_descriptor_acquire(controller, pinB, GPIO_OWNER_GPIO); + descB_ = gpio_descriptor_acquire(controller, pinB, flags, GPIO_OWNER_GPIO); if (!descB_) { ESP_LOGW(TAG, "Failed to acquire pin %d", (int)pinB); gpio_descriptor_release(descA_); @@ -24,20 +26,6 @@ bool UnitDualButton::begin(Device* controller, gpio_pin_t pinA, gpio_pin_t pinB) return false; } - gpio_flags_t flags = GPIO_FLAG_DIRECTION_INPUT | GPIO_FLAG_PULL_UP; - if (gpio_descriptor_set_flags(descA_, flags) != ERROR_NONE) { - ESP_LOGW(TAG, "Failed to configure pin %d flags", (int)pinA); - gpio_descriptor_release(descA_); gpio_descriptor_release(descB_); - descA_ = descB_ = nullptr; - return false; - } - if (gpio_descriptor_set_flags(descB_, flags) != ERROR_NONE) { - ESP_LOGW(TAG, "Failed to configure pin %d flags", (int)pinB); - gpio_descriptor_release(descA_); gpio_descriptor_release(descB_); - descA_ = descB_ = nullptr; - return false; - } - ready_ = true; ESP_LOGI(TAG, "DualButton ready on pins %d/%d", (int)pinA, (int)pinB); return true;