Paparazzi UAS  v5.8.2_stable-0-g6260b7c
Paparazzi is a free software Unmanned Aircraft System.
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Modules Pages
gps_sirf.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2012 Freek van Tienen
3  *
4  * This file is part of paparazzi.
5  *
6  * paparazzi is free software; you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License as published by
8  * the Free Software Foundation; either version 2, or (at your option)
9  * any later version.
10  *
11  * paparazzi is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14  * GNU General Public License for more details.
15  *
16  * You should have received a copy of the GNU General Public License
17  * along with paparazzi; see the file COPYING. If not, write to
18  * the Free Software Foundation, 59 Temple Place - Suite 330,
19  * Boston, MA 02111-1307, USA.
20  *
21  */
22 
29 #ifndef GPS_SIRF_H
30 #define GPS_SIRF_H
31 
32 #include "std.h"
33 
34 #define GPS_NB_CHANNELS 16
35 #define SIRF_MAXLEN 255
36 
37 //Read states
38 #define UNINIT 0
39 #define GOT_A0 1
40 #define GOT_A2 2
41 #define GOT_B0 3
42 
43 struct GpsSirf {
44  bool_t msg_available;
45  bool_t pos_available;
47  int msg_len;
49 };
50 
51 extern struct GpsSirf gps_sirf;
52 
53 //Invert bytes
54 #define Invert2Bytes(x) ((x>>8) | (x<<8))
55 #define Invert4Bytes(x) ((x>>24) | ((x<<8) & 0x00FF0000) | ((x>>8) & 0x0000FF00) | (x<<24))
56 
58 struct sirf_msg_2 {
84 } __attribute__((packed));
85 
86 
88 struct sirf_msg_41 {
125 } __attribute__((packed));
126 
127 /*
128  * This part is used by the autopilot to read data from a uart
129  */
130 #include "mcu_periph/link_device.h"
131 #include "mcu_periph/uart.h"
132 
133 extern void sirf_parse_char(uint8_t c);
134 extern void sirf_parse_msg(void);
135 extern void gps_sirf_msg(void);
136 
137 static inline void GpsEvent(void)
138 {
139  struct link_device *dev = &((GPS_LINK).device);
140 
141  while (dev->char_available(dev->periph)) {
142  sirf_parse_char(dev->get_byte(dev->periph));
143  if (gps_sirf.msg_available) {
144  gps_sirf_msg();
145  }
146  }
147 }
148 
149 #endif /* GPS_SIRF_H */
int8_t map_datum
Definition: gps_sirf.h:105
unsigned short uint16_t
Definition: types.h:16
uint8_t ch10prn
Definition: gps_sirf.h:81
arch independent UART (Universal Asynchronous Receiver/Transmitter) API
void sirf_parse_msg(void)
Definition: gps_sirf.c:193
uint16_t distance_err
in meters
Definition: gps_sirf.h:120
uint8_t ch8prn
Definition: gps_sirf.h:79
uint8_t mode2
Definition: gps_sirf.h:68
int msg_len
Definition: gps_sirf.h:47
#define SIRF_MAXLEN
Definition: gps_sirf.h:35
uint32_t tow
time of week in seconds *10^3]
Definition: gps_sirf.h:93
bool_t msg_available
Definition: gps_sirf.h:44
uint8_t ch3prn
Definition: gps_sirf.h:74
uint8_t ch11prn
Definition: gps_sirf.h:82
uint32_t evpe
estimated vertical position error, in meters * 10^2
Definition: gps_sirf.h:112
uint32_t ete
estimated time error, in seconds * 10^2
Definition: gps_sirf.h:113
int16_t vx
x-velocity * 8 in m/s
Definition: gps_sirf.h:63
uint32_t clock_bias_err
in m * 10^2
Definition: gps_sirf.h:116
uint8_t ch1prn
pseudo-random noise, 12 channels
Definition: gps_sirf.h:72
uint8_t ch5prn
Definition: gps_sirf.h:76
int32_t longitude
in degrees (+= East) *10*7
Definition: gps_sirf.h:102
int16_t vy
y-velocity * 8 in m/s
Definition: gps_sirf.h:64
int16_t climb_rate
in m/s * 10^2
Definition: gps_sirf.h:109
uint8_t msg_id
hex value 0x29 (= decimal 41)
Definition: gps_sirf.h:89
uint32_t ehpe
estimated horizontal position error, in meters * 10^2
Definition: gps_sirf.h:111
static void GpsEvent(void)
Definition: gps_sirf.h:137
uint8_t minute
Definition: gps_sirf.h:98
int16_t mag_var
not implemented
Definition: gps_sirf.h:108
int32_t x_pos
x-position in m
Definition: gps_sirf.h:60
int16_t vz
z-velocity * 8 in m/s
Definition: gps_sirf.h:65
int32_t z_pos
z-position in m
Definition: gps_sirf.h:62
uint8_t ch6prn
Definition: gps_sirf.h:77
uint8_t month
Definition: gps_sirf.h:95
uint16_t second
Definition: gps_sirf.h:99
void gps_sirf_msg(void)
Definition: gps_sirf.c:51
uint8_t day
Definition: gps_sirf.h:96
uint8_t msg_id
hex value 0x02 ( = decimal 2)
Definition: gps_sirf.h:59
uint8_t ch7prn
Definition: gps_sirf.h:78
uint32_t tow
time of week in seconds * 10^2
Definition: gps_sirf.h:70
Message ID 2 from GPS.
Definition: gps_sirf.h:58
uint16_t sog
speed over ground, in m/s * 10^2
Definition: gps_sirf.h:106
bool_t pos_available
Definition: gps_sirf.h:45
uint16_t ehve
estimated horizontal velocity error in m/s * 10^2
Definition: gps_sirf.h:114
unsigned long uint32_t
Definition: types.h:18
uint16_t week
Definition: gps_sirf.h:69
uint8_t num_sat
Number of satellites used for solution.
Definition: gps_sirf.h:122
signed short int16_t
Definition: types.h:17
void sirf_parse_char(uint8_t c)
Definition: gps_sirf.c:68
uint16_t nav_type
Definition: gps_sirf.h:91
Message ID 41 from GPS.
Definition: gps_sirf.h:88
int16_t heading_rate
in deg/s * 10^2
Definition: gps_sirf.h:110
uint8_t mode1
Definition: gps_sirf.h:66
uint8_t ch9prn
Definition: gps_sirf.h:80
signed long int32_t
Definition: types.h:19
uint8_t hdop
horizontal dilution of precision *5 (0.2 precision)
Definition: gps_sirf.h:67
static const struct usb_device_descriptor dev
Definition: usb_ser_hw.c:69
char msg_buf[SIRF_MAXLEN]
buffer for storing one nmea-line
Definition: gps_sirf.h:46
uint16_t cog
course over ground, in degrees clockwise from true north * 10^2
Definition: gps_sirf.h:107
struct GpsSirf gps_sirf
Definition: gps_sirf.c:39
unsigned char uint8_t
Definition: types.h:14
uint8_t add_info
Additional mode info.
Definition: gps_sirf.h:124
uint32_t distance
Distance traveled since reset in m.
Definition: gps_sirf.h:119
int32_t latitude
in degrees (+= North) *10^7
Definition: gps_sirf.h:101
uint16_t heading_err
in degrees * 10^2
Definition: gps_sirf.h:121
int32_t y_pos
y-position in m
Definition: gps_sirf.h:61
uint8_t hdop
Horizontal dilution of precision x 5 (0.2 precision)
Definition: gps_sirf.h:123
int read_state
Definition: gps_sirf.h:48
int32_t clock_drift
in m/s * 10^2
Definition: gps_sirf.h:117
uint8_t ch2prn
Definition: gps_sirf.h:73
int32_t alt_ellipsoid
in meters *10^2
Definition: gps_sirf.h:103
uint16_t nav_valid
if equal to 0x0000, then navigation solution is valid
Definition: gps_sirf.h:90
int32_t alt_msl
in meters *10^2
Definition: gps_sirf.h:104
signed char int8_t
Definition: types.h:15
uint8_t hour
Definition: gps_sirf.h:97
uint16_t extended_week_number
Definition: gps_sirf.h:92
uint8_t ch12prn
Definition: gps_sirf.h:83
uint8_t ch4prn
Definition: gps_sirf.h:75
uint16_t year
Definition: gps_sirf.h:94
uint8_t num_sat
Number of satellites in fix.
Definition: gps_sirf.h:71
int32_t clock_bias
in m * 10^2
Definition: gps_sirf.h:115
uint32_t clock_drift_err
in m/s * 10^2
Definition: gps_sirf.h:118
uint32_t sat_id
satellites used in solution. Each satellite corresponds with a bit, e.g. bit 1 ON = SV 1 is used in s...
Definition: gps_sirf.h:100