Skip to content

Commit

Permalink
esp8266/modules/neopixel.py: Add timing param to NeoPixel constructor.
Browse files Browse the repository at this point in the history
This matches the esp32 port.
  • Loading branch information
chris-tse authored and dpgeorge committed Jan 30, 2021
1 parent 993ab6a commit 5c37e76
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions ports/esp8266/modules/neopixel.py
Expand Up @@ -7,12 +7,13 @@
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
Expand All @@ -28,4 +29,4 @@ def fill(self, color):
self[i] = color

def write(self):
neopixel_write(self.pin, self.buf, True)
neopixel_write(self.pin, self.buf, self.timing)

0 comments on commit 5c37e76

Please sign in to comment.