Wataru Mikawa / GPS

Dependents:   Sample_GPSlib

Files at this revision

API Documentation at this revision

Comitter:
mikawataru
Date:
Sat Jul 15 15:08:02 2017 +0000
Parent:
0:8c134f1c71f2
Child:
2:482c199ca6de
Commit message:
Library for GPS

Changed in this revision

GPS.cpp Show annotated file Show diff for this revision Revisions of this file
GPS.h Show annotated file Show diff for this revision Revisions of this file
--- a/GPS.cpp	Fri Jul 14 18:09:46 2017 +0000
+++ b/GPS.cpp	Sat Jul 15 15:08:02 2017 +0000
@@ -2,6 +2,28 @@
 #include "string.h"
 #include "GPS.h"
 
+GPS::GPS(PinName tx, PinName rx) : gps(tx,rx){
+  gps.baud(115200);
+  gps.printf("$PMTK251,9600*17\r\n");
+  wait(0.5);
+  gps.baud(9600);
+  gps.printf("$PMTK314,0,1,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0*28\r\n");
+  wait(0.5);
+};
+
+void GPS::rateUP(){
+  gps.baud(9600);
+  gps.printf("$PMTK251,115200*1F\r\n");
+  wait(0.5);
+  gps.baud(115200);
+  gps.printf("$PMTK220,100*2F\r\n");
+  wait(0.5);
+  gps.printf("$PMTK300,00,0,0,0,0*2C\r\n");
+  wait(0.5);
+  gps.printf("$PMTK251,115200*1F\r\n");
+}
+
+
 void GPS::getGPS(){
   gps_data[cnt_gps] = gps.getc();
   
--- a/GPS.h	Fri Jul 14 18:09:46 2017 +0000
+++ b/GPS.h	Sat Jul 15 15:08:02 2017 +0000
@@ -10,9 +10,8 @@
    int cnt_gps;
 public:
    Serial *debug;
-   GPS(PinName tx, PinName rx) : gps(tx,rx){
-      gps.baud(9600);
-   };
+   GPS(PinName tx, PinName rx);
+   void rateUP();
    void getGPS();
    void LogStart(PinName tx, PinName rx);
    float calcLatitude(float raw_data);