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
Diff: LeonardoMbos.cpp
- Revision:
- 3:a2f9eb3b8a16
- Parent:
- 2:8917036cbf69
diff -r 8917036cbf69 -r a2f9eb3b8a16 LeonardoMbos.cpp --- 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