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);
Main include for ABI (AirBorneInterface).
uint32_t get_sys_time_usec(void)
Get the time in microseconds since startup.
Device independent GPS code (interface)
int16_t azim
azimuth in deg
uint32_t tow
GPS time of week in ms.
int32_t hmsl
height above mean sea level (MSL) in mm
int8_t elev
elevation in deg
struct LlaCoor_i lla_pos
position in LLA (lat,lon: deg*1e7; alt: mm over ellipsoid)
int32_t course
GPS course over ground in rad*1e7, [0, 2*Pi]*1e7 (CW/north)
uint8_t cno
Carrier to Noise Ratio (Signal Strength) in dbHz.
struct EcefCoor_i ecef_pos
position in ECEF in cm
#define GPS_VALID_POS_LLA_BIT
uint32_t last_3dfix_ticks
cpu time ticks at last valid 3D fix
uint16_t pdop
position dilution of precision scaled by 100
#define GPS_VALID_POS_ECEF_BIT
#define GPS_VALID_HMSL_BIT
uint32_t last_msg_time
cpu time in sec at last received GPS message
uint8_t svid
Satellite ID.
uint8_t nb_channels
Number of scanned satellites.
uint32_t last_3dfix_time
cpu time in sec at last valid 3D fix
uint16_t gspeed
norm of 2d ground speed in cm/s
uint8_t valid_fields
bitfield indicating valid fields (GPS_VALID_x_BIT)
#define GPS_FIX_3D
3D GPS fix
struct SVinfo svinfos[GPS_NB_CHANNELS]
holds information from the Space Vehicles (Satellites)
#define GPS_VALID_COURSE_BIT
uint32_t last_msg_ticks
cpu time ticks at last received GPS message
uint8_t num_sv
number of sat in fix
static bool nmea_parse_RMC(void)
Parse RMC NMEA messages.
bool nmea_parse_msg(void)
nmea_parse_char() has a complete line.
static bool nmea_parse_GSV(void)
Parse GSV-nmea-messages.
bool WEAK nmea_parse_prop_msg(void)
uint8_t nmea_calc_crc(const char *buff, int buff_sz)
Calculate control sum of binary buffer.
static bool nmea_parse_GSA(void)
Parse GSA NMEA messages.
void gps_nmea_event(void)
void WEAK nmea_parse_prop_init(void)
void WEAK nmea_configure(void)
The function to be called when a characted from the device is available.
void nmea_parse_char(uint8_t c)
This is the actual parser.
static bool nmea_parse_GGA(void)
Parse GGA NMEA messages.
NMEA protocol specific code.
#define GPS_NMEA_NB_CHANNELS
uint8_t status
line parser status
static void nmea_read_until(int *i)
Read until a certain character, placed here for proprietary includes.
bool have_gsv
flag set to TRUE if GPGSV message received
uint8_t gps_nb_ovrn
number if incomplete nmea-messages
bool msg_available
flag set to TRUE if a new msg/sentence is available to be parsed
bool is_configured
flag set to TRUE if configuration is finished
char msg_buf[NMEA_MAXLEN]
buffer for storing one nmea-line
int32_t lat
in degrees*1e7
int32_t alt
in millimeters above WGS84 reference ellipsoid
int32_t lon
in degrees*1e7
uint8_t buff[25]
Buffer used for general comunication over SPI (in buffer)
arch independent LED (Light Emitting Diodes) API
void ecef_of_lla_f(struct EcefCoor_f *out, struct LlaCoor_f *in)
Paparazzi floating point math for geodetic calculations.
float alt
in meters (normally above WGS84 reference ellipsoid)
vector in EarthCenteredEarthFixed coordinates
vector in Latitude, Longitude and Altitude
static const struct usb_device_descriptor dev
volatile uint32_t nb_sec
full seconds since startup
volatile uint32_t nb_sec_rem
remainder of seconds since startup in CPU_TICKS
unsigned int uint32_t
Typedef defining 32 bit unsigned int type.
unsigned char uint8_t
Typedef defining 8 bit unsigned char type.