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

Files at this revision

API Documentation at this revision

Comitter:
guiott
Date:
Fri Feb 03 16:29:52 2012 +0000
Parent:
2:8917036cbf69
Commit message:

Changed in this revision

ConfigFile.lib Show annotated file Show diff for this revision Revisions of this file
Init.h Show annotated file Show diff for this revision Revisions of this file
LeonardoMbos.cpp Show annotated file Show diff for this revision Revisions of this file
Startup.cpp Show annotated file Show diff for this revision Revisions of this file
Startup.h Show annotated file Show diff for this revision Revisions of this file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ConfigFile.lib	Fri Feb 03 16:29:52 2012 +0000
@@ -0,0 +1,1 @@
+http://mbed.org/users/shintamainjp/code/ConfigFile/#f6ceafabe9f8
--- a/Init.h	Tue Jan 31 00:22:58 2012 +0000
+++ b/Init.h	Fri Feb 03 16:29:52 2012 +0000
@@ -1,6 +1,9 @@
 extern Serial pc;
 extern Watchdog wd;
 
+LocalFileSystem local("local");
+ConfigFile cfg;
+
 // Globals
 int X=0, Y=0;
 
--- a/LeonardoMbos.cpp	Tue Jan 31 00:22:58 2012 +0000
+++ b/LeonardoMbos.cpp	Fri Feb 03 16:29:52 2012 +0000
@@ -5,11 +5,11 @@
  char  Ver1[] = "Leonardo's GPS 0.1.0";
  char  Ver2[] = "  by Guiott  01-12";
 /**
-* \mainpage Leonardo.cpp
-* \author   Guido Ottaviani-->guido@guiott.com<--
-* \version  0.1.0
-* \date     01/2012
-* \details This is a test program to study the capability of a GPS module to
+* @mainpage Leonardo.cpp
+* @author   Guido Ottaviani-->guido@guiott.com<--
+* @version  0.1.0
+* @date     01/2012
+* @details This is a test program to study the capability of a GPS module to
    control navigation of a robot in an outdoor environment.
         
    This version is developed within the mbos RTOS:
@@ -38,7 +38,7 @@
  This is the reason why the name of this project is "Leonardo".
 **
 -------------------------------------------------------------------------------
-* \copyright 2012 Guido Ottaviani
+* @copyright 2012 Guido Ottaviani
 guido@guiott.com
 
     LeonardoMbos is free software: you can redistribute it and/or modify
@@ -62,6 +62,7 @@
 #include "TextLCD.h"
 #include "nmea/nmea.h"
 #include <Watchdog.h>
+#include "ConfigFile.h"
 #include "Init.h" 
 #include "Prototype.h"
 #include "mbos.h"
@@ -86,7 +87,7 @@
 
 void mbosIdleTask(void)
 {/**
- *\brief TASK 0 watchdog kick
+ *@brief TASK 0 watchdog kick
  */
  while(1)
  {
@@ -96,7 +97,7 @@
 
 int CmpRead(void)
 {/**
- *\brief Magnetic Compass reading 
+ *@brief Magnetic Compass reading 
  */
     int Cmp;
 
@@ -105,3 +106,34 @@
     return(Cmp);
 }
 
+void ReadCfg(char *Config[])
+{/**
+ *@brief Read a configuration file from a mbed filesystem
+ */
+    char value[BUFSIZ];
+    
+    if (!cfg.read("/local/input.cfg")) 
+    {
+        pc.printf("Failure to read a configuration file.\n");
+    }
+      
+    if (cfg.getValue(Config[0], &value[0], sizeof(value))) 
+    {
+        pc.printf("'%s'='%s'\n", Config[0], value);
+    }
+ 
+     if (cfg.getValue(Config[1], &value[0], sizeof(value))) 
+    {
+        pc.printf("'%s'='%s'\n", Config[1], value);
+    }
+}
+
+void WriteCfg()
+{/**
+ *@brief Write configurations to mbed filesystem
+ */
+     cfg.setValue("LonStart", "lon");
+     cfg.setValue("LatStart", "lat");
+
+     cfg.write("/local/input.cfg", "# Configuration file for LeonardoGps.");
+ }
\ No newline at end of file
--- a/Startup.cpp	Tue Jan 31 00:22:58 2012 +0000
+++ b/Startup.cpp	Fri Feb 03 16:29:52 2012 +0000
@@ -60,4 +60,8 @@
 os.SetTimer(LCD_LIGHT_DIM_OFF_TMR, LCD_LIGHT_DIM_TIMER, 0);
 
 // os.SetTimer(TEMP_TMR, TEMP_TIMER, TEMP_TIMER); // enabled just for test or debug
+
+ReadCfg(Config);
+WriteCfg();
+ReadCfg(Config);
 }
--- a/Startup.h	Tue Jan 31 00:22:58 2012 +0000
+++ b/Startup.h	Fri Feb 03 16:29:52 2012 +0000
@@ -4,6 +4,7 @@
 #include "nmea/nmea.h"
 #include "mbos.h"
 #include "Tasks.h"
+#include "ConfigFile.h"
 
 extern TextLCD lcd;
 extern mbos os;
@@ -17,6 +18,10 @@
 void GpsSerialIsr(void);
 void trace_h(const char *str, int str_size);
 void error_h(const char *str, int str_size);
+void ReadCfg(char *Config[]);
+void WriteCfg();
 
 extern  char  Ver1[];
 extern  char  Ver2[];
+
+char *Config[] = {"LatStart","LonStart"};