EmbeddedArtists AB / app_gps

Dependencies:   MTK3339 mbed

Files at this revision

API Documentation at this revision

Comitter:
embeddedartists
Date:
Thu Nov 07 11:53:56 2013 +0000
Commit message:
First commit

Changed in this revision

MTK3339.lib Show annotated file Show diff for this revision Revisions of this file
main.cpp Show annotated file Show diff for this revision Revisions of this file
mbed.lib Show annotated file Show diff for this revision Revisions of this file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/MTK3339.lib	Thu Nov 07 11:53:56 2013 +0000
@@ -0,0 +1,1 @@
+http://mbed.org/users/embeddedartists/code/MTK3339/#bd0fe2412980
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp	Thu Nov 07 11:53:56 2013 +0000
@@ -0,0 +1,36 @@
+#include "mbed.h"
+#include "MTK3339.h"
+
+static int waitData = 0;
+static MTK3339 gps(P4_22, P4_23);
+
+
+static void dataAvailable() {
+    waitData |= gps.getAvailableDataType();
+}
+
+int main(void) {
+   
+    gps.start(&dataAvailable, (MTK3339::NmeaGga|MTK3339::NmeaVtg));
+
+    while(1) {
+        while(waitData == 0);
+        
+        if ((waitData & MTK3339::NmeaGga) != 0) {
+            waitData &= ~(MTK3339::NmeaGga);
+            printf("gpa: fix=%d, sats=%d, alt=%f, lat=%f, lon=%f\n", 
+                gps.gga.fix, gps.gga.satellites, gps.gga.altitude, 
+                gps.getLatitudeAsDegrees(), gps.getLongitudeAsDegrees());            
+        }
+        if ((waitData & MTK3339::NmeaVtg) != 0) {
+            waitData &= ~(MTK3339::NmeaVtg);
+            printf("vtg: course=%f, speed=%f km/h, mode=%c\n", 
+                gps.vtg.course, gps.vtg.speedKmHour, gps.vtg.mode);            
+        }   
+        
+        waitData &= (MTK3339::NmeaGga|MTK3339::NmeaVtg);
+    }
+
+
+
+}
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mbed.lib	Thu Nov 07 11:53:56 2013 +0000
@@ -0,0 +1,1 @@
+http://mbed.org/users/mbed_official/code/mbed/#f37f3b9c9f0b