If you use the C libraries that are in the files section, there are 2 macros that are important to set to match the hardware configuration. The first one is in the MatrixDriver_MAX7221.h file at the top of the Defines area:
//=========================================================================
// Defines
//=========================================================================
#define NUM_DISPLAY_MODULES (3) // Number of display modules on the SPI / I2C bus
Set NUM_DISPLAY_MODULES to the number of MAX7221 chips on the SPI chain.
The second one is in the the file MatrixDriver_MAX7221.c at the top of the Defines area:
//=========================================================================
// Defines
//=========================================================================
// Uncomment to run a left to right (physical) SPI chain. The early single
// driver boards ran left to right data flow, and since the first byte out
// of the SPI Master winds up in the far end of the SPI chain, the
// character display data needs to have it's order swapped. Later versions // and the dual driver versions run a right to left SPI chain and do not
// need the order swapped.
#define LEFT_TO_RIGHT_SPI_CHAIN
This one pertains to the physical direction of the SPI chain. If the SPI chain runs from the leftmost module to the rightmost module, you want this uncommented. Conversely, if the SPI chain runs from the rightmost module to the leftmost module, comment this define out.
The NUM_DISPLAY_MODULES value is used in many places in the MatrixDriver_MAX7221 file and will be useful in the top level application code for sizing output arrays and such.
The LEFT_TO_RIGHT_SPI_CHAIN value is only used in the Send_Buffer() function in the MatrixDriver_MAX7221.c file to determine the assembly order in the translation from ASCII string to MAX7221 data.
Discussions
Become a Hackaday.io Member
Create an account to leave a comment. Already have an account? Log In.