Skip to content

Commit 1bbee58

Browse files
committed
qt breakout & demo
1 parent b040cc5 commit 1bbee58

File tree

3 files changed

+103
-1
lines changed

3 files changed

+103
-1
lines changed

adafruit_is31fl3741/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -185,7 +185,7 @@ def pixel(self, x, y, color=None):
185185
if not 0 <= y <= self.height:
186186
return None
187187
addrs = self.pixel_addrs(x, y)
188-
print(addrs)
188+
#print(addrs)
189189
if color is not None: # set the color
190190
self[addrs[0]] = (color >> 16) & 0xFF
191191
self[addrs[1]] = (color >> 8) & 0xFF
Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
# SPDX-FileCopyrightText: Tony DiCola 2017 for Adafruit Industries
2+
#
3+
# SPDX-License-Identifier: MIT
4+
5+
"""
6+
`adafruit_is31fl3741.adafruit_rgbmatrixqt`
7+
====================================================
8+
9+
CircuitPython driver for the Adafruit IS31FL3741 RGB Matrix QT board
10+
11+
12+
* Author(s): ladyada
13+
14+
Implementation Notes
15+
--------------------
16+
17+
**Hardware:**
18+
19+
**Software and Dependencies:**
20+
21+
* Adafruit CircuitPython firmware for the supported boards:
22+
https://github.com/adafruit/circuitpython/releases
23+
24+
"""
25+
26+
# imports
27+
from . import IS31FL3741
28+
29+
30+
class Adafruit_RGBMatrixQT(IS31FL3741):
31+
"""Supports the ISSI IS31FL3741 eval board"""
32+
33+
width = 13
34+
height = 9
35+
36+
@staticmethod
37+
def pixel_addrs(x, y):
38+
"""Calulate the RGB offsets into the device array for x,y pixel"""
39+
col = x
40+
row = y
41+
42+
# remap the row
43+
rowmap = [8, 5, 4, 3, 2, 1, 0, 7, 6]
44+
row = rowmap[y]
45+
46+
offset = 0
47+
48+
if row <= 5:
49+
if col < 10:
50+
offset = 0x1E*row + col*3
51+
else:
52+
offset = 0xB4 + 0x5A + 9*row + (col - 10)*3
53+
else:
54+
if col < 10:
55+
offset = 0xB4 + (row-6)*0x1E + col*3
56+
else:
57+
offset = 0xB4 + 0x5A + 9*row + (col - 10)*3
58+
59+
#print(x, ",", y, "->", hex(offset))
60+
r_off = 0
61+
g_off = 1
62+
b_off = 2
63+
if col == 12 or col % 2 == 1: # odds + last col
64+
r_off = 2
65+
g_off = 1
66+
b_off = 0
67+
else: # evens
68+
r_off = 0
69+
g_off = 2
70+
b_off = 1
71+
72+
return (offset+r_off, offset+g_off, offset+b_off)

examples/is31fl3741_rgbswirl.py

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
"""CircuitPython Essentials I2C Scan example"""
2+
# If you run this and it seems to hang, try manually unlocking
3+
# your I2C bus from the REPL with
4+
# >>> import board
5+
# >>> board.I2C().unlock()
6+
7+
import time
8+
import board
9+
import adafruit_is31fl3741
10+
from rainbowio import colorwheel
11+
12+
#from adafruit_is31fl3741.issi_evb import ISSI_EVB
13+
from adafruit_is31fl3741.adafruit_rgbmatrixqt import Adafruit_RGBMatrixQT
14+
15+
i2c = board.I2C()
16+
17+
is31 = Adafruit_RGBMatrixQT(i2c)
18+
is31.set_led_scaling(0xFF)
19+
is31.global_current = 0xFF
20+
#print("global current is", is31.global_current)
21+
is31.enable = True
22+
#print("Enabled?", is31.enable)
23+
24+
wheeloffset = 0
25+
while True:
26+
27+
for y in range (9):
28+
for x in range (13):
29+
is31.pixel(x, y, colorwheel((y*13 + x)*2 + wheeloffset))
30+
wheeloffset += 1

0 commit comments

Comments
 (0)