From 1f8072374cc46af081d10e209728553c9a69fd74 Mon Sep 17 00:00:00 2001 From: Raphael Coeffic Date: Sat, 11 Jun 2022 18:07:39 +0200 Subject: [PATCH] x12s: move touch panel inversion to LVGL driver --- radio/src/gui/colorlcd/LvglWrapper.cpp | 5 +++++ radio/src/targets/horus/hal.h | 4 ++++ radio/src/targets/horus/tp_gt911.cpp | 5 ----- 3 files changed, 9 insertions(+), 5 deletions(-) diff --git a/radio/src/gui/colorlcd/LvglWrapper.cpp b/radio/src/gui/colorlcd/LvglWrapper.cpp index 7bd4275d8..9c0db2a2f 100644 --- a/radio/src/gui/colorlcd/LvglWrapper.cpp +++ b/radio/src/gui/colorlcd/LvglWrapper.cpp @@ -177,6 +177,11 @@ extern "C" void touchDriverRead(lv_indev_drv_t *drv, lv_indev_data_t *data) TouchState st = touchPanelRead(); +#if defined(TOUCH_PANEL_INVERTED) && !defined(SIMU) + st.x = LCD_W - st.x; + st.y = LCD_H - st.y; +#endif + // no touch input if backlight is disabled if (!isBacklightEnabled()) { reset_inactivity(); diff --git a/radio/src/targets/horus/hal.h b/radio/src/targets/horus/hal.h index bb4591e21..de308a9ae 100644 --- a/radio/src/targets/horus/hal.h +++ b/radio/src/targets/horus/hal.h @@ -720,7 +720,11 @@ #define TOUCH_INT_EXTI_SysCfgLine LL_SYSCFG_EXTI_LINE2 #define TOUCH_INT_EXTI_IRQn EXTI2_IRQn #define TOUCH_INT_EXTI_IRQHandler EXTI2_IRQHandler + +#if defined(PCBX12S) + #define TOUCH_PANEL_INVERTED #endif +#endif // HARDWARE_TOUCH // First I2C Bus #if defined(RADIO_T18) diff --git a/radio/src/targets/horus/tp_gt911.cpp b/radio/src/targets/horus/tp_gt911.cpp index 1bf67003f..51de5244c 100644 --- a/radio/src/targets/horus/tp_gt911.cpp +++ b/radio/src/targets/horus/tp_gt911.cpp @@ -746,11 +746,6 @@ struct TouchState touchPanelRead() return internalTouchState; } -#if defined (PCBX12S) - touchData.points[0].x = LCD_W - touchData.points[0].x; - touchData.points[0].y = LCD_H - touchData.points[0].y; -#endif - if (internalTouchState.event == TE_NONE || internalTouchState.event == TE_UP || internalTouchState.event == TE_SLIDE_END) {