A VIAM module to support led matrices with a max7219 chip. The module is a wrapper of the luma.led-matrix python library.
The module was tested with a 3 pack of EC Buying MAX7219 Dot Matrix Modules
The first module should be wired to a raspberry pi in the following way:
Max Pin | RPI Pin |
---|---|
VCC | Any 5v Pin |
GND | Any Ground Pin |
DIN | MOSI Pin 19 / GPIO 10 |
CS | CE0 Pin 24 / GPIO 8 |
CLK | SCLK Pin 23 / GPIO 11 |
Based on the official pinout diagram provided by Raspberry Pi
The following config is used to control a single HiLetgo MAX7219 Dot Matrix Module.
{
"spi_bus":"0",
"device":"0",
"block_orientation": 0,
"width": 32,
"height": 24,
"rotate": 0
}
A single DoCommand call will erase the display and draw a new canvas from scratch. Each DoCommand call can contain a list of drawings to be performed in a single frame, where the screen will not be cleared between each drawing.
Draws a border around the display using the provided width + height in the attributes of the component. This type has no options available to it.
{
"drawings": [
{
"type": "border"
}
]
}
Draw a rectangle on the display. Options:
pixels
: An array of integers representing the start and end pixels to draw the rectangle. Provide the coordinates a list of four integers like[start_x, start_y, end_x, end_y]
.
{
"drawings": [
{
"type": "rectangle",
"pixels": [
0,
0,
4,
5
]
}
]
}
Write text to the display. Options:
message
: The text to displaystart_pixel
: The xy coordinates to start the text. Helpful to center text visually. Provide the coordinates a list of two integers like[x, y]
.font
: The font to use, defaults toLCD_FONT
if not provided. The other option isCP437_FONT
which provides thicker "bold" letters.
{
"drawings": [
{
"type": "text",
"message": "VIAM",
"start_pixel": [
3,
0
],
"font": "CP437_FONT"
}
]
}
Light up a single pixel on the display. Options:
pixel
The xy coordinates of the pixel. Provide the coordinates a list of two integers like[x, y]
.
{
"drawings": [
{
"type": "point",
"pixel": [
3,
0
]
}
]
}
Draw a line of pixels on the display. Options:
pixels
: An array of integers representing the start and end pixels to draw the line. Provide the coordinates a list of four integers like[start_x, start_y, end_x, end_y]
.
{
"drawings": [
{
"type": "line",
"pixels": [
0,
0,
0,
5
]
}
]
}
Erases all pixels on the display to show a blank screen.
{
"drawings": [
{
"type": "clear"
}
]
}
Provide a list of drawings to place multiple elements on to the screen. The next DoCommand will erase the screen
{
"drawings": [
{
"type": "point",
"pixel": [
0,
0
]
},
{
"type": "text",
"message": "VIAM",
"start_pixel": [
3,
0
]
},
{
"type": "line",
"pixels": [
31,
0,
31,
7
]
}
]
}