3131__version__ = "0.0.0-auto.0"
3232__repo__ = "https://github.com/adafruit/Adafruit_CircuitPython_HT16K33.git"
3333
34- class Matrix16x8 (HT16K33 ):
35- """A double matrix or the matrix wing ."""
34+ class Matrix8x8 (HT16K33 ):
35+ """A single matrix."""
3636 def pixel (self , x , y , color = None ):
3737 """Get or set the color of a given pixel."""
38- if not 0 <= x <= 15 :
38+ if not 0 <= x <= 7 :
3939 return None
4040 if not 0 <= y <= 7 :
4141 return None
42- if x >= 8 :
43- x -= 8
44- y += 8
45- return super ()._pixel (y , x , color )
42+ x = (x - 1 ) % 8
43+ return super ()._pixel (x , y , color )
4644
4745 def __getitem__ (self , key ):
4846 x , y = key
@@ -52,26 +50,30 @@ def __setitem__(self, key, value):
5250 x , y = key
5351 self .pixel (x , y , value )
5452
55- class Matrix8x8 ( HT16K33 ):
56- """A single matrix."""
53+ class Matrix16x8 ( Matrix8x8 ):
54+ """The matrix wing ."""
5755 def pixel (self , x , y , color = None ):
5856 """Get or set the color of a given pixel."""
59- if not 0 <= x <= 7 :
57+ if not 0 <= x <= 15 :
6058 return None
6159 if not 0 <= y <= 7 :
6260 return None
63- x = (x - 1 ) % 8
64- return super ()._pixel (x , y , color )
65-
66- def __getitem__ (self , key ):
67- x , y = key
68- return self .pixel (x , y )
61+ if x >= 8 :
62+ x -= 8
63+ y += 8
64+ return super ()._pixel (y , x , color )
6965
70- def __setitem__ (self , key , value ):
71- x , y = key
72- self .pixel (x , y , value )
66+ class MatrixBackpack16x8 (Matrix8x8 ):
67+ """A double matrix backpack."""
68+ def pixel (self , x , y , color = None ):
69+ """Get or set the color of a given pixel."""
70+ if not 0 <= x <= 15 :
71+ return None
72+ if not 0 <= y <= 7 :
73+ return None
74+ return super ()._pixel (x , y , color )
7375
74- class Matrix8x8x2 (HT16K33 ):
76+ class Matrix8x8x2 (Matrix8x8 ):
7577 """A bi-color matrix."""
7678 def pixel (self , x , y , color = None ):
7779 """Get or set the color of a given pixel."""
@@ -86,14 +88,6 @@ def pixel(self, x, y, color=None):
8688 return super ()._pixel (y , x ) | super ()._pixel (y + 8 , x ) << 1
8789 return None
8890
89- def __getitem__ (self , key ):
90- x , y = key
91- return self .pixel (x , y )
92-
93- def __setitem__ (self , key , value ):
94- x , y = key
95- self .pixel (x , y , value )
96-
9791 def fill (self , color ):
9892 """Fill the whole display with the given color."""
9993 fill1 = 0xff if color & 0x01 else 0x00
0 commit comments