31
31
__version__ = "0.0.0-auto.0"
32
32
__repo__ = "https://github.com/adafruit/Adafruit_CircuitPython_HT16K33.git"
33
33
34
- class Matrix16x8 (HT16K33 ):
35
- """A double matrix or the matrix wing ."""
34
+ class Matrix8x8 (HT16K33 ):
35
+ """A single matrix."""
36
36
def pixel (self , x , y , color = None ):
37
37
"""Get or set the color of a given pixel."""
38
- if not 0 <= x <= 15 :
38
+ if not 0 <= x <= 7 :
39
39
return None
40
40
if not 0 <= y <= 7 :
41
41
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 )
46
44
47
45
def __getitem__ (self , key ):
48
46
x , y = key
@@ -52,26 +50,30 @@ def __setitem__(self, key, value):
52
50
x , y = key
53
51
self .pixel (x , y , value )
54
52
55
- class Matrix8x8 ( HT16K33 ):
56
- """A single matrix."""
53
+ class Matrix16x8 ( Matrix8x8 ):
54
+ """The matrix wing ."""
57
55
def pixel (self , x , y , color = None ):
58
56
"""Get or set the color of a given pixel."""
59
- if not 0 <= x <= 7 :
57
+ if not 0 <= x <= 15 :
60
58
return None
61
59
if not 0 <= y <= 7 :
62
60
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 )
69
65
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 )
73
75
74
- class Matrix8x8x2 (HT16K33 ):
76
+ class Matrix8x8x2 (Matrix8x8 ):
75
77
"""A bi-color matrix."""
76
78
def pixel (self , x , y , color = None ):
77
79
"""Get or set the color of a given pixel."""
@@ -86,14 +88,6 @@ def pixel(self, x, y, color=None):
86
88
return super ()._pixel (y , x ) | super ()._pixel (y + 8 , x ) << 1
87
89
return None
88
90
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
-
97
91
def fill (self , color ):
98
92
"""Fill the whole display with the given color."""
99
93
fill1 = 0xff if color & 0x01 else 0x00
0 commit comments