13 volatile int gps_stopping;
14 volatile int gps_stack[100];
15 volatile int _gps_rx_pin, _gps_tx_pin, _gps_baud;
19 gps_byte_t inBuff[GPS_INBUFF_SIZE];
29 void gps_run(
void *par)
31 gps_byte_t tempBuff[16];
35 gps_ser = fdserial_open(_gps_rx_pin, _gps_tx_pin, 0, _gps_baud);
41 fdserial_close(gps_ser);
44 ch = fdserial_rxChar(gps_ser);
55 ch = fdserial_rxChar(gps_ser);
64 if(strncmp(inBuff,
"GPRMC", 5) == 0)
66 if(strncmp(inBuff,
"GPGGA", 5) == 0)
76 ptrBuff = strtok(inBuff,
",");
78 while(ptrBuff && i<12)
81 gps_data.time = atof(ptrBuff);
84 gps_data.fix_valid = strcmp(ptrBuff,
"A") ? GPS_FALSE:GPS_TRUE;
90 f_temp = (float)atof(ptrBuff);
91 ptrBuff = strtok(NULL,
",");
95 sign = strcmp(ptrBuff,
"N") ? -1:1;
96 degs = (int)f_temp/100;
98 gps_data.lat_dds = sign*((f_temp/60)+degs);
105 f_temp = (float)atof(ptrBuff);
106 ptrBuff = strtok(NULL,
",");
113 sign = strcmp(ptrBuff,
"E") ? -1:1;
114 degs = (int)f_temp/100;
115 f_temp -= (degs*100);
116 gps_data.lon_dds = sign*((f_temp/60)+degs);
120 gps_data.velocity = (float)atof(ptrBuff);
123 gps_data.heading = (float)atof(ptrBuff);
126 gps_data.date = atoi(ptrBuff);
129 gps_data.mag_var = (float)atof(ptrBuff);
131 ptrBuff = strtok(NULL,
",");
142 ptrBuff = strtok(inBuff,
",");
144 while(ptrBuff && i<16)
147 gps_data.fix = atoi(ptrBuff);
150 gps_data.sats_tracked = atoi(ptrBuff);
153 gps_data.altitude = (float)atof(ptrBuff);
155 ptrBuff = strtok(NULL,
",");
164 int ch, prevch=0, len, i;
165 len = strlen(inBuff);
170 if(ch ==
',' && prevch ==
',')
172 memmove(inBuff+i+1, inBuff+i, len-i);
173 prevch = inBuff[i] =
'0';
Structure that contains data used by simple text device libraries.