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:
Fri Feb 03 16:29:52 2012 +0000
Revision:
3:a2f9eb3b8a16
Parent:
0:d177c0087d1f

        

Who changed what in which revision?

UserRevisionLine numberNew contents of line
guiott 0:d177c0087d1f 1 /*
guiott 0:d177c0087d1f 2 *
guiott 0:d177c0087d1f 3 * NMEA library
guiott 0:d177c0087d1f 4 * URL: http://nmea.sourceforge.net
guiott 0:d177c0087d1f 5 * Author: Tim (xtimor@gmail.com)
guiott 0:d177c0087d1f 6 * Licence: http://www.gnu.org/licenses/lgpl.html
guiott 0:d177c0087d1f 7 * $Id: time.c 4 2007-08-27 13:11:03Z xtimor $
guiott 0:d177c0087d1f 8 *
guiott 0:d177c0087d1f 9 */
guiott 0:d177c0087d1f 10
guiott 0:d177c0087d1f 11 /*! \file time.h */
guiott 0:d177c0087d1f 12
guiott 0:d177c0087d1f 13 #include "nmea/time.h"
guiott 0:d177c0087d1f 14
guiott 0:d177c0087d1f 15 #ifdef NMEA_WIN
guiott 0:d177c0087d1f 16 # pragma warning(disable: 4201)
guiott 0:d177c0087d1f 17 # pragma warning(disable: 4214)
guiott 0:d177c0087d1f 18 # pragma warning(disable: 4115)
guiott 0:d177c0087d1f 19 # include <windows.h>
guiott 0:d177c0087d1f 20 # pragma warning(default: 4201)
guiott 0:d177c0087d1f 21 # pragma warning(default: 4214)
guiott 0:d177c0087d1f 22 # pragma warning(default: 4115)
guiott 0:d177c0087d1f 23 #else
guiott 0:d177c0087d1f 24 # include <time.h>
guiott 0:d177c0087d1f 25 #endif
guiott 0:d177c0087d1f 26
guiott 0:d177c0087d1f 27 #ifdef NMEA_WIN
guiott 0:d177c0087d1f 28
guiott 0:d177c0087d1f 29 void nmea_time_now(nmeaTIME *stm)
guiott 0:d177c0087d1f 30 {
guiott 0:d177c0087d1f 31 SYSTEMTIME st;
guiott 0:d177c0087d1f 32
guiott 0:d177c0087d1f 33 GetSystemTime(&st);
guiott 0:d177c0087d1f 34
guiott 0:d177c0087d1f 35 stm->year = st.wYear - 1900;
guiott 0:d177c0087d1f 36 stm->mon = st.wMonth - 1;
guiott 0:d177c0087d1f 37 stm->day = st.wDay;
guiott 0:d177c0087d1f 38 stm->hour = st.wHour;
guiott 0:d177c0087d1f 39 stm->min = st.wMinute;
guiott 0:d177c0087d1f 40 stm->sec = st.wSecond;
guiott 0:d177c0087d1f 41 stm->hsec = st.wMilliseconds / 10;
guiott 0:d177c0087d1f 42 }
guiott 0:d177c0087d1f 43
guiott 0:d177c0087d1f 44 #else /* NMEA_WIN */
guiott 0:d177c0087d1f 45
guiott 0:d177c0087d1f 46 void nmea_time_now(nmeaTIME *stm)
guiott 0:d177c0087d1f 47 {
guiott 0:d177c0087d1f 48 time_t lt;
guiott 0:d177c0087d1f 49 struct tm *tt;
guiott 0:d177c0087d1f 50
guiott 0:d177c0087d1f 51 time(&lt);
guiott 0:d177c0087d1f 52 tt = gmtime(&lt);
guiott 0:d177c0087d1f 53
guiott 0:d177c0087d1f 54 stm->year = tt->tm_year;
guiott 0:d177c0087d1f 55 stm->mon = tt->tm_mon;
guiott 0:d177c0087d1f 56 stm->day = tt->tm_mday;
guiott 0:d177c0087d1f 57 stm->hour = tt->tm_hour;
guiott 0:d177c0087d1f 58 stm->min = tt->tm_min;
guiott 0:d177c0087d1f 59 stm->sec = tt->tm_sec;
guiott 0:d177c0087d1f 60 stm->hsec = 0;
guiott 0:d177c0087d1f 61 }
guiott 0:d177c0087d1f 62
guiott 0:d177c0087d1f 63 #endif