support two chained panels to produce 128*16 display
authorDobrica Pavlinusic <dpavlin@rot13.org>
Thu, 24 Dec 2015 10:45:57 +0000 (11:45 +0100)
committerDobrica Pavlinusic <dpavlin@rot13.org>
Thu, 24 Dec 2015 10:45:57 +0000 (11:45 +0100)
Hub08_LedMatrix/Hub08_LedMatrix.ino

index f23ceaf..d0a48de 100644 (file)
 #include "LEDMatrix.h"
 #include "font.h"
 
-#define WIDTH   64
+#define WIDTH   128 // 2 panels * 64
 #define HEIGHT  16
 
 //     LEDMatrix(a, b, c, d, oe, r1, stb, clk);
 LEDMatrix matrix(4, 5, 6, 7, 9,  11, 10,  13);
 
 // Display Buffer 128 = 64 * 16 / 8
-uint8_t displaybuf[WIDTH * HEIGHT / 8] = {
-    0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-    0x01, 0xFC, 0x00, 0x00, 0x00, 0x00, 0x00, 0x60, 0x01, 0xF8, 0x00, 0x00, 0x00, 0x00, 0x00, 0x60,
-    0x01, 0xF0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x60, 0x00, 0xE0, 0x07, 0x8F, 0xC7, 0xC7, 0xC7, 0xE0,
-    0x00, 0x40, 0x0C, 0xCE, 0x6C, 0x6C, 0x6C, 0xE0, 0x00, 0xE0, 0x0C, 0x0C, 0x6C, 0x6C, 0x6C, 0x60,
-    0x01, 0xF0, 0x07, 0x8C, 0x6F, 0xEF, 0xEC, 0x60, 0x23, 0xF8, 0x00, 0xCC, 0x6C, 0x0C, 0x0C, 0x60,
-    0x33, 0xF8, 0x0C, 0xCE, 0x6C, 0x6C, 0x6C, 0xE0, 0x3B, 0xF8, 0x07, 0x8F, 0xC7, 0xC7, 0xC7, 0xE0,
-    0x3B, 0xF8, 0x00, 0x0C, 0x00, 0x00, 0x00, 0x00, 0x1B, 0xF8, 0x00, 0x0C, 0x00, 0x00, 0x00, 0x00,
-    0x0B, 0xF8, 0x00, 0x0C, 0x00, 0x00, 0x00, 0x00, 0x07, 0xF8, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-};
+uint8_t displaybuf[WIDTH * HEIGHT / 8];
 
 uint8_t displaybuf_w[((WIDTH/8)+1) * HEIGHT];
 
@@ -103,7 +94,7 @@ void matrixPrint(String c) {
   //Serial.println(c.length());
   for (int i=0 ; i<c.length() ; i++) {
       MatrixWriteCharacter(i,3,c[i]);
-//      matrix.scan();
+      matrix.scan();
       //Serial.print(i);
       //Serial.print(" -> ");
       //Serial.println(c[i]);
@@ -135,7 +126,7 @@ void loop()
 
     for (int p=0; p<poruka.length() ; p++) {
          matrix.clear();
-         matrixPrint(poruka.substring(p,p+9));
+         matrixPrint(poruka.substring(p,p+(WIDTH/8)+1));
           for (int o=0; o<8; o++) {
                uint8_t *src  = displaybuf_w;
                uint8_t *dest = displaybuf;
@@ -146,9 +137,10 @@ void loop()
                                *(dest + i) = ( *(src + j) << o ) | (( *(src + j + 1) & ( 0xff << 8 - o ) ) >> 8 - o );
                                i++;
                                j++;
+                               matrix.scan();
                        }
-                       j++;
-                       matrix.scan();
+                       j++; // skip off-screen character used for smooth scroll
+//                     matrix.scan();
                 }
           }
     }