507 |
kaklik |
1 |
/*! \file gps.c \brief GPS position storage and processing library. */
|
|
|
2 |
//*****************************************************************************
|
|
|
3 |
//
|
|
|
4 |
// File Name : 'gps.c'
|
|
|
5 |
// Title : GPS position storage and processing function library
|
|
|
6 |
// Author : Pascal Stang - Copyright (C) 2002-2005
|
|
|
7 |
// Created : 2005.01.14
|
|
|
8 |
// Revised : 2002.07.17
|
|
|
9 |
// Version : 0.1
|
|
|
10 |
// Target MCU : Atmel AVR Series
|
|
|
11 |
// Editor Tabs : 4
|
|
|
12 |
//
|
|
|
13 |
// NOTE: This code is currently below version 1.0, and therefore is considered
|
|
|
14 |
// to be lacking in some functionality or documentation, or may not be fully
|
|
|
15 |
// tested. Nonetheless, you can expect most functions to work.
|
|
|
16 |
//
|
|
|
17 |
// This code is distributed under the GNU Public License
|
|
|
18 |
// which can be found at http://www.gnu.org/licenses/gpl.txt
|
|
|
19 |
//
|
|
|
20 |
//*****************************************************************************
|
|
|
21 |
|
|
|
22 |
#ifndef WIN32
|
|
|
23 |
#include <avr/io.h>
|
|
|
24 |
#include <avr/interrupt.h>
|
|
|
25 |
#include <avr/pgmspace.h>
|
|
|
26 |
#include <math.h>
|
|
|
27 |
#include <stdlib.h>
|
|
|
28 |
#endif
|
|
|
29 |
|
|
|
30 |
#include "global.h"
|
|
|
31 |
#include "rprintf.h"
|
|
|
32 |
#include "gps.h"
|
|
|
33 |
|
|
|
34 |
// Global variables
|
|
|
35 |
GpsInfoType GpsInfo;
|
|
|
36 |
|
|
|
37 |
// Functions
|
|
|
38 |
void gpsInit(void)
|
|
|
39 |
{
|
|
|
40 |
|
|
|
41 |
}
|
|
|
42 |
|
|
|
43 |
GpsInfoType* gpsGetInfo(void)
|
|
|
44 |
{
|
|
|
45 |
return &GpsInfo;
|
|
|
46 |
}
|
|
|
47 |
|
|
|
48 |
void gpsInfoPrint(void)
|
|
|
49 |
{
|
|
|
50 |
|
|
|
51 |
rprintfProgStrM("TOW: "); rprintfFloat(8, GpsInfo.TimeOfWeek.f); rprintfCRLF();
|
|
|
52 |
rprintfProgStrM("WkNum: "); rprintfNum(10,4,0,' ',GpsInfo.WeekNum); rprintfCRLF();
|
|
|
53 |
rprintfProgStrM("UTCoffset:"); rprintfFloat(8, GpsInfo.UtcOffset.f); rprintfCRLF();
|
|
|
54 |
rprintfProgStrM("Num SVs: "); rprintfNum(10,4,0,' ',GpsInfo.numSVs); rprintfCRLF();
|
|
|
55 |
|
|
|
56 |
rprintfProgStrM("X_ECEF: "); rprintfFloat(8, GpsInfo.PosECEF.x.f); rprintfCRLF();
|
|
|
57 |
rprintfProgStrM("Y_ECEF: "); rprintfFloat(8, GpsInfo.PosECEF.y.f); rprintfCRLF();
|
|
|
58 |
rprintfProgStrM("Z_ECEF: "); rprintfFloat(8, GpsInfo.PosECEF.z.f); rprintfCRLF();
|
|
|
59 |
rprintfProgStrM("TOF: "); rprintfFloat(8, GpsInfo.PosECEF.TimeOfFix.f); rprintfCRLF();
|
|
|
60 |
rprintfProgStrM("Updates: "); rprintfNum(10,6,0,' ',GpsInfo.PosECEF.updates); rprintfCRLF();
|
|
|
61 |
|
|
|
62 |
//u08 str[20];
|
|
|
63 |
//rprintfProgStrM(" PosLat: "); rprintfStr(dtostrf(GpsInfo.PosLat.f, 10, 5, str));
|
|
|
64 |
rprintfProgStrM("PosLat: "); rprintfFloat(8, 180*(GpsInfo.PosLLA.lat.f/PI)); rprintfCRLF();
|
|
|
65 |
rprintfProgStrM("PosLon: "); rprintfFloat(8, 180*(GpsInfo.PosLLA.lon.f/PI)); rprintfCRLF();
|
|
|
66 |
rprintfProgStrM("PosAlt: "); rprintfFloat(8, GpsInfo.PosLLA.alt.f); rprintfCRLF();
|
|
|
67 |
rprintfProgStrM("TOF: "); rprintfFloat(8, GpsInfo.PosLLA.TimeOfFix.f); rprintfCRLF();
|
|
|
68 |
rprintfProgStrM("Updates: "); rprintfNum(10,6,0,' ',GpsInfo.PosLLA.updates); rprintfCRLF();
|
|
|
69 |
|
|
|
70 |
rprintfProgStrM("Vel East: "); rprintfFloat(8, GpsInfo.VelENU.east.f); rprintfCRLF();
|
|
|
71 |
rprintfProgStrM("Vel North:"); rprintfFloat(8, GpsInfo.VelENU.north.f); rprintfCRLF();
|
|
|
72 |
rprintfProgStrM("Vel Up: "); rprintfFloat(8, GpsInfo.VelENU.up.f); rprintfCRLF();
|
|
|
73 |
// rprintfProgStrM("TOF: "); rprintfFloat(8, GpsInfo.VelENU.TimeOfFix.f); rprintfCRLF();
|
|
|
74 |
rprintfProgStrM("Updates: "); rprintfNum(10,6,0,' ',GpsInfo.VelENU.updates); rprintfCRLF();
|
|
|
75 |
|
|
|
76 |
rprintfProgStrM("Vel Head: "); rprintfFloat(8, GpsInfo.VelHS.heading.f); rprintfCRLF();
|
|
|
77 |
rprintfProgStrM("Vel Speed:"); rprintfFloat(8, GpsInfo.VelHS.speed.f); rprintfCRLF();
|
|
|
78 |
// rprintfProgStrM("TOF: "); rprintfFloat(8, GpsInfo.VelHS.TimeOfFix.f); rprintfCRLF();
|
|
|
79 |
rprintfProgStrM("Updates: "); rprintfNum(10,6,0,' ',GpsInfo.VelHS.updates); rprintfCRLF();
|
|
|
80 |
|
|
|
81 |
}
|
|
|
82 |
|
|
|
83 |
|