giovanni migon
/
GPS_LIB
a program to get GPS latitude and longitude and precision, with a simple validation.
Diff: main.cpp
- Revision:
- 0:cc406c7b09be
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/main.cpp Fri May 25 20:59:59 2018 +0000 @@ -0,0 +1,30 @@ +/*LIB GPS +author: Giovanni Migon +GPS GP 735T +*/ + +#include "mbed.h" +#include "GPS.h" + +DigitalOut myled(LED1); + +GPS gps(p9,p10,9600); +Serial pc(USBTX,USBRX); + +// I could not put this method inside the class +void SerialRecvInterrupt (void) +{ + if( gps._serial.readable() ) + gps._buf_rx[gps._count_rx++%sizeof(gps._buf_rx)] = gps._serial.getc(); +} + +int main() { + myled = 1; + pc.attach(SerialRecvInterrupt, pc.RxIrq); + + while(1) { + gps.printGPS(); + //gps.printRX(); + wait(1); + } +}