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 0:d177c0087d1f 1 #include "Startup.h"
guiott 0:d177c0087d1f 2
guiott 0:d177c0087d1f 3 void Initialize (void)
guiott 0:d177c0087d1f 4 {
guiott 0:d177c0087d1f 5 // initialize serial ports
guiott 0:d177c0087d1f 6 pc.baud(PCBAUD); // USB/serial
guiott 0:d177c0087d1f 7 gps.baud(GPSBAUD);
guiott 0:d177c0087d1f 8
guiott 0:d177c0087d1f 9 gps.attach( &GpsSerialIsr ); // Start serial interrupt
guiott 0:d177c0087d1f 10
guiott 0:d177c0087d1f 11 nmea_property()->trace_func = &trace_h;
guiott 0:d177c0087d1f 12 nmea_property()->error_func = &error_h;
guiott 0:d177c0087d1f 13 nmea_zero_INFO(&info);
guiott 0:d177c0087d1f 14 nmea_parser_init(&parser);
guiott 0:d177c0087d1f 15
guiott 0:d177c0087d1f 16 LcdBklight = 0;
guiott 0:d177c0087d1f 17 wait(0.5);
guiott 0:d177c0087d1f 18 lcd.cls();
guiott 0:d177c0087d1f 19 LcdBklight=1; // Backlight on
guiott 0:d177c0087d1f 20
guiott 0:d177c0087d1f 21 // LCD splash screen
guiott 0:d177c0087d1f 22 lcd.locate(0,1);
guiott 0:d177c0087d1f 23 lcd.printf(Ver1);
guiott 0:d177c0087d1f 24 lcd.locate(0,2);
guiott 0:d177c0087d1f 25 lcd.printf(Ver2);
guiott 0:d177c0087d1f 26 wait(4.0);
guiott 0:d177c0087d1f 27 lcd.cls();
guiott 0:d177c0087d1f 28
guiott 0:d177c0087d1f 29 // Console splash screen
guiott 0:d177c0087d1f 30 pc.printf(Ver1);
guiott 0:d177c0087d1f 31 pc.printf("\n");
guiott 0:d177c0087d1f 32 pc.printf(Ver2);
guiott 0:d177c0087d1f 33 pc.printf("\n");
guiott 0:d177c0087d1f 34 pc.printf("input a number to enable debug, 0 to disable\n");
guiott 0:d177c0087d1f 35
guiott 0:d177c0087d1f 36 os.CreateTask(GPS_SERIAL_TASK, GPS_SER_PRIORITY, GPS_SER_STACK_SZ, GpsSerialTask);
guiott 0:d177c0087d1f 37 os.CreateTask(KEYPAD_TASK, KEYPAD_PRIORITY, KEYPAD_STACK_SZ, KeypadTask);
guiott 0:d177c0087d1f 38 os.CreateTask(SHOW_LCD_TASK, SHOW_LCD_PRIORITY, SHOW_LCD_STACK_SZ, ShowLcdTask);
guiott 0:d177c0087d1f 39 os.CreateTask(LED_BLINK_TASK, LED_BLINK_PRIORITY, LED_BLINK_STACK_SZ, LedBlinkTask);
guiott 0:d177c0087d1f 40 os.CreateTask(SET_TIME_TASK, SET_TIME_PRIORITY, SET_TIME_STACK_SZ, SetTimeTask);
guiott 0:d177c0087d1f 41 os.CreateTask(SHOW_PC_TASK, SHOW_PC_PRIORITY, SHOW_PC_STACK_SZ, ShowPcTask);
guiott 0:d177c0087d1f 42 os.CreateTask(LCD_LIGHT_DIM_TASK, LCD_LIGHT_DIM_PRIORITY, LCD_LIGHT_DIM_STACK_SZ, LcdLightDimTask);
guiott 0:d177c0087d1f 43 os.CreateTask(TEMP_TASK, TEMP_PRIORITY, TEMP_STACK_SZ, TempTask);
guiott 2:8917036cbf69 44 os.CreateTask(WDT_TASK, WDT_PRIORITY, WDT_STACK_SZ, WdtTask);
guiott 0:d177c0087d1f 45
guiott 0:d177c0087d1f 46 os.CreateResource(GPS_SERIAL,GPS_SERIAL_PRIO);
guiott 0:d177c0087d1f 47 os.CreateResource(PC_SERIAL,PC_SERIAL_PRIO);
guiott 0:d177c0087d1f 48 os.CreateResource(LCD,LCD_PRIO);
guiott 0:d177c0087d1f 49 os.CreateResource(LCD_LIGHT_DIM,LCD_LIGHT_DIM_PRIO);
guiott 0:d177c0087d1f 50
guiott 0:d177c0087d1f 51 os.CreateTimer(KEYPAD_TMR, KEYPAD_TASK, KEYPAD_EVT);
guiott 0:d177c0087d1f 52 os.CreateTimer(SHOW_LCD_TMR, SHOW_LCD_TASK, SHOW_LCD_EVT);
guiott 0:d177c0087d1f 53 os.CreateTimer(LED_BLINK_TMR, LED_BLINK_TASK, LED_BLINK_EVT);
guiott 0:d177c0087d1f 54 os.CreateTimer(SET_TIME_TMR, SET_TIME_TASK, SET_TIME_EVT);
guiott 0:d177c0087d1f 55 os.CreateTimer(SHOW_PC_TMR, SHOW_PC_TASK, SHOW_PC_EVT);
guiott 0:d177c0087d1f 56 os.CreateTimer(LCD_LIGHT_DIM_OFF_TMR, LCD_LIGHT_DIM_TASK, LCD_LIGHT_DIM_OFF_EVT);
guiott 0:d177c0087d1f 57 os.CreateTimer(TEMP_TMR, TEMP_TASK, TEMP_EVT);
guiott 2:8917036cbf69 58 os.CreateTimer(WDT_TMR, WDT_TASK, WDT_EVT);
guiott 0:d177c0087d1f 59
guiott 0:d177c0087d1f 60 os.SetTimer(LCD_LIGHT_DIM_OFF_TMR, LCD_LIGHT_DIM_TIMER, 0);
guiott 2:8917036cbf69 61
guiott 0:d177c0087d1f 62 // os.SetTimer(TEMP_TMR, TEMP_TIMER, TEMP_TIMER); // enabled just for test or debug
guiott 3:a2f9eb3b8a16 63
guiott 3:a2f9eb3b8a16 64 ReadCfg(Config);
guiott 3:a2f9eb3b8a16 65 WriteCfg();
guiott 3:a2f9eb3b8a16 66 ReadCfg(Config);
guiott 0:d177c0087d1f 67 }