| 403 | } |
| 404 | |
| 405 | inline int disable_handler(const isr_handle_t& handle) FL_NOEXCEPT { |
| 406 | if (!handle.is_valid() || handle.platform_id != ESP32_PLATFORM_ID) { |
| 407 | ESP_LOGW(ESP32_ISR_TAG, "disableHandler: invalid handle"); |
| 408 | return -1; // Invalid handle |
| 409 | } |
| 410 | |
| 411 | esp32_isr_handle_data* handle_data = static_cast<esp32_isr_handle_data*>(handle.platform_handle); |
| 412 | if (!handle_data) { |
| 413 | ESP_LOGW(ESP32_ISR_TAG, "disableHandler: null handle data"); |
| 414 | return -1; // Invalid handle |
| 415 | } |
| 416 | |
| 417 | if (handle_data->is_timer && handle_data->timer_handle) { |
| 418 | esp_err_t ret = gptimer_stop(handle_data->timer_handle); |
| 419 | if (ret != ESP_OK && ret != ESP_ERR_INVALID_STATE) { |
| 420 | ESP_LOGW(ESP32_ISR_TAG, "disableHandler: gptimer_stop failed: %s", esp_err_to_name(ret)); |
| 421 | return -13; // Disable failed |
| 422 | } |
| 423 | handle_data->is_enabled = false; |
| 424 | } else if (!handle_data->is_timer && handle_data->gpio_pin != 0xFF) { |
| 425 | esp_err_t ret = gpio_intr_disable(static_cast<gpio_num_t>(handle_data->gpio_pin)); |
| 426 | if (ret != ESP_OK) { |
| 427 | ESP_LOGW(ESP32_ISR_TAG, "disableHandler: gpio_intr_disable failed: %s", esp_err_to_name(ret)); |
| 428 | return -15; |
| 429 | } |
| 430 | handle_data->is_enabled = false; |
| 431 | } |
| 432 | |
| 433 | return 0; // Success |
| 434 | } |
| 435 | |
| 436 | inline bool is_handler_enabled(const isr_handle_t& handle) FL_NOEXCEPT { |
| 437 | if (!handle.is_valid() || handle.platform_id != ESP32_PLATFORM_ID) { |
nothing calls this directly
no test coverage detected