Merge pull request #3798 from DedeHai/ESP32_S3_TouchFix

Esp32 s3 touch fix
This commit is contained in:
Blaž Kristan
2024-04-07 22:24:32 +02:00
committed by GitHub
4 changed files with 40 additions and 9 deletions

View File

@@ -96,9 +96,13 @@ bool isButtonPressed(uint8_t i)
case BTN_TYPE_TOUCH:
case BTN_TYPE_TOUCH_SWITCH:
#if defined(ARDUINO_ARCH_ESP32) && !defined(CONFIG_IDF_TARGET_ESP32C3)
if (digitalPinToTouchChannel(btnPin[i]) >= 0 && touchRead(pin) <= touchThreshold) return true;
#ifdef SOC_TOUCH_VERSION_2 //ESP32 S2 and S3 provide a function to check touch state (state is updated in interrupt)
if (touchInterruptGetLastStatus(pin)) return true;
#else
if (digitalPinToTouchChannel(btnPin[i]) >= 0 && touchRead(pin) <= touchThreshold) return true;
#endif
#endif
break;
break;
}
return false;
}
@@ -403,3 +407,8 @@ void handleIO()
offMode = true;
}
}
void IRAM_ATTR touchButtonISR()
{
// used for ESP32 S2 and S3: nothing to do, ISR is just used to update registers of HAL driver
}