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);
touchScreenImpl1->init();
}
#elif HAS_TOUCHSCREEN
#elif HAS_TOUCHSCREEN && !defined(USE_EINK)
touchScreenImpl1 =
new TouchScreenImpl1(dispdev->getWidth(), dispdev->getHeight(), static_cast<TFTDisplay *>(dispdev)->getTouch);
touchScreenImpl1->init();

View File

@ -19,14 +19,13 @@ void touchISR()
bool readTouch(int16_t *x, int16_t *y)
{
if (1 /* intReceived */) {
if (intReceived) {
intReceived = false;
// 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
// if (tsPanel.isTouched(0)) {
if (tsPanel.getTouches()) {
if (tsPanel.isTouched(0)) {
*x = tsPanel.getPoint(0).x;
*y = tsPanel.getPoint(0).y;
return true;
@ -39,7 +38,7 @@ bool readTouch(int16_t *x, int16_t *y)
void lateInitVariant()
{
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->init();
}

View File

@ -10,6 +10,7 @@
#define I2C_SCL SCL
// 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_RST 45