6#if FASTLED_RMT5 || FASTLED_ESP32_HAS_CLOCKLESS_SPI
17static const char *TAG =
"led_strip";
21 ESP_RETURN_ON_FALSE(strip, ESP_ERR_INVALID_ARG, TAG,
"invalid argument");
22 return strip->
set_pixel(strip, index, red, green, blue);
27 ESP_RETURN_ON_FALSE(strip, ESP_ERR_INVALID_ARG, TAG,
"invalid argument");
33 uint32_t rgb_max = value;
34 uint32_t rgb_min = rgb_max * (255 - saturation) / 255.0f;
36 uint32_t i = hue / 60;
37 uint32_t diff = hue % 60;
40 uint32_t rgb_adj = (rgb_max - rgb_min) * diff / 60;
45 green = rgb_min + rgb_adj;
49 red = rgb_max - rgb_adj;
56 blue = rgb_min + rgb_adj;
60 green = rgb_max - rgb_adj;
64 red = rgb_min + rgb_adj;
71 blue = rgb_max - rgb_adj;
75 return strip->
set_pixel(strip, index, red, green, blue);
80 ESP_RETURN_ON_FALSE(strip, ESP_ERR_INVALID_ARG, TAG,
"invalid argument");
86 ESP_RETURN_ON_FALSE(strip, ESP_ERR_INVALID_ARG, TAG,
"invalid argument");
87 return strip->
set_pixel_rgbw(strip, index, red, green, blue, white);
92 ESP_RETURN_ON_FALSE(strip, ESP_ERR_INVALID_ARG, TAG,
"invalid argument");
93 ESP_RETURN_ON_ERROR(strip->
refresh_async(strip), TAG,
"refresh failed");
94 ESP_RETURN_ON_ERROR(strip->
refresh_wait_done(strip), TAG,
"wait for done failed");
100 ESP_RETURN_ON_FALSE(strip, ESP_ERR_INVALID_ARG, TAG,
"invalid argument");
106 ESP_RETURN_ON_FALSE(strip, ESP_ERR_INVALID_ARG, TAG,
"invalid argument");
107 return strip->
clear(strip);
112 ESP_RETURN_ON_FALSE(strip, ESP_ERR_INVALID_ARG, TAG,
"invalid argument");
113 return strip->
del(strip);
esp_err_t led_strip_clear(led_strip_handle_t strip)
Clear LED strip (turn off all LEDs)
esp_err_t led_strip_set_pixel_rgbw(led_strip_handle_t strip, uint32_t index, uint32_t red, uint32_t green, uint32_t blue, uint32_t white)
Set RGBW for a specific pixel.
esp_err_t led_strip_refresh_wait_done(led_strip_handle_t strip)
esp_err_t led_strip_set_pixel_hsv(led_strip_handle_t strip, uint32_t index, uint16_t hue, uint8_t saturation, uint8_t value)
Set HSV for a specific pixel.
esp_err_t led_strip_refresh_async(led_strip_handle_t strip)
esp_err_t led_strip_refresh(led_strip_handle_t strip)
Refresh memory colors to LEDs.
esp_err_t led_strip_del(led_strip_handle_t strip)
Free LED strip resources.
esp_err_t led_strip_set_pixel(led_strip_handle_t strip, uint32_t index, uint32_t red, uint32_t green, uint32_t blue)
Set RGB for a specific pixel.
esp_err_t(* refresh_wait_done)(led_strip_t *strip)
esp_err_t(* set_pixel)(led_strip_t *strip, uint32_t index, uint32_t red, uint32_t green, uint32_t blue)
Set RGB for a specific pixel.
esp_err_t(* del)(led_strip_t *strip)
Free LED strip resources.
esp_err_t(* refresh_async)(led_strip_t *strip)
esp_err_t(* set_pixel_rgbw)(led_strip_t *strip, uint32_t index, uint32_t red, uint32_t green, uint32_t blue, uint32_t white)
Set RGBW for a specific pixel.
esp_err_t(* clear)(led_strip_t *strip)
Clear LED strip (turn off all LEDs)
struct led_strip_t * led_strip_handle_t
Type of LED strip handle.