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:
0:d177c0087d1f

        

Who changed what in which revision?

UserRevisionLine numberNew contents of line
guiott 0:d177c0087d1f 1 /*
guiott 0:d177c0087d1f 2 *
guiott 0:d177c0087d1f 3 * NMEA library
guiott 0:d177c0087d1f 4 * URL: http://nmea.sourceforge.net
guiott 0:d177c0087d1f 5 * Author: Tim (xtimor@gmail.com)
guiott 0:d177c0087d1f 6 * Licence: http://www.gnu.org/licenses/lgpl.html
guiott 0:d177c0087d1f 7 * $Id: context.c 17 2008-03-11 11:56:11Z xtimor $
guiott 0:d177c0087d1f 8 *
guiott 0:d177c0087d1f 9 */
guiott 0:d177c0087d1f 10
guiott 0:d177c0087d1f 11 #include "nmea/context.h"
guiott 0:d177c0087d1f 12
guiott 0:d177c0087d1f 13 #include <string.h>
guiott 0:d177c0087d1f 14 #include <stdarg.h>
guiott 0:d177c0087d1f 15 #include <stdio.h>
guiott 0:d177c0087d1f 16
guiott 0:d177c0087d1f 17 nmeaPROPERTY * nmea_property()
guiott 0:d177c0087d1f 18 {
guiott 0:d177c0087d1f 19 static nmeaPROPERTY prop = {
guiott 0:d177c0087d1f 20 0, 0, NMEA_DEF_PARSEBUFF
guiott 0:d177c0087d1f 21 };
guiott 0:d177c0087d1f 22
guiott 0:d177c0087d1f 23 return &prop;
guiott 0:d177c0087d1f 24 }
guiott 0:d177c0087d1f 25
guiott 0:d177c0087d1f 26 void nmea_trace(const char *str, ...)
guiott 0:d177c0087d1f 27 {
guiott 0:d177c0087d1f 28 int size;
guiott 0:d177c0087d1f 29 va_list arg_list;
guiott 0:d177c0087d1f 30 char buff[NMEA_DEF_PARSEBUFF];
guiott 0:d177c0087d1f 31 nmeaTraceFunc func = nmea_property()->trace_func;
guiott 0:d177c0087d1f 32
guiott 0:d177c0087d1f 33 if(func)
guiott 0:d177c0087d1f 34 {
guiott 0:d177c0087d1f 35 va_start(arg_list, str);
guiott 0:d177c0087d1f 36 size = NMEA_POSIX(vsnprintf)(&buff[0], NMEA_DEF_PARSEBUFF - 1, str, arg_list);
guiott 0:d177c0087d1f 37 va_end(arg_list);
guiott 0:d177c0087d1f 38
guiott 0:d177c0087d1f 39 if(size > 0)
guiott 0:d177c0087d1f 40 (*func)(&buff[0], size);
guiott 0:d177c0087d1f 41 }
guiott 0:d177c0087d1f 42 }
guiott 0:d177c0087d1f 43
guiott 0:d177c0087d1f 44 void nmea_trace_buff(const char *buff, int buff_size)
guiott 0:d177c0087d1f 45 {
guiott 0:d177c0087d1f 46 nmeaTraceFunc func = nmea_property()->trace_func;
guiott 0:d177c0087d1f 47 if(func && buff_size)
guiott 0:d177c0087d1f 48 (*func)(buff, buff_size);
guiott 0:d177c0087d1f 49 }
guiott 0:d177c0087d1f 50
guiott 0:d177c0087d1f 51 void nmea_error(const char *str, ...)
guiott 0:d177c0087d1f 52 {
guiott 0:d177c0087d1f 53 int size;
guiott 0:d177c0087d1f 54 va_list arg_list;
guiott 0:d177c0087d1f 55 char buff[NMEA_DEF_PARSEBUFF];
guiott 0:d177c0087d1f 56 nmeaErrorFunc func = nmea_property()->error_func;
guiott 0:d177c0087d1f 57
guiott 0:d177c0087d1f 58 if(func)
guiott 0:d177c0087d1f 59 {
guiott 0:d177c0087d1f 60 va_start(arg_list, str);
guiott 0:d177c0087d1f 61 size = NMEA_POSIX(vsnprintf)(&buff[0], NMEA_DEF_PARSEBUFF - 1, str, arg_list);
guiott 0:d177c0087d1f 62 va_end(arg_list);
guiott 0:d177c0087d1f 63
guiott 0:d177c0087d1f 64 if(size > 0)
guiott 0:d177c0087d1f 65 (*func)(&buff[0], size);
guiott 0:d177c0087d1f 66 }
guiott 0:d177c0087d1f 67 }