![]() |
Paparazzi UAS
v5.8.2_stable-0-g6260b7c
Paparazzi is a free software Unmanned Aircraft System.
|
Basic parser for the NMEA protocol. More...
#include "subsystems/gps.h"
#include "subsystems/abi.h"
#include "led.h"
#include "math/pprz_geodetic_float.h"
#include <inttypes.h>
#include <string.h>
#include <math.h>
#include <stdlib.h>
#include <stdio.h>
Go to the source code of this file.
Macros | |
#define | NMEA_PRINT(...) {}; |
#define | WAIT 0 |
#define | GOT_START 1 |
#define | GOT_CHECKSUM 2 |
#define | GOT_END 3 |
Functions | |
static void | nmea_parse_GSA (void) |
Parse GSA NMEA messages. More... | |
static void | nmea_parse_RMC (void) |
Parse RMC NMEA messages. More... | |
static void | nmea_parse_GGA (void) |
Parse GGA NMEA messages. More... | |
static void | nmea_parse_GSV (void) |
Parse GSV-nmea-messages. More... | |
void | gps_impl_init (void) |
GPS initialization. More... | |
void | gps_nmea_msg (void) |
void WEAK | nmea_configure (void) |
The function to be called when a characted from the device is available. More... | |
void WEAK | nmea_parse_prop_init (void) |
void WEAK | nmea_parse_prop_msg (void) |
void | nmea_parse_msg (void) |
nmea_parse_char() has a complete line. More... | |
void | nmea_parse_char (uint8_t c) |
This is the actual parser. More... | |
uint8_t | nmea_calc_crc (const char *buff, int buff_sz) |
Calculate control sum of binary buffer. More... | |
Variables | |
struct GpsNmea | gps_nmea |
Basic parser for the NMEA protocol.
Status: Parsing GGA, RMC, GSA and GSV.
Definition in file gps_nmea.c.
#define GOT_CHECKSUM 2 |
Definition at line 59 of file gps_nmea.c.
Referenced by nmea_parse_char().
#define GOT_END 3 |
Definition at line 60 of file gps_nmea.c.
Referenced by nmea_parse_char().
#define GOT_START 1 |
Definition at line 58 of file gps_nmea.c.
Referenced by nmea_parse_char().
#define NMEA_PRINT | ( | ... | ) | {}; |
Definition at line 49 of file gps_nmea.c.
Referenced by nmea_parse_char(), nmea_parse_GGA(), nmea_parse_GSA(), nmea_parse_GSV(), nmea_parse_msg(), and nmea_parse_RMC().
#define WAIT 0 |
Definition at line 57 of file gps_nmea.c.
Referenced by nmea_parse_char(), and nmea_parse_msg().
void gps_impl_init | ( | void | ) |
GPS initialization.
GPS model specific init implementation.
Definition at line 70 of file gps_nmea.c.
References FALSE, gps, GPS_NB_CHANNELS, GpsNmea::gps_nb_ovrn, gps_nmea, GpsNmea::have_gsv, GpsNmea::is_configured, GpsNmea::msg_available, GpsNmea::msg_len, GpsState::nb_channels, nmea_configure(), nmea_parse_prop_init(), and GpsNmea::pos_available.
void gps_nmea_msg | ( | void | ) |
Definition at line 83 of file gps_nmea.c.
References FALSE, GpsState::fix, get_sys_time_usec(), gps, GPS_FIX_3D, gps_nmea, GPS_NMEA_ID, GpsState::last_3dfix_ticks, GpsState::last_3dfix_time, GpsState::last_msg_ticks, GpsState::last_msg_time, GpsNmea::msg_available, sys_time::nb_sec, sys_time::nb_sec_rem, nmea_parse_msg(), and GpsNmea::pos_available.
Referenced by GpsEvent().
uint8_t nmea_calc_crc | ( | const char * | buff, |
int | buff_sz | ||
) |
Calculate control sum of binary buffer.
Definition at line 225 of file gps_nmea.c.
Referenced by nmea_configure().
void WEAK nmea_configure | ( | void | ) |
The function to be called when a characted from the device is available.
The function to be called when a characted from the device is available.
Sets gps_nmea.is_configured to TRUE if all config msgs are sent.
Definition at line 101 of file gps_nmea.c.
References buf, crc, furuno_cfg_cnt, gps_furuno_settings, GPS_FURUNO_SETTINGS_NB, gps_nmea, GpsLinkDevice, GpsNmea::is_configured, nmea_calc_crc(), and TRUE.
Referenced by gps_impl_init(), and GpsEvent().
void nmea_parse_char | ( | uint8_t | c | ) |
This is the actual parser.
It reads one character at a time setting gps_nmea.msg_available to TRUE after a full line.
Definition at line 156 of file gps_nmea.c.
References GOT_CHECKSUM, GOT_END, GOT_START, gps_nmea, GpsNmea::msg_available, GpsNmea::msg_buf, GpsNmea::msg_len, NMEA_MAXLEN, NMEA_PRINT, GpsNmea::status, TRUE, and WAIT.
Referenced by GpsEvent().
|
static |
Parse GGA NMEA messages.
GGA has essential fix data providing 3D location and HDOP. Msg stored in gps_nmea.msg_buf.
Definition at line 353 of file gps_nmea.c.
References LlaCoor_f::alt, LlaCoor_i::alt, UtmCoor_i::alt, UtmCoor_f::east, UtmCoor_i::east, ecef_of_lla_f(), GpsState::ecef_pos, FALSE, gps, gps_nmea, GpsState::hmsl, LlaCoor_f::lat, LlaCoor_i::lat, GpsState::lla_pos, LlaCoor_f::lon, LlaCoor_i::lon, GpsNmea::msg_buf, nav_utm_zone0, NMEA_PRINT, nmea_read_until(), UtmCoor_f::north, UtmCoor_i::north, GpsState::num_sv, GpsNmea::pos_available, GpsState::tow, TRUE, utm_of_lla_f(), GpsState::utm_pos, EcefCoor_f::x, EcefCoor_i::x, EcefCoor_f::y, EcefCoor_i::y, EcefCoor_f::z, EcefCoor_i::z, UtmCoor_f::zone, and UtmCoor_i::zone.
Referenced by nmea_parse_msg().
|
static |
Parse GSA NMEA messages.
GPS DOP and active satellites. Msg stored in gps_nmea.msg_buf.
Definition at line 242 of file gps_nmea.c.
References GpsState::fix, gps, gps_nmea, GpsNmea::have_gsv, GpsNmea::msg_buf, NMEA_PRINT, nmea_read_until(), GpsState::pdop, SVinfo::svid, and GpsState::svinfos.
Referenced by nmea_parse_msg().
|
static |
Parse GSV-nmea-messages.
Msg stored in gps_nmea.msg_buf.
Definition at line 479 of file gps_nmea.c.
References SVinfo::azim, SVinfo::cno, SVinfo::elev, FALSE, gps, gps_nmea, GpsNmea::msg_buf, NMEA_PRINT, nmea_read_until(), SVinfo::svid, GpsState::svinfos, and TRUE.
Referenced by nmea_parse_msg().
void nmea_parse_msg | ( | void | ) |
nmea_parse_char() has a complete line.
Find out what type of message it is and hand it to the parser for that type.
Definition at line 119 of file gps_nmea.c.
References gps_nmea, GpsNmea::have_gsv, GpsNmea::msg_buf, GpsNmea::msg_len, nmea_parse_GGA(), nmea_parse_GSA(), nmea_parse_GSV(), nmea_parse_prop_msg(), nmea_parse_RMC(), NMEA_PRINT, GpsNmea::status, TRUE, and WAIT.
Referenced by gps_nmea_msg().
void WEAK nmea_parse_prop_init | ( | void | ) |
Definition at line 106 of file gps_nmea.c.
References furuno_cfg_cnt.
Referenced by gps_impl_init().
void WEAK nmea_parse_prop_msg | ( | void | ) |
Definition at line 110 of file gps_nmea.c.
References gps_nmea, GpsNmea::msg_buf, GpsNmea::msg_len, and nmea_parse_perdcrv().
Referenced by nmea_parse_msg().
|
static |
Parse RMC NMEA messages.
Recommended minimum GPS sentence. Msg stored in gps_nmea.msg_buf.
Definition at line 308 of file gps_nmea.c.
References GpsState::course, gps, gps_nmea, GpsState::gspeed, GpsNmea::msg_buf, NMEA_PRINT, and nmea_read_until().
Referenced by nmea_parse_msg().
struct GpsNmea gps_nmea |
Definition at line 62 of file gps_nmea.c.
Referenced by gps_impl_init(), gps_nmea_msg(), GpsEvent(), nmea_configure(), nmea_parse_char(), nmea_parse_GGA(), nmea_parse_GSA(), nmea_parse_GSV(), nmea_parse_msg(), nmea_parse_perdcrv(), nmea_parse_prop_msg(), nmea_parse_RMC(), and nmea_read_until().