esp8266/modules/neopixel.py: Add timing param to NeoPixel constructor.

This matches the esp32 port.
pull/6820/head
Christopher Tse 2021-01-26 03:28:20 -06:00 zatwierdzone przez Damien George
rodzic 993ab6aa2c
commit 5c37e76e4f
1 zmienionych plików z 3 dodań i 2 usunięć

Wyświetl plik

@ -7,12 +7,13 @@ from esp import neopixel_write
class NeoPixel:
ORDER = (1, 0, 2, 3)
def __init__(self, pin, n, bpp=3):
def __init__(self, pin, n, bpp=3, timing=1):
self.pin = pin
self.n = n
self.bpp = bpp
self.buf = bytearray(n * bpp)
self.pin.init(pin.OUT)
self.timing = timing
def __setitem__(self, index, val):
offset = index * self.bpp
@ -28,4 +29,4 @@ class NeoPixel:
self[i] = color
def write(self):
neopixel_write(self.pin, self.buf, True)
neopixel_write(self.pin, self.buf, self.timing)