A GPS serial interrupt service routine that has an on the fly nmea parser. Works with a STM32F411RE and a Adafruit GPS logger.

Dependents:   Bicycl_Computer_NUCLEO-F411RE Bicycl_Computer_NUCLEO-L476RG

Fork of GPS by Simon Ford

main.cpp

#include "mbed.h"
#include "GPSISR.h"

#define PIN_RX_GPS      PA_12 //GPS Shield RX pin
#define PIN_TX_GPS      PA_11 //GPS Shield TX pin
Serial pc(USBTX, USBRX);

// Set up serial interrupe service handler for gps characters.
GPS MyGPS(PIN_TX_GPS,PIN_RX_GPS, 9600);
int main()
{
    while (1) {
	if (MyGPS.dataready()) {
					MyGPS.read();
					pc.printf("NMEA has valid data");
					pc.printf("Sats : %d \n", MyGPS.buffer.satellites);
					pc.printf("%d-%d-%d\n", MyGPS.buffer.month, MyGPS.buffer.day, MyGPS.buffer.year);
					pc.printf("%d:%d:%d\n", MyGPS.buffer.hours, MyGPS.buffer.minutes, MyGPS.buffer.seconds);
	}
	else {
                pc.printf("NMEA has no valid data");
	}   
   }  
} 

History

Math error in GPS speed calculation from Knots to Kilometer. Should be ; 1Kn = 1.85Km default tip

2017-03-01, by trevieze [Wed, 01 Mar 2017 15:36:05 +0000] rev 6

Math error in GPS speed calculation from Knots to Kilometer. Should be ; 1Kn = 1.85Km


Added NEWS indication to Lon and Lat display

2017-03-01, by trevieze [Wed, 01 Mar 2017 03:38:03 +0000] rev 5

Added NEWS indication to Lon and Lat display


Added missing seconds in structure

2017-02-18, by trevieze [Sat, 18 Feb 2017 01:37:25 +0000] rev 4

Added missing seconds in structure


Tested library with Adafruit GPS data logger and appears to work.

2017-02-17, by trevieze [Fri, 17 Feb 2017 23:31:39 +0000] rev 3

Tested library with Adafruit GPS data logger and appears to work.


Wrapper for NMEA

2017-02-16, by trevieze [Thu, 16 Feb 2017 23:55:28 +0000] rev 2

Wrapper for NMEA


New interrupt service handler for NMEA library

2017-02-10, by trevieze [Fri, 10 Feb 2017 17:57:45 +0000] rev 1

New interrupt service handler for NMEA library


2010-06-08, by simon [Tue, 08 Jun 2010 14:10:27 +0000] rev 0