1269 |
kakl |
1 |
/*! \file gps.h \brief GPS position storage and processing library. */ |
|
|
2 |
//***************************************************************************** |
|
|
3 |
// |
|
|
4 |
// File Name : 'gps.h' |
|
|
5 |
// Title : GPS position storage and processing function library |
|
|
6 |
// Author : Pascal Stang - Copyright (C) 2002 |
|
|
7 |
// Created : 2002.08.29 |
|
|
8 |
// Revised : 2002.08.29 |
|
|
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 |
/// \ingroup driver_hw |
|
|
18 |
/// \defgroup gps GPS Positioning and Navigation Function Library (gps.c) |
|
|
19 |
/// \code #include "gps.h" \endcode |
|
|
20 |
/// \par Overview |
|
|
21 |
/// This library provides a generic way to store and process information |
|
|
22 |
/// received from a GPS receiver. Currently the library only stores the most |
|
|
23 |
/// recent set of GPS data (position, velocity, time) from a GPS receiver. |
|
|
24 |
/// Future revisions will include navigation functions like calculate |
|
|
25 |
/// heading/distance to a waypoint. The processing of incoming serial data |
|
|
26 |
/// packets from GPS hardware is not done in this library. The libraries |
|
|
27 |
/// tsip.c and nmea.c do the packet processing for Trimble Standard Interface |
|
|
28 |
/// Protocol and NMEA-0813 repectively, and store the results in this library. |
|
|
29 |
// |
|
|
30 |
// This code is distributed under the GNU Public License |
|
|
31 |
// which can be found at http://www.gnu.org/licenses/gpl.txt |
|
|
32 |
// |
|
|
33 |
//***************************************************************************** |
|
|
34 |
|
|
|
35 |
#ifndef GPS_H |
|
|
36 |
#define GPS_H |
|
|
37 |
|
|
|
38 |
#include "global.h" |
|
|
39 |
|
|
|
40 |
char GPSlat[10]; |
|
|
41 |
char GPSlon[10]; |
|
|
42 |
|
|
|
43 |
// constants/macros/typdefs |
|
|
44 |
typedef union union_float_u32 |
|
|
45 |
{ |
|
|
46 |
float f; |
|
|
47 |
unsigned long i; |
|
|
48 |
unsigned char b[4]; |
|
|
49 |
} float_u32; |
|
|
50 |
|
|
|
51 |
typedef union union_double_u64 |
|
|
52 |
{ |
|
|
53 |
double f; |
|
|
54 |
unsigned long long i; |
|
|
55 |
unsigned char b[8]; |
|
|
56 |
} double_u64; |
|
|
57 |
|
|
|
58 |
struct PositionLLA |
|
|
59 |
{ |
|
|
60 |
float_u32 lat; |
|
|
61 |
float_u32 lon; |
|
|
62 |
float_u32 alt; |
|
|
63 |
float_u32 TimeOfFix; |
|
|
64 |
u16 updates; |
|
|
65 |
}; |
|
|
66 |
|
|
|
67 |
struct VelocityENU |
|
|
68 |
{ |
|
|
69 |
float_u32 east; |
|
|
70 |
float_u32 north; |
|
|
71 |
float_u32 up; |
|
|
72 |
float_u32 TimeOfFix; |
|
|
73 |
u16 updates; |
|
|
74 |
}; |
|
|
75 |
|
|
|
76 |
struct VelocityHS |
|
|
77 |
{ |
|
|
78 |
float_u32 heading; |
|
|
79 |
float_u32 speed; |
|
|
80 |
float_u32 TimeOfFix; |
|
|
81 |
u16 updates; |
|
|
82 |
}; |
|
|
83 |
|
|
|
84 |
struct PositionECEF |
|
|
85 |
{ |
|
|
86 |
float_u32 x; |
|
|
87 |
float_u32 y; |
|
|
88 |
float_u32 z; |
|
|
89 |
float_u32 TimeOfFix; |
|
|
90 |
u16 updates; |
|
|
91 |
}; |
|
|
92 |
|
|
|
93 |
struct VelocityECEF |
|
|
94 |
{ |
|
|
95 |
float_u32 x; |
|
|
96 |
float_u32 y; |
|
|
97 |
float_u32 z; |
|
|
98 |
float_u32 TimeOfFix; |
|
|
99 |
u16 updates; |
|
|
100 |
}; |
|
|
101 |
|
|
|
102 |
typedef struct struct_GpsInfo |
|
|
103 |
{ |
|
|
104 |
float_u32 TimeOfWeek; |
|
|
105 |
u16 WeekNum; |
|
|
106 |
float_u32 UtcOffset; |
|
|
107 |
u08 numSVs; |
|
|
108 |
|
|
|
109 |
struct PositionLLA PosLLA; |
|
|
110 |
struct PositionECEF PosECEF; |
|
|
111 |
struct VelocityECEF VelECEF; |
|
|
112 |
struct VelocityENU VelENU; |
|
|
113 |
struct VelocityHS VelHS; |
|
|
114 |
|
|
|
115 |
} GpsInfoType; |
|
|
116 |
|
|
|
117 |
// functions |
|
|
118 |
void gpsInit(void); |
|
|
119 |
GpsInfoType* gpsGetInfo(void); |
|
|
120 |
void gpsInfoPrint(void); |
|
|
121 |
void gpsInfoPrintLCD(void); |
|
|
122 |
void gpsInfoPrintLCD2(void); |
|
|
123 |
|
|
|
124 |
#endif |