Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Fork of HL_GPS_Example by
Revision 22:9551b2ce17c9, committed 2017-03-17
- Comitter:
- HackerLabATTKit01
- Date:
- Fri Mar 17 00:11:56 2017 +0000
- Parent:
- 21:dfa20810d1d0
- Commit message:
- Modified to not tie up the serial lines with interrupt disables.
Changed in this revision
--- a/GwoopsGPS.cpp	Thu Mar 16 23:10:57 2017 +0000
+++ b/GwoopsGPS.cpp	Fri Mar 17 00:11:56 2017 +0000
@@ -66,7 +66,6 @@
     rawindex = 0;
     clearAllData();
     gps = _gps;
-    gps->attach(this, &GwoopsGPS::parseCallback, Serial::RxIrq);
     valid = 0;
 }
 
@@ -94,12 +93,14 @@
 char*    GwoopsGPS::getdate()       {return date;}
 char*    GwoopsGPS::getmagvar()     {return magvar;}
 char     GwoopsGPS::getmagvardir()  {return magvardir;}
-uint8_t  GwoopsGPS::isValid()       {return valid;}
+
 
 /**************************************************************************
 * MEMBER FUNCTIONS
 *************************************************************************/
 
+uint8_t  GwoopsGPS::isValid() {return valid == 'A';}
+
 void GwoopsGPS::writeStructToObj(GPRMCSentence *rcrd) {
     sprintf(time, "%s", rcrd->time);
     status =  rcrd->status;
@@ -226,6 +227,15 @@
     return;
 }
 
+void GwoopsGPS::init() {
+    gps->attach(this, &GwoopsGPS::parseCallback, Serial::RxIrq);
+    return;
+}
+
+void GwoopsGPS::deinit() {
+    gps->attach(NULL, Serial::RxIrq);
+    return;
+}
 
 
 
@@ -240,3 +250,4 @@
 
 
 
+
--- a/GwoopsGPS.h	Thu Mar 16 23:10:57 2017 +0000
+++ b/GwoopsGPS.h	Fri Mar 17 00:11:56 2017 +0000
@@ -84,6 +84,8 @@
         /**************************************************************************
         * MEMBER FUNCTIONS
         *************************************************************************/
+        void init();
+        void deinit();
         void clearRawGPSData();
         void clearAllData();
         int8_t parseRawGPSData(char*, GPRMCSentence*);
--- a/main.cpp	Thu Mar 16 23:10:57 2017 +0000
+++ b/main.cpp	Fri Mar 17 00:11:56 2017 +0000
@@ -4,12 +4,14 @@
 #define GPSBUFFSIZE 256
 
 Serial pc(USBTX, USBRX); // tx, rx
-Serial sgps(PTC15, PTC14, 9600);
+Serial sgps(PTC15, PTC14);
 
  
 int main() {
     pc.printf("Where am I? ----------- \n\r");
+    sgps.baud(9600);
     GwoopsGPS xgps(&sgps);
+    xgps.init();
     while(1) {
         if (xgps.isValid()) {
             pc.printf("\r\n");
    