Skip to content

Commit

Permalink
[TouchDrv] Fixed an issue that caused reset to fail when using extern…
Browse files Browse the repository at this point in the history
…al extended GPIO variants.
  • Loading branch information
lewisxhe committed Jan 30, 2024
1 parent b636efb commit 0d1a58e
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 15 deletions.
8 changes: 7 additions & 1 deletion src/TouchDrvFT6X36.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -351,7 +351,13 @@ class TouchDrvFT6X36 :
this->setGpioLevel(__rst, LOW);
delay(30);
this->setGpioLevel(__rst, HIGH);
delay(5);
#if defined(ARDUINO)
delay(10);
#elif defined(ESP_PLATFORM)
// For the variant of GPIO extended RST,
// communication and delay are carried out simultaneously, and 160ms is measured in T-RGB esp-idf new api
delay(160);
#endif
}
}

Expand Down
21 changes: 7 additions & 14 deletions src/TouchDrvGT911.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -119,16 +119,6 @@ class TouchDrvGT911 :
}


void setIrqPin(int irq)
{
__irq = irq;
}

void setRstPin(int rst)
{
__rst = rst;
}

void reset()
{
if (__rst != SENSOR_PIN_NONE) {
Expand Down Expand Up @@ -346,7 +336,7 @@ class TouchDrvGT911 :

bool initImpl()
{
int16_t x, y;
int16_t x = 0, y = 0;

if (__addr == GT911_SLAVE_ADDRESS_H &&
__rst != SENSOR_PIN_NONE &&
Expand All @@ -361,7 +351,7 @@ class TouchDrvGT911 :
this->setGpioLevel(__irq, HIGH);
delayMicroseconds(120);
this->setGpioLevel(__rst, HIGH);
delay(8);
delay(18);
this->setGpioMode(__irq, INPUT);

} else if (__addr == GT911_SLAVE_ADDRESS_L &&
Expand All @@ -377,17 +367,20 @@ class TouchDrvGT911 :
this->setGpioLevel(__irq, LOW);
delayMicroseconds(120);
this->setGpioLevel(__rst, HIGH);
delay(8);
delay(18);
this->setGpioMode(__irq, INPUT);

} else {
reset();
}

// For variants where the GPIO is controlled by I2C, a delay is required here
delay(20);

__chipID = getChipID();
log_i("Product id:%ld\n", __chipID);

if (getChipID() != 911) {
if (__chipID != 911) {
log_i("Not find device GT911\n");
return false;
}
Expand Down

0 comments on commit 0d1a58e

Please sign in to comment.