MCPcopy Create free account
hub / github.com/FastLED/FastLED / disable_handler

Function disable_handler

src/platforms/esp/32/isr_esp32_idf4.hpp:466–495  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

464}
465
466inline int disable_handler(const isr_handle_t& handle) FL_NOEXCEPT {
467 if (!handle.is_valid() || handle.platform_id != ESP32_IDF4_PLATFORM_ID) {
468 ESP_LOGW(ESP32_IDF4_ISR_TAG, "disableHandler: invalid handle");
469 return -1; // Invalid handle
470 }
471
472 esp32_idf4_isr_handle_data* handle_data = static_cast<esp32_idf4_isr_handle_data*>(handle.platform_handle);
473 if (!handle_data) {
474 ESP_LOGW(ESP32_IDF4_ISR_TAG, "disableHandler: null handle data");
475 return -1; // Invalid handle
476 }
477
478 if (handle_data->is_timer) {
479 esp_err_t ret = timer_pause(handle_data->timer_group, handle_data->timer_idx);
480 if (ret != ESP_OK) {
481 ESP_LOGW(ESP32_IDF4_ISR_TAG, "disableHandler: timer_pause failed: %s", esp_err_to_name(ret));
482 return -13; // Disable failed
483 }
484 handle_data->is_enabled = false;
485 } else if (handle_data->gpio_pin != 0xFF) {
486 esp_err_t ret = gpio_intr_disable(static_cast<gpio_num_t>(handle_data->gpio_pin));
487 if (ret != ESP_OK) {
488 ESP_LOGW(ESP32_IDF4_ISR_TAG, "disableHandler: gpio_intr_disable failed: %s", esp_err_to_name(ret));
489 return -15;
490 }
491 handle_data->is_enabled = false;
492 }
493
494 return 0; // Success
495}
496
497inline bool is_handler_enabled(const isr_handle_t& handle) FL_NOEXCEPT {
498 if (!handle.is_valid() || handle.platform_id != ESP32_IDF4_PLATFORM_ID) {

Callers

nothing calls this directly

Calls 2

esp_err_to_nameFunction · 0.85
is_validMethod · 0.45

Tested by

no test coverage detected