This library allows control of the TLC5940 PWM driver IC. It supports both normal operation and controlling multiplexed displays.

Dependencies:   FastPWM

Dependents:   TLC5940LEDtreiber

Revision:
3:e5ed5650eb15
Parent:
0:be9399a34b15
--- a/TLC5940Mux.cpp	Sun May 26 03:08:58 2013 +0000
+++ b/TLC5940Mux.cpp	Sun May 26 05:04:29 2013 +0000
@@ -7,7 +7,7 @@
                        const int rows, void (*SetRows)(int)) : TLC5940(SCLK, MOSI, GSCLK, BLANK, XLAT, DCPRG, VPRG, number),
                                                                rows(rows),
                                                                SetRows(SetRows),
-                                                               index(0)
+                                                               currentIndex(0)
 
 {
     // Create a data buffer to store the current LED states
@@ -40,16 +40,16 @@
 void TLC5940Mux::setNextData()
 {
     // Move into the dataBuffer and return a pointer corresponding to the start of the correct data block
-    setNewGSData(dataBuffer + (index * 16 * number));
+    setNewGSData(dataBuffer + (currentIndex * 16 * number));
     
     // Since the data we sent on the previous reset was just latched in,
     // we must enable the row for the previous index so it is displayed in the right position
     // The ternary is used in case index is zero (we can't have an index of -1)
-    SetRows((index ? (index - 1) : (rows - 1)));
+    SetRows((currentIndex ? (currentIndex - 1) : (rows - 1)));
     
     // Go to next index
-    if (index == (rows - 1))
-        index = 0;
+    if (currentIndex == (rows - 1))
+        currentIndex = 0;
     else
-        index++;
+        currentIndex++;
 }
\ No newline at end of file