add new dot correction method

Fork of TLC5940 by suu pen

Revision:
1:be9daf113060
Parent:
0:ead2ebe1dc77
--- a/TLC5940.cpp	Sun Dec 11 00:24:02 2011 +0000
+++ b/TLC5940.cpp	Thu Jul 26 16:14:47 2012 +0000
@@ -46,9 +46,13 @@
     for (int i = 0; i < (16 * D_cascade); i++) {
         int whoami = _spi.write(Z_dotCorrection);
     }
-
+    
     _xlat = 1;
+    wait_us(5);
     _xlat = 0;
+    wait_us(5);
+    _vprg = 0;
+    wait_us(10);
 }
 
 /******************************************************************************
@@ -82,6 +86,35 @@
     _xlat = 0;
 }
 
+/********************************************************
+dotCorrection
+**********************************************************/
+void TLC5940::dotCorrection(uint8_t *data)
+{
+    _vprg = 1;
+    _spi.format(6,0);
+    _spi.frequency(Z_clockFrequency);
+
+    int8_t x = 0;
+    
+    for(uint8_t C_cascade = 1; C_cascade <= D_cascade; C_cascade++){
+        for(x = 0; x < 16; x++){
+            _spi.write((uint8_t)*(data + (16 * (D_cascade - C_cascade)) + (15 - x)));
+        }
+    }
+    
+    
+    _xlat = 1;
+    wait_us(5);
+    _xlat = 0;
+    wait_us(5);
+    _vprg = 0;
+    wait_us(10);
+    
+    _spi.format(12,0);
+    _spi.frequency(Z_clockFrequency);
+}
+
 /**************************************
 * main
 **************************************/