From c047aa47eb3dcd36290733725bdc8cf0358d6054 Mon Sep 17 00:00:00 2001 From: "J. Nick Koston" Date: Wed, 11 Jun 2025 22:46:40 -0500 Subject: [PATCH] use ll for all --- esphome/components/esp32_touch/esp32_touch.cpp | 14 +++----------- 1 file changed, 3 insertions(+), 11 deletions(-) diff --git a/esphome/components/esp32_touch/esp32_touch.cpp b/esphome/components/esp32_touch/esp32_touch.cpp index e661cbe388..53656ec226 100644 --- a/esphome/components/esp32_touch/esp32_touch.cpp +++ b/esphome/components/esp32_touch/esp32_touch.cpp @@ -7,10 +7,8 @@ #include -#if !defined(USE_ESP32_VARIANT_ESP32S2) && !defined(USE_ESP32_VARIANT_ESP32S3) -// For ESP32 classic, we need the low-level HAL functions for ISR-safe reads +// Include HAL for ISR-safe touch reading on all variants #include "hal/touch_sensor_ll.h" -#endif namespace esphome { namespace esp32_touch { @@ -412,15 +410,9 @@ void IRAM_ATTR ESP32TouchComponent::touch_isr_handler(void *arg) { touch_pad_t pad = static_cast(i); TouchPadEvent event; event.pad = pad; - // Read value in ISR - event.value = 0; -#if defined(USE_ESP32_VARIANT_ESP32S2) || defined(USE_ESP32_VARIANT_ESP32S3) - touch_pad_read_raw_data(pad, &event.value); -#else - // For ESP32, we need to use the low-level HAL function that doesn't use semaphores - // touch_pad_read() uses a semaphore internally and cannot be called from ISR + // Read value in ISR using HAL function (safe for all variants) + // touch_pad_read() and touch_pad_read_raw_data() use semaphores and cannot be called from ISR event.value = touch_ll_read_raw_data(pad); -#endif // Send to queue from ISR BaseType_t xHigherPriorityTaskWoken = pdFALSE; xQueueSendFromISR(component->touch_queue_, &event, &xHigherPriorityTaskWoken);