// Project includes #include "types.hpp" // SDK Includes #include "led_strip.h" enum class led_status : uint8 { Connecting, Ready, Failed }; // Could be a config but its the GPIO on my ESP32-S3-ETH #define LED_GPIO GPIO_NUM_21 static led_strip_handle_t led_strip; static void setup_led(void) { /* LED strip initialization with the GPIO and pixels number*/ led_strip_config_t strip_config = {}; strip_config.strip_gpio_num = LED_GPIO; strip_config.max_leds = 1; // at least one LED on board led_strip_rmt_config_t rmt_config = {}; rmt_config.resolution_hz = 10 * 1000 * 1000; // 10MHz rmt_config.flags.with_dma = false; ESP_ERROR_CHECK( led_strip_new_rmt_device(&strip_config, &rmt_config, &led_strip)); led_strip_clear(led_strip); } static void destroy_led(void) { led_strip_clear(led_strip); } void set_led_status(led_status status) { switch (status) { case led_status::Connecting: led_strip_set_pixel(led_strip, 0, 0, 0, 255); break; case led_status::Ready: led_strip_set_pixel(led_strip, 0, 0, 255, 0); break; case led_status::Failed: led_strip_set_pixel(led_strip, 0, 255, 0, 0); break; } led_strip_refresh(led_strip); }