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

Task5SetTime.cpp

Committer:
guiott
Date:
2012-02-03
Revision:
3:a2f9eb3b8a16
Parent:
2:8917036cbf69

File content as of revision 3:a2f9eb3b8a16:

#include "Task5SetTime.h"

void SetTimeTask(void)
{/**
 *\brief TASK 5, Set RTC system time if the GPS time is valid
 */
 struct tm t;
 
 os.SetTimer(SET_TIME_TMR, 60000, 60000);
 while(1)
 {  
 os.WaitEvent(SET_TIME_EVT);

    if(info.sig != 0)    
    {
       t.tm_mday=info.utc.day;
       t.tm_mon=info.utc.mon;
       t.tm_year=info.utc.year; 
       t.tm_hour=info.utc.hour;
       t.tm_min=info.utc.min;
       t.tm_sec=info.utc.sec;        
          
        time_t seconds = mktime(&t);       
        set_time(seconds);
        
        SetTimeOk = 1; // RTC was set 
    }
 }    
}