drivers icon indicating copy to clipboard operation
drivers copied to clipboard

Simplify examples/ws2812

Open sago35 opened this issue 1 year ago • 1 comments
trafficstars

The WS2812 example had variations due to its dependency on led and the different PIN names used. With this PR, boards with WS2812 now have machine.WS2812 available. This PR makes the following changes:

  • Remove dependency on machine.LED (as some variations don't have machine.LED)
  • Update to use machine.WS2812 where it is defined

sago35 avatar May 03 '24 01:05 sago35

My main motivation was to create an example of running WS2812 on waveshare-rp2040-zero. However, adding the new variation required many changes, so I created this PR. Going forward, this example will work without changes as long as machine.WS2812 is defined.

I have tested the following for verification and confirmed that at least the build is successful.

tinygo build -o /tmp/out.uf2 -target arduino               ./examples/ws2812/
tinygo build -o /tmp/out.uf2 -target digispark             ./examples/ws2812/
tinygo build -o /tmp/out.uf2 -target qtpy                  ./examples/ws2812/
tinygo build -o /tmp/out.bin -target m5stamp-c3            ./examples/ws2812/
tinygo build -o /tmp/out.uf2 -target thingplus-rp2040      ./examples/ws2812/
tinygo build -o /tmp/out.uf2 -target waveshare-rp2040-zero ./examples/ws2812/

sago35 avatar May 03 '24 01:05 sago35

Thank you for the improvements @sago35 and to @aykevl for review. Now merging.

deadprogram avatar May 06 '24 09:05 deadprogram