Alright I am very close to getting this working. Upon testing I've noticed that the bit arrays are being clipped down to 8 instead of 16 somewhere along the way.
The only other issue is Case 3 displaying mirrored vertically, however im sure that can be fixed with some array transpose.
Here is my current code:
#include "LedControl.h"
#define Width 16
#define Height 16
/*
pin 12 is connected to the DATA
pin 11 is connected to the CLK
pin 10 is connected to CS
*/
LedControl lc = LedControl(12, 11, 10, 4);
byte t9[16] = {0b0000000000000000,
0b0000111111110001,
0b0000111111110000,
0b0000111111110000,
0b0000111111110000,
0b0000111111110000,
0b0000111111110000,
0b0000111111110000,
0b0000111111110001,
0b1111111111111111,
0b0000000000000000,
0b0000000000000000,
0b0000000000000000,
0b0000000000000000,
0b0000000000000000,
0b1111111111111111
};
byte t10[16] = {0b0000000000000000,
0b0000111111110000,
0b0000111111110001,
0b0000111111110000,
0b0000111111110000,
0b0000111111110000,
0b0000111111110000,
0b0000111111110000,
0b0000111111110010,
0b1111111111111111,
0b0000000000000000,
0b0000000000000000,
0b0000000000000000,
0b0000000000000000,
0b0000000000000000,
0b1111111111111111
};
byte t11[16] = {0b0000000000000000,
0b1000111111110000,
0b0000111111110000,
0b0000111111110001,
0b0000111111110000,
0b0000111111110000,
0b0000111111110000,
0b0000111111110000,
0b0000111111110100,
0b1111111111111111,
0b0000000000000000,
0b0000000000000000,
0b0000000000000000,
0b0000000000000000,
0b0000000000000000,
0b1111111111111111
};
byte t12[16] = {0b0000000000000000,
0b0000111111110000,
0b1000111111110000,
0b0000111111110000,
0b0000111111110001,
0b0000111111110000,
0b0000111111110000,
0b0000111111110000,
0b0000111111111000,
0b1111111111111111,
0b0000000000000000,
0b0000000000000000,
0b0000000000000000,
0b0000000000000000,
0b0000000000000000,
0b1111111111111111
};
unsigned long delayTime = 1000;
//byte t1[16][16];
byte t2[16];
byte A[16];
void setup() {
int devices = lc.getDeviceCount();
//we have to init all devices in a loop
for (int address = 0; address < devices; address++) {
delay(10);
/*The MAX72XX is in power-saving mode on startup*/
lc.shutdown(address, false);
/* Set the brightness to a medium values */
lc.setIntensity(address, 1);
/* and clear the display */
lc.clearDisplay(address);
Serial.begin(9600);
}
//randomize(t1);
}
void loop() {
display(t9);
delay(delayTime);
display(t10);
delay(delayTime);
display(t11);
delay(delayTime);
display(t12);
delay(delayTime);
}
void display(byte t1[16]) {
for (unsigned char matrixCount = 0; matrixCount < 4; matrixCount++) {
//lc.clearDisplay(matrixCount);
for (unsigned int i = 0; i < 8; i++) {
switch (matrixCount) {
case 1: {
A[i] = t1[i];
break;
}
case 0: {
A[i] = t1[i];
break;
}
case 2: {
A[i] = t1[i+8];
break;
}
case 3: {
A[i] = t1[i+8];
break;
}
}
}
updateDisplay(matrixCount);
}
}
void updateDisplay(unsigned char address) {
if (address < 2 ) {
for (int i = 0; i < 8; i++) {
lc.setRow(address, i, rowValue(address, i));
//delay(100);
}
} else {
for (int i = 0; i < 8; i++) {
lc.setRow(address, i, rowValue(address, 7-i));
//delay(100);
}
}
}
int rowValue(unsigned char address,byte i) {
int result;
switch (address) {
case 2: case 1: {
Serial.println(A[i]);
result = A[i] & 0b1111111100000000;
break;
}
case 3: case 0: {
result = A[i] & 0b0000000011111111;
break;
}
}
return result;
}