Test program for Princeton PT6964 LED controller library.

Dependencies:   PT6964 mbed

See here for more information.

Files at this revision

API Documentation at this revision

Comitter:
wim
Date:
Sat Nov 21 16:43:26 2015 +0000
Child:
1:f60466cbc186
Commit message:
First version

Changed in this revision

PT6964.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
mbed.bld Show annotated file Show diff for this revision Revisions of this file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/PT6964.lib	Sat Nov 21 16:43:26 2015 +0000
@@ -0,0 +1,1 @@
+PT6964#27f32a087e5a
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp	Sat Nov 21 16:43:26 2015 +0000
@@ -0,0 +1,225 @@
+/* mbed PT6964 Test program, for PT6964 LED controller
+ * Copyright (c) 2015, v01: WH, Initial version
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+#include "mbed.h"
+#include "PT6964.h"
+
+Serial pc(USBTX, USBRX);
+DigitalOut myled(LED1);
+
+#if(1)
+//High level Control PT9664 for DVD538
+
+PT6964_DVD538A::DisplayData_t all_str  = {0xFF,0x0F, 0xFF,0x0F, 0xFF,0x0F, 0xFF,0x0F, 0xFF,0x0F, 0xFF,0x0F, 0xFF,0x0F};  
+
+// KeyData_t size is 5 bytes  
+PT6964_DVD538A::KeyData_t keydata; 
+
+// PT6964 declaration, Default setting 7 Grids @ 10 Segments
+PT6964_DVD538A PT6964_dvd538a(p5,p6,p7, p8);
+
+int main() {
+    
+    pc.printf("Hello World\r\n"); //    
+    
+    PT6964_dvd538a.cls(); 
+    PT6964_dvd538a.writeData(all_str);
+    wait(4);
+    PT6964_dvd538a.setBrightness(PT6964_BRT3);    
+    wait(1);
+    PT6964_dvd538a.setBrightness(PT6964_BRT0);        
+    wait(1);
+    PT6964_dvd538a.setBrightness(PT6964_BRT3);            
+    
+    while (1) {
+     
+      // Check and read keydata
+      if (PT6964_dvd538a.getKeys(&keydata)) {
+        pc.printf("Keydata 0..4 = 0x%02x 0x%02x 0x%02x 0x%02x 0x%02x\r\n", keydata[0], keydata[1], keydata[2], keydata[3], keydata[4]);
+
+        if (keydata[0] == 0x01) { //sw1 L/R  
+//          PT6964_dvd538a.cls(); 
+          PT6964_dvd538a.setIcon(PT6964_DVD538A::Grid1_LD1);
+          PT6964_dvd538a.setIcon(PT6964_DVD538A::Grid1_LD2);
+          PT6964_dvd538a.setIcon(PT6964_DVD538A::Grid1_CD);
+          PT6964_dvd538a.setIcon(PT6964_DVD538A::Grid1_DVD);
+          PT6964_dvd538a.setIcon(PT6964_DVD538A::Grid1_PSE);
+          PT6964_dvd538a.setIcon(PT6964_DVD538A::Grid1_PLY);
+          PT6964_dvd538a.setIcon(PT6964_DVD538A::Grid1_COL);
+          PT6964_dvd538a.setIcon(PT6964_DVD538A::Grid1_MP4);         
+          PT6964_dvd538a.setIcon(PT6964_DVD538A::Grid1_MP3); 
+          
+        }       
+
+        if (keydata[0] == 0x02) { //sw2 Stop  
+          PT6964_dvd538a.cls(); 
+
+        }  
+
+        if (keydata[0] == 0x08) { //sw4 Play   
+          PT6964_dvd538a.cls(); 
+//          for (int i=0; i<16; i++) {
+          for (int i=0x00; i<=0xFF; i++) {            
+            PT6964_dvd538a.locate(0);            
+            PT6964_dvd538a.printf("%04x", i);
+//            PT6964_dvd538a.printf("%04X", i);            
+            wait(0.2);
+          }  
+        }       
+
+        if (keydata[0] == 0x10) { //sw3 Open  
+//          PT6964_dvd538a.cls(); 
+          PT6964_dvd538a.clrIcon(PT6964_DVD538A::Grid1_LD1); 
+          PT6964_dvd538a.clrIcon(PT6964_DVD538A::Grid1_MP3);          
+        }  
+        
+      } //if
+
+      myled = !myled;
+      wait(0.3);      
+    } //while
+}
+
+
+#else
+//Direct control of PT9664 for DVD538
+
+// DisplayData_t size is  8 bytes (4 digits @ 13 segments) OR 10 bytes (5 digits @ 12 segments) OR
+//                       12 bytes (6 digits @ 11 segments) OR 14 bytes (7 digits @ 10 segments) 
+PT6964::DisplayData_t mbed_str = {0xDA,0x00, 0x7C,0x00, 0x3C,0x01, 0xF6,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00};  
+PT6964::DisplayData_t all_str  = {0xFF,0x0F, 0xFF,0x0F, 0xFF,0x0F, 0xFF,0x0F, 0xFF,0x0F, 0xFF,0x0F, 0xFF,0x0F};  
+PT6964::DisplayData_t bye_str = {0x7C,0x00, 0xEC,0x00, 0x3C,0x01, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00};  
+PT6964::DisplayData_t hello_str = {0xDC,0x00, 0x3C,0x01, 0x38,0x00, 0x38,0x00, 0xF8,0x01, 0x00,0x00, 0x00,0x00};  
+PT6964::DisplayData_t tst_str;  
+#if(0)
+PT6964::DisplayData_t hello1_str = {0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0xF8,0x03, 0x00,0x00, 0x00,0x00};  
+PT6964::DisplayData_t hello2_str = {0x00,0x00, 0x00,0x00, 0x00,0x00, 0xF8,0x03, 0x00,0x00, 0x00,0x00, 0x00,0x00};  
+PT6964::DisplayData_t hello3_str = {0x00,0x00, 0x00,0x00, 0xF8,0x03, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00};  
+PT6964::DisplayData_t hello4_str = {0x00,0x00, 0xF8,0x03, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00};  
+#endif
+PT6964::DisplayData_t hello1_str = {0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x30,0x00, 0x00,0x00, 0x00,0x00};  
+PT6964::DisplayData_t hello2_str = {0x00,0x00, 0x00,0x00, 0x00,0x00, 0xE8,0x02, 0x00,0x00, 0x00,0x00, 0x00,0x00};  
+PT6964::DisplayData_t hello3_str = {0x00,0x00, 0x00,0x00, 0x78,0x02, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00};  
+PT6964::DisplayData_t hello4_str = {0x00,0x00, 0x30,0x03, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00};  
+
+
+// KeyData_t size is 5 bytes  
+PT6964::KeyData_t keydata; 
+
+// PT6964 declaration, Default setting 7 Grids @ 10 Segments
+PT6964 PT6964(p5,p6,p7, p8);
+
+int main() {
+    
+    pc.printf("Hello World\r\n"); //    
+    
+    PT6964.cls(); 
+    PT6964.writeData(all_str);
+    wait(4);
+    PT6964.setBrightness(PT6964_BRT3);    
+    PT6964.writeData(mbed_str);    
+    wait(1);
+    PT6964.setBrightness(PT6964_BRT0);        
+    wait(1);
+    PT6964.setBrightness(PT6964_BRT3);            
+    
+    while (1) {
+     
+      // Check and read keydata
+      if (PT6964.getKeys(&keydata)) {
+        pc.printf("Keydata 0..4 = 0x%02x 0x%02x 0x%02x 0x%02x 0x%02x\r\n", keydata[0], keydata[1], keydata[2], keydata[3], keydata[4]);
+
+        if (keydata[0] == 0x01) { //sw1 L/R  
+          PT6964.cls(); 
+          PT6964.writeData(hello1_str);
+                    
+#if(0)
+          for (int idx=0; idx < PT6964_DISPLAY_MEM;idx++){
+            tst_str[idx]=0x00;
+          }
+//          tst_str[0]=0x01; //LD2
+//          tst_str[0]=0x10; //DVD
+//          tst_str[1]=0x01; // MP4       
+//          tst_str[2]=0x08; // D4
+          tst_str[2]=0x80; // E4        
+          PT6964.writeData(tst_str);
+#endif
+        }       
+
+        if (keydata[0] == 0x02) { //sw2 Stop  
+          PT6964.cls(); 
+          PT6964.writeData(hello2_str);          
+
+#if(0)
+          for (int idx=0; idx < PT6964_DISPLAY_MEM;idx++){
+            tst_str[idx]=0x00;
+          }
+//          tst_str[0]=0x02; //LD1
+//          tst_str[0]=0x20; // pause
+//          tst_str[1]=0x02; // MP3
+//          tst_str[2]=0x10; // C4
+          tst_str[3]=0x01; // F4
+          PT6964.writeData(tst_str);
+#endif
+        }  
+
+        if (keydata[0] == 0x08) { //sw4 Play   
+          PT6964.cls(); 
+          PT6964.writeData(hello3_str);          
+
+#if(0)                    
+          for (int idx=0; idx < PT6964_DISPLAY_MEM;idx++){
+            tst_str[idx]=0x00;
+          }
+//          tst_str[0]=0x04; // nc
+//          tst_str[0]=0x40; // Play arrow
+//          tst_str[2]=0x01; // nc
+//          tst_str[2]=0x20; // B4
+          tst_str[3]=0x02; // G4
+          PT6964.writeData(tst_str);
+#endif
+          
+        }       
+
+        if (keydata[0] == 0x10) { //sw3 Open  
+          PT6964.cls(); 
+          PT6964.writeData(hello4_str);          
+
+#if(0)                    
+          for (int idx=0; idx < PT6964_DISPLAY_MEM;idx++){
+            tst_str[idx]=0x00;
+          }
+//          tst_str[0]=0x08; //CD
+//          tst_str[0]=0x80; // colon          
+//          tst_str[2]=0x02; // nc
+//          tst_str[2]=0x40; // A4        
+          tst_str[3]=0x04; // nc
+          PT6964.writeData(tst_str);
+#endif          
+        }       
+        
+      } //if
+
+      myled = !myled;
+      wait(0.3);      
+    } //while
+}
+#endif
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mbed.bld	Sat Nov 21 16:43:26 2015 +0000
@@ -0,0 +1,1 @@
+http://mbed.org/users/mbed_official/code/mbed/builds/9296ab0bfc11
\ No newline at end of file