|
| 1 | +#!/usr/bin/python3 |
| 2 | +# SPDX-FileCopyrightText: 2025 Tim Cocks for Adafruit Industries |
| 3 | +# |
| 4 | +# SPDX-License-Identifier: MIT |
| 5 | +""" |
| 6 | +Display a simple test pattern of 3 shapes on three 64x64 matrix panels |
| 7 | +using Active3 compatible connections. |
| 8 | +
|
| 9 | +Run like this: |
| 10 | +
|
| 11 | +$ python triple_matrix_active3_simpletest.py |
| 12 | +
|
| 13 | +""" |
| 14 | + |
| 15 | +import numpy as np |
| 16 | +from PIL import Image, ImageDraw |
| 17 | + |
| 18 | +import adafruit_blinka_raspberry_pi5_piomatter as piomatter |
| 19 | +from adafruit_blinka_raspberry_pi5_piomatter.pixelmappers import simple_multilane_mapper |
| 20 | + |
| 21 | +width = 64 |
| 22 | +n_lanes = 6 |
| 23 | +n_addr_lines = 5 |
| 24 | +height = n_lanes << n_addr_lines |
| 25 | +pen_radius = 1 |
| 26 | + |
| 27 | +canvas = Image.new('RGB', (width, height), (0, 0, 0)) |
| 28 | +draw = ImageDraw.Draw(canvas) |
| 29 | + |
| 30 | +pixelmap = simple_multilane_mapper(width, height, n_addr_lines, n_lanes) |
| 31 | +geometry = piomatter.Geometry(width=width, height=height, n_addr_lines=n_addr_lines, n_planes=10, n_temporal_planes=4, map=pixelmap, n_lanes=n_lanes) |
| 32 | +framebuffer = np.asarray(canvas) + 0 # Make a mutable copy |
| 33 | +matrix = piomatter.PioMatter(colorspace=piomatter.Colorspace.RGB888Packed, |
| 34 | + pinout=piomatter.Pinout.Active3BGR, |
| 35 | + framebuffer=framebuffer, |
| 36 | + geometry=geometry) |
| 37 | + |
| 38 | + |
| 39 | +draw.rectangle((8, 8, width-8, width-8), fill=0x008800) |
| 40 | +draw.circle((32, 64+32), 22, fill=0x880000) |
| 41 | +draw.polygon([(32, 136), (54, 180), (10, 180)], fill=0x000088) |
| 42 | + |
| 43 | +framebuffer[:] = np.asarray(canvas) |
| 44 | +matrix.show() |
| 45 | + |
| 46 | +input("Press enter to exit") |
0 commit comments