RS232 control for TVOne products

Dependents:   SPK-DVIMXR

Revision:
17:68b9bb89da2b
Parent:
16:ed8d08386034
Child:
18:d765b0d9271c
--- a/spk_tvone_mbed.cpp	Sun Dec 02 01:06:50 2012 +0000
+++ b/spk_tvone_mbed.cpp	Tue Dec 04 19:09:06 2012 +0000
@@ -40,6 +40,7 @@
     minimumCommandPeriod = 30;
     
     timer.start();
+    timerCheckTicker.attach(this, &SPKTVOne::timerCheck, 60);
     
     // Link up debug Serial object
     // Passing in shared object as debugging is shared between all DVI mixer functions
@@ -311,6 +312,16 @@
     *errorDO = 0;
 }
 
+void SPKTVOne::timerCheck() {
+    // timers are based on 32-bit int microsecond counters, so can only time up to a maximum of 2^31-1 microseconds i.e. 30 minutes.
+    // this method is called once a minute, and resets the timer if we've been idle for 25mins.
+    if (timer.read_ms() > 1000*25) 
+    {
+        if (debug) debug->printf("TVOne Timer reset at %ims", timer.read_ms());
+        timer.reset();
+    }
+}
+
 bool SPKTVOne::uploadEDID(FILE *file, int edidSlotIndex)
 {
     bool success;