Revised Embedded Artists' MTK3339 library to save all raw GPS messages and enable optional decoding of RMC message.

Fork of MTK3339 by EmbeddedArtists AB

Files at this revision

API Documentation at this revision

Comitter:
tbronez
Date:
Tue Dec 29 16:46:07 2015 +0000
Parent:
3:124e25586234
Commit message:
Added additional statements useful for debugging

Changed in this revision

MTK3339.cpp Show annotated file Show diff for this revision Revisions of this file
--- a/MTK3339.cpp	Sun Aug 23 21:48:48 2015 +0000
+++ b/MTK3339.cpp	Tue Dec 29 16:46:07 2015 +0000
@@ -1,6 +1,5 @@
-// Class to represent serial interface to MTK3339 GPS chip
 // Original author: Embedded Artists
-// Revised by T. Bronez, 2015-08-23
+// Revised by T. Bronez, 2015-12-16
 
 #include "mbed.h"
 #include "MTK3339.h"
@@ -39,6 +38,10 @@
         _sentenceMask = mask;
         _serial.attach(this, &MTK3339::uartIrq, Serial::RxIrq);
     }
+
+    // DEBUG: Query antenna status    
+    //_serial.printf("$PGTOP,11,3*6F\r\n");
+    //_serial.printf("$PGCMD,33,1*6C\r\n");
 }
 
 void MTK3339::stop() {
@@ -264,6 +267,8 @@
             break;
         }
 
+        //printf("msg: %s\n", data); // DEBUG
+        
         // Save appropriate sentence for later decoding   
         if (strncmp("$GPRMC", data, 6) == 0 && (_sentenceMask & NMEA_RMC) != 0) {
             //flashLED2();    // for DEBUG
@@ -295,7 +300,7 @@
             _availDataType = NMEA_VTG;
             _dataCallback.call();
             _availDataType = NMEA_NONE;
-        }          
+        }
     } while(0);
 }
 
@@ -329,4 +334,27 @@
     }
 }
 
+/*
+ From http://forum.trenz-electronic.de/index.php?topic=273.0
+ (untested), other MTK3339 commands and responses:
+ 
+ To disable antenna status/advisor messages,
+    $PGCMD,33,0*6D<CR><LF>
+    
+ MTK3339 should acknowledge with
+    $PGACK,33,0*6E<CR><LF>
 
+ To enable antenna status/advisor messages,
+    $PGCMD,33,1*6C<CR><LF>
+    
+ MTK3339 should acknowledge with
+    $PGACK,33,1*6F<CR><LF>
+
+ To query antenna status,
+    $PGTOP,11,3*6F<CR><LF>
+    
+ MTK3339 should respond with one of the following:
+    $PGTOP,11,1*6D  active antenna shorted
+    $PGTOP,11,2*6E  using internal antenna
+    $PGTOP,11,3*6F  using active antenna
+*/