This is some alternative code for WS2812 LEDs running on the esp32.
Rather than the RMT based component (I get issues with this being deprecated...) 
I tried two alternatives - using the i2s hardware where I got 'reasonable' results.  LEDs would set but occasional glitches ( I think the T1L time I got was a little short).
And this which uses the SPI and DMA.  The code is actually very short - there are some structures defined in supplementary code (where the maximum number of LEDs is given a maximum and the IO pin is hardcoded as GPIO_25) 
It would convert fairly easily to a component - with a user selected pin and number of LEDs - and there are two fairly short macros that do the work (Refresh and Initialise).  For conversion to a component - the header would need a #define for the pin and _1 _2 etc for the structures.
It this sample - I bolted on some Rainbow code - which rather clumsily creates a colour then unpacks it again.  It's also hardcoded to 24 WS2812 LEDs (which is what I had to hand)
 Martin
			
			
									
						ESP32 WS2812 LEDs (An alternative approach)
- 
				mnfisher
 - Valued Contributor
 - Posts: 1694
 - http://meble-kuchenne.info.pl
 - Joined: Wed Dec 09, 2020 9:37 pm
 - Has thanked: 146 times
 - Been thanked: 789 times