From d8416c3b00ae22ab78746bae2715c56d6dcb7150 Mon Sep 17 00:00:00 2001 From: caternuson Date: Sat, 18 Jan 2020 13:41:58 -0800 Subject: [PATCH 1/2] add buf property --- adafruit_pypixelbuf.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/adafruit_pypixelbuf.py b/adafruit_pypixelbuf.py index 833638d..05148e6 100644 --- a/adafruit_pypixelbuf.py +++ b/adafruit_pypixelbuf.py @@ -95,6 +95,11 @@ def __init__(self, n, buf, byteorder="BGR", brightness=1.0, # pylint: disable=t for i in range(0, self._pixels * 4, 4): self._bytearray[i + self._offset] = DOTSTAR_LED_START_FULL_BRIGHT + @property + def buf(self): + return bytearray([int(i * self.brightness) for i in self._bytearray]) + + @staticmethod def parse_byteorder(byteorder): """ From 466dca154e7b0497f6973a4d809f21391a714b25 Mon Sep 17 00:00:00 2001 From: caternuson Date: Sat, 18 Jan 2020 13:56:38 -0800 Subject: [PATCH 2/2] lint --- adafruit_pypixelbuf.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/adafruit_pypixelbuf.py b/adafruit_pypixelbuf.py index 05148e6..1d88663 100644 --- a/adafruit_pypixelbuf.py +++ b/adafruit_pypixelbuf.py @@ -97,9 +97,9 @@ def __init__(self, n, buf, byteorder="BGR", brightness=1.0, # pylint: disable=t @property def buf(self): + """The brightness adjusted pixel buffer data.""" return bytearray([int(i * self.brightness) for i in self._bytearray]) - @staticmethod def parse_byteorder(byteorder): """