mirror of
https://github.com/tinygo-org/drivers.git
synced 2026-08-18 05:33:58 +00:00
fix issue #858
This commit is contained in:
committed by
Ron Evans
parent
2673cc1e9a
commit
e960a6ff57
+4
-3
@@ -35,9 +35,10 @@ func NewWS2812(pin machine.Pin) Device {
|
|||||||
return newWS2812Device(pin)
|
return newWS2812Device(pin)
|
||||||
}
|
}
|
||||||
|
|
||||||
// New returns a new SK6812(RGBA) driver.
|
// NewSK6812 returns a new SK6812W/RGBW driver (4 channels, GRBW order, 32-bit protocol), for the 3 channels version use NewWS2812
|
||||||
// It does not touch the pin object: you have
|
// Use this for SK6812W strips that have a dedicated white channel controlled via color.A.
|
||||||
// to configure it as an output pin before calling New.
|
// It does not touch the pin object: you have to configure it as an output pin before
|
||||||
|
// calling this.
|
||||||
func NewSK6812(pin machine.Pin) Device {
|
func NewSK6812(pin machine.Pin) Device {
|
||||||
return Device{
|
return Device{
|
||||||
Pin: pin,
|
Pin: pin,
|
||||||
|
|||||||
@@ -6,5 +6,5 @@ import "machine"
|
|||||||
|
|
||||||
// newWS2812Device creates a WS2812 device using the bit-bang driver.
|
// newWS2812Device creates a WS2812 device using the bit-bang driver.
|
||||||
func newWS2812Device(pin machine.Pin) Device {
|
func newWS2812Device(pin machine.Pin) Device {
|
||||||
return Device{Pin: pin, writeColorFunc: writeColorsRGB}
|
return Device{Pin: pin, brightness: 255, writeColorFunc: writeColorsRGB}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -15,11 +15,11 @@ import (
|
|||||||
func newWS2812Device(pin machine.Pin) Device {
|
func newWS2812Device(pin machine.Pin) Device {
|
||||||
sm, err := pio.PIO0.ClaimStateMachine()
|
sm, err := pio.PIO0.ClaimStateMachine()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return Device{Pin: pin, writeColorFunc: writeColorsRGB}
|
return Device{Pin: pin, brightness: 255, writeColorFunc: writeColorsRGB}
|
||||||
}
|
}
|
||||||
ws, err := piolib.NewWS2812B(sm, pin)
|
ws, err := piolib.NewWS2812B(sm, pin)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return Device{Pin: pin, writeColorFunc: writeColorsRGB}
|
return Device{Pin: pin, brightness: 255, writeColorFunc: writeColorsRGB}
|
||||||
}
|
}
|
||||||
return Device{
|
return Device{
|
||||||
Pin: pin,
|
Pin: pin,
|
||||||
|
|||||||
Reference in New Issue
Block a user