8000 esp8266/modules/neopixel.py: Add timing param to NeoPixel constructor. · micropython/micropython@5c37e76 · GitHub
[go: up one dir, main page]

Skip to content

Commit 5c37e76

Browse files
chris-tsedpgeorge
authored andcommitted
esp8266/modules/neopixel.py: Add timing param to NeoPixel constructor.
This matches the esp32 port.
1 parent 993ab6a commit 5c37e76

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

ports/esp8266/modules/neopixel.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,13 @@
77
class NeoPixel:
88
ORDER = (1, 0, 2, 3)
99

10-
def __init__(self, pin, n, bpp=3):
10+
def __init__(self, pin, n, bpp=3, timing=1):
1111
self.pin = pin
1212
self.n = n
1313
self.bpp = bpp
1414
self.buf = bytearray(n * bpp)
1515
self.pin.init(pin.OUT)
16+
self.timing = timing
1617

1718
def __setitem__(self, index, val):
1819
offset = index * self.bpp
@@ -28,4 +29,4 @@ def fill(self, color):
2829
self[i] = color
2930

3031
def write(self):
31-
neopixel_write(self.pin, self.buf, True)
32+
neopixel_write(self.pin, self.buf, self.timing)

0 commit comments

Comments
 (0)
0