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 Jan 09 13:40:23 2016 +0000
Parent:
1:f60466cbc186
Child:
3:d7990de75130
Commit message:
Updated Icon handling, UDCs and _putc()

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
--- a/PT6964.lib	Sat Nov 21 18:49:19 2015 +0000
+++ b/PT6964.lib	Sat Jan 09 13:40:23 2016 +0000
@@ -1,1 +1,1 @@
-https://developer.mbed.org/users/wim/code/PT6964/#27f32a087e5a
+https://developer.mbed.org/users/wim/code/PT6964/#1adf993a3e34
--- a/main.cpp	Sat Nov 21 18:49:19 2015 +0000
+++ b/main.cpp	Sat Jan 09 13:40:23 2016 +0000
@@ -1,5 +1,6 @@
 /* mbed PT6964 Test program, for PT6964 LED controller
  * Copyright (c) 2015, v01: WH, Initial version
+ *               2016, v03: WH, updated Icon handling, UDCs and _putc()
  *
  * Permission is hereby granted, free of charge, to any person obtaining a copy
  * of this software and associated documentation files (the "Software"), to deal
@@ -25,10 +26,15 @@
 Serial pc(USBTX, USBRX);
 DigitalOut myled(LED1);
 
-#if(1)
-//High level Control PT9664 for DVD538
+// Select one of the testboards for Princeton PT6964 LED controller
+#define PT6964_TEST   0 
+#define DVD538A_TEST  1 
+
+#if (DVD538A_TEST == 1)
+//High level Control PT9664 for DVD538A
 
 PT6964_DVD538A::DisplayData_t all_str  = {0xFF,0x0F, 0xFF,0x0F, 0xFF,0x0F, 0xFF,0x0F, 0xFF,0x0F, 0xFF,0x0F, 0xFF,0x0F};  
+PT6964_DVD538A::DisplayData_t bye_str  = {LO(C7_B),HI(C7_B), LO(C7_Y),HI(C7_Y), LO(C7_E),HI(C7_E), 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00};
 
 // KeyData_t size is 5 bytes  
 PT6964_DVD538A::KeyData_t keydata; 
@@ -36,6 +42,7 @@
 // PT6964 declaration, Default setting 7 Grids @ 10 Segments
 PT6964_DVD538A PT6964_dvd538a(p5,p6,p7, p8);
 
+char cmd;
 int main() {
     
     pc.printf("Hello World\r\n"); //    
@@ -56,22 +63,32 @@
         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); 
-          
+          float delay = 0.2;
+
+          PT6964_dvd538a.cls(); 
+          PT6964_dvd538a.setIcon(PT6964_DVD538A::LD1); wait(delay);
+          PT6964_dvd538a.setIcon(PT6964_DVD538A::LD2); wait(delay);
+          PT6964_dvd538a.setIcon(PT6964_DVD538A::CD);  wait(delay);
+          PT6964_dvd538a.setIcon(PT6964_DVD538A::DVD); wait(delay);
+          PT6964_dvd538a.setIcon(PT6964_DVD538A::PSE); wait(delay);
+          PT6964_dvd538a.setIcon(PT6964_DVD538A::PLY); wait(delay);
+          PT6964_dvd538a.setIcon(PT6964_DVD538A::COL2); wait(delay);
+          PT6964_dvd538a.setIcon(PT6964_DVD538A::MP4); wait(delay);
+          PT6964_dvd538a.setIcon(PT6964_DVD538A::MP3); wait(delay);
+
+          PT6964_dvd538a.clrIcon(PT6964_DVD538A::LD1); wait(delay);
+          PT6964_dvd538a.clrIcon(PT6964_DVD538A::LD2); wait(delay);
+          PT6964_dvd538a.clrIcon(PT6964_DVD538A::CD);  wait(delay);
+          PT6964_dvd538a.clrIcon(PT6964_DVD538A::DVD); wait(delay);
+          PT6964_dvd538a.clrIcon(PT6964_DVD538A::PSE); wait(delay);
+          PT6964_dvd538a.clrIcon(PT6964_DVD538A::PLY); wait(delay);
+          PT6964_dvd538a.clrIcon(PT6964_DVD538A::COL2); wait(delay);
+          PT6964_dvd538a.clrIcon(PT6964_DVD538A::MP4); wait(delay);
+          PT6964_dvd538a.clrIcon(PT6964_DVD538A::MP3); wait(delay);
         }       
 
         if (keydata[0] == 0x02) { //sw2 Stop  
           PT6964_dvd538a.cls(); 
-
         }  
 
         if (keydata[0] == 0x08) { //sw4 Play   
@@ -86,9 +103,29 @@
         }       
 
         if (keydata[0] == 0x10) { //sw3 Open  
-//          PT6964_dvd538a.cls(); 
-          PT6964_dvd538a.clrIcon(PT6964_DVD538A::Grid1_LD1); 
-          PT6964_dvd538a.clrIcon(PT6964_DVD538A::Grid1_MP3);          
+#if(1)
+//test to show all digits (base is 0x10)
+          pc.printf("Show all hex digits\r\n");
+          wait(1);          
+          PT6964_dvd538a.cls(); 
+
+          PT6964_dvd538a.printf("%04x", 0x01AB);
+          cmd = pc.getc(); // wait for key                                     
+          
+          int val = 1; 
+          for (int i=0; i<DVD538A_NR_DIGITS; i++) {
+
+            for (int cnt=0; cnt<0x10; cnt++) {
+              PT6964_dvd538a.locate(0);
+              PT6964_dvd538a.printf("%04x", (val * cnt));
+
+//              wait(0.5);
+              cmd = pc.getc(); // wait for key
+            }  
+            val = val * 0x10;
+          }
+          pc.printf("\r\nShow all hex digits done\r\n");          
+#endif 
         }  
         
       } //if
@@ -97,9 +134,9 @@
       wait(0.3);      
     } //while
 }
-
+#endif
 
-#else
+#if (PT6964_TEST == 1) 
 //Direct control of PT9664 for DVD538
 
 // DisplayData_t size is  8 bytes (4 digits @ 13 segments) OR 10 bytes (5 digits @ 12 segments) OR