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

Function enable_handler

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

Source from the content-addressed store, hash-verified

433}
434
435inline 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
466inline int disable_handler(const isr_handle_t& handle) FL_NOEXCEPT {
467 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