|
1 |
| -# SPDX-FileCopyrightText: Tony DiCola 2017 for Adafruit Industries |
| 1 | +# SPDX-FileCopyrightText: Tony DiCola 2017 for Adafruit Industries, Rose Hooper |
2 | 2 | #
|
3 | 3 | # SPDX-License-Identifier: MIT
|
4 | 4 |
|
|
9 | 9 | CircuitPython driver for the Adafruit IS31FL3741 RGB Matrix QT board
|
10 | 10 |
|
11 | 11 |
|
12 |
| -* Author(s): ladyada |
| 12 | +* Author(s): ladyada, Rose Hooper |
13 | 13 |
|
14 | 14 | Implementation Notes
|
15 | 15 | --------------------
|
|
22 | 22 | https://github.com/adafruit/circuitpython/releases
|
23 | 23 |
|
24 | 24 | """
|
25 |
| -# pylint: disable=abstract-method, super-init-not-called |
26 | 25 | import adafruit_is31fl3741
|
27 | 26 | from . import IS31FL3741
|
28 | 27 |
|
29 | 28 |
|
30 |
| -class Right_Ring(IS31FL3741): |
| 29 | +class Right_Ring: |
31 | 30 | """The right eye ring of the LED glasses"""
|
32 | 31 |
|
33 | 32 | ledmap = (
|
@@ -132,11 +131,117 @@ def __getitem__(self, led):
|
132 | 131 | class LED_Glasses(IS31FL3741):
|
133 | 132 | """Class representing LED Glasses"""
|
134 | 133 |
|
| 134 | + ledmap = [ |
| 135 | + (None, None, None), |
| 136 | + (216, 215, 217), |
| 137 | + (186, 185, 187), |
| 138 | + (36, 35, 37), |
| 139 | + (66, 65, 67), |
| 140 | + (96, 95, 97), |
| 141 | + (126, 125, 127), |
| 142 | + (156, 155, 157), |
| 143 | + (246, 245, 247), |
| 144 | + (346, 347, 345), |
| 145 | + (337, 338, 336), |
| 146 | + (328, 329, 327), |
| 147 | + (319, 320, 318), |
| 148 | + (310, 311, 309), |
| 149 | + (301, 302, 300), |
| 150 | + (292, 293, 291), |
| 151 | + (283, 284, 282), |
| 152 | + (None, None, None), |
| 153 | + (9, 8, 10), |
| 154 | + (219, 218, 220), |
| 155 | + (189, 188, 190), |
| 156 | + (39, 38, 40), |
| 157 | + (69, 68, 70), |
| 158 | + (99, 98, 100), |
| 159 | + (129, 128, 130), |
| 160 | + (159, 158, 160), |
| 161 | + (249, 248, 250), |
| 162 | + (343, 344, 342), |
| 163 | + (334, 335, 333), |
| 164 | + (325, 326, 324), |
| 165 | + (316, 317, 315), |
| 166 | + (307, 308, 306), |
| 167 | + (298, 299, 297), |
| 168 | + (289, 290, 288), |
| 169 | + (280, 281, 279), |
| 170 | + (271, 272, 270), |
| 171 | + (12, 11, 13), |
| 172 | + (222, 221, 223), |
| 173 | + (192, 191, 193), |
| 174 | + (42, 41, 43), |
| 175 | + (72, 71, 73), |
| 176 | + (102, 101, 103), |
| 177 | + (132, 131, 133), |
| 178 | + (162, 161, 163), |
| 179 | + (252, 251, 253), |
| 180 | + (268, 269, 267), |
| 181 | + (238, 239, 237), |
| 182 | + (208, 209, 207), |
| 183 | + (178, 179, 177), |
| 184 | + (148, 149, 147), |
| 185 | + (118, 119, 117), |
| 186 | + (88, 89, 87), |
| 187 | + (58, 59, 57), |
| 188 | + (28, 29, 27), |
| 189 | + (15, 14, 16), |
| 190 | + (225, 224, 226), |
| 191 | + (195, 194, 196), |
| 192 | + (45, 44, 46), |
| 193 | + (75, 74, 76), |
| 194 | + (105, 104, 106), |
| 195 | + (135, 134, 136), |
| 196 | + (165, 164, 166), |
| 197 | + (255, 254, 256), |
| 198 | + (264, 265, 263), |
| 199 | + (234, 235, 233), |
| 200 | + (204, 205, 203), |
| 201 | + (174, 175, 173), |
| 202 | + (144, 145, 143), |
| 203 | + (114, 115, 113), |
| 204 | + (84, 85, 83), |
| 205 | + (54, 55, 53), |
| 206 | + (24, 25, 23), |
| 207 | + (3, 2, 4), |
| 208 | + (213, 212, 214), |
| 209 | + (183, 182, 184), |
| 210 | + (33, 32, 34), |
| 211 | + (63, 62, 64), |
| 212 | + (93, 92, 94), |
| 213 | + (123, 122, 124), |
| 214 | + (243, 242, 244), |
| 215 | + (None, None, None), |
| 216 | + (None, None, None), |
| 217 | + (349, 262, 348), |
| 218 | + (331, 202, 330), |
| 219 | + (322, 172, 321), |
| 220 | + (313, 142, 312), |
| 221 | + (304, 112, 303), |
| 222 | + (295, 82, 294), |
| 223 | + (286, 52, 285), |
| 224 | + (277, 22, 276), |
| 225 | + ] |
| 226 | + width = 18 |
| 227 | + height = 5 |
| 228 | + # These pixels aren't connected to anything and are safe to use for pixels that aren't visible |
| 229 | + unused_pixels = (120, 121, 314) |
| 230 | + |
135 | 231 | def __init__(self, i2c, allocate=adafruit_is31fl3741.NO_BUFFER):
|
136 | 232 | super().__init__(i2c, allocate=allocate)
|
| 233 | + |
137 | 234 | self.set_led_scaling(0xFF) # turn on LEDs all the way
|
138 | 235 | self.global_current = 0xFE # set current to max
|
139 | 236 | self.enable = True # enable!
|
140 | 237 |
|
141 | 238 | self.right_ring = Right_Ring(self)
|
142 | 239 | self.left_ring = Left_Ring(self)
|
| 240 | + self.grid = self |
| 241 | + |
| 242 | + @staticmethod |
| 243 | + def pixel_addrs(x, y): |
| 244 | + addrs = LED_Glasses.ledmap[x + (LED_Glasses.width * y)] |
| 245 | + if addrs[0] is None: |
| 246 | + return LED_Glasses.unused_pixels |
| 247 | + return addrs |
0 commit comments