fix touchscreen

This commit is contained in:
mverch67 2025-06-01 09:45:43 +02:00 committed by Thomas Göttgens
parent f6ee533f41
commit 212839bdd3
3 changed files with 6 additions and 6 deletions

View File

@ -1795,7 +1795,7 @@ void Screen::setup()
new TouchScreenImpl1(dispdev->getWidth(), dispdev->getHeight(), static_cast<TFTDisplay *>(dispdev)->getTouch); new TouchScreenImpl1(dispdev->getWidth(), dispdev->getHeight(), static_cast<TFTDisplay *>(dispdev)->getTouch);
touchScreenImpl1->init(); touchScreenImpl1->init();
} }
#elif HAS_TOUCHSCREEN #elif HAS_TOUCHSCREEN && !defined(USE_EINK)
touchScreenImpl1 = touchScreenImpl1 =
new TouchScreenImpl1(dispdev->getWidth(), dispdev->getHeight(), static_cast<TFTDisplay *>(dispdev)->getTouch); new TouchScreenImpl1(dispdev->getWidth(), dispdev->getHeight(), static_cast<TFTDisplay *>(dispdev)->getTouch);
touchScreenImpl1->init(); touchScreenImpl1->init();

View File

@ -19,14 +19,13 @@ void touchISR()
bool readTouch(int16_t *x, int16_t *y) bool readTouch(int16_t *x, int16_t *y)
{ {
if (1 /* intReceived */) { if (intReceived) {
intReceived = false; intReceived = false;
// Reattach the interrupt for the next touch // Reattach the interrupt for the next touch
// attachInterrupt (digitalPinToInterrupt(CST328_PIN_INT), touchISR, FALLING); attachInterrupt(digitalPinToInterrupt(CST328_PIN_INT), touchISR, FALLING);
// Read the touch point // Read the touch point
// if (tsPanel.isTouched(0)) { if (tsPanel.isTouched(0)) {
if (tsPanel.getTouches()) {
*x = tsPanel.getPoint(0).x; *x = tsPanel.getPoint(0).x;
*y = tsPanel.getPoint(0).y; *y = tsPanel.getPoint(0).y;
return true; return true;
@ -39,7 +38,7 @@ bool readTouch(int16_t *x, int16_t *y)
void lateInitVariant() void lateInitVariant()
{ {
tsPanel.begin(); tsPanel.begin();
// attachInterrupt (digitalPinToInterrupt(CST328_PIN_INT), touchISR, FALLING); attachInterrupt(digitalPinToInterrupt(CST328_PIN_INT), touchISR, FALLING);
touchScreenImpl1 = new TouchScreenImpl1(EINK_WIDTH, EINK_HEIGHT, readTouch); touchScreenImpl1 = new TouchScreenImpl1(EINK_WIDTH, EINK_HEIGHT, readTouch);
touchScreenImpl1->init(); touchScreenImpl1->init();
} }

View File

@ -10,6 +10,7 @@
#define I2C_SCL SCL #define I2C_SCL SCL
// CST328 touch screen (implementation in src/platform/extra_variants/t_deck_pro/variant.cpp) // CST328 touch screen (implementation in src/platform/extra_variants/t_deck_pro/variant.cpp)
#define HAS_TOUCHSCREEN 1
#define CST328_PIN_INT 12 #define CST328_PIN_INT 12
#define CST328_PIN_RST 45 #define CST328_PIN_RST 45