| 115 | } |
| 116 | |
| 117 | void IRAM_ATTR ButtonControl::gpioIsrHandler(void* arg) { |
| 118 | auto* isrArg = static_cast<IsrArg*>(arg); |
| 119 | ButtonEvent event { |
| 120 | .pin = isrArg->pin, |
| 121 | .pressed = gpio_get_level(isrArg->pin) == 0, // active-low: LOW = pressed |
| 122 | }; |
| 123 | // tt::MessageQueue::put() is ISR-safe with timeout=0: it detects ISR context via |
| 124 | // xPortInIsrContext() and uses xQueueSendFromISR() + portYIELD_FROM_ISR() internally. |
| 125 | isrArg->self->buttonQueue.put(&event, 0); |
| 126 | } |
| 127 | |
| 128 | void ButtonControl::driverThreadMain() { |
| 129 | ButtonEvent event; |