Cogless 1-Wire Pixel (WS2811/WS2812 type) Driver
For a work project I need to update a very small quantity of WS2812-type LEDs on two pins. For this application there is no need to consume a cog and fill the object with lots of fanciful support routines. This attached object is small and lean, taking advantage of inline PASM2 to generate the data stream to the pixels.
Keep in mind that this is not using a cog, so you have to manually tell the driver to update your pixels with the .show() method (same as with drivers for other popular microcontrollers).
I have tested my Spin code in Propeller Tool and FlexProp -- it works in both places (though I'm sure at least one forum member will claim it doesn't....).
NOTE: You have to specify the details for your pixel type in the start method, though several suggestions are provided in the object comments. If you're using the WS2811, you'll see that they list the specs for low speed (400kHz) mode; this driver works at 800kHz, hence those values must be halved.
From the WS2811 data sheet.
Special thanks to Terry (@ke4pjw) for providing feedback as I was making final decisions on the driver.
Comments
Partial translation of demo to C (I've just cracked open the K&R and will work my way through it). Get driver from archive in post #1.
Partial translation of demo to BASIC (FlexProp). Get driver from archive in post #1.