Commit 5c37e76e authored by Christopher Tse's avatar Christopher Tse Committed by Damien George

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

This matches the esp32 port.
parent 993ab6aa
......@@ -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)
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment