diff --git a/ws2812/ws2812.go b/ws2812/ws2812.go index 824b0c5..8080fc2 100644 --- a/ws2812/ws2812.go +++ b/ws2812/ws2812.go @@ -17,10 +17,11 @@ func New(pin machine.GPIO) Device { } // Write the raw bitstring out using the WS2812 protocol. -func (d Device) Write(buf []byte) { +func (d Device) Write(buf []byte) (n int, err error) { for _, c := range buf { d.WriteByte(c) } + return len(buf), nil } // Write the given color slice out using the WS2812 protocol. diff --git a/ws2812/ws2812_avr_16m.go b/ws2812/ws2812_avr_16m.go index 6db1205..cb1a850 100644 --- a/ws2812/ws2812_avr_16m.go +++ b/ws2812/ws2812_avr_16m.go @@ -9,7 +9,7 @@ import ( ) // Send a single byte using the WS2812 protocol. -func (d Device) WriteByte(c byte) { +func (d Device) WriteByte(c byte) error { // For the AVR at 16MHz portSet, maskSet := d.Pin.PortMaskSet() portClear, maskClear := d.Pin.PortMaskClear() @@ -38,4 +38,5 @@ func (d Device) WriteByte(c byte) { "maskClear": maskClear, "portClear": portClear, }) + return nil } diff --git a/ws2812/ws2812_m0_16m.go b/ws2812/ws2812_m0_16m.go index 6004d6f..11df526 100644 --- a/ws2812/ws2812_m0_16m.go +++ b/ws2812/ws2812_m0_16m.go @@ -10,7 +10,7 @@ import ( ) // Send a single byte using the WS2812 protocol. -func (d Device) WriteByte(c byte) { +func (d Device) WriteByte(c byte) error { // For the Cortex-M0 at 16MHz portSet, maskSet := d.Pin.PortMaskSet() portClear, maskClear := d.Pin.PortMaskClear() @@ -40,4 +40,5 @@ func (d Device) WriteByte(c byte) { "maskClear": maskClear, "portClear": portClear, }) + return nil }