Main Page | Modules | Data Structures | Directories | File List | Data Fields | Globals | Related Pages

# gps.c

Go to the documentation of this file.

    00001 /*! \file gps.c \brief GPS position storage and processing library. */
    00002 //*****************************************************************************
    00003 //
    00004 // File Name    : 'gps.c'
    00005 // Title        : GPS position storage and processing function library
    00006 // Author       : Pascal Stang - Copyright (C) 2002-2005
    00007 // Created      : 2005.01.14
    00008 // Revised      : 2002.07.17
    00009 // Version      : 0.1
    00010 // Target MCU   : Atmel AVR Series
    00011 // Editor Tabs  : 4
    00012 //
    00013 // NOTE: This code is currently below version 1.0, and therefore is considered
    00014 // to be lacking in some functionality or documentation, or may not be fully
    00015 // tested.  Nonetheless, you can expect most functions to work.
    00016 //
    00017 // This code is distributed under the GNU Public License
    00018 //      which can be found at http://www.gnu.org/licenses/gpl.txt
    00019 //
    00020 //*****************************************************************************
    00021
    00022 #ifndef WIN32
    00023     #include <avr/io.h>
    00024     #include <avr/interrupt.h>
    00025     #include <avr/pgmspace.h>
    00026     #include <math.h>
    00027     #include <stdlib.h>
    00028 #endif
    00029
    00030 #include "global.h"
    00031 #include "rprintf.h"
    00032 #include "gps.h"
    00033
    00034 // Global variables
    00035 GpsInfoType GpsInfo;
    00036
    00037 // Functions
    00038 void gpsInit(void)
    00039 {
    00040
    00041 }
    00042
    00043 GpsInfoType* gpsGetInfo(void)
    00044 {
    00045     return &GpsInfo;
    00046 }
    00047
    00048 void gpsInfoPrint(void)
    00049 {
    00050
    00051     rprintfProgStrM("TOW:      ");  rprintfFloat(8, GpsInfo.TimeOfWeek.f);          rprintfCRLF();
    00052     rprintfProgStrM("WkNum:    ");  rprintfNum(10,4,0,' ',GpsInfo.WeekNum);         rprintfCRLF();
    00053     rprintfProgStrM("UTCoffset:");  rprintfFloat(8, GpsInfo.UtcOffset.f);           rprintfCRLF();
    00054     rprintfProgStrM("Num SVs:  ");  rprintfNum(10,4,0,' ',GpsInfo.numSVs);          rprintfCRLF();
    00055
    00056     rprintfProgStrM("X_ECEF:   ");  rprintfFloat(8, GpsInfo.PosECEF.x.f);           rprintfCRLF();
    00057     rprintfProgStrM("Y_ECEF:   ");  rprintfFloat(8, GpsInfo.PosECEF.y.f);           rprintfCRLF();
    00058     rprintfProgStrM("Z_ECEF:   ");  rprintfFloat(8, GpsInfo.PosECEF.z.f);           rprintfCRLF();
    00059     rprintfProgStrM("TOF:      ");  rprintfFloat(8, GpsInfo.PosECEF.TimeOfFix.f);   rprintfCRLF();
    00060     rprintfProgStrM("Updates:  ");  rprintfNum(10,6,0,' ',GpsInfo.PosECEF.updates); rprintfCRLF();
    00061
    00062     //u08 str[20];
    00063     //rprintfProgStrM(" PosLat: ");     rprintfStr(dtostrf(GpsInfo.PosLat.f, 10, 5, str));
    00064     rprintfProgStrM("PosLat:   ");  rprintfFloat(8, 180*(GpsInfo.PosLLA.lat.f/PI)); rprintfCRLF();
    00065     rprintfProgStrM("PosLon:   ");  rprintfFloat(8, 180*(GpsInfo.PosLLA.lon.f/PI)); rprintfCRLF();
    00066     rprintfProgStrM("PosAlt:   ");  rprintfFloat(8, GpsInfo.PosLLA.alt.f);          rprintfCRLF();
    00067     rprintfProgStrM("TOF:      ");  rprintfFloat(8, GpsInfo.PosLLA.TimeOfFix.f);    rprintfCRLF();
    00068     rprintfProgStrM("Updates:  ");  rprintfNum(10,6,0,' ',GpsInfo.PosLLA.updates);  rprintfCRLF();
    00069
    00070     rprintfProgStrM("Vel East: ");  rprintfFloat(8, GpsInfo.VelENU.east.f);         rprintfCRLF();
    00071     rprintfProgStrM("Vel North:");  rprintfFloat(8, GpsInfo.VelENU.north.f);        rprintfCRLF();
    00072     rprintfProgStrM("Vel Up:   ");  rprintfFloat(8, GpsInfo.VelENU.up.f);           rprintfCRLF();
    00073 //  rprintfProgStrM("TOF:      ");  rprintfFloat(8, GpsInfo.VelENU.TimeOfFix.f);    rprintfCRLF();
    00074     rprintfProgStrM("Updates:  ");  rprintfNum(10,6,0,' ',GpsInfo.VelENU.updates);  rprintfCRLF();
    00075
    00076     rprintfProgStrM("Vel Head: ");  rprintfFloat(8, GpsInfo.VelHS.heading.f);       rprintfCRLF();
    00077     rprintfProgStrM("Vel Speed:");  rprintfFloat(8, GpsInfo.VelHS.speed.f);         rprintfCRLF();
    00078 //  rprintfProgStrM("TOF:      ");  rprintfFloat(8, GpsInfo.VelHS.TimeOfFix.f); rprintfCRLF();
    00079     rprintfProgStrM("Updates:  ");  rprintfNum(10,6,0,' ',GpsInfo.VelHS.updates);   rprintfCRLF();
    00080
    00081 }
    00082
    00083