Make n_temporal_planes, n_lanes "standard" argmuents
& add the simple multilane mapper to examples that use click
This commit is contained in:
parent
8ae0fea913
commit
372a158bd7
4 changed files with 18 additions and 9 deletions
|
|
@ -53,7 +53,7 @@ def make_pixelmap_multilane(width, height, n_addr_lines, n_lanes):
|
|||
@click.command
|
||||
@click.option("--x-offset", "xoffset", type=int, help="The x offset of top left corner of the region to mirror", default=0)
|
||||
@click.option("--y-offset", "yoffset", type=int, help="The y offset of top left corner of the region to mirror", default=0)
|
||||
@piomatter_click.standard_options(n_lanes=2, n_temporal_planes=4)
|
||||
@piomatter_click.standard_options
|
||||
def main(xoffset, yoffset, width, height, serpentine, rotation, pinout, n_planes, n_temporal_planes, n_addr_lines, n_lanes):
|
||||
if n_lanes != 2:
|
||||
pixelmap = simple_multilane_mapper(width, height, n_addr_lines, n_lanes)
|
||||
|
|
|
|||
|
|
@ -43,6 +43,7 @@ import PIL.Image as Image
|
|||
|
||||
import adafruit_blinka_raspberry_pi5_piomatter as piomatter
|
||||
import adafruit_blinka_raspberry_pi5_piomatter.click as piomatter_click
|
||||
from adafruit_blinka_raspberry_pi5_piomatter.pixelmappers import simple_multilane_mapper
|
||||
|
||||
with open("/sys/class/graphics/fb0/virtual_size") as f:
|
||||
screenx, screeny = [int(word) for word in f.read().split(",")]
|
||||
|
|
@ -66,8 +67,12 @@ linux_framebuffer = np.memmap('/dev/fb0',mode='r', shape=(screeny, stride // byt
|
|||
@click.option("--y-offset", "yoffset", type=int, help="The y offset of top left corner of the region to mirror", default=0)
|
||||
@click.option("--scale", "scale", type=int, help="The scale factor to reduce the display down by.", default=3)
|
||||
@piomatter_click.standard_options
|
||||
def main(xoffset, yoffset, scale, width, height, serpentine, rotation, pinout, n_planes, n_addr_lines):
|
||||
geometry = piomatter.Geometry(width=width, height=height, n_planes=n_planes, n_addr_lines=n_addr_lines, rotation=rotation)
|
||||
def main(xoffset, yoffset, scale, width, height, serpentine, rotation, pinout, n_planes, n_temporal_planes, n_addr_lines, n_lanes):
|
||||
if n_lanes != 2:
|
||||
pixelmap = simple_multilane_mapper(width, height, n_addr_lines, n_lanes)
|
||||
geometry = piomatter.Geometry(width=width, height=height, n_planes=n_planes, n_addr_lines=n_addr_lines, n_temporal_planes=n_temporal_planes, n_lanes=n_lanes, map=pixelmap)
|
||||
else:
|
||||
geometry = piomatter.Geometry(width=width, height=height, n_planes=n_planes, n_temporal_planes=n_temporal_planes, n_addr_lines=n_addr_lines, rotation=rotation)
|
||||
matrix_framebuffer = np.zeros(shape=(geometry.height, geometry.width, 3), dtype=np.uint8)
|
||||
matrix = piomatter.PioMatter(colorspace=piomatter.Colorspace.RGB888Packed, pinout=pinout, framebuffer=matrix_framebuffer, geometry=geometry)
|
||||
|
||||
|
|
|
|||
|
|
@ -35,6 +35,7 @@ from pyvirtualdisplay.smartdisplay import SmartDisplay
|
|||
|
||||
import adafruit_blinka_raspberry_pi5_piomatter as piomatter
|
||||
import adafruit_blinka_raspberry_pi5_piomatter.click as piomatter_click
|
||||
from adafruit_blinka_raspberry_pi5_piomatter.pixelmappers import simple_multilane_mapper
|
||||
|
||||
keyboard_debug = False
|
||||
keys_down = set()
|
||||
|
|
@ -92,8 +93,8 @@ ctrl_modified_range = (1, 26)
|
|||
@click.option("--ctrl-c-interrupt/--no-ctrl-c-interrupt", help="If Ctrl+C should be handled as an interrupt.", default=True)
|
||||
@piomatter_click.standard_options
|
||||
@click.argument("command", nargs=-1)
|
||||
def main(scale, backend, use_xauth, extra_args, rfbport, width, height, serpentine, rotation, pinout, n_planes,
|
||||
n_addr_lines, ctrl_c_interrupt, command):
|
||||
def main(scale, backend, use_xauth, extra_args, rfbport, width, height, serpentine, rotation, pinout, n_planes, n_temporal_planes,
|
||||
n_addr_lines, n_lanes, ctrl_c_interrupt, command):
|
||||
def handle_key_event(evt_data):
|
||||
if evt_data in key_map.keys():
|
||||
keys_down.add(key_map[evt_data])
|
||||
|
|
@ -133,8 +134,11 @@ def main(scale, backend, use_xauth, extra_args, rfbport, width, height, serpenti
|
|||
if extra_args:
|
||||
kwargs['extra_args'] = shlex.split(extra_args)
|
||||
print("xauth", use_xauth)
|
||||
geometry = piomatter.Geometry(width=width, height=height, n_planes=n_planes, n_addr_lines=n_addr_lines,
|
||||
rotation=rotation)
|
||||
if n_lanes != 2:
|
||||
pixelmap = simple_multilane_mapper(width, height, n_addr_lines, n_lanes)
|
||||
geometry = piomatter.Geometry(width=width, height=height, n_planes=n_planes, n_addr_lines=n_addr_lines, n_temporal_planes=n_temporal_planes, n_lanes=n_lanes, map=pixelmap)
|
||||
else:
|
||||
geometry = piomatter.Geometry(width=width, height=height, n_planes=n_planes, n_temporal_planes=n_temporal_planes, n_addr_lines=n_addr_lines, rotation=rotation)
|
||||
framebuffer = np.zeros(shape=(geometry.height, geometry.width, 3), dtype=np.uint8)
|
||||
matrix = piomatter.PioMatter(colorspace=piomatter.Colorspace.RGB888Packed, pinout=pinout, framebuffer=framebuffer,
|
||||
geometry=geometry)
|
||||
|
|
|
|||
|
|
@ -40,9 +40,9 @@ def standard_options(
|
|||
rotation=piomatter.Orientation.Normal,
|
||||
pinout=piomatter.Pinout.AdafruitMatrixBonnet,
|
||||
n_planes=10,
|
||||
n_temporal_planes=None,
|
||||
n_temporal_planes=0,
|
||||
n_addr_lines=4,
|
||||
n_lanes=None,
|
||||
n_lanes=2,
|
||||
) -> Callable[[], None]:
|
||||
"""Add standard commandline flags, with the defaults given
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue