mirror of
https://github.com/esphome/esphome.git
synced 2025-09-14 17:22:20 +01:00
try touch_ll_read_raw_data
This commit is contained in:
@@ -7,6 +7,11 @@
|
||||
|
||||
#include <cinttypes>
|
||||
|
||||
#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/touch_sensor_ll.h"
|
||||
#endif
|
||||
|
||||
namespace esphome {
|
||||
namespace esp32_touch {
|
||||
|
||||
@@ -412,9 +417,9 @@ void IRAM_ATTR ESP32TouchComponent::touch_isr_handler(void *arg) {
|
||||
#if defined(USE_ESP32_VARIANT_ESP32S2) || defined(USE_ESP32_VARIANT_ESP32S3)
|
||||
touch_pad_read_raw_data(pad, &event.value);
|
||||
#else
|
||||
uint16_t val = 0;
|
||||
touch_pad_read(pad, &val);
|
||||
event.value = val;
|
||||
// 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
|
||||
event.value = touch_ll_read_raw_data(pad);
|
||||
#endif
|
||||
// Send to queue from ISR
|
||||
BaseType_t xHigherPriorityTaskWoken = pdFALSE;
|
||||
|
Reference in New Issue
Block a user