mirror of
https://github.com/meshtastic/firmware.git
synced 2025-06-08 06:02:05 +00:00
fix touchscreen
This commit is contained in:
parent
212839bdd3
commit
4f4d55e7c9
@ -8,29 +8,13 @@
|
||||
|
||||
CSE_CST328 tsPanel = CSE_CST328(EINK_WIDTH, EINK_HEIGHT, &Wire, CST328_PIN_RST, CST328_PIN_INT);
|
||||
|
||||
volatile bool intReceived = false;
|
||||
|
||||
void touchISR()
|
||||
{
|
||||
// Detach the interrupt to prevent multiple interrupts
|
||||
detachInterrupt(digitalPinToInterrupt(CST328_PIN_INT));
|
||||
intReceived = true;
|
||||
}
|
||||
|
||||
bool readTouch(int16_t *x, int16_t *y)
|
||||
{
|
||||
if (intReceived) {
|
||||
intReceived = false;
|
||||
// Reattach the interrupt for the next touch
|
||||
attachInterrupt(digitalPinToInterrupt(CST328_PIN_INT), touchISR, FALLING);
|
||||
|
||||
// Read the touch point
|
||||
if (tsPanel.isTouched(0)) {
|
||||
if (tsPanel.getTouches()) {
|
||||
*x = tsPanel.getPoint(0).x;
|
||||
*y = tsPanel.getPoint(0).y;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -38,7 +22,6 @@ bool readTouch(int16_t *x, int16_t *y)
|
||||
void lateInitVariant()
|
||||
{
|
||||
tsPanel.begin();
|
||||
attachInterrupt(digitalPinToInterrupt(CST328_PIN_INT), touchISR, FALLING);
|
||||
touchScreenImpl1 = new TouchScreenImpl1(EINK_WIDTH, EINK_HEIGHT, readTouch);
|
||||
touchScreenImpl1->init();
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user