Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions ws2812/ws2812_rp2_pio.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ package ws2812
import (
"image/color"
"machine"
"runtime"

pio "github.com/tinygo-org/pio/rp2-pio"
"github.com/tinygo-org/pio/rp2-pio/piolib"
Expand All @@ -27,6 +28,9 @@ func newWS2812Device(pin machine.Pin) Device {
writeColorFunc: func(_ Device, buf []color.RGBA, brightness uint8) error {
for _, c := range buf {
r, g, b := applyBrightness(c, brightness)
for ws.IsQueueFull() {
runtime.Gosched()
}
ws.PutRGB(r, g, b)
}
return nil
Expand Down