When SmartMatrix Library 3.0 was released, there was only one processor family supported (the Teensy 3.x), and only one type of SmartMatrix Shield. Now there’s two types of shields for the Teensy 3, preliminary ESP32 support with many potential hardware configurations, and Teensy 4 support is coming with multiple possible hardware configurations as well.
With SmartMatrix Library 4.0, I’m planning to make it easier (and mandatory) to choose the hardware configuration in the sketch. It will also be possible to use a custom hardware configuration without modifying the library by adding a file into the sketch directory.
Selecting Hardware Configuration
For all projects, a MatrixHardware*.h file must be included before including
#include <MatrixHardware_KitV4.h> //#include <MatrixHardware_KitV1.h> #include <SmartMatrix4.h>
If there’s no MatrixHardware file included, the compiler will throw an error:
No MatrixHardware*.h file included - You must include one at the top of your sketch
If you accidentally include multiple files, a different error:
Multiple MatrixHardware*.h files included - Only include one MatrixHardware file at the top of your sketch
The MatrixHardware configuration will be printed out with a message in the compiler output, e.g.:
#pragma message "MatrixHardware: SmartLED Shield V4"
Custom MatrixHardware File
If the files included with the library aren’t suitable, you can copy the closest pinout to what you need from the library to your sketch directory, tweak it to your liking, and include it in your sketch:
#include "MatrixHardware_KitV4_custom.h" //#include <MatrixHardware_KitV4.h> #include <SmartMatrix4.h>
To handle the case where a HUB75 panel manufacturer has used non-standard color order in their HUB75 pinout, you can swap the order in the MatrixHardware file.
Does this new method seem like a good improvement? Did I overlook anything that might be useful?