add new dot correction method

Fork of TLC5940 by suu pen

Files at this revision

API Documentation at this revision

Comitter:
motoi1484
Date:
Thu Jul 26 16:14:47 2012 +0000
Parent:
0:ead2ebe1dc77
Commit message:
add new dot correction method

Changed in this revision

TLC5940.cpp Show annotated file Show diff for this revision Revisions of this file
TLC5940.h Show annotated file Show diff for this revision Revisions of this file
--- 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
 **************************************/
--- a/TLC5940.h	Sun Dec 11 00:24:02 2011 +0000
+++ b/TLC5940.h	Thu Jul 26 16:14:47 2012 +0000
@@ -59,7 +59,8 @@
     * @param uint16_t* data : grayData table  &data[cascade number][16]  data[][] = 11 - 0bit
     */
     void grayDataSetAndDisplay(uint16_t *data);
-
+    void dotCorrection(uint8_t *data);
+    
 private:
 
     SPI _spi;