Skip to content

Commit 1230da9

Browse files
authored
Merge pull request #102 from caternuson/iss101_bpp
Fix incorrect RGBW NeoPixel output
2 parents 7c7b5fe + 6bfc0e9 commit 1230da9

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

adafruit_seesaw/neopixel.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,19 +59,21 @@ def __init__(
5959
pin,
6060
n,
6161
*,
62-
bpp=3,
62+
bpp=None,
6363
brightness=1.0,
6464
auto_write=True,
6565
pixel_order=None
6666
):
6767
# TODO: brightness not yet implemented.
6868
self._seesaw = seesaw
6969
self._pin = pin
70-
self._bpp = bpp
7170
self.auto_write = auto_write
7271
self._n = n
7372
self._brightness = min(max(brightness, 0.0), 1.0)
7473
self._pixel_order = GRBW if pixel_order is None else pixel_order
74+
self._bpp = len(self._pixel_order) if bpp is None else bpp
75+
if self._bpp != len(self._pixel_order):
76+
raise ValueError("Pixel order and bpp value do not agree.")
7577

7678
cmd = bytearray([pin])
7779
self._seesaw.write(_NEOPIXEL_BASE, _NEOPIXEL_PIN, cmd)

0 commit comments

Comments
 (0)