From b86452fb70b7a1ad58179501bce7ab8d376b669b Mon Sep 17 00:00:00 2001 From: Reinhold Gschweicher Date: Sat, 28 Sep 2024 22:05:24 +0200 Subject: [PATCH] sim: LittleVgl: add new function ClearTouchState for PR #2108 Add function `LittleVgl::ClearTouchState` introduced with https://github.com/InfiniTimeOrg/InfiniTime/pull/2108 As it is a new function the change is compatible with current v1.14.0-dev state (`main` branch of InfiniTime) --- sim/displayapp/LittleVgl.cpp | 14 +++++++++----- sim/displayapp/LittleVgl.h | 1 + 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/sim/displayapp/LittleVgl.cpp b/sim/displayapp/LittleVgl.cpp index 088accf..5a0b2c1 100644 --- a/sim/displayapp/LittleVgl.cpp +++ b/sim/displayapp/LittleVgl.cpp @@ -220,10 +220,6 @@ void MoveScreen(lv_disp_drv_t *disp_drv, int16_t height) { void LittleVgl::FlushDisplay(const lv_area_t* area, lv_color_t* color_p) { uint16_t y1, y2, width, height = 0; - //ulTaskNotifyTake(pdTRUE, 200); - // Notification is still needed (even if there is a mutex on SPI) because of the DataCommand pin - // which cannot be set/clear during a transfer. - //if ((scrollDirection == LittleVgl::FullRefreshDirections::Down) && (area->y2 == visibleNbLines - 1)) { // writeOffset = ((writeOffset + totalNbLines) - visibleNbLines) % totalNbLines; //} else if ((scrollDirection == FullRefreshDirections::Up) && (area->y1 == 0)) { @@ -296,7 +292,6 @@ void LittleVgl::FlushDisplay(const lv_area_t* area, lv_color_t* color_p) { if (height > 0) { //lcd.DrawBuffer(area->x1, y1, width, height, reinterpret_cast(color_p), width * height * 2); DrawBuffer(&disp_drv, area->x1, y1, width, height, reinterpret_cast(color_p), width * height * 2); - //ulTaskNotifyTake(pdTRUE, 100); } uint16_t pixOffset = width * height; @@ -341,6 +336,8 @@ void LittleVgl::SetNewTouchPoint(int16_t x, int16_t y, bool contact) { } } +// Cancel an ongoing tap +// Signifies that LVGL should not handle the current tap void LittleVgl::CancelTap() { if (tapped) { isCancelled = true; @@ -348,6 +345,13 @@ void LittleVgl::CancelTap() { } } +// Clear the current tapped state +// Signifies that touch input processing is suspended +void LittleVgl::ClearTouchState() { + touchPoint = {-1, -1}; + tapped = false; +} + bool LittleVgl::GetTouchPadInfo(lv_indev_data_t* ptr) { ptr->point.x = touchPoint.x; ptr->point.y = touchPoint.y; diff --git a/sim/displayapp/LittleVgl.h b/sim/displayapp/LittleVgl.h index 9a15ae1..54505b3 100644 --- a/sim/displayapp/LittleVgl.h +++ b/sim/displayapp/LittleVgl.h @@ -26,6 +26,7 @@ namespace Pinetime { void SetFullRefresh(FullRefreshDirections direction); void SetNewTouchPoint(int16_t x, int16_t y, bool contact); void CancelTap(); + void ClearTouchState(); bool GetFullRefresh() { bool returnValue = fullRefresh;