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

Files at this revision

API Documentation at this revision

Comitter:
zhjcpi
Date:
Mon Aug 11 03:23:23 2014 +0000
Parent:
7:1fde78f27d5b
Child:
9:e6f22b1a7797
Commit message:
Add wakeup pin input process.

Changed in this revision

CsrLocation.cpp Show annotated file Show diff for this revision Revisions of this file
CsrLocation.h Show annotated file Show diff for this revision Revisions of this file
--- 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;
+}
--- a/CsrLocation.h	Tue Aug 05 06:22:16 2014 +0000
+++ b/CsrLocation.h	Mon Aug 11 03:23:23 2014 +0000
@@ -318,6 +318,8 @@
     DigitalOut      *pPinOnoff;
     /** GPIO pin to control location chip reset, low level will keep location chip in hibernation state and high level will permit location chip to be activated */
     DigitalOut      *pPinReset;
+    /** GPIO pin to detect if the chip is still wakeup */
+    DigitalIn       *pWakeup;
 }tCsrLocConfig;
 
 /* General OSP mesasge format */
@@ -355,6 +357,7 @@
     LOC_SERIAL_TYPE *pSerialLoc;
     DigitalOut      *pPinOnoff;
     DigitalOut      *pPinReset;
+    DigitalIn       *pWakeup;
 
     uint8_t         serialBuf[MAX_SERIAL_BUF_LEN]; /* buffer the serial data from uart callback function */
     uint8_t         serialPkt[MAX_SERIAL_PKT_LEN]; /* decoded osp data */
@@ -461,6 +464,10 @@
 
     /* Trigger a reset on the reset pin */
     void _CsrLocHwReset(void);
+
+    /* Detect wakeup status on the wakeup pin */
+    bool _CsrLocIsWakeup(void);
+
 };