Paparazzi UAS v7.0_unstable
Paparazzi is a free software Unmanned Aircraft System.
All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Modules Pages
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 "modules/gps/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
54
55extern struct GpsNmea gps_nmea;
56
57extern void gps_nmea_init(void);
58extern 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
70extern void nmea_configure(void);
71extern void nmea_parse_char(uint8_t c);
72extern bool nmea_parse_msg(void);
73extern uint8_t nmea_calc_crc(const char *buff, int buff_sz);
74extern void nmea_parse_prop_init(void);
75extern bool nmea_parse_prop_msg(void);
76extern void nmea_gps_msg(void);
77
79static 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 */
Device independent GPS code (interface)
data structure for GPS information
Definition gps.h:87
struct GpsNmea gps_nmea
Definition gps_nmea.c:59
uint8_t status
line parser status
Definition gps_nmea.h:50
int msg_len
Definition gps_nmea.h:49
static void nmea_read_until(int *i)
Read until a certain character, placed here for proprietary includes.
Definition gps_nmea.h:79
bool nmea_parse_msg(void)
nmea_parse_char() has a complete line.
Definition gps_nmea.c:133
void gps_nmea_init(void)
Definition gps_nmea.c:66
uint8_t nmea_calc_crc(const char *buff, int buff_sz)
Calculate control sum of binary buffer.
Definition gps_nmea.c:243
struct GpsState state
Definition gps_nmea.h:52
bool have_gsv
flag set to TRUE if GPGSV message received
Definition gps_nmea.h:46
uint8_t gps_nb_ovrn
number if incomplete nmea-messages
Definition gps_nmea.h:47
void gps_nmea_event(void)
Definition gps_nmea.c:78
#define NMEA_MAXLEN
Definition gps_nmea.h:37
bool nmea_parse_prop_msg(void)
Definition gps_furuno.c:96
void nmea_gps_msg(void)
Definition gps_nmea.c:95
bool msg_available
flag set to TRUE if a new msg/sentence is available to be parsed
Definition gps_nmea.h:44
void nmea_parse_prop_init(void)
Definition gps_furuno.c:90
bool is_configured
flag set to TRUE if configuration is finished
Definition gps_nmea.h:45
char msg_buf[NMEA_MAXLEN]
buffer for storing one nmea-line
Definition gps_nmea.h:48
void nmea_parse_char(uint8_t c)
This is the actual parser.
Definition gps_nmea.c:174
void nmea_configure(void)
The function to be called when a characted from the device is available.
Definition gps_furuno.c:66
uint8_t buff[25]
Buffer used for general comunication over SPI (in buffer)
uint16_t foo
Definition main_demo5.c:58
arch independent UART (Universal Asynchronous Receiver/Transmitter) API
unsigned char uint8_t
Typedef defining 8 bit unsigned char type.