This commit is contained in:
Maximilian Giller 2023-10-11 01:53:43 +02:00
parent 08cb3b9588
commit c2376c85a0

View file

@ -9,8 +9,9 @@ from luma.core.legacy.font import proportional, CP437_FONT, LCD_FONT
class MatrixDisplay: class MatrixDisplay:
def __init__(self, *, contrast=0) -> None: def __init__(self, *, contrast=0, text_speed=0.02) -> None:
self.contrast = contrast self.contrast = contrast
self.text_speed = text_speed
self.serial = spi(port=0, device=0, gpio=noop()) self.serial = spi(port=0, device=0, gpio=noop())
self.device = max7219( self.device = max7219(
self.serial, width=32, height=8, rotate=2, block_orientation=-90 self.serial, width=32, height=8, rotate=2, block_orientation=-90
@ -28,7 +29,7 @@ class MatrixDisplay:
for offset in range(width): for offset in range(width):
virtual.set_position((offset, 0)) virtual.set_position((offset, 0))
time.sleep(0.015) time.sleep(self.text_speed)
def flash(self, count=1): def flash(self, count=1):
self.device.contrast(255) self.device.contrast(255)