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.