pimoroni-pico/micropython/modules/hub75
Gee Bartlett 104c819412
Hub75: Update to use Picographics (#601)
* have a basic pg working needs optimizing

* working well ported some examples from GU

* started on micropython module

* Fixes to get new Hub75 compiling in MP

* stripped down for faster compilling

* Update hub75.cmake

* added hub75 to galatic and eviro as it is needed for picographics

* Update picographics.c

* added hu75 update

* added _ModPicoGraphics_obj_t

* Update hub75.cpp

* update bindings

* some examples needs linting

* added other panel sizes and linted

* Update picographics.cpp

* Update picographics.c

* fixing gc memory allocation

* Update hub75.cpp

* Update interstate75_balls_demo.cpp

* review

* broke

* working with built in panel defs

* still borked

* not much change needs review

* Update hub75.cpp

* reverted alot of things

* adding i75 lib

* lots of updates ready to test compile mp

* Update picographics.h

* little tweaks

* an inability to count fixed!

* fixed some readme's

* lots of tiding

* fixed linting and removed experimental code

* Minor formatting

* Minor formatting and cmake tidy

* Removed unneeded parts of examples

* Final tidy

* tidy examples and adding more

* updated to new library

* documentation tweaks

* fixed inclusion of interstate75 module

* syncing some stuff

* fixed linting

Co-authored-by: ZodiusInfuser <christopher.parrott2@gmail.com>
2022-12-16 20:53:16 +00:00
..
README.md Hub75: Update to use Picographics (#601) 2022-12-16 20:53:16 +00:00
hub75.c Hub75: Update to use Picographics (#601) 2022-12-16 20:53:16 +00:00
hub75.cpp Hub75: Update to use Picographics (#601) 2022-12-16 20:53:16 +00:00
hub75.h Hub75: Update to use Picographics (#601) 2022-12-16 20:53:16 +00:00
micropython.cmake Hub75: Update to use Picographics (#601) 2022-12-16 20:53:16 +00:00

README.md

HUB75

This library can be used with the Interstate 75 and 75W bypasses the use of picographics and can be used for situations where RAM is constrained or for custom display configurations like 2x2 HUB75 panels.

For most cases we recommend using the picographics based module for Interstate 75 and 75W as it contains a lot of helper functions to draw text and shapes, further information on its usage can be found here: Interstate75

The Interstate 75 library is intended for the Interstate 75 and Interstate 75 W "HUB75" matrix panel driver board.

It can, in theory, be used with your own custom wiring, though custom pin assignments are not supported yet.

Notes On PIO & DMA Limitations

The Hub 75 driver uses the PIO hardware on the RP2040. There are only two PIOs with four state machines each, and hub75 uses one of these (PIO0) and two state machines- one for clocking out pixels, and another for latching/lighting a row.

It also uses two DMA channels, one to copy pixel data from the back buffer back to the front buffer and one to supply the row driving PIO with row data.

Getting Started

Construct a new Hub75 instance, specifying the width/height of the display and any additional options.

import hub75

WIDTH = 64
HEIGHT = 64

matrix = hub75.Hub75(WIDTH, HEIGHT, stb_invert=True)

Use stb_invert if you see a missing middle row corruption on the top row.

Start the matrix strip by calling start. This sets up DMA and PIO to drive your panel, pulling rows from the back buffer and refreshing as fast as it can.

matrix.start()

FM6216A Panels

Some panels - based on the FM6126A chips - require a couple of register settings for them to display anything at all. Interstate 75 will set these for you if you specify panel_type=hub75.PANEL_FM6126A. Eg:

import hub75

WIDTH = 64
HEIGHT = 64

matrix = hub75.Hub75(WIDTH, HEIGHT,panel_type=hub75.PANEL_FM6126A)

Quick Reference

Set A Pixel

You can set the colour of a pixel using RGB values. This will instantly update the pixel on the matrix display.

Set the top left-most LED - 0, 0 - to Purple 255, 0, 255:

matrix.set_pixel(0, 0, 255, 0, 255)

Clear the display

Calling .clear() will clear the whole contents of the display

matrix.clear()