adafruit / Adafruit_CircuitPython_seesaw

seesaw helper IC driver for circuitPython
MIT License
60 stars 35 forks source link

Fix incorrect RGBW NeoPixel output #102

Closed caternuson closed 2 years ago

caternuson commented 2 years ago

Simple fix for #101.

This works:

Adafruit CircuitPython 7.2.5 on 2022-04-06; Adafruit Feather M4 Express with samd51j19
>>> import board
>>> from adafruit_seesaw import seesaw, neopixel
>>> ss = seesaw.Seesaw(board.I2C())
>>> pixels = neopixel.NeoPixel(ss, 20, 12, pixel_order=neopixel.GRBW)
>>> pixels.fill(0xFF0000)
>>> 

This also works (assumes RGBW pixel order):

Adafruit CircuitPython 7.2.5 on 2022-04-06; Adafruit Feather M4 Express with samd51j19
>>> import board
>>> from adafruit_seesaw import seesaw, neopixel
>>> ss = seesaw.Seesaw(board.I2C())
>>> pixels = neopixel.NeoPixel(ss, 20, 12, bpp=4)
>>> pixels.fill(0xFF0000)
>>> 

Trying to over specify incompatible values throws exception:

Adafruit CircuitPython 7.2.5 on 2022-04-06; Adafruit Feather M4 Express with samd51j19
>>> import board
>>> from adafruit_seesaw import seesaw, neopixel
>>> ss = seesaw.Seesaw(board.I2C())
>>> pixels = neopixel.NeoPixel(ss, 20, 12, bpp=3, pixel_order=neopixel.GRBW)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/lib/adafruit_seesaw/neopixel.py", line 78, in __init__
ValueError: Pixel order and bpp value do not agree.
>>> 
ladyada commented 2 years ago

thanks @caternuson i didnt get to look till now!