GPS working with LoRa code - can't transmit faster that once every 6 seconds
Dependencies: mbed LoRaWAN-lib_gps_lora SingleFrequencyLora
app/l86.hpp@13:66d854ad31d8, 2017-11-24 (annotated)
- Committer:
- Rishin
- Date:
- Fri Nov 24 15:20:12 2017 +0000
- Revision:
- 13:66d854ad31d8
- Parent:
- l86.hpp@11:f2a7f98cc9bf
- Child:
- 15:b4d11baea8bc
Valid GPS data sent over LoRa for roughly 7 mins with no crash
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
Rishin | 5:850a9db98a41 | 1 | /* |
Rishin | 5:850a9db98a41 | 2 | * l86.h |
Rishin | 5:850a9db98a41 | 3 | * Author: Rishin Amin |
Rishin | 5:850a9db98a41 | 4 | * library header file for communication with the Quectel L86 MT33 GPS module |
Rishin | 5:850a9db98a41 | 5 | * |
Rishin | 5:850a9db98a41 | 6 | */ |
Rishin | 5:850a9db98a41 | 7 | |
Rishin | 5:850a9db98a41 | 8 | #ifndef l86_hpp |
Rishin | 5:850a9db98a41 | 9 | #define l86_hpp |
Rishin | 5:850a9db98a41 | 10 | |
Rishin | 5:850a9db98a41 | 11 | #define DEBUGGER // uncomment to output serial data to PC |
Rishin | 5:850a9db98a41 | 12 | |
Rishin | 6:670ff1507ff4 | 13 | /* PIN DEFINITIONS */ |
Rishin | 13:66d854ad31d8 | 14 | // #define RESET_PIN PB_14 |
Rishin | 13:66d854ad31d8 | 15 | // #define FORCE_ON_PIN PB_15 |
Rishin | 13:66d854ad31d8 | 16 | // #define ONEPPS_PIN PA_8 |
Rishin | 6:670ff1507ff4 | 17 | #define GPS_RX PA_10 |
Rishin | 6:670ff1507ff4 | 18 | #define GPS_TX PA_9 |
Rishin | 6:670ff1507ff4 | 19 | #define PC_RX PC_5 |
Rishin | 6:670ff1507ff4 | 20 | #define PC_TX PC_4 |
Rishin | 6:670ff1507ff4 | 21 | #define GPS_STATUS_LED LED1 |
Rishin | 6:670ff1507ff4 | 22 | |
Rishin | 6:670ff1507ff4 | 23 | /* PMTK MMESSAGE DEFINITIONS */ |
Rishin | 6:670ff1507ff4 | 24 | #define MAX_NMEA_LENGTH 82 // maximum length of an NMEA sentence |
Rishin | 5:850a9db98a41 | 25 | #define PMTK_SET_NMEA_OUTPUT_RMC "$PMTK314,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0*29\r\n" |
Rishin | 5:850a9db98a41 | 26 | #define PMTK_SET_UPDATE_F_2HZ "$PMTK300,500,0,0,0,0*28\r\n" |
Rishin | 6:670ff1507ff4 | 27 | #define PMTK_COLD_RESTART "$PMTK104*37\r\n" |
Rishin | 6:670ff1507ff4 | 28 | #define PMTK_WARM_START "$PMTK102*31\r\n" |
Rishin | 6:670ff1507ff4 | 29 | #define PMTK_HOT_START "$PMTK101*32\r\n" |
Rishin | 6:670ff1507ff4 | 30 | #define PMTK_ALWAYS_LOCATE_STANDDBY "$PMTK225,8*23\r\n" |
Rishin | 6:670ff1507ff4 | 31 | #define PMTK_ALWAYS_LOCATE_BACKUP "$PMTK225,922\r\n*" |
Rishin | 7:1c90f51096fe | 32 | #define PMTK_STANDBY_MODE "$PMTK161,0*28\r\n" // Any UART data will retrun to Full-on mode |
Rishin | 6:670ff1507ff4 | 33 | #define PMTK_BACKUP_MODE "$PMTK225,4*2F\r\n" // Force_on must be low before entering backup mode! |
Rishin | 6:670ff1507ff4 | 34 | // Pull Force_on high to exit backup mode |
Rishin | 6:670ff1507ff4 | 35 | |
Rishin | 6:670ff1507ff4 | 36 | |
Rishin | 5:850a9db98a41 | 37 | |
Rishin | 5:850a9db98a41 | 38 | static const char GPRMC_Tag[] = "$GPRMC"; |
Rishin | 5:850a9db98a41 | 39 | static const char GNRMC_Tag[] = "$GNRMC"; |
Rishin | 5:850a9db98a41 | 40 | |
Rishin | 5:850a9db98a41 | 41 | typedef struct RMC_data |
Rishin | 5:850a9db98a41 | 42 | { |
Rishin | 5:850a9db98a41 | 43 | char Message[MAX_NMEA_LENGTH]; /* Un-parsed NMEA sentence */ |
Rishin | 5:850a9db98a41 | 44 | char Message_ID[7]; /* RMC Protocol header */ |
Rishin | 5:850a9db98a41 | 45 | char UTC_Time[11]; /* hhmmss.sss */ |
Rishin | 5:850a9db98a41 | 46 | char Status[2]; /* A = data valid, V = data NOT valid */ |
Rishin | 5:850a9db98a41 | 47 | char Latitude[10]; /* ddmm.mmmm */ |
Rishin | 5:850a9db98a41 | 48 | char N_S_Indicator[3]; /* N = North, S = South */ |
Rishin | 5:850a9db98a41 | 49 | char Longitude[11]; /* dddmm.mmmm */ |
Rishin | 5:850a9db98a41 | 50 | char E_W_Indicator[3]; /* E = East, W = West */ |
Rishin | 5:850a9db98a41 | 51 | char Speed_Over_Ground[5]; /* In Knots */ |
Rishin | 5:850a9db98a41 | 52 | char Course_Over_Ground[7]; /* Degrees */ |
Rishin | 5:850a9db98a41 | 53 | char Date[7]; /* ddmmyy */ |
Rishin | 6:670ff1507ff4 | 54 | char Mode[5]; /* N = No Fix, A = autonomous mode, D = Differential mode + checksum */ |
Rishin | 7:1c90f51096fe | 55 | }RMC_data; |
Rishin | 5:850a9db98a41 | 56 | |
Rishin | 10:0b5a507b4a4d | 57 | typedef struct GPS_data |
Rishin | 10:0b5a507b4a4d | 58 | { |
Rishin | 11:f2a7f98cc9bf | 59 | char UTC_Time[11]; |
Rishin | 11:f2a7f98cc9bf | 60 | char Latitude[11]; |
Rishin | 11:f2a7f98cc9bf | 61 | char Longitude[12]; |
Rishin | 11:f2a7f98cc9bf | 62 | char Speed_Over_Ground[5]; |
Rishin | 11:f2a7f98cc9bf | 63 | char Course_Over_Ground[7]; |
Rishin | 11:f2a7f98cc9bf | 64 | char Date[7]; |
Rishin | 10:0b5a507b4a4d | 65 | char Valid[2]; |
Rishin | 10:0b5a507b4a4d | 66 | }GPS_data; |
Rishin | 10:0b5a507b4a4d | 67 | |
Rishin | 10:0b5a507b4a4d | 68 | RMC_data Parse_RMC_sentence(char RMC_sentence[MAX_NMEA_LENGTH]); |
Rishin | 7:1c90f51096fe | 69 | void Print_RMC_data(RMC_data *RMC_data_print); |
Rishin | 10:0b5a507b4a4d | 70 | GPS_data Parse_RMC_data(RMC_data RMC_parsed); |
Rishin | 10:0b5a507b4a4d | 71 | void Print_GPS_data(GPS_data GPS_data_print); |
Rishin | 5:850a9db98a41 | 72 | |
Rishin | 5:850a9db98a41 | 73 | #endif |
Rishin | 5:850a9db98a41 | 74 |