Csr location class shows location and satellite information, which supports H13467 + ST F103RB/NXP LCP1549 boards now.

Dependents:   CsrLocationDemo CsrLocationDemo

Fork of CsrLocation by jie zhao

Revision:
8:fa29f8455134
Parent:
7:1fde78f27d5b
Child:
12:5fb829ce6b82
--- a/CsrLocation.cpp	Tue Aug 05 06:22:16 2014 +0000
+++ b/CsrLocation.cpp	Mon Aug 11 03:23:23 2014 +0000
@@ -27,6 +27,7 @@
     csrLocInst.pSerialLoc   = pLocConfig->pSerialLoc;
     csrLocInst.pPinOnoff    = pLocConfig->pPinOnoff;
     csrLocInst.pPinReset    = pLocConfig->pPinReset;
+    csrLocInst.pWakeup      = pLocConfig->pWakeup;
     csrLocInst.pTimeoutChk  = new Timeout();
 
     csrLocInst.pPinReset->write(1);
@@ -126,8 +127,17 @@
     {
         _CsrLocSendData(SEND_DATA_TYPE_OSP_STOP_REQ);
     }
-    wait_ms(10);
-    _CsrLocHwReset();
+    wait_ms(200);
+    if(_CsrLocIsWakeup())
+    {
+        _CsrLocHwOnoff();
+	    wait_ms(300);
+        if(_CsrLocIsWakeup())
+        {
+            _CsrLocHwReset();
+        }
+    }
+    
     csrLocInst.locState = CSR_LOC_STATE_IDLE;
     csrLocInst.appEventCb(CSR_LOC_EVENT_STOP_RESULT, 0);
 
@@ -292,7 +302,7 @@
         {
             pLocInst->protoState = PROTO_STATE_DET_INVALID;
             CSR_LOG_INFO("Checking switched NMEA protocol failed.\r\n");
-            pLocInst->appEventCb(CSR_LOC_EVENT_START_RESULT, 1);
+//            pLocInst->appEventCb(CSR_LOC_EVENT_START_RESULT, 1);
         }
     }
     else
@@ -1028,3 +1038,9 @@
 	csrLocInst.pPinReset->write(1);
 	CSR_LOG_INFO("Reset pulse given.\r\n");
 }
+
+bool CsrLocation::_CsrLocIsWakeup(void)
+{
+    CSR_LOG_INFO("Is wakeup %d.\r\n", csrLocInst.pWakeup->read());
+	return csrLocInst.pWakeup->read() != 0 ? true : false;
+}