| 433 | } |
| 434 | |
| 435 | inline int enable_handler(const isr_handle_t& handle) FL_NOEXCEPT { |
| 436 | if (!handle.is_valid() || handle.platform_id != ESP32_IDF4_PLATFORM_ID) { |
| 437 | ESP_LOGW(ESP32_IDF4_ISR_TAG, "enableHandler: invalid handle"); |
| 438 | return -1; // Invalid handle |
| 439 | } |
| 440 | |
| 441 | esp32_idf4_isr_handle_data* handle_data = static_cast<esp32_idf4_isr_handle_data*>(handle.platform_handle); |
| 442 | if (!handle_data) { |
| 443 | ESP_LOGW(ESP32_IDF4_ISR_TAG, "enableHandler: null handle data"); |
| 444 | return -1; // Invalid handle |
| 445 | } |
| 446 | |
| 447 | if (handle_data->is_timer) { |
| 448 | esp_err_t ret = timer_start(handle_data->timer_group, handle_data->timer_idx); |
| 449 | if (ret != ESP_OK) { |
| 450 | ESP_LOGW(ESP32_IDF4_ISR_TAG, "enableHandler: timer_start failed: %s", esp_err_to_name(ret)); |
| 451 | return -12; // Enable failed |
| 452 | } |
| 453 | handle_data->is_enabled = true; |
| 454 | } else if (handle_data->gpio_pin != 0xFF) { |
| 455 | esp_err_t ret = gpio_intr_enable(static_cast<gpio_num_t>(handle_data->gpio_pin)); |
| 456 | if (ret != ESP_OK) { |
| 457 | ESP_LOGW(ESP32_IDF4_ISR_TAG, "enableHandler: gpio_intr_enable failed: %s", esp_err_to_name(ret)); |
| 458 | return -14; |
| 459 | } |
| 460 | handle_data->is_enabled = true; |
| 461 | } |
| 462 | |
| 463 | return 0; // Success |
| 464 | } |
| 465 | |
| 466 | inline int disable_handler(const isr_handle_t& handle) FL_NOEXCEPT { |
| 467 | if (!handle.is_valid() || handle.platform_id != ESP32_IDF4_PLATFORM_ID) { |
nothing calls this directly
no test coverage detected