removed is pressed + interrupt

This commit is contained in:
Nasimovy 2025-06-25 20:44:13 +02:00
parent 2abcdb7ea7
commit 7b365b7b3d

View File

@ -8,7 +8,6 @@
TouchDrvCSTXXX tsPanel;
static constexpr uint8_t PossibleAddresses[2] = {CST226SE_ADDR, CST226SE_ADDR_ALT};
volatile bool isPressed = false;
uint8_t i2cAddress = 0;
bool readTouch(int16_t *x, int16_t *y)
@ -18,7 +17,6 @@ bool readTouch(int16_t *x, int16_t *y)
if (touched > 0) {
*y = x_array[0];
*x = (TFT_WIDTH - y_array[0]);
// Check bounds
if (*x < 0 || *x >= TFT_WIDTH || *y < 0 || *y >= TFT_HEIGHT) {
return false;
@ -30,16 +28,10 @@ bool readTouch(int16_t *x, int16_t *y)
void lateInitVariant()
{
tsPanel.setPins(-1, TOUCH_IRQ);
tsPanel.setTouchDrvModel(TouchDrv_CST226);
for (uint8_t addr : PossibleAddresses) {
if (tsPanel.begin(Wire, addr, I2C_SDA, I2C_SCL)) {
i2cAddress = addr;
if (TOUCH_IRQ != -1) {
pinMode(TOUCH_IRQ, INPUT_PULLUP);
attachInterrupt(
TOUCH_IRQ, []() { isPressed = true; }, FALLING);
}
LOG_DEBUG("CST226SE init OK at address 0x%02X", addr);
touchScreenImpl1 = new TouchScreenImpl1(TFT_WIDTH, TFT_HEIGHT, readTouch);
touchScreenImpl1->init();