Skip to main content

RGBMatrixDriver

pypi Badge

RGBMatrixDriver is a driver middleware for rpi-rgb-led-matrix/RGBMatrixEmulator compatible display scripts.

Write your display script once, then run it on either real hardware or via software emulation. Out of the box, the middleware lets you get off the ground with a sensible default configuration while allowing extensibility and additional features.

Installation

RGBMatrixDriver is in the Python Package Index (PyPI). Installing with pip is recommended for all systems.

pip install RGBMatrixDriver

Setup

Projects that are compatible with RGBMatrixDriver will rely on importing classes from rpi-rgb-led-matrix. These will need to be replaced by equivalent RGBMatrixDriver classes.

For example, usage on a Rasberry Pi might look like this:

from rgbmatrix import RGBMatrix, RGBMatrixOptions

Using the driver middleware, you will need to use RGBMatrixDriver classes:

from RGBMatrixDriver import RGBMatrix, RGBMatrixOptions

To take full advantage of the driver middleware, you will need to parse arguments using the RGBMatrixArguments class instead of a standard argparse.ArgumentParser. You can run this example in /samples/quick_start.py.

from random import randint as r
from RGBMatrixDriver import RGBMatrix, RGBMatrixArguments, prefilled_matrix_options


# Support all the defaults that RGBMatrixDriver includes
args = RGBMatrixArguments().parse_args()

# Fill out an RGBMatrixOptions instance with all the arguments
options = prefilled_matrix_options(args)

# Create a matrix and canvas
matrix = RGBMatrix(options=options)
canvas = matrix.CreateFrameCanvas()

# Push the pixels!
while True:
  # Simulate static -- Set R, G, B equal to each other at random
  for y in range(matrix.height):
    for x in range(matrix.width):
      canvas.SetPixel(x, y, *tuple([r(0, 255)] * 3))

  canvas = matrix.SwapOnVSync(canvas)

You can also set a driver log level if you want, which is useful if you use any reporting middleware (such as the --driver-fps=log flag).

import logging, RGBMatrixDriver


RGBMatrixDriver.logger.setLevel(logging.INFO)

Usage

For the most part, startup of the existing script will be unchanged, unless you want to pass additional driver flags, as listed in the Flags section below.

The driver can handle both hardware and software emulation display modes.

Hardware Mode

By default the driver tries to load in hardware mode. This is the mode end users will typically want to run as, so there are no additional flags needed to work on Raspberry Pi.

Software Emulation Mode

If hardware loading fails for any reason, the driver will fallback to software emulation via RGBMatrixEmulator. A command line flag --emulated can also be used to force emulation.

See RGBMatrixEmulator README for customization options when running software emulation mode.

Flags

You can pass the -h / --help flags at any time to show a list of arguments that your script supports. This will be a default list of arguments provided for rpi-rgb-led-matrix, driver flags provided by this library, and finally, any custom flags you have implemented for your own script.

You should reference the project README for rpi-rgb-led-matrix library when necessary.

Driver Flags

--driver-fps {log,overlay}
  Calculate FPS and display via selected method: log, overlay
--emulated
  Run the script in software emulation mode via RGBMatrixEmulator

Contributing

If you want to help develop RGBMatrixDriver, you must also install the dev dependencies, which can be done by running pip install -e .[dev] from within the directory.

Before submitting a PR, please open an issue to help us track development. All development should be based off of the dev branch. This branch is kept up-to-date with main after releases.

Contact

Tyler Porter

tyler.b.porter@gmail.com

Metadata

Release files for RGBMatrixDriver 0.1.3

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for RGBMatrixDriver 0.1.3
File Size Uploaded
rgbmatrixdriver-0.1.3.tar.gz 3.5 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for RGBMatrixDriver 0.1.3
File Interpreter ABI Platform
rgbmatrixdriver-0.1.3-py2.py3-none-any.whl Python 3, Python 2 none any Details

Total release size: 26.3 kB

Release files / rgbmatrixdriver-0.1.3.tar.gz

Download URL rgbmatrixdriver-0.1.3.tar.gz
Size 3.5 kB
Tags Source
SHA-256 checksum
How to use checksums
cc02af45be5bca57a532816a4400fc5499a4684c08becc5d36caf7cd5d0cc5a7
BLAKE2b-256 checksum
How to use checksums
1a21a09d286f5d959920910182477bbfa82f2d2de64d53f2bb803105cdf86b00
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.1.0 CPython/3.9.19

Release files / rgbmatrixdriver-0.1.3-py2.py3-none-any.whl

Download URL rgbmatrixdriver-0.1.3-py2.py3-none-any.whl
Size 22.8 kB
Tags Python 2 Python 3
SHA-256 checksum
How to use checksums
73ef714ee1f870e28f217306bc3139681f5e89cdace1fcb8f34d29ae73d71bfb
BLAKE2b-256 checksum
How to use checksums
106f1f142e9bc0e28f42108892fb73949f1b4c47e9094b46757efa9620deb751
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.1.0 CPython/3.9.19

Release history Release notifications | RSS feed

This release

0.1.3 This release

2 release files

0.1.2

2 release files

0.1.1

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page