GPS working with LoRa code - can't transmit faster that once every 6 seconds
Dependencies: mbed LoRaWAN-lib_gps_lora SingleFrequencyLora
l86.hpp@7:1c90f51096fe, 2017-11-13 (annotated)
- Committer:
- Rishin
- Date:
- Mon Nov 13 18:37:05 2017 +0000
- Revision:
- 7:1c90f51096fe
- Parent:
- 6:670ff1507ff4
- Child:
- 10:0b5a507b4a4d
Successfully parsing RMC data - need to fix printf hang when writing to serial device
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 | 6:670ff1507ff4 | 14 | #define RESET_PIN PB_14 |
Rishin | 6:670ff1507ff4 | 15 | #define FORCE_ON_PIN PB_15 |
Rishin | 6:670ff1507ff4 | 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 | 7:1c90f51096fe | 57 | RMC_data Parse_RMC_data(char RMC_sentence[MAX_NMEA_LENGTH]); |
Rishin | 7:1c90f51096fe | 58 | void Print_RMC_data(RMC_data *RMC_data_print); |
Rishin | 5:850a9db98a41 | 59 | |
Rishin | 5:850a9db98a41 | 60 | // struct RMC_msg l86_retreive_RMC(void) <= e.g. |
Rishin | 5:850a9db98a41 | 61 | |
Rishin | 5:850a9db98a41 | 62 | #endif |
Rishin | 5:850a9db98a41 | 63 |