Paparazzi UAS  v5.18.0_stable
Paparazzi is a free software Unmanned Aircraft System.
gps_nmea.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2004-2011 The Paparazzi Team
3  * 2014 Freek van Tienen <freek.v.tienen@gmail.com>
4  *
5  * This file is part of paparazzi.
6  *
7  * paparazzi is free software; you can redistribute it and/or modify
8  * it under the terms of the GNU General Public License as published by
9  * the Free Software Foundation; either version 2, or (at your option)
10  * any later version.
11  *
12  * paparazzi is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15  * GNU General Public License for more details.
16  *
17  * You should have received a copy of the GNU General Public License
18  * along with paparazzi; see the file COPYING. If not, write to
19  * the Free Software Foundation, 59 Temple Place - Suite 330,
20  * Boston, MA 02111-1307, USA.
21  *
22  */
23 
29 #ifndef GPS_NMEA_H
30 #define GPS_NMEA_H
31 
32 #include "mcu_periph/uart.h"
33 #include "subsystems/gps.h"
34 
35 #define GPS_NMEA_NB_CHANNELS 12
36 
37 #define NMEA_MAXLEN 255
38 
39 #ifndef PRIMARY_GPS
40 #define PRIMARY_GPS GPS_NMEA
41 #endif
42 
43 struct GpsNmea {
46  bool have_gsv;
49  int msg_len;
51 
52  struct GpsState state;
53 };
54 
55 extern struct GpsNmea gps_nmea;
56 
57 extern void gps_nmea_init(void);
58 extern void gps_nmea_event(void);
59 
60 #define gps_nmea_periodic_check() gps_periodic_check(&gps_nmea.state)
61 
62 
63 /*
64  * This part is used by the autopilot to read data from a uart
65  */
66 
68 #include "pprzlink/pprzlink_device.h"
69 
70 extern void nmea_configure(void);
71 extern void nmea_parse_char(uint8_t c);
72 extern bool nmea_parse_msg(void);
73 extern uint8_t nmea_calc_crc(const char *buff, int buff_sz);
74 extern void nmea_parse_prop_init(void);
75 extern bool nmea_parse_prop_msg(void);
76 extern void nmea_gps_msg(void);
77 
79 static inline void nmea_read_until(int *i)
80 {
81  while (gps_nmea.msg_buf[(*i)++] != ',') {
82  if (*i >= gps_nmea.msg_len) {
83  return;
84  }
85  }
86 }
87 
88 #endif /* GPS_NMEA_H */
c
VIC slots used for the LPC2148 define name e g gps UART1_VIC_SLOT e g modem SPI1_VIC_SLOT SPI1 in mcu_periph spi_arch c or spi_slave_hs_arch c(and some others not using the SPI peripheral yet..) I2C0_VIC_SLOT 8 mcu_periph/i2c_arch.c I2C1_VIC_SLOT 9 mcu_periph/i2c_arch.c USB_VIC_SLOT 10 usb
nmea_parse_prop_init
void nmea_parse_prop_init(void)
Definition: gps_furuno.c:90
gps_nmea_init
void gps_nmea_init(void)
Definition: gps_nmea.c:66
GpsNmea::gps_nb_ovrn
uint8_t gps_nb_ovrn
number if incomplete nmea-messages
Definition: gps_nmea.h:47
GpsNmea::status
uint8_t status
line parser status
Definition: gps_nmea.h:50
GpsNmea::msg_available
bool msg_available
flag set to TRUE if a new msg/sentence is available to be parsed
Definition: gps_nmea.h:44
nmea_read_until
static void nmea_read_until(int *i)
Read until a certain character, placed here for proprietary includes.
Definition: gps_nmea.h:79
GpsState
data structure for GPS information
Definition: gps.h:87
buff
uint8_t buff[25]
Buffer used for general comunication over SPI (in buffer)
Definition: high_speed_logger_direct_memory.c:130
uart.h
arch independent UART (Universal Asynchronous Receiver/Transmitter) API
gps.h
Device independent GPS code (interface)
GpsNmea
Definition: gps_nmea.h:43
GpsNmea::is_configured
bool is_configured
flag set to TRUE if configuration is finished
Definition: gps_nmea.h:45
NMEA_MAXLEN
#define NMEA_MAXLEN
Definition: gps_nmea.h:37
GpsNmea::msg_buf
char msg_buf[NMEA_MAXLEN]
buffer for storing one nmea-line
Definition: gps_nmea.h:48
uint8_t
unsigned char uint8_t
Definition: types.h:14
GpsNmea::have_gsv
bool have_gsv
flag set to TRUE if GPGSV message received
Definition: gps_nmea.h:46
GpsNmea::state
struct GpsState state
Definition: gps_nmea.h:52
nmea_parse_msg
bool nmea_parse_msg(void)
nmea_parse_char() has a complete line.
Definition: gps_nmea.c:133
nmea_parse_char
void nmea_parse_char(uint8_t c)
This is the actual parser.
Definition: gps_nmea.c:174
nmea_gps_msg
void nmea_gps_msg(void)
Definition: gps_nmea.c:95
gps_nmea_event
void gps_nmea_event(void)
Definition: gps_nmea.c:78
nmea_calc_crc
uint8_t nmea_calc_crc(const char *buff, int buff_sz)
Calculate control sum of binary buffer.
Definition: gps_nmea.c:243
nmea_parse_prop_msg
bool nmea_parse_prop_msg(void)
Definition: gps_furuno.c:96
gps_nmea
struct GpsNmea gps_nmea
Definition: gps_nmea.c:59
GpsNmea::msg_len
int msg_len
Definition: gps_nmea.h:49
nmea_configure
void nmea_configure(void)
The function to be called when a characted from the device is available.
Definition: gps_furuno.c:66