Open ozett opened 8 years ago
This python library (https://github.com/rm-hull/max7219) supports the "vertical" configuration needed to work with modules like this one http://www.gearbest.com/raspberry-pi/pp_391811.html
I'm going to take a look to see if I can incorporate this functionality in this library. I'll submit a PR if I get it working.
I have fixed by changing the commit() api as below :
void LedMatrix::commit() {
byte index = B0000001;
byte col;
if(deviceOrientation == HORIZONTAL) {
for (col = 0; col < myNumberOfDevices * 8; col++) {
sendByte(col / 8, col % 8 + 1, cols[col]);
}
} else if(deviceOrientation == VERTICAL){ // orient the device vertically
for (col = 0; col < myNumberOfDevices * 8; col++) {
xcols[col] = 0;
}
// little inefficient, can be enhanced, rotate the matrix !
for (col = 0; col < myNumberOfDevices * 8; col++) {
for(byte bits = 0; bits < 8; bits++)
xcols[col] |= ((cols[bits + 8*(col/8)] & (index << (col%8))) ?
(B10000000 >> bits) : 0);
sendByte(col / 8, col % 8 + 1, xcols[col]);
}
}
}
See the image on a 1x4 matrix module
Look for deviceOrientation in the .h
Your lib does not Support a Rotation of certain degree? Or is it in the lib? How to Set? Thanks for help.. +1 (Or are you expanding your Code?)