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

Function detach_handler

src/platforms/esp/32/isr_esp32_idf3.hpp:414–448  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

412}
413
414inline int detach_handler(isr_handle_t& handle) FL_NOEXCEPT {
415 if (!handle.is_valid() || handle.platform_id != ESP32_IDF3_PLATFORM_ID) {
416 ESP_LOGW(ESP32_IDF3_ISR_TAG, "detachHandler: invalid handle");
417 return -1; // Invalid handle
418 }
419
420 esp32_idf3_isr_handle_data* handle_data = static_cast<esp32_idf3_isr_handle_data*>(handle.platform_handle);
421 if (!handle_data) {
422 ESP_LOGW(ESP32_IDF3_ISR_TAG, "detachHandler: null handle data");
423 return -1; // Invalid handle
424 }
425
426 if (handle_data->is_timer) {
427 // Stop and cleanup timer
428 timer_pause(handle_data->timer_group, handle_data->timer_idx);
429 timer_disable_intr(handle_data->timer_group, handle_data->timer_idx);
430 // Free the interrupt handle (IDF 3.x)
431 if (handle_data->intr_handle) {
432 esp_intr_free(handle_data->intr_handle);
433 }
434 free_timer(handle_data->timer_group, handle_data->timer_idx);
435 } else {
436 // Cleanup GPIO interrupt
437 if (handle_data->gpio_pin != 0xFF) {
438 gpio_isr_handler_remove(static_cast<gpio_num_t>(handle_data->gpio_pin));
439 }
440 }
441
442 delete handle_data; // ok bare allocation (C API teardown)
443 handle.platform_handle = nullptr;
444 handle.platform_id = 0;
445
446 ESP_LOGD(ESP32_IDF3_ISR_TAG, "Handler detached");
447 return 0; // Success
448}
449
450inline int enable_handler(const isr_handle_t& handle) FL_NOEXCEPT {
451 if (!handle.is_valid() || handle.platform_id != ESP32_IDF3_PLATFORM_ID) {

Callers

nothing calls this directly

Calls 2

free_timerFunction · 0.70
is_validMethod · 0.45

Tested by

no test coverage detected