From df2b1a4758500d3ac538b30fad2e5a48126ea4a0 Mon Sep 17 00:00:00 2001 From: Paul Sokolovsky Date: Thu, 5 May 2016 23:47:37 +0300 Subject: esp8266/scripts/: Remove use of pin.PULL_NONE. This constant is no longer part of hardware API (replaced with just None), and is a default, so not needed in calls. --- esp8266/scripts/neopixel.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'esp8266/scripts/neopixel.py') diff --git a/esp8266/scripts/neopixel.py b/esp8266/scripts/neopixel.py index 4818c74a3b..6b7541e64a 100644 --- a/esp8266/scripts/neopixel.py +++ b/esp8266/scripts/neopixel.py @@ -8,7 +8,7 @@ class NeoPixel: self.pin = pin self.n = n self.buf = bytearray(n * 3) - self.pin.init(pin.OUT, pin.PULL_NONE) + self.pin.init(pin.OUT) def __setitem__(self, index, val): r, g, b = val -- cgit v1.2.3 From 13d06a83e1c1f79bc9b1d627e7c0b02c59791304 Mon Sep 17 00:00:00 2001 From: Mike Causer Date: Fri, 6 May 2016 17:28:14 +1000 Subject: esp8266/scripts/: Add fill() to NeoPixel --- esp8266/scripts/neopixel.py | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'esp8266/scripts/neopixel.py') diff --git a/esp8266/scripts/neopixel.py b/esp8266/scripts/neopixel.py index 6b7541e64a..8aa0348680 100644 --- a/esp8266/scripts/neopixel.py +++ b/esp8266/scripts/neopixel.py @@ -20,5 +20,12 @@ class NeoPixel: i = index * 3 return self.buf[i + 1], self.buf[i], self.buf[i + 2] + def fill(self, color): + r, g, b = color + for i in range(len(self.buf) / 3): + self.buf[i * 3] = g + self.buf[i * 3 + 1] = r + self.buf[i * 3 + 2] = b + def write(self): neopixel_write(self.pin, self.buf, True) -- cgit v1.2.3