Skip to content

Commit fd7b63b

Browse files
committed
Added W support for #13
1 parent 7eacd06 commit fd7b63b

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

library/rpi_ws281x/rpi_ws281x.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,12 @@
44
import atexit
55

66

7-
def Color(red, green, blue):
7+
def Color(red, green, blue, white=0):
88
"""Convert the provided red, green, blue color to a 24-bit color value.
99
Each color component should be a value 0-255 where 0 is the lowest intensity
1010
and 255 is the highest intensity.
1111
"""
12-
return (red << 16) | (green << 8) | blue
12+
return (white << 24) | (red << 16) | (green << 8) | blue
1313

1414

1515
class _LED_Data(object):
@@ -135,12 +135,12 @@ def setPixelColor(self, n, color):
135135
"""
136136
self._led_data[n] = color
137137

138-
def setPixelColorRGB(self, n, red, green, blue):
138+
def setPixelColorRGB(self, n, red, green, blue, white=0):
139139
"""Set LED at position n to the provided red, green, and blue color.
140140
Each color component should be a value from 0 to 255 (where 0 is the
141141
lowest intensity and 255 is the highest intensity).
142142
"""
143-
self.setPixelColor(n, Color(red, green, blue))
143+
self.setPixelColor(n, Color(red, green, blue, white))
144144

145145
def getBrightness(self):
146146
return ws.ws2811_channel_t_brightness_get(self._channel)

0 commit comments

Comments
 (0)