12-Channel LED Driver With Gray scale Adaptive Pulse Density Modulation Control IC maker MY-Semi

Dependencies:   MY9221 mbed

Files at this revision

API Documentation at this revision

Comitter:
suupen
Date:
Sun Oct 22 23:18:19 2017 +0000
Parent:
1:caa6335a5b06
Child:
3:7df2f4cd2f04
Commit message:
library sample program complete

Changed in this revision

MY9221.lib Show annotated file Show diff for this revision Revisions of this file
main.cpp Show annotated file Show diff for this revision Revisions of this file
--- a/MY9221.lib	Sun Oct 22 12:08:38 2017 +0000
+++ b/MY9221.lib	Sun Oct 22 23:18:19 2017 +0000
@@ -1,1 +1,1 @@
-MY9221#4d9aee0bd724
+MY9221#2131a24e5489
--- a/main.cpp	Sun Oct 22 12:08:38 2017 +0000
+++ b/main.cpp	Sun Oct 22 23:18:19 2017 +0000
@@ -2,21 +2,35 @@
  * @section DESCRIPTION
  * maker http://www.my-semi.com/content/products/product_mean.aspx?id=9
  * shop  http://akizukidenshi.com/catalog/g/gI-09678/
+ *
+ * sample program schematic
+ *
+ *                VOUT(3.3V)           VOUT                     VOUT  
+ *                 |                   |VDD                      |VDD     
+ *          --------------            -------------            --------------- 
+ *          mbed(LPC1768)|            |MY9221(2)  |            |MY9221(1)    |
+ *                    p5 |------------|DI     DO  | ---------- |DI           |
+ *                    p10|------------|DCKI   DCKO| ---------- |DCKI         | 
+ *                       |            |           |            |             |  
+ *                       |  22kOhme --|REXT-C     |  22kOhme --|REXT-C       |  
+ *                       |  22kOhme --|REXT-B     |  22kOhme --|REXT-B       |  
+ *                       |  22kOhme --|REXT-A     |  22kOhme --|REXT-A       |  
+ *          -------------             -------------            --------------  
+ *                                     |.........|              |...........|
+ *                                     LED1   LED12             LED1    LED12                            
  */
 
 /*
 MY9366
 http://www.my-semi.com/content/products/product_mean.aspx?id=28
 */
-#define LIBMY9221
 
 #include "mbed.h"
-
 #include "MY9221.h"
 MY9221 MY9221(p5, p10, 2);  // di, clk, number
 
 uint16_t D_gray[12] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
-float D_gray2[12] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
+float D_gray2[12] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
 
 int main()
 {
@@ -27,13 +41,13 @@
     while(1) {
 
         for(int i=0; i < 12; i++) {
-            D_gray[i] += 0x1;
-            D_gray2[i] += 0.001;
+            D_gray[i] += 0x100;
+            D_gray2[i] += 0.01;
             if(D_gray2[i] > 1)D_gray2[i] = 0;
         }
         MY9221.dataRawSet(D_gray, 1);
         MY9221.dataSet(D_gray2, 2);
-        wait_ms(20);
+        wait_ms(20);                            // Image refresh Rate [s] < led gray data update cycle [s]
         MY9221.refresh();
 
     }