From 4d9cfd85113976cf2f5a8cbae427090573335007 Mon Sep 17 00:00:00 2001 From: irgendwer92 <55090043+irgendwer92@users.noreply.github.com> Date: Wed, 4 Jun 2025 14:57:39 +0200 Subject: [PATCH] added mirror option --- max7219.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/max7219.py b/max7219.py index 9342172..cf077a2 100644 --- a/max7219.py +++ b/max7219.py @@ -36,7 +36,7 @@ _DISPLAYTEST = const(15) class Matrix8x8: - def __init__(self, spi, cs, num): + def __init__(self, spi, cs, num, mirror=0): """ Driver for cascading MAX7219 8x8 LED matrices. @@ -53,7 +53,10 @@ def __init__(self, spi, cs, num): self.cs.init(cs.OUT, True) self.buffer = bytearray(8 * num) self.num = num - fb = framebuf.FrameBuffer(self.buffer, 8 * num, 8, framebuf.MONO_HLSB) + if not mirror: + fb = framebuf.FrameBuffer(self.buffer, 8 * num, 8, framebuf.MONO_HLSB) + else: + fb = framebuf.FrameBuffer(self.buffer, 8 * num, 8, framebuf.MONO_HMSB) self.framebuf = fb # Provide methods for accessing FrameBuffer graphics primitives. This is a workround # because inheritance from a native class is currently unsupported.