mirror of
https://github.com/tinygo-org/drivers.git
synced 2026-09-10 16:49:32 +00:00
Disable interrupts before sending ws2812 data
This commit is contained in:
committed by
Ron Evans
parent
5645eb3f91
commit
7b565e8cb0
@@ -7,6 +7,7 @@ package ws2812
|
||||
|
||||
import (
|
||||
"device/arm"
|
||||
"runtime/interrupt"
|
||||
)
|
||||
|
||||
// Send a single byte using the WS2812 protocol.
|
||||
@@ -14,6 +15,7 @@ func (d Device) WriteByte(c byte) error {
|
||||
// For the Cortex-M0 at 16MHz
|
||||
portSet, maskSet := d.Pin.PortMaskSet()
|
||||
portClear, maskClear := d.Pin.PortMaskClear()
|
||||
mask := interrupt.Disable()
|
||||
|
||||
// See:
|
||||
// https://wp.josh.com/2014/05/13/ws2812-neopixels-are-not-so-finicky-once-you-get-to-know-them/
|
||||
@@ -48,5 +50,6 @@ func (d Device) WriteByte(c byte) error {
|
||||
"maskClear": maskClear,
|
||||
"portClear": portClear,
|
||||
})
|
||||
interrupt.Restore(mask)
|
||||
return nil
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user