diff options
author | JF002 <JF002@users.noreply.github.com> | 2021-08-28 15:06:03 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-08-28 15:06:03 +0200 |
commit | 969de9a8bccfa97da29de2eac61be9325dd2fdaa (patch) | |
tree | 820a3bbe74993ff6ce6b7f430d187a397a46f363 /src/displayapp/LittleVgl.cpp | |
parent | df8ea7fe523bb9ec0ac3e24f0b1bebe5743d90cc (diff) | |
parent | 85c99797dad39348976d92ecf935536f362ee2c5 (diff) |
Merge pull request #492 from Riksu9000/new_touch_handler
New touch handler
Diffstat (limited to 'src/displayapp/LittleVgl.cpp')
-rw-r--r-- | src/displayapp/LittleVgl.cpp | 30 |
1 files changed, 4 insertions, 26 deletions
diff --git a/src/displayapp/LittleVgl.cpp b/src/displayapp/LittleVgl.cpp index c069afa2..2bd5e57b 100644 --- a/src/displayapp/LittleVgl.cpp +++ b/src/displayapp/LittleVgl.cpp @@ -166,43 +166,21 @@ void LittleVgl::FlushDisplay(const lv_area_t* area, lv_color_t* color_p) { lv_disp_flush_ready(&disp_drv); } -void LittleVgl::SetNewTapEvent(uint16_t x, uint16_t y) { +void LittleVgl::SetNewTouchPoint(uint16_t x, uint16_t y, bool contact) { tap_x = x; tap_y = y; - tapped = true; + tapped = contact; } bool LittleVgl::GetTouchPadInfo(lv_indev_data_t* ptr) { + ptr->point.x = tap_x; + ptr->point.y = tap_y; if (tapped) { - ptr->point.x = tap_x; - ptr->point.y = tap_y; ptr->state = LV_INDEV_STATE_PR; - tapped = false; } else { ptr->state = LV_INDEV_STATE_REL; } return false; - /* - auto info = touchPanel.GetTouchInfo(); - - if((previousClick.x != info.x || previousClick.y != info.y) && - (info.gesture == Drivers::Cst816S::Gestures::SingleTap)) { - // TODO For an unknown reason, the first touch is taken twice into account. - // 'firstTouch' is a quite'n'dirty workaound until I find a better solution - if(firstTouch) ptr->state = LV_INDEV_STATE_REL; - else ptr->state = LV_INDEV_STATE_PR; - firstTouch = false; - previousClick.x = info.x; - previousClick.y = info.y; - } - else { - ptr->state = LV_INDEV_STATE_REL; - } - - ptr->point.x = info.x; - ptr->point.y = info.y; - return false; - */ } void LittleVgl::InitTheme() { |