RS232 control for TVOne products

Dependents:   SPK-DVIMXR

Files at this revision

API Documentation at this revision

Comitter:
tobyspark
Date:
Thu Oct 17 15:49:16 2013 +0000
Parent:
23:46f42462a183
Commit message:
Resolution Timings - bug fixes; Matrox - support for digital and analogue edition timings of 2048x768

Changed in this revision

spk_tvone.h Show annotated file Show diff for this revision Revisions of this file
spk_tvone_mbed.cpp Show annotated file Show diff for this revision Revisions of this file
spk_tvone_mbed.h Show annotated file Show diff for this revision Revisions of this file
diff -r 46f42462a183 -r 4eec37b8387e spk_tvone.h
--- a/spk_tvone.h	Tue Jun 25 02:06:35 2013 +0000
+++ b/spk_tvone.h	Thu Oct 17 15:49:16 2013 +0000
@@ -257,8 +257,8 @@
 #define kTV1FunctionAdjustResolutionActiveV            0x97    // Values: 64 - 2047
 #define kTV1FunctionAdjustResolutionStartH            0x8B    // Values: 0 - 1023
 #define kTV1FunctionAdjustResolutionStartV            0x8C    // Values: 0 - 1023
-#define kTV1FunctionAdjustResolutionCLKS            0x8E    // Values: 64 - 4095
-#define kTV1FunctionAdjustResolutionLines            0xBE    // Values: 64 - 2047
+#define kTV1FunctionAdjustResolutionCLKS            0x8D    // Values: 64 - 4095
+#define kTV1FunctionAdjustResolutionLines            0x8E    // Values: 64 - 2047
 #define kTV1FunctionAdjustResolutionSyncH            0x8F    // Values: 8 - 1023
 #define kTV1FunctionAdjustResolutionSyncV            0x90    // Values: 1 - 1023
 #define kTV1FunctionAdjustResolutionSyncPolarity    0x94    // Values: 0 - 3 (++, +-. -+. --)
diff -r 46f42462a183 -r 4eec37b8387e spk_tvone_mbed.cpp
--- a/spk_tvone_mbed.cpp	Tue Jun 25 02:06:35 2013 +0000
+++ b/spk_tvone_mbed.cpp	Thu Oct 17 15:49:16 2013 +0000
@@ -238,19 +238,21 @@
     return timer.read_ms();
 }
 
-bool SPKTVOne::uploadCustomResolutions() 
+bool SPKTVOne::setMatroxResolutions(bool digitalEdition) 
 {
-  bool ok = true;;
+  bool lock = true;
+  bool ok = true;
   int unlocked = 0;
   int locked = 1;
   
-  ok = ok && command(0, 0, kTV1FunctionAdjustFrontPanelLock, locked);
+  lock = lock && command(0, kTV1WindowIDA, kTV1FunctionAdjustFrontPanelLock, locked);
   
-  ok = ok && set1920x480(kTV1ResolutionTripleHeadVGAp60);
-  ok = ok && set1600x600(kTV1ResolutionDualHeadSVGAp60);
-  ok = ok && set2048x768(kTV1ResolutionDualHeadXGAp60);
+  // TODO: Any other resolutions that have different timings between analogue and digital editions of the matrox boxes.
+  // ok = ok && set1920x480(kTV1ResolutionTripleHeadVGAp60);
+  // ok = ok && set1600x600(kTV1ResolutionDualHeadSVGAp60);
+  ok = ok && set2048x768(kTV1ResolutionDualHeadXGAp60, digitalEdition);
   
-  ok = ok && command(0, 0, kTV1FunctionAdjustFrontPanelLock, unlocked);
+  lock = lock && command(0, kTV1WindowIDA, kTV1FunctionAdjustFrontPanelLock, unlocked);
   
   return ok;
 }
@@ -483,20 +485,20 @@
 {
   bool ok;
 
-  ok = command(0, 0, kTV1FunctionAdjustResolutionImageToAdjust, resStoreNumber);
+  ok = command(0, kTV1WindowIDA, kTV1FunctionAdjustResolutionImageToAdjust, resStoreNumber);
 
-  ok = ok && command(0, 0, kTV1FunctionAdjustResolutionInterlaced, 0);
-  ok = ok && command(0, 0, kTV1FunctionAdjustResolutionFreqCoarseH, 31475);
-  ok = ok && command(0, 0, kTV1FunctionAdjustResolutionFreqFineH, 31475);
-  ok = ok && command(0, 0, kTV1FunctionAdjustResolutionActiveH, 1920);
-  ok = ok && command(0, 0, kTV1FunctionAdjustResolutionActiveV, 480);
-  ok = ok && command(0, 0, kTV1FunctionAdjustResolutionStartH, 240); 
-  ok = ok && command(0, 0, kTV1FunctionAdjustResolutionStartV, 5); 
-  ok = ok && command(0, 0, kTV1FunctionAdjustResolutionCLKS, 2400); 
-  ok = ok && command(0, 0, kTV1FunctionAdjustResolutionLines, 525);
-  ok = ok && command(0, 0, kTV1FunctionAdjustResolutionSyncH, 192);
-  ok = ok && command(0, 0, kTV1FunctionAdjustResolutionSyncV, 30); 
-  ok = ok && command(0, 0, kTV1FunctionAdjustResolutionSyncPolarity, 0);
+  ok = ok && command(0, kTV1WindowIDA, kTV1FunctionAdjustResolutionInterlaced, 0);
+  ok = ok && command(0, kTV1WindowIDA, kTV1FunctionAdjustResolutionFreqCoarseH, 31475);
+  ok = ok && command(0, kTV1WindowIDA, kTV1FunctionAdjustResolutionFreqFineH, 31475);
+  ok = ok && command(0, kTV1WindowIDA, kTV1FunctionAdjustResolutionActiveH, 1920);
+  ok = ok && command(0, kTV1WindowIDA, kTV1FunctionAdjustResolutionActiveV, 480);
+  ok = ok && command(0, kTV1WindowIDA, kTV1FunctionAdjustResolutionStartH, 240); 
+  ok = ok && command(0, kTV1WindowIDA, kTV1FunctionAdjustResolutionStartV, 5); 
+  ok = ok && command(0, kTV1WindowIDA, kTV1FunctionAdjustResolutionCLKS, 2400); 
+  ok = ok && command(0, kTV1WindowIDA, kTV1FunctionAdjustResolutionLines, 525);
+  ok = ok && command(0, kTV1WindowIDA, kTV1FunctionAdjustResolutionSyncH, 192);
+  ok = ok && command(0, kTV1WindowIDA, kTV1FunctionAdjustResolutionSyncV, 30); 
+  ok = ok && command(0, kTV1WindowIDA, kTV1FunctionAdjustResolutionSyncPolarity, 0);
   
   return ok;
 }
@@ -505,42 +507,42 @@
 {
   bool ok;
 
-  ok = command(0, 0, kTV1FunctionAdjustResolutionImageToAdjust, resStoreNumber);
+  ok = command(0, kTV1WindowIDA, kTV1FunctionAdjustResolutionImageToAdjust, resStoreNumber);
 
-  ok = ok && command(0, 0, kTV1FunctionAdjustResolutionInterlaced, 0);
-  ok = ok && command(0, 0, kTV1FunctionAdjustResolutionFreqCoarseH, 37879);
-  ok = ok && command(0, 0, kTV1FunctionAdjustResolutionFreqFineH, 37879);
-  ok = ok && command(0, 0, kTV1FunctionAdjustResolutionActiveH, 1600);
-  ok = ok && command(0, 0, kTV1FunctionAdjustResolutionActiveV, 600);
-  ok = ok && command(0, 0, kTV1FunctionAdjustResolutionStartH, 192); 
-  ok = ok && command(0, 0, kTV1FunctionAdjustResolutionStartV, 14); 
-  ok = ok && command(0, 0, kTV1FunctionAdjustResolutionCLKS, 2112); 
-  ok = ok && command(0, 0, kTV1FunctionAdjustResolutionLines, 628);
-  ok = ok && command(0, 0, kTV1FunctionAdjustResolutionSyncH, 160);
-  ok = ok && command(0, 0, kTV1FunctionAdjustResolutionSyncV, 13); 
-  ok = ok && command(0, 0, kTV1FunctionAdjustResolutionSyncPolarity, 0);
+  ok = ok && command(0, kTV1WindowIDA, kTV1FunctionAdjustResolutionInterlaced, 0);
+  ok = ok && command(0, kTV1WindowIDA, kTV1FunctionAdjustResolutionFreqCoarseH, 37879);
+  ok = ok && command(0, kTV1WindowIDA, kTV1FunctionAdjustResolutionFreqFineH, 37879);
+  ok = ok && command(0, kTV1WindowIDA, kTV1FunctionAdjustResolutionActiveH, 1600);
+  ok = ok && command(0, kTV1WindowIDA, kTV1FunctionAdjustResolutionActiveV, 600);
+  ok = ok && command(0, kTV1WindowIDA, kTV1FunctionAdjustResolutionStartH, 192); 
+  ok = ok && command(0, kTV1WindowIDA, kTV1FunctionAdjustResolutionStartV, 14); 
+  ok = ok && command(0, kTV1WindowIDA, kTV1FunctionAdjustResolutionCLKS, 2112); 
+  ok = ok && command(0, kTV1WindowIDA, kTV1FunctionAdjustResolutionLines, 628);
+  ok = ok && command(0, kTV1WindowIDA, kTV1FunctionAdjustResolutionSyncH, 160);
+  ok = ok && command(0, kTV1WindowIDA, kTV1FunctionAdjustResolutionSyncV, 13); 
+  ok = ok && command(0, kTV1WindowIDA, kTV1FunctionAdjustResolutionSyncPolarity, 0);
     
   return ok;
 }
 
-bool SPKTVOne::set2048x768(int resStoreNumber) 
+bool SPKTVOne::set2048x768(int resStoreNumber, bool de)
 {
   bool ok;
   
-  ok = command(0, 0, kTV1FunctionAdjustResolutionImageToAdjust, resStoreNumber);
+  ok = command(0, kTV1WindowIDA, kTV1FunctionAdjustResolutionImageToAdjust, resStoreNumber);
 
-  ok = ok && command(0, 0, kTV1FunctionAdjustResolutionInterlaced, 0);
-  ok = ok && command(0, 0, kTV1FunctionAdjustResolutionFreqCoarseH, 48363);
-  ok = ok && command(0, 0, kTV1FunctionAdjustResolutionFreqFineH, 48363);
-  ok = ok && command(0, 0, kTV1FunctionAdjustResolutionActiveH, 2048);
-  ok = ok && command(0, 0, kTV1FunctionAdjustResolutionActiveV, 768);
-  ok = ok && command(0, 0, kTV1FunctionAdjustResolutionStartH, 224); 
-  ok = ok && command(0, 0, kTV1FunctionAdjustResolutionStartV, 11); 
-  ok = ok && command(0, 0, kTV1FunctionAdjustResolutionCLKS, 2688); 
-  ok = ok && command(0, 0, kTV1FunctionAdjustResolutionLines, 806);
-  ok = ok && command(0, 0, kTV1FunctionAdjustResolutionSyncH, 368);
-  ok = ok && command(0, 0, kTV1FunctionAdjustResolutionSyncV, 24); 
-  ok = ok && command(0, 0, kTV1FunctionAdjustResolutionSyncPolarity, 0);
+  ok = ok && command(0, kTV1WindowIDA, kTV1FunctionAdjustResolutionInterlaced, 0);
+  ok = ok && command(0, kTV1WindowIDA, kTV1FunctionAdjustResolutionFreqCoarseH, 48363);
+  ok = ok && command(0, kTV1WindowIDA, kTV1FunctionAdjustResolutionFreqFineH, 48363);
+  ok = ok && command(0, kTV1WindowIDA, kTV1FunctionAdjustResolutionActiveH, 2048);
+  ok = ok && command(0, kTV1WindowIDA, kTV1FunctionAdjustResolutionActiveV, 768);
+  ok = ok && command(0, kTV1WindowIDA, kTV1FunctionAdjustResolutionStartH, de ? 224 : 152); 
+  ok = ok && command(0, kTV1WindowIDA, kTV1FunctionAdjustResolutionStartV, de ? 11 : 20); 
+  ok = ok && command(0, kTV1WindowIDA, kTV1FunctionAdjustResolutionCLKS, de ? 2688 : 2352); 
+  ok = ok && command(0, kTV1WindowIDA, kTV1FunctionAdjustResolutionLines, de ? 806 : 806);
+  ok = ok && command(0, kTV1WindowIDA, kTV1FunctionAdjustResolutionSyncH, de ? 368 : 64);
+  ok = ok && command(0, kTV1WindowIDA, kTV1FunctionAdjustResolutionSyncV, de ? 24 : 15); 
+  ok = ok && command(0, kTV1WindowIDA, kTV1FunctionAdjustResolutionSyncPolarity, 3);
     
   return ok;
 }
diff -r 46f42462a183 -r 4eec37b8387e spk_tvone_mbed.h
--- a/spk_tvone_mbed.h	Tue Jun 25 02:06:35 2013 +0000
+++ b/spk_tvone_mbed.h	Thu Oct 17 15:49:16 2013 +0000
@@ -51,7 +51,7 @@
 
     bool uploadEDID(FILE* file, int edidSlotIndex);
     bool uploadImage(FILE* file, int sisIndex);
-    bool uploadCustomResolutions();
+    bool setMatroxResolutions(bool digitalEdition = true);
     
     void setCommandTimeoutPeriod(int millis);
     int  getCommandTimeoutPeriod();
@@ -71,7 +71,7 @@
     
     bool set1920x480(int resStoreNumber);
     bool set1600x600(int resStoreNumber);
-    bool set2048x768(int resStoreNumber);
+    bool set2048x768(int resStoreNumber, bool digitalEdition);
     
     Serial *serial;
     Serial *debug;