Justin Howard / Mbed 2 deprecated AdaFruit_RGBLCD

Dependencies:   AdaFruit_RGBLCDShield MCP23017 mbed RTclock

Dependents:   SX1276_GPS

Fork of MCP_test by Wim Huiskamp

Revision:
13:9641bc42db92
Parent:
11:96146db429de
Child:
15:d1eaddb363be
--- a/Modules/TimeModule.cpp	Sun Aug 10 16:01:43 2014 +0000
+++ b/Modules/TimeModule.cpp	Mon Aug 11 19:11:43 2014 +0000
@@ -18,10 +18,10 @@
 
 TimeModule::TimeModule
 (
-    Adafruit_RGBLCDShield & in_cLCD,
-    RTclock & in_cRTclock
+    Serial &    in_cDisplay,
+    RTclock &   in_cRTclock
 )
-    : Module(in_cLCD)
+    : Module(in_cDisplay)
     , m_cRTclock(in_cRTclock)
 {
 }
@@ -32,8 +32,7 @@
 
 void TimeModule::change
 (
-    int         in_nIndexX,
-    int         in_nCursorY,
+    size_t      in_nIndex,
     bool        in_bUp
 )
 {
@@ -54,7 +53,7 @@
         eAmPm,
     };    
     
-    switch (in_nIndexX)
+    switch (in_nIndex)
     {
         case eHourTen:      sTM.tm_hour += (in_bUp ? 1 : -1) * 10;  break;
         case eHourSingle:   sTM.tm_hour += (in_bUp ? 1 : -1); break;
@@ -100,23 +99,14 @@
     }
 }
 
-int TimeModule::setCursor
-(
-    int in_nIndex,
-    int in_nCursorX,
-    int in_nCursorY
-)
+int TimeModule::getCursorOffset(size_t & inout_nIndex)
 {
     const int k_aCursor[] = { 0, 1, 3, 4, 6, 7, 10 };
     
-    int nIndex = in_nIndex;
-    if (nIndex < 0) nIndex = 0;
-    if (nIndex >= _countof(k_aCursor)) nIndex = _countof(k_aCursor) - 1;
+    if ((int)inout_nIndex < 0) inout_nIndex = 0;
+    if (inout_nIndex >= _countof(k_aCursor)) inout_nIndex = _countof(k_aCursor) - 1;
        
-    int nCursorX = k_aCursor[nIndex];
-    m_cLCD.setCursor(in_nCursorX + nCursorX,in_nCursorY);
-    
-    return nIndex;
+    return k_aCursor[inout_nIndex];
 }
 
 void TimeModule::show()
@@ -140,5 +130,5 @@
         GetTime(sTM);
     }
 
-    m_cLCD.printf ("%02i:%02i:%02i %s   ", sTM.tm_hour, sTM.tm_min, sTM.tm_sec, pUnits);    
+    m_cDisplay.printf ("%02i:%02i:%02i %s   ", sTM.tm_hour, sTM.tm_min, sTM.tm_sec, pUnits);    
 }