Closed
Description
The get_time() function needs updating to deal with variable pixel ordering introduced in #15 #18.
def __getitem__(self, index):
if isinstance(index, slice):
out = []
for in_i in range(*index.indices(self._n)):
out.append(
tuple(self._buf[in_i * 4 + (3 - i) + START_HEADER_SIZE] for i in range(3)))
return out
if index < 0:
index += len(self)
if index >= self._n or index < 0:
raise IndexError
offset = index * 4
return tuple(self._buf[offset + (3 - i) + START_HEADER_SIZE]
for i in range(3))
I've not tested the code this is just from inspection after seeing the issue come up in adafruit/Adafruit_CircuitPython_WS2801#9. I'd imagine it'll end up similar to the neopixel implementation in https://github.com/adafruit/Adafruit_CircuitPython_NeoPixel/blob/163bd47a8385b993309a4b9100bb5956b2066a1d/neopixel.py#L182-L195