Forked LEDMatrix and added horizontal scrolling

Fork of LEDMatrix by Yihui Xiong

Files at this revision

API Documentation at this revision

Comitter:
Bobty
Date:
Fri Jan 15 12:18:34 2016 +0000
Parent:
4:40d4afefcd74
Commit message:
Cleared inversion on clear(); Changed setAlert to setHighlight

Changed in this revision

LEDMatrix.cpp Show annotated file Show diff for this revision Revisions of this file
LEDMatrix.h Show annotated file Show diff for this revision Revisions of this file
diff -r 40d4afefcd74 -r 334fc002e200 LEDMatrix.cpp
--- a/LEDMatrix.cpp	Fri Jan 15 09:50:10 2016 +0000
+++ b/LEDMatrix.cpp	Fri Jan 15 12:18:34 2016 +0000
@@ -53,7 +53,7 @@
     for (int i = 0; i < LED_MATRIX_MAX_LINES; i++)
     {
         _lineScrollInc[i] = 0;
-        _lineAlert[i] = false;
+        _lineHighlight[i] = false;
         _lineInvert[i] = false;
     }
     _isBusy = false;
@@ -181,7 +181,6 @@
 
         // Work out which display line we're in
         uint8_t dispMask = mask;
-        bool invertRow = false;
         int rowsInLine = (height/numLines);
         int dispLine = scanRowIdx / rowsInLine;
         if (dispLine < numLines)
@@ -326,6 +325,9 @@
     int bytesToZero = numRows * (dispBufWidth / 8);
     for (int i = 0; i < bytesToZero; i++) 
         *ptr++ = 0x00;
+    // Stop invert
+    for (int i = 0; i < LED_MATRIX_MAX_LINES; i++)
+        _lineInvert[i] = false;
 }
 
 void LEDMatrix::setScrollRate(int rate)
@@ -367,9 +369,9 @@
         _lineScrollInc[i+startLine] = scrollInc;
 }
 
-void LEDMatrix::setAlert(int lineIdx, bool alertOn)
+void LEDMatrix::setHighlight(int lineIdx, bool highlightOn)
 {
-    // Store the alert status
+    // Store the highlight status
     int startLine = 0;
     int linesToProcess = numLines;
     if (lineIdx != -1)
@@ -380,7 +382,7 @@
         linesToProcess = 1;
     }
     for (int i = 0; i < linesToProcess; i++)
-        _lineAlert[i+startLine] = alertOn;
+        _lineHighlight[i+startLine] = highlightOn;
 }
     
 void LEDMatrix::serviceEffects()
@@ -405,9 +407,7 @@
         _flashCounter = 0;
         _flashState = !_flashState;
         for (int i = 0; i < numLines; i++)
-        {
-            _lineInvert[i] = _lineAlert[i] ? _flashState : false;
-        }
+            _lineInvert[i] = _lineHighlight[i] ? _flashState : false;
     }
 }
     
diff -r 40d4afefcd74 -r 334fc002e200 LEDMatrix.h
--- a/LEDMatrix.h	Fri Jan 15 09:50:10 2016 +0000
+++ b/LEDMatrix.h	Fri Jan 15 12:18:34 2016 +0000
@@ -94,7 +94,7 @@
     
     void setScrollRate(int rate);
     void setFlashRate(int rate);
-    void setAlert(int lineIdx, bool alertOn);
+    void setHighlight(int lineIdx, bool highlightOn);
 
     // Called frequently and regularly to handle effects like scrolling
     void serviceEffects();
@@ -114,7 +114,7 @@
     bool _isBusy;
     int _charSeparation;
     int _lineScrollInc[LED_MATRIX_MAX_LINES];
-    bool _lineAlert[LED_MATRIX_MAX_LINES];
+    bool _lineHighlight[LED_MATRIX_MAX_LINES];
     bool _lineInvert[LED_MATRIX_MAX_LINES];
     int _flashCounter;
     int _flashRate;