mirror of
https://github.com/hybridgroup/gobot.git
synced 2025-04-29 13:49:14 +08:00
spi: correct param used for APA102 Draw() method
Signed-off-by: Ron Evans <ron@hybridgroup.com>
This commit is contained in:
parent
78ec92af7a
commit
ee68549f94
@ -1,9 +1,10 @@
|
|||||||
package spi
|
package spi
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"gobot.io/x/gobot"
|
|
||||||
"image/color"
|
"image/color"
|
||||||
"math"
|
"math"
|
||||||
|
|
||||||
|
"gobot.io/x/gobot"
|
||||||
)
|
)
|
||||||
|
|
||||||
// APA102Driver is a driver for the APA102 programmable RGB LEDs
|
// APA102Driver is a driver for the APA102 programmable RGB LEDs
|
||||||
@ -93,7 +94,7 @@ func (d *APA102Driver) Draw() error {
|
|||||||
|
|
||||||
for i, c := range d.vals {
|
for i, c := range d.vals {
|
||||||
j := (i + 1) * 4
|
j := (i + 1) * 4
|
||||||
tx[j] = 0xe0 + byte(math.Min(c.A, 31))
|
tx[j] = 0xe0 + byte(math.Min(float64(c.A), 31))
|
||||||
tx[j+1] = byte(c.B)
|
tx[j+1] = byte(c.B)
|
||||||
tx[j+2] = byte(c.G)
|
tx[j+2] = byte(c.G)
|
||||||
tx[j+3] = byte(c.R)
|
tx[j+3] = byte(c.R)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user