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:
Tue Jan 31 00:22:58 2012 +0000
Revision:
2:8917036cbf69
Parent:
1:360c4a23cb1d
Child:
3:a2f9eb3b8a16
WDT optimized for reliability. A better organization of source code has be done separating each task in a dedicated module.

Who changed what in which revision?

UserRevisionLine numberNew contents of line
guiott 0:d177c0087d1f 1 /* ////////////////////////////////////////////////////////////////////////////
guiott 0:d177c0087d1f 2 ** File: LeonardoMbos.cpp
guiott 0:d177c0087d1f 3 */
guiott 0:d177c0087d1f 4 /* 12345678901234567890 */
guiott 0:d177c0087d1f 5 char Ver1[] = "Leonardo's GPS 0.1.0";
guiott 0:d177c0087d1f 6 char Ver2[] = " by Guiott 01-12";
guiott 0:d177c0087d1f 7 /**
guiott 0:d177c0087d1f 8 * \mainpage Leonardo.cpp
guiott 0:d177c0087d1f 9 * \author Guido Ottaviani-->guido@guiott.com<--
guiott 0:d177c0087d1f 10 * \version 0.1.0
guiott 0:d177c0087d1f 11 * \date 01/2012
guiott 0:d177c0087d1f 12 * \details This is a test program to study the capability of a GPS module to
guiott 0:d177c0087d1f 13 control navigation of a robot in an outdoor environment.
guiott 0:d177c0087d1f 14
guiott 0:d177c0087d1f 15 This version is developed within the mbos RTOS:
guiott 0:d177c0087d1f 16 http://mbed.org/users/AndrewL/libraries/mbos/lqn3ca
guiott 0:d177c0087d1f 17
guiott 0:d177c0087d1f 18 It uses NMEA library by Tim (xtimor@gmail.com)
guiott 0:d177c0087d1f 19 available on public mbed library or http://nmea.sourceforge.net
guiott 0:d177c0087d1f 20
guiott 0:d177c0087d1f 21 The original gmath.c has been modified to fix a bug in nmea_distance_ellipsoid() function
guiott 0:d177c0087d1f 22 according to bug report ID: 2945855
guiott 0:d177c0087d1f 23
guiott 0:d177c0087d1f 24 http://sourceforge.net/tracker/?func=detail&aid=2945855&group_id=192054&atid=939854
guiott 0:d177c0087d1f 25
guiott 0:d177c0087d1f 26 // while ((delta_lambda > 1e-12) && (remaining_steps > 0)) original by xtimor
guiott 0:d177c0087d1f 27 while (( remaining_steps == 20 ) || ((fabs(delta_lambda) > 1e-12) && (remaining_steps > 0)))
guiott 0:d177c0087d1f 28
guiott 0:d177c0087d1f 29 the original code always returns a zero distance if the arrival point longitude
guiott 0:d177c0087d1f 30 is equal or smaller than the starting point one.
guiott 0:d177c0087d1f 31
guiott 0:d177c0087d1f 32 The mbed module is interfaced with a Garmin GPS sensor (used in standard mode)
guiott 0:d177c0087d1f 33 with an external antenna, a 20x4 LCD text display and a 5 keys keypad.
guiott 0:d177c0087d1f 34 A curiosity:
guiott 0:d177c0087d1f 35 All the hardware components of the test set are mounted on the top of a wooden
guiott 0:d177c0087d1f 36 box, looking like a kind of a steampunk navigator. When my daughter looked at
guiott 0:d177c0087d1f 37 the box she said: "it looks alike the navigator of the da Vinci car".
guiott 0:d177c0087d1f 38 This is the reason why the name of this project is "Leonardo".
guiott 0:d177c0087d1f 39 **
guiott 0:d177c0087d1f 40 -------------------------------------------------------------------------------
guiott 0:d177c0087d1f 41 * \copyright 2012 Guido Ottaviani
guiott 0:d177c0087d1f 42 guido@guiott.com
guiott 0:d177c0087d1f 43
guiott 0:d177c0087d1f 44 LeonardoMbos is free software: you can redistribute it and/or modify
guiott 0:d177c0087d1f 45 it under the terms of the GNU General Public License as published by
guiott 0:d177c0087d1f 46 the Free Software Foundation, either version 3 of the License, or
guiott 0:d177c0087d1f 47 (at your option) any later version.
guiott 0:d177c0087d1f 48
guiott 1:360c4a23cb1d 49 LeonardoMbos is distributed in the hope that it will be useful,
guiott 0:d177c0087d1f 50 but WITHOUT ANY WARRANTY; without even the implied warranty of
guiott 0:d177c0087d1f 51 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
guiott 0:d177c0087d1f 52 GNU General Public License for more details.
guiott 0:d177c0087d1f 53
guiott 0:d177c0087d1f 54 You should have received a copy of the GNU General Public License
guiott 0:d177c0087d1f 55 along with LeonardoMbos.cpp. If not, see <http://www.gnu.org/licenses/>.
guiott 0:d177c0087d1f 56
guiott 0:d177c0087d1f 57 -------------------------------------------------------------------------------
guiott 0:d177c0087d1f 58 */
guiott 0:d177c0087d1f 59 #include "Common.h"
guiott 0:d177c0087d1f 60 #include "mbed.h"
guiott 0:d177c0087d1f 61 #include <string>
guiott 0:d177c0087d1f 62 #include "TextLCD.h"
guiott 0:d177c0087d1f 63 #include "nmea/nmea.h"
guiott 2:8917036cbf69 64 #include <Watchdog.h>
guiott 0:d177c0087d1f 65 #include "Init.h"
guiott 0:d177c0087d1f 66 #include "Prototype.h"
guiott 0:d177c0087d1f 67 #include "mbos.h"
guiott 0:d177c0087d1f 68 #include "Tasks.h"
guiott 0:d177c0087d1f 69
guiott 0:d177c0087d1f 70 // Set up RTOS;
guiott 0:d177c0087d1f 71 mbos os(NUM_TASKS, NUM_TIMERS, NUM_RESOURCES);
guiott 0:d177c0087d1f 72
guiott 0:d177c0087d1f 73 int main()
guiott 0:d177c0087d1f 74 {
guiott 0:d177c0087d1f 75 Initialize();
guiott 0:d177c0087d1f 76 if (wd.WatchdogCausedReset())
guiott 0:d177c0087d1f 77 {
guiott 0:d177c0087d1f 78 pc.printf("Watchdog caused reset**********************************\r\n");
guiott 0:d177c0087d1f 79 }
guiott 2:8917036cbf69 80 wd.Configure(WDT_TIMEOUT); // sets the timeout interval
guiott 0:d177c0087d1f 81
guiott 0:d177c0087d1f 82 os.Start(); // the RTOS starts now
guiott 0:d177c0087d1f 83 }
guiott 0:d177c0087d1f 84
guiott 0:d177c0087d1f 85 //functions =====================================================================
guiott 0:d177c0087d1f 86
guiott 2:8917036cbf69 87 void mbosIdleTask(void)
guiott 2:8917036cbf69 88 {/**
guiott 2:8917036cbf69 89 *\brief TASK 0 watchdog kick
guiott 2:8917036cbf69 90 */
guiott 2:8917036cbf69 91 while(1)
guiott 2:8917036cbf69 92 {
guiott 2:8917036cbf69 93
guiott 2:8917036cbf69 94 }
guiott 2:8917036cbf69 95 }
guiott 2:8917036cbf69 96
guiott 0:d177c0087d1f 97 int CmpRead(void)
guiott 0:d177c0087d1f 98 {/**
guiott 0:d177c0087d1f 99 *\brief Magnetic Compass reading
guiott 0:d177c0087d1f 100 */
guiott 0:d177c0087d1f 101 int Cmp;
guiott 0:d177c0087d1f 102
guiott 0:d177c0087d1f 103 // To Be Done
guiott 0:d177c0087d1f 104 Cmp = 0; // ************debug
guiott 0:d177c0087d1f 105 return(Cmp);
guiott 0:d177c0087d1f 106 }
guiott 0:d177c0087d1f 107