WncControllerK64F

Dependencies:   WncController

Fork of WncControllerK64F by Fred Kellerman

Revision:
13:ef379cdd57aa
Parent:
0:98d149685c95
Child:
15:68d73d402cb0
--- a/WncControllerK64F.cpp	Thu Sep 15 15:31:29 2016 +0000
+++ b/WncControllerK64F.cpp	Fri Sep 16 14:47:17 2016 +0000
@@ -38,32 +38,35 @@
     m_gpioPinList = *pPins;
 }
 
-bool WncControllerK64F::enterWncTerminalMode(bool echoOn)
+bool WncControllerK64F::enterWncTerminalMode(MODSERIAL * pUart, bool echoOn)
 {
+    if (pUart == NULL)
+        return (false);  // Need a uart!
+        
     string * resp;
     AtCmdErr_e r = sendWncCmd("AT", &resp, 500);
     if (r == WNC_AT_CMD_TIMEOUT)
         return (false);
     
-    m_pDbgUart->puts("\r\nEntering WNC Terminal Mode - press <CTRL>-Q to exit!\r\n");
+    pUart->puts("\r\nEntering WNC Terminal Mode - press <CTRL>-Q to exit!\r\n");
     
     while (1) {
-        if (m_pDbgUart->readable()) {
-            char c = m_pDbgUart->getc();
+        if (pUart->readable()) {
+            char c = pUart->getc();
             if (c == '\x11') {
-                m_pDbgUart->puts("\r\nExiting WNC Terminal Mode!\r\n");
+                pUart->puts("\r\nExiting WNC Terminal Mode!\r\n");
                 // Cleanup in case user doesn't finish command:
                 sendWncCmd("AT", &resp, 300);
                 // Above AT may fail but should get WNC back in sync
                 return (sendWncCmd("AT", &resp, 500) == WNC_AT_CMD_OK);
             }
             if (echoOn == true) {
-                m_pDbgUart->putc(c);
+                pUart->putc(c);
             }
-            m_pWncUart->putc(c);
+            pUart->putc(c);
         }
-        if (m_pWncUart->readable())
-            m_pDbgUart->putc(m_pWncUart->getc());
+        if (pUart->readable())
+            pUart->putc(pUart->getc());
     }
 }