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:
2:8917036cbf69

        

Who changed what in which revision?

UserRevisionLine numberNew contents of line
guiott 2:8917036cbf69 1 #include "Task5SetTime.h"
guiott 2:8917036cbf69 2
guiott 2:8917036cbf69 3 void SetTimeTask(void)
guiott 2:8917036cbf69 4 {/**
guiott 2:8917036cbf69 5 *\brief TASK 5, Set RTC system time if the GPS time is valid
guiott 2:8917036cbf69 6 */
guiott 2:8917036cbf69 7 struct tm t;
guiott 2:8917036cbf69 8
guiott 2:8917036cbf69 9 os.SetTimer(SET_TIME_TMR, 60000, 60000);
guiott 2:8917036cbf69 10 while(1)
guiott 2:8917036cbf69 11 {
guiott 2:8917036cbf69 12 os.WaitEvent(SET_TIME_EVT);
guiott 2:8917036cbf69 13
guiott 2:8917036cbf69 14 if(info.sig != 0)
guiott 2:8917036cbf69 15 {
guiott 2:8917036cbf69 16 t.tm_mday=info.utc.day;
guiott 2:8917036cbf69 17 t.tm_mon=info.utc.mon;
guiott 2:8917036cbf69 18 t.tm_year=info.utc.year;
guiott 2:8917036cbf69 19 t.tm_hour=info.utc.hour;
guiott 2:8917036cbf69 20 t.tm_min=info.utc.min;
guiott 2:8917036cbf69 21 t.tm_sec=info.utc.sec;
guiott 2:8917036cbf69 22
guiott 2:8917036cbf69 23 time_t seconds = mktime(&t);
guiott 2:8917036cbf69 24 set_time(seconds);
guiott 2:8917036cbf69 25
guiott 2:8917036cbf69 26 SetTimeOk = 1; // RTC was set
guiott 2:8917036cbf69 27 }
guiott 2:8917036cbf69 28 }
guiott 2:8917036cbf69 29 }