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

Function enable_handler

src/platforms/esp/32/isr_esp32_idf5.hpp:374–403  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

372}
373
374inline int enable_handler(const isr_handle_t& handle) FL_NOEXCEPT {
375 if (!handle.is_valid() || handle.platform_id != ESP32_PLATFORM_ID) {
376 ESP_LOGW(ESP32_ISR_TAG, "enableHandler: invalid handle");
377 return -1; // Invalid handle
378 }
379
380 esp32_isr_handle_data* handle_data = static_cast<esp32_isr_handle_data*>(handle.platform_handle);
381 if (!handle_data) {
382 ESP_LOGW(ESP32_ISR_TAG, "enableHandler: null handle data");
383 return -1; // Invalid handle
384 }
385
386 if (handle_data->is_timer && handle_data->timer_handle) {
387 esp_err_t ret = gptimer_start(handle_data->timer_handle);
388 if (ret != ESP_OK && ret != ESP_ERR_INVALID_STATE) {
389 ESP_LOGW(ESP32_ISR_TAG, "enableHandler: gptimer_start failed: %s", esp_err_to_name(ret));
390 return -12; // Enable failed
391 }
392 handle_data->is_enabled = true;
393 } else if (!handle_data->is_timer && handle_data->gpio_pin != 0xFF) {
394 esp_err_t ret = gpio_intr_enable(static_cast<gpio_num_t>(handle_data->gpio_pin));
395 if (ret != ESP_OK) {
396 ESP_LOGW(ESP32_ISR_TAG, "enableHandler: gpio_intr_enable failed: %s", esp_err_to_name(ret));
397 return -14;
398 }
399 handle_data->is_enabled = true;
400 }
401
402 return 0; // Success
403}
404
405inline int disable_handler(const isr_handle_t& handle) FL_NOEXCEPT {
406 if (!handle.is_valid() || handle.platform_id != ESP32_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