GPS working with LoRa code - can't transmit faster that once every 6 seconds
Dependencies: mbed LoRaWAN-lib_gps_lora SingleFrequencyLora
l86.cpp@6:670ff1507ff4, 2017-11-13 (annotated)
- Committer:
- Rishin
- Date:
- Mon Nov 13 15:44:11 2017 +0000
- Revision:
- 6:670ff1507ff4
- Parent:
- 5:850a9db98a41
- Child:
- 7:1c90f51096fe
Added definitions for more PMTK commands
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
Rishin | 5:850a9db98a41 | 1 | #include "l86.hpp" |
Rishin | 5:850a9db98a41 | 2 | #include <string.h> |
Rishin | 6:670ff1507ff4 | 3 | #include <stdio.h> |
Rishin | 5:850a9db98a41 | 4 | |
Rishin | 6:670ff1507ff4 | 5 | void Parse_RMC_data(RMC_data *RMC_data_parse){ |
Rishin | 5:850a9db98a41 | 6 | |
Rishin | 5:850a9db98a41 | 7 | //Local Variables |
Rishin | 5:850a9db98a41 | 8 | char RMC_message_copy[MAX_NMEA_LENGTH] = ""; |
Rishin | 5:850a9db98a41 | 9 | const char delimeter[2] = ","; |
Rishin | 5:850a9db98a41 | 10 | char *token = ""; |
Rishin | 5:850a9db98a41 | 11 | int i = 0; |
Rishin | 6:670ff1507ff4 | 12 | char temp[13][12]; /* [13][12]: 13 strings, of length 12 */ |
Rishin | 5:850a9db98a41 | 13 | |
Rishin | 5:850a9db98a41 | 14 | //Copy original RMC sentence to a copy in order to not destroy message |
Rishin | 6:670ff1507ff4 | 15 | strcpy(RMC_message_copy,RMC_data_parse->Message); |
Rishin | 5:850a9db98a41 | 16 | |
Rishin | 5:850a9db98a41 | 17 | //Seperated Message |
Rishin | 5:850a9db98a41 | 18 | /* get the first token */ |
Rishin | 5:850a9db98a41 | 19 | token = strtok(RMC_message_copy, delimeter); |
Rishin | 5:850a9db98a41 | 20 | |
Rishin | 5:850a9db98a41 | 21 | /* walk through other tokens */ |
Rishin | 5:850a9db98a41 | 22 | while( token != NULL ) |
Rishin | 5:850a9db98a41 | 23 | { |
Rishin | 5:850a9db98a41 | 24 | strcpy(temp[i],token); |
Rishin | 5:850a9db98a41 | 25 | i++; |
Rishin | 5:850a9db98a41 | 26 | token = strtok(NULL, delimeter); |
Rishin | 5:850a9db98a41 | 27 | } |
Rishin | 5:850a9db98a41 | 28 | |
Rishin | 6:670ff1507ff4 | 29 | //Copy the message into its individual components |
Rishin | 6:670ff1507ff4 | 30 | strcpy(RMC_data_parse->Message_ID,temp[0]); |
Rishin | 6:670ff1507ff4 | 31 | strcpy(RMC_data_parse->UTC_Time,temp[1]); |
Rishin | 6:670ff1507ff4 | 32 | strcpy(RMC_data_parse->Status,temp[2]); |
Rishin | 6:670ff1507ff4 | 33 | strcpy(RMC_data_parse->Latitude,temp[3]); |
Rishin | 6:670ff1507ff4 | 34 | strcpy(RMC_data_parse->N_S_Indicator,temp[4]); |
Rishin | 6:670ff1507ff4 | 35 | strcpy(RMC_data_parse->Longitude,temp[5]); |
Rishin | 6:670ff1507ff4 | 36 | strcpy(RMC_data_parse->E_W_Indicator,temp[6]); |
Rishin | 6:670ff1507ff4 | 37 | strcpy(RMC_data_parse->Speed_Over_Ground,temp[7]); |
Rishin | 6:670ff1507ff4 | 38 | strcpy(RMC_data_parse->Course_Over_Ground,temp[8]); |
Rishin | 6:670ff1507ff4 | 39 | strcpy(RMC_data_parse->Date,temp[9]); |
Rishin | 6:670ff1507ff4 | 40 | strcpy(RMC_data_parse->Magnetic_Variation,temp[10]); |
Rishin | 6:670ff1507ff4 | 41 | strcpy(RMC_data_parse->Magnetic_E_W_Indicator,temp[11]); |
Rishin | 6:670ff1507ff4 | 42 | strcpy(RMC_data_parse->Mode,temp[12]); |
Rishin | 6:670ff1507ff4 | 43 | } |
Rishin | 6:670ff1507ff4 | 44 | |
Rishin | 6:670ff1507ff4 | 45 | // Used GPS data pares function? // parses into data formats that will be sent over LoRa? |