|
Paparazzi UAS
v5.18.0_stable
Paparazzi is a free software Unmanned Aircraft System.
|
Go to the documentation of this file.
46 #define NMEA_PRINT(...) {};
49 #if NMEA_PRINT == printf
56 #define GOT_CHECKSUM 2
80 struct link_device *
dev = &((NMEA_GPS_LINK).device);
86 while (
dev->char_available(
dev->periph)) {
135 bool msg_valid =
false;
205 NMEA_PRINT(
"nmea_parse_char: skipping incomplete msg: len=%i, \"%s\"\n\r",
218 NMEA_PRINT(
"nmea_parse_char: msg too long, len=%i, \"%s\"\n\r",
232 NMEA_PRINT(
"nmea_parse_char: this should not happen!");
248 for (it = 0; it < buff_sz; ++it) {
267 NMEA_PRINT(
"p_GSA() - skipping empty message\n\r");
287 for (prn_cnt = 0; prn_cnt < 12; prn_cnt++) {
290 NMEA_PRINT(
"p_GSA() - PRN %i=%i\n\r", satcount, prn);
311 float hdop __attribute__((unused)) = strtof(&
gps_nmea.
msg_buf[i], NULL);
316 float vdop __attribute__((unused)) = strtof(&
gps_nmea.
msg_buf[i], NULL);
336 NMEA_PRINT(
"p_RMC() - skipping empty message\n\r");
383 double degrees, minutesfrac;
388 NMEA_PRINT(
"p_GGA() - skipping empty message\n\r");
402 minutesfrac = modf(
lat / 100, °rees);
403 lat = degrees + (minutesfrac * 100) / 60;
412 lla_f.
lat = RadOfDeg(
lat);
421 minutesfrac = modf(
lon / 100, °rees);
422 lon = degrees + (minutesfrac * 100) / 60;
431 lla_f.
lon = RadOfDeg(
lon);
441 NMEA_PRINT(
"p_GGA() - POS_AVAILABLE == TRUE\n\r");
443 NMEA_PRINT(
"p_GGA() - gps_pos_available == false\n\r");
469 NMEA_PRINT(
"p_GGA() - geoid alt=%f\n\r", geoid);
471 lla_f.
alt = hmsl + geoid;
504 NMEA_PRINT(
"p_GSV() - skipping empty message\n\r");
511 bool is_glonass =
false;
518 NMEA_PRINT(
"p_GSV() - %i sentences\n\r", nb_sen);
523 NMEA_PRINT(
"p_GSV() - sentence=%i\n\r", cur_sen);
528 NMEA_PRINT(
"p_GSV() - num_sat=%i\n\r", num_sat);
533 for (sat_cnt = 0; sat_cnt < 4; sat_cnt++) {
545 int ch_idx = (cur_sen - 1) * 4 + sat_cnt;
547 if (!is_glonass && ch_idx > 0 && ch_idx < 12) {
554 NMEA_PRINT(
"p_GSV() - GLONASS %i PRN=%i elev=%i azim=%i snr=%i\n\r", ch_idx, prn, elev, azim, snr);
557 NMEA_PRINT(
"p_GSV() - GPS %i PRN=%i elev=%i azim=%i snr=%i\n\r", ch_idx, prn, elev, azim, snr);
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
bool nmea_parse_msg(void)
nmea_parse_char() has a complete line.
int32_t lon
in degrees*1e7
uint8_t valid_fields
bitfield indicating valid fields (GPS_VALID_x_BIT)
int32_t alt
in millimeters above WGS84 reference ellipsoid
#define GPS_VALID_COURSE_BIT
uint8_t gps_nb_ovrn
number if incomplete nmea-messages
int16_t azim
azimuth in deg
#define GPS_NMEA_NB_CHANNELS
uint8_t status
line parser status
uint32_t tow
GPS time of week in ms.
bool msg_available
flag set to TRUE if a new msg/sentence is available to be parsed
static void nmea_read_until(int *i)
Read until a certain character, placed here for proprietary includes.
uint8_t nb_channels
Number of scanned satellites.
void WEAK nmea_parse_prop_init(void)
uint8_t buff[25]
Buffer used for general comunication over SPI (in buffer)
void ecef_of_lla_f(struct EcefCoor_f *out, struct LlaCoor_f *in)
#define GPS_VALID_POS_LLA_BIT
uint32_t get_sys_time_usec(void)
Get the time in microseconds since startup.
int32_t lat
in degrees*1e7
void WEAK nmea_configure(void)
The function to be called when a characted from the device is available.
uint32_t last_msg_ticks
cpu time ticks at last received GPS message
static bool nmea_parse_GSA(void)
Parse GSA NMEA messages.
Paparazzi floating point math for geodetic calculations.
uint8_t cno
Carrier to Noise Ratio (Signal Strength) in dbHz.
Device independent GPS code (interface)
static const struct usb_device_descriptor dev
uint8_t svid
Satellite ID.
bool is_configured
flag set to TRUE if configuration is finished
char msg_buf[NMEA_MAXLEN]
buffer for storing one nmea-line
uint16_t gspeed
norm of 2d ground speed in cm/s
uint32_t last_3dfix_time
cpu time in sec at last valid 3D fix
uint32_t last_3dfix_ticks
cpu time ticks at last valid 3D fix
arch independent LED (Light Emitting Diodes) API
void gps_nmea_event(void)
float alt
in meters (normally above WGS84 reference ellipsoid)
static bool nmea_parse_GGA(void)
Parse GGA NMEA messages.
bool have_gsv
flag set to TRUE if GPGSV message received
int32_t course
GPS course over ground in rad*1e7, [0, 2*Pi]*1e7 (CW/north)
void nmea_parse_char(uint8_t c)
This is the actual parser.
uint32_t last_msg_time
cpu time in sec at last received GPS message
struct EcefCoor_i ecef_pos
position in ECEF in cm
static bool nmea_parse_GSV(void)
Parse GSV-nmea-messages.
struct LlaCoor_i lla_pos
position in LLA (lat,lon: deg*1e7; alt: mm over ellipsoid)
vector in EarthCenteredEarthFixed coordinates
uint8_t num_sv
number of sat in fix
volatile uint32_t nb_sec_rem
remainder of seconds since startup in CPU_TICKS
int32_t hmsl
height above mean sea level (MSL) in mm
int8_t elev
elevation in deg
uint16_t pdop
position dilution of precision scaled by 100
uint8_t nmea_calc_crc(const char *buff, int buff_sz)
Calculate control sum of binary buffer.
#define GPS_VALID_POS_ECEF_BIT
static bool nmea_parse_RMC(void)
Parse RMC NMEA messages.
volatile uint32_t nb_sec
full seconds since startup
struct SVinfo svinfos[GPS_NB_CHANNELS]
holds information from the Space Vehicles (Satellites)
bool WEAK nmea_parse_prop_msg(void)
#define GPS_FIX_3D
3D GPS fix
#define GPS_VALID_HMSL_BIT
vector in Latitude, Longitude and Altitude