Shogo Nerome / GPS
Committer:
takepiyo
Date:
Sun Aug 18 08:17:48 2019 +0000
Revision:
4:0893111db5e7
Parent:
1:432f77f0d864
i2c change

Who changed what in which revision?

UserRevisionLine numberNew contents of line
Nerosho 0:3d25bc7ff80e 1 #include "GPS.h"
takepiyo 4:0893111db5e7 2 #include "mbed.h"
Nerosho 0:3d25bc7ff80e 3
takepiyo 4:0893111db5e7 4 GPS::GPS(PinName tx, PinName rx)
Nerosho 0:3d25bc7ff80e 5 {
Nerosho 0:3d25bc7ff80e 6 _tx=tx;
Nerosho 0:3d25bc7ff80e 7 _rx=rx;
takepiyo 4:0893111db5e7 8 _gps(_tx,_rx);
Nerosho 1:432f77f0d864 9 }
Nerosho 1:432f77f0d864 10 //Serial pc(USBTX,USBRX);
Nerosho 0:3d25bc7ff80e 11
Nerosho 1:432f77f0d864 12 //char getGPS[128];
Nerosho 1:432f77f0d864 13 //int i=0;
Nerosho 0:3d25bc7ff80e 14
takepiyo 4:0893111db5e7 15 char GPS::getGPGGA()
Nerosho 0:3d25bc7ff80e 16 {
Nerosho 0:3d25bc7ff80e 17 int i=0;
takepiyo 4:0893111db5e7 18 _gps.start();
takepiyo 4:0893111db5e7 19 while(1)
takepiyo 4:0893111db5e7 20 {
takepiyo 4:0893111db5e7 21 getGPS[i]=_gps.read();
Nerosho 0:3d25bc7ff80e 22
takepiyo 4:0893111db5e7 23 if(getGPS[i]=='\n')
takepiyo 4:0893111db5e7 24 {
takepiyo 4:0893111db5e7 25 if((getGPS[5]=='G')&&(getGPS[6]=='A'))
takepiyo 4:0893111db5e7 26 {
takepiyo 4:0893111db5e7 27 for(int n=0; n<i+1; n++)
takepiyo 4:0893111db5e7 28 {
Nerosho 0:3d25bc7ff80e 29 GPSMessage[n] = getGPS[n];
Nerosho 0:3d25bc7ff80e 30 }
takepiyo 4:0893111db5e7 31 //pc.printf("%s",GPSMessage);
takepiyo 4:0893111db5e7 32 goto OUT;
Nerosho 1:432f77f0d864 33 }//if GAの終わり
Nerosho 0:3d25bc7ff80e 34 i=0;
Nerosho 1:432f77f0d864 35 }//if \nの終わり
Nerosho 0:3d25bc7ff80e 36 i++;
Nerosho 0:3d25bc7ff80e 37 }
takepiyo 4:0893111db5e7 38 OUT:
takepiyo 4:0893111db5e7 39 return GPSMessage;
Nerosho 0:3d25bc7ff80e 40 }