From bf189ea0b2f0dc6540bf7a911eec0584ab852a17 Mon Sep 17 00:00:00 2001 From: Remy Moll Date: Tue, 13 Oct 2020 21:42:23 +0200 Subject: [PATCH] now --- dashboard_api/hat/sim.py | 2 +- dashboard_api/hat/unicorn.py | 6 +++++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/dashboard_api/hat/sim.py b/dashboard_api/hat/sim.py index 6ea274a..39f3e5f 100644 --- a/dashboard_api/hat/sim.py +++ b/dashboard_api/hat/sim.py @@ -68,7 +68,7 @@ class UnicornHat(object): return (self.width, self.height) - def brightness(self, *args): + def set_brightness(self, *args): pass diff --git a/dashboard_api/hat/unicorn.py b/dashboard_api/hat/unicorn.py index 756031b..f7ec284 100644 --- a/dashboard_api/hat/unicorn.py +++ b/dashboard_api/hat/unicorn.py @@ -9,6 +9,7 @@ class UnicornHat(object): def __init__(self, width, height, rotation_offset = 0): self.PIN_CLK = 11 ################################## + # GPIO Pins for the actual signal. The other ones are for signal clocks and resets. self.PINS_DAT = [10, 22] ################################## self.PIN_CS = 8 @@ -28,7 +29,10 @@ class UnicornHat(object): self.brightness = 0.5 self.buffer = numpy.zeros((self.HEIGHT,self.WIDTH,3), dtype=int) + self.reset_clock() + def reset_clock(self): + GPIO.output(self.PIN_CLK, GPIO.LOW) def spi_write(self, buf1, buf2): GPIO.output(self.PIN_CS, GPIO.LOW) @@ -52,7 +56,7 @@ class UnicornHat(object): time.sleep(0.00000001) GPIO.output(self.PIN_CLK, GPIO.LOW) - def brightness(self, b): + def set_brightness(self, b): """Set the display brightness between 0.0 and 1.0. :param b: Brightness from 0.0 to 1.0 (default 0.5) """