This code is intentionally written in C++ to illustrate the basics of driving HUB75 without being overly complicated to read and understand.
Tested on a 32x32 panel and a 64x64 "FM6126A" panel, for which this code includes a magic pair of register settings.