Crate max_7219_led_matrix_util

Source
Expand description

Provides utility functions on top of “max7219”-crate to display data (like text) on a MAX7219 powered matrix display.

Modules§

encoding
Encoding utility functions that helps you to print symbols easily on a MAX7219-powered LED matrix.
mappings
Provides mappings for a mono spaced font I created myself. The font is not complete and many symbols are missing. This ist just an demonstration how it could be done.

Constants§

LED_SQUARE_MATRIX_DIM
We use 8x8 square matrices (per single display)
MAX_DISPLAYS
Maximum supported chained displays by MAX7219.

Functions§

prepare_display
Convenient function that turns on the display, clears the display and sets the brightness to the highest possible value. It also sets the DecodeMode to NoDecode which is necessary for displaying content on the 8x8 matrix display. (Max7219 can also be used for 7 segment displays).
remove_gaps_in_display_text
Iterates through the data and removes all gaps between symbols. A gap is two or more cols after each other that are all zero. This way, text looks more natural, as letters are closer together. Hence, we do not have a monospace font here. But (currently), also spaces are removed.
setup_adapter
Set’s up the MAX7219-driver using “gpio_cdev”. This only works on Linux. It works for example on Raspberry. The communication uses SPI protocol. This does not require the “SPI Module” on Raspberry Pi to be activated. This works via regular GPIO pins.
shift_all_rows_one_bit_left
Shift all row bits one to the left (to the next col). This way you can animate a moving text.
show_moving_text_in_loop
Shows a moving text in loop. After each iteration all bits are shifted one col to the left. Make sure to call prepare_display() first!
transpose_single_display_data
This does a transpose operation on the SingleDisplayData-Matrix and is a helper function for remove_gaps_in_display_text. Cols become rows and rows become cols. Example:

Type Aliases§

Max7219Adapter
The type of the driver.