Skip to content

Conversation

@harmon25
Copy link

@harmon25 harmon25 commented Dec 5, 2025

This pull request adds support for SK6812 RGBW LED strips to the AtomVM NeoPixel library, in addition to the existing WS2812 RGB LED support. The documentation has been extensively updated to describe the new features, color spaces, and API options for both RGB and RGBW strips. The native C code has been refactored to support the new LED type and to simplify the initialization and error handling logic, making the library compatible with ESP-IDF 5.x.

Feature additions and documentation updates:

  • Added support for SK6812 RGBW strips with a dedicated white channel, including new API functions and options for RGBW and HSVW color spaces. Updated both README.md and markdown/neopixel.md to reflect these changes and document the new features and usage examples. [1] [2] [3] [4] [5] [6]
  • Documented global brightness control, including new API functions set_brightness/2 and get_brightness/1, with details on how brightness scaling works efficiently.

API and codebase changes:

  • Refactored the native C code in nifs/atomvm_neopixel.c to support the new RGBW LED type, including handling for the led_type argument and removal of legacy RMT channel logic. Initialization now uses the new configuration structure compatible with ESP-IDF 5.x. [1] [2] [3] [4]
  • Simplified error handling in the native code by removing unnecessary else blocks and ensuring consistent tuple construction for errors. [1] [2] [3] [4]

* Refactor RMT handling for ESP-IDF version compatibility and update LED strip driver initialization

* Update header includes to use esp_idf_version.h for SDK version compatibility

* Ensure esp_idf_version.h is included first in relevant source files for proper SDK version compatibility

* Refactor LED strip driver for ESP-IDF 5.x compatibility by removing legacy RMT API code and simplifying initialization

* Fix memory allocation for WS2812 LED strip by ensuring proper variable declaration
* Add brightness control functions for NeoPixel strip

* Refactor brightness handling in ws2812 LED strip driver
* Add RGBW support for NeoPixel LED strips

- Introduced `set_pixel_rgbw` function to handle RGBW pixel settings.
- Updated NIF initialization to accept LED type (RGB/RGBW).
- Enhanced LED strip configuration to include LED type.
- Modified existing functions to accommodate RGBW data handling.

* Refactor options type to support maps and proplists; add options normalization

* log changes

* Remove unnecessary logging for LED type and strip initialization in RGBW support

* Enhance NeoPixel library documentation and add HSVW pixel control for SK6812 support
@harmon25 harmon25 changed the title Removes legacy RMT, adds brightness + RGBW support [neopixel] Removes legacy RMT, adds brightness + RGBW support Dec 5, 2025
@harmon25 harmon25 changed the title [neopixel] Removes legacy RMT, adds brightness + RGBW support Removes legacy RMT, adds brightness + RGBW support Dec 5, 2025
* Add fill and set pixel functions for RGB and RGBW strips

- Implemented `fill_rgb/4` and `fill_rgbw/5` functions to fill the entire strip with a single color.
- Added `set_pixels_rgb/2`, `set_pixels_rgb/3`, `set_pixels_rgbw/2`, and `set_pixels_rgbw/3` functions to set multiple pixels from a list of colors.
- Updated the NIF layer to support new functionalities and ensure proper error handling.
- Enhanced documentation for new functions and usage examples in the markdown files.

* Add HSV and HSVW fill functions for NeoPixel strips
* Refactor to use ESP-IDF led_strip component

- Replace custom RMT driver with ESP-IDF led_strip component
- Add idf_component.yml with espressif/led_strip dependency
- Rename types to avm_led_strip_* to avoid conflicts
- New led_strip_driver.c wrapper supports:
  - RMT with DMA on ESP32-S3/C6
  - RMT without DMA on ESP32/C3
  - SPI backend fallback for reliable DMA on all chips
- Remove old led_strip_rmt_ws2812.c and led_strip.h

* Update led_strip dependency to ^3.0.2

* Fix led_strip v3.x API: use color_component_format instead of led_pixel_format

* Improve backend selection for better WiFi coexistence

- Prefer SPI backend on original ESP32 (best WiFi coexistence)
- Add Kconfig options to force backend selection (Auto/SPI/RMT)
- Cleaner fallback logic with informative log messages
- ESP32-S3/C6/P4 still prefer RMT with DMA
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant