A porting of a GPS decoding and presenting program within the mbos RTOS. It is not a definitive application but a study program to test NMEA full decoding library and a first approach to an RTOS. Many thanks to Andrew Levido for his support and his patience on teaching me the RTOS principles from the other side of the Earth. It uses NMEA library by Tim (xtimor@gmail.com) ported by Ken Todotani (http://mbed.org/users/todotani/) on public mbed library (http://mbed.org/users/todotani/programs/GPS_nmeaLib/5yo4h) also available, as original universal C library, on http://nmea.sourceforge.net

Dependencies:   mbos Watchdog TextLCD mbed ConfigFile

Committer:
guiott
Date:
Sun Jan 29 16:06:12 2012 +0000
Revision:
0:d177c0087d1f
Child:
2:8917036cbf69

        

Who changed what in which revision?

UserRevisionLine numberNew contents of line
guiott 0:d177c0087d1f 1 // Ports initialization
guiott 0:d177c0087d1f 2 DigitalOut led1(LED1);
guiott 0:d177c0087d1f 3 DigitalOut led2(LED2);
guiott 0:d177c0087d1f 4 DigitalOut led3(LED3);
guiott 0:d177c0087d1f 5 DigitalOut led4(LED4);
guiott 0:d177c0087d1f 6 Serial pc(USBTX, USBRX);
guiott 0:d177c0087d1f 7 Serial gps(NC, GPSRX);
guiott 0:d177c0087d1f 8
guiott 0:d177c0087d1f 9 PwmOut LcdBklight(p25);
guiott 0:d177c0087d1f 10 AnalogIn KeypadIn(p20);
guiott 0:d177c0087d1f 11
guiott 0:d177c0087d1f 12 // Globals
guiott 0:d177c0087d1f 13 int size;
guiott 0:d177c0087d1f 14 int X=0, Y=0;
guiott 0:d177c0087d1f 15 char Key='-';
guiott 0:d177c0087d1f 16
guiott 0:d177c0087d1f 17 char msgBuff[2][BUFF_SIZE]; // Receive data buffer from GPS module
guiott 0:d177c0087d1f 18 // Two buffer for double buffering
guiott 0:d177c0087d1f 19 volatile int writePointer = 0; // Write pointer for active data buffer
guiott 0:d177c0087d1f 20 volatile unsigned int bufferSelect = 0; // Active buffer selector
guiott 0:d177c0087d1f 21
guiott 0:d177c0087d1f 22 double latitude, longitude;
guiott 0:d177c0087d1f 23 double degrees, minutes;
guiott 0:d177c0087d1f 24
guiott 0:d177c0087d1f 25 int SetTimeOk=0; // is RTC in sync?
guiott 0:d177c0087d1f 26 int PcMonitor=0; // to control serial out on USB serial
guiott 0:d177c0087d1f 27 int Menu = 0;
guiott 0:d177c0087d1f 28 const char *Lab[]={"MAG", "DIR", "GPS"}; //Label to display in compass view
guiott 0:d177c0087d1f 29 int CmpPos[]={0,15,0}; //Compass position
guiott 0:d177c0087d1f 30 int Ang[3]; //Compass angle values
guiott 0:d177c0087d1f 31 enum DirLab{Mag, Dir, Gps};
guiott 0:d177c0087d1f 32
guiott 0:d177c0087d1f 33 nmeaINFO info; // Store GPS information
guiott 0:d177c0087d1f 34 nmeaPARSER parser;
guiott 0:d177c0087d1f 35
guiott 0:d177c0087d1f 36 typedef struct _DegMinSec
guiott 0:d177c0087d1f 37 {
guiott 0:d177c0087d1f 38 int Deg;
guiott 0:d177c0087d1f 39 int Min;
guiott 0:d177c0087d1f 40 double Sec;
guiott 0:d177c0087d1f 41 } DegMinSec;
guiott 0:d177c0087d1f 42
guiott 0:d177c0087d1f 43 typedef struct _DistAzimuth
guiott 0:d177c0087d1f 44 {
guiott 0:d177c0087d1f 45 double Dist;
guiott 0:d177c0087d1f 46 double Azimuth[2];
guiott 0:d177c0087d1f 47 } DistAzimuth;
guiott 0:d177c0087d1f 48
guiott 0:d177c0087d1f 49 DistAzimuth Path;
guiott 0:d177c0087d1f 50 nmeaPOS Pos[2];
guiott 0:d177c0087d1f 51 nmeaINFO Dest;
guiott 0:d177c0087d1f 52