This commit is contained in:
Remy Moll 2020-10-13 21:42:23 +02:00
parent 6d87e43984
commit bf189ea0b2
2 changed files with 6 additions and 2 deletions

View File

@ -68,7 +68,7 @@ class UnicornHat(object):
return (self.width, self.height) return (self.width, self.height)
def brightness(self, *args): def set_brightness(self, *args):
pass pass

View File

@ -9,6 +9,7 @@ class UnicornHat(object):
def __init__(self, width, height, rotation_offset = 0): def __init__(self, width, height, rotation_offset = 0):
self.PIN_CLK = 11 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.PINS_DAT = [10, 22]
################################## ##################################
self.PIN_CS = 8 self.PIN_CS = 8
@ -28,7 +29,10 @@ class UnicornHat(object):
self.brightness = 0.5 self.brightness = 0.5
self.buffer = numpy.zeros((self.HEIGHT,self.WIDTH,3), dtype=int) 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): def spi_write(self, buf1, buf2):
GPIO.output(self.PIN_CS, GPIO.LOW) GPIO.output(self.PIN_CS, GPIO.LOW)
@ -52,7 +56,7 @@ class UnicornHat(object):
time.sleep(0.00000001) time.sleep(0.00000001)
GPIO.output(self.PIN_CLK, GPIO.LOW) 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. """Set the display brightness between 0.0 and 1.0.
:param b: Brightness from 0.0 to 1.0 (default 0.5) :param b: Brightness from 0.0 to 1.0 (default 0.5)
""" """