-
Notifications
You must be signed in to change notification settings - Fork 18
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add HUB75 RGB Matrix utility & README updates
- Loading branch information
1 parent
c399b99
commit 70d4df1
Showing
6 changed files
with
116 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,96 @@ | ||
# This will initalize connected HUB75 RGB Matrix panels as a CircuitPython Display | ||
|
||
import board | ||
import displayio | ||
import terminalio | ||
import framebufferio | ||
import rgbmatrix | ||
import supervisor | ||
|
||
try: | ||
type(passedIn) | ||
except: | ||
passedIn = "" | ||
|
||
if passedIn == '1': | ||
base_width = 64 | ||
base_height = 32 | ||
bit_depth = 1 | ||
chain_across = 1 | ||
tile_down = 1 | ||
elif passedIn == '4': | ||
base_width = 64 | ||
base_height = 32 | ||
bit_depth = 1 | ||
chain_across = 2 | ||
tile_down = 2 | ||
else: | ||
try: | ||
base_width = int(input('Panel pixel width (64): ')) | ||
except: | ||
base_width = 64 | ||
try: | ||
base_height = int(input('Panel pixel height (32): ')) | ||
except: | ||
base_height = 32 | ||
try: | ||
bit_depth = int(input('Bit Depth (1): ')) | ||
except: | ||
bit_depth = 1 | ||
try: | ||
chain_across = int(input('Number of panels across (1): ')) | ||
except: | ||
chain_across = 1 | ||
try: | ||
tile_down = int(input('Number of panels down (1): ')) | ||
except: | ||
tile_down = 1 | ||
|
||
serpentine = True | ||
|
||
width = base_width * chain_across | ||
height = base_height * tile_down | ||
|
||
displayio.release_displays() | ||
|
||
matrix = rgbmatrix.RGBMatrix( | ||
width=width,height=height, bit_depth=bit_depth, | ||
rgb_pins=[ | ||
board.MTX_R1, | ||
board.MTX_G1, | ||
board.MTX_B1, | ||
board.MTX_R2, | ||
board.MTX_G2, | ||
board.MTX_B2 | ||
], | ||
addr_pins=[ | ||
board.MTX_ADDRA, | ||
board.MTX_ADDRB, | ||
board.MTX_ADDRC, | ||
board.MTX_ADDRD | ||
], | ||
clock_pin=board.MTX_CLK, | ||
latch_pin=board.MTX_LAT, | ||
output_enable_pin=board.MTX_OE, | ||
tile=tile_down, serpentine=serpentine, | ||
) | ||
# Associate the RGB matrix with a Display so that we can use displayio features | ||
|
||
try: | ||
type(envVars) | ||
except: | ||
envVars = {} | ||
|
||
envVars["_display"] = framebufferio.FramebufferDisplay(matrix) | ||
|
||
# Remove Blinka and CP Status from top line of display | ||
envVars["_display"].root_group[0].hidden = False | ||
envVars["_display"].root_group[1].hidden = True # logo | ||
envVars["_display"].root_group[2].hidden = True # status bar | ||
supervisor.reset_terminal(envVars["_display"].width, 75) | ||
envVars["_display"].root_group[0].y=-2 | ||
envVars["_display"].root_group[0].x=0 | ||
|
||
envVars["_scrWidth"]=round(envVars["_display"].width/((terminalio.FONT.bitmap.width/95)*displayio.CIRCUITPYTHON_TERMINAL.scale))-1 | ||
envVars["_scrHeight"]=round(envVars["_display"].height/(terminalio.FONT.bitmap.height*displayio.CIRCUITPYTHON_TERMINAL.scale)) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters