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 "Task4LedBlink.h"
guiott 2:8917036cbf69 2
guiott 2:8917036cbf69 3 void LedBlinkTask(void)
guiott 2:8917036cbf69 4 {/**
guiott 2:8917036cbf69 5 *\brief TASK 4
guiott 2:8917036cbf69 6 LED 1: Quick blink=NOT fix, Slow blink=fix OK
guiott 2:8917036cbf69 7 LED 2: blinks proportionally to HDOP
guiott 2:8917036cbf69 8 LED 3: blinks proportionally to VDOP
guiott 2:8917036cbf69 9 */
guiott 2:8917036cbf69 10
guiott 2:8917036cbf69 11 static int LedCnt1=0;
guiott 2:8917036cbf69 12 // static int LedCnt2=0;
guiott 2:8917036cbf69 13 int OnH=0;
guiott 2:8917036cbf69 14 int OnV=0;
guiott 2:8917036cbf69 15
guiott 2:8917036cbf69 16 #define MAX 20
guiott 2:8917036cbf69 17
guiott 2:8917036cbf69 18 os.SetTimer(LED_BLINK_TMR, 100, 100);
guiott 2:8917036cbf69 19
guiott 2:8917036cbf69 20 while(1)
guiott 2:8917036cbf69 21 {
guiott 2:8917036cbf69 22 os.WaitEvent(LED_BLINK_EVT);
guiott 2:8917036cbf69 23
guiott 2:8917036cbf69 24 if((info.HDOP>0)&&(info.HDOP<=2))
guiott 2:8917036cbf69 25 {
guiott 2:8917036cbf69 26 OnH=2;
guiott 2:8917036cbf69 27 }
guiott 2:8917036cbf69 28 else if((info.HDOP>2)&&(info.HDOP<=4))
guiott 2:8917036cbf69 29 {
guiott 2:8917036cbf69 30 OnH=4;
guiott 2:8917036cbf69 31 }
guiott 2:8917036cbf69 32 else if((info.HDOP>4)&&(info.HDOP<=6))
guiott 2:8917036cbf69 33 {
guiott 2:8917036cbf69 34 OnH=6;
guiott 2:8917036cbf69 35 }
guiott 2:8917036cbf69 36 else if((info.HDOP>6))
guiott 2:8917036cbf69 37 {
guiott 2:8917036cbf69 38 OnH=MAX/2;
guiott 2:8917036cbf69 39 }
guiott 2:8917036cbf69 40
guiott 2:8917036cbf69 41 if((info.VDOP>0)&&(info.VDOP<=2))
guiott 2:8917036cbf69 42 {
guiott 2:8917036cbf69 43 OnV=2;
guiott 2:8917036cbf69 44 }
guiott 2:8917036cbf69 45 else if((info.VDOP>2)&&(info.VDOP<=4))
guiott 2:8917036cbf69 46 {
guiott 2:8917036cbf69 47 OnV=4;
guiott 2:8917036cbf69 48 }
guiott 2:8917036cbf69 49 else if((info.VDOP>4)&&(info.VDOP<=6))
guiott 2:8917036cbf69 50 {
guiott 2:8917036cbf69 51 OnV=6;
guiott 2:8917036cbf69 52 }
guiott 2:8917036cbf69 53 else if((info.VDOP>6))
guiott 2:8917036cbf69 54 {
guiott 2:8917036cbf69 55 OnV=MAX/2;
guiott 2:8917036cbf69 56 }
guiott 2:8917036cbf69 57
guiott 2:8917036cbf69 58 if(info.sig == 0)
guiott 2:8917036cbf69 59 {
guiott 2:8917036cbf69 60 led1=!led1;
guiott 2:8917036cbf69 61 led2=0;
guiott 2:8917036cbf69 62 led3=0;
guiott 2:8917036cbf69 63 }
guiott 2:8917036cbf69 64 else
guiott 2:8917036cbf69 65 {
guiott 2:8917036cbf69 66 if(LedCnt1<=MAX/2)
guiott 2:8917036cbf69 67 {
guiott 2:8917036cbf69 68 LedCnt1++;
guiott 2:8917036cbf69 69 led1=0;
guiott 2:8917036cbf69 70 if(LedCnt1<OnH)
guiott 2:8917036cbf69 71 {
guiott 2:8917036cbf69 72 led2=!led2;
guiott 2:8917036cbf69 73 }
guiott 2:8917036cbf69 74 else
guiott 2:8917036cbf69 75 {
guiott 2:8917036cbf69 76 led2=0;
guiott 2:8917036cbf69 77 }
guiott 2:8917036cbf69 78
guiott 2:8917036cbf69 79 if(LedCnt1<OnV)
guiott 2:8917036cbf69 80 {
guiott 2:8917036cbf69 81 led3=!led3;
guiott 2:8917036cbf69 82 }
guiott 2:8917036cbf69 83 else
guiott 2:8917036cbf69 84 {
guiott 2:8917036cbf69 85 led3=0;
guiott 2:8917036cbf69 86 }
guiott 2:8917036cbf69 87 }
guiott 2:8917036cbf69 88 else if((LedCnt1>MAX/2)&&(LedCnt1<=MAX))
guiott 2:8917036cbf69 89 {
guiott 2:8917036cbf69 90 LedCnt1++;
guiott 2:8917036cbf69 91 led1=1;
guiott 2:8917036cbf69 92 led2=0;
guiott 2:8917036cbf69 93 led3=0;
guiott 2:8917036cbf69 94 }
guiott 2:8917036cbf69 95 else if(LedCnt1>MAX)
guiott 2:8917036cbf69 96 {
guiott 2:8917036cbf69 97 LedCnt1=0;
guiott 2:8917036cbf69 98 }
guiott 2:8917036cbf69 99 }
guiott 2:8917036cbf69 100 }
guiott 2:8917036cbf69 101 }