ver1

Dependents:   EM_ver1 template FM_ver3_for_ARLISS FM_ver3_for_test

Committer:
Nerosho
Date:
Tue Jul 30 11:08:55 2019 +0000
Revision:
1:432f77f0d864
Parent:
0:3d25bc7ff80e
Child:
2:e3c59956d8ce
Child:
4:0893111db5e7
ver2_2

Who changed what in which revision?

UserRevisionLine numberNew contents of line
Nerosho 0:3d25bc7ff80e 1 #include "GPS.h"
Nerosho 1:432f77f0d864 2
Nerosho 0:3d25bc7ff80e 3
Nerosho 0:3d25bc7ff80e 4
Nerosho 1:432f77f0d864 5 GPS::GPS(PinName tx, PinName rx):_gps(tx,rx)
Nerosho 0:3d25bc7ff80e 6 {
Nerosho 1:432f77f0d864 7 _gps.baud(9600);
Nerosho 0:3d25bc7ff80e 8 _tx=tx;
Nerosho 0:3d25bc7ff80e 9 _rx=rx;
Nerosho 1:432f77f0d864 10 }
Nerosho 1:432f77f0d864 11 //Serial pc(USBTX,USBRX);
Nerosho 0:3d25bc7ff80e 12
Nerosho 1:432f77f0d864 13 //char getGPS[128];
Nerosho 1:432f77f0d864 14 //int i=0;
Nerosho 0:3d25bc7ff80e 15
Nerosho 0:3d25bc7ff80e 16 int GPS::getGPGGA()
Nerosho 0:3d25bc7ff80e 17 {
Nerosho 0:3d25bc7ff80e 18 //Serial gps(_tx,_rx);
Nerosho 1:432f77f0d864 19 //gps.baud(9600);
Nerosho 0:3d25bc7ff80e 20 //Serial pc(USBTX,USBRX);
Nerosho 1:432f77f0d864 21 //pc.baud(19200);
Nerosho 0:3d25bc7ff80e 22
Nerosho 0:3d25bc7ff80e 23 int i=0;
Nerosho 1:432f77f0d864 24
Nerosho 1:432f77f0d864 25 //while(1) {
Nerosho 1:432f77f0d864 26
Nerosho 0:3d25bc7ff80e 27
Nerosho 1:432f77f0d864 28
Nerosho 1:432f77f0d864 29 if(_gps.readable()) {
Nerosho 1:432f77f0d864 30 //GPSread=1;
Nerosho 0:3d25bc7ff80e 31
Nerosho 1:432f77f0d864 32 //for (i=0; i<256; i++) {
Nerosho 1:432f77f0d864 33 getGPS[i]=_gps.getc();
Nerosho 0:3d25bc7ff80e 34
Nerosho 1:432f77f0d864 35 if(getGPS[i]=='\n') {
Nerosho 1:432f77f0d864 36
Nerosho 0:3d25bc7ff80e 37
Nerosho 1:432f77f0d864 38 if((getGPS[5]=='G')&&(getGPS[6]=='A')) {
Nerosho 1:432f77f0d864 39
Nerosho 0:3d25bc7ff80e 40
Nerosho 0:3d25bc7ff80e 41 for(int n=0; n<i+1; n++) {
Nerosho 1:432f77f0d864 42 //pc.printf("%c",getGPS[n]);
Nerosho 0:3d25bc7ff80e 43
Nerosho 0:3d25bc7ff80e 44 GPSMessage[n] = getGPS[n];
Nerosho 1:432f77f0d864 45 return 1;
Nerosho 1:432f77f0d864 46
Nerosho 0:3d25bc7ff80e 47 }
Nerosho 1:432f77f0d864 48
Nerosho 1:432f77f0d864 49 //pc.printf("%s",GPSMessage);
Nerosho 0:3d25bc7ff80e 50
Nerosho 1:432f77f0d864 51
Nerosho 1:432f77f0d864 52 }//if GAの終わり
Nerosho 0:3d25bc7ff80e 53
Nerosho 0:3d25bc7ff80e 54 i=0;
Nerosho 0:3d25bc7ff80e 55
Nerosho 1:432f77f0d864 56 //break;
Nerosho 1:432f77f0d864 57
Nerosho 1:432f77f0d864 58 }//if \nの終わり
Nerosho 0:3d25bc7ff80e 59
Nerosho 0:3d25bc7ff80e 60 i++;
Nerosho 1:432f77f0d864 61
Nerosho 1:432f77f0d864 62 //}//forの終わり
Nerosho 1:432f77f0d864 63
Nerosho 0:3d25bc7ff80e 64 }
Nerosho 0:3d25bc7ff80e 65
Nerosho 1:432f77f0d864 66 //}//whileの終わり
Nerosho 0:3d25bc7ff80e 67 return 0;
Nerosho 0:3d25bc7ff80e 68 }