49 #define NMEA_PRINT(...) {};
52 #if NMEA_PRINT == printf
59 #define GOT_CHECKSUM 2
187 NMEA_PRINT(
"nmea_parse_char: skipping incomplete msg: len=%i, \"%s\"\n\r",
200 NMEA_PRINT(
"nmea_parse_char: msg too long, len=%i, \"%s\"\n\r",
214 NMEA_PRINT(
"nmea_parse_char: this should not happen!");
230 for (it = 0; it < buff_sz; ++it) {
248 NMEA_PRINT(
"p_GSA() - skipping empty message\n\r");
268 for (prn_cnt = 0; prn_cnt < 12; prn_cnt++) {
271 NMEA_PRINT(
"p_GSA() - PRN %i=%i\n\r", satcount, prn);
292 float hdop __attribute__((unused)) = strtof(&
gps_nmea.
msg_buf[i], NULL);
297 float vdop __attribute__((unused)) = strtof(&
gps_nmea.
msg_buf[i], NULL);
314 NMEA_PRINT(
"p_RMC() - skipping empty message\n\r");
337 gps.
gspeed = speed * 1.852 * 100 / (60 * 60);
344 NMEA_PRINT(
"p_RMC() - course: %f deg\n\r", course);
356 double degrees, minutesfrac;
361 NMEA_PRINT(
"p_GGA() - skipping empty message\n\r");
375 minutesfrac = modf(lat / 100, °rees);
376 lat = degrees + (minutesfrac * 100) / 60;
385 lla_f.
lat = RadOfDeg(lat);
387 NMEA_PRINT(
"p_GGA() - lat=%f gps_lat=%f\n\r", (lat * 1000), lla_f.
lat);
394 minutesfrac = modf(lon / 100, °rees);
395 lon = degrees + (minutesfrac * 100) / 60;
404 lla_f.
lon = RadOfDeg(lon);
414 NMEA_PRINT(
"p_GGA() - POS_AVAILABLE == TRUE\n\r");
417 NMEA_PRINT(
"p_GGA() - gps_pos_available == false\n\r");
442 NMEA_PRINT(
"p_GGA() - geoid alt=%f\n\r", geoid);
444 lla_f.
alt = hmsl + geoid;
485 NMEA_PRINT(
"p_GSV() - skipping empty message\n\r");
492 bool_t is_glonass =
FALSE;
499 NMEA_PRINT(
"p_GSV() - %i sentences\n\r", nb_sen);
504 NMEA_PRINT(
"p_GSV() - sentence=%i\n\r", cur_sen);
509 NMEA_PRINT(
"p_GSV() - num_sat=%i\n\r", num_sat);
514 for (sat_cnt = 0; sat_cnt < 4; sat_cnt++) {
526 int ch_idx = (cur_sen - 1) * 4 + sat_cnt;
528 if (!is_glonass && ch_idx > 0 && ch_idx < 12) {
535 NMEA_PRINT(
"p_GSV() - GLONASS %i PRN=%i elev=%i azim=%i snr=%i\n\r", ch_idx, prn, elev, azim, snr);
538 NMEA_PRINT(
"p_GSV() - GPS %i PRN=%i elev=%i azim=%i snr=%i\n\r", ch_idx, prn, elev, azim, snr);
int32_t north
in centimeters
struct SVinfo svinfos[GPS_NB_CHANNELS]
holds information from the Space Vehicles (Satellites)
int16_t azim
azimuth in deg
uint8_t nb_channels
Number of scanned satellites.
vector in EarthCenteredEarthFixed coordinates
void nmea_parse_msg(void)
nmea_parse_char() has a complete line.
void WEAK nmea_parse_prop_init(void)
char msg_buf[NMEA_MAXLEN]
buffer for storing one nmea-line
Main include for ABI (AirBorneInterface).
static void nmea_read_until(int *i)
Read until a certain character, placed here for proprietary includes.
void gps_impl_init(void)
GPS initialization.
position in UTM coordinates Units: meters
int32_t east
in centimeters
uint8_t svid
Satellite ID.
#define GPS_FIX_3D
3D GPS fix
struct UtmCoor_i utm_pos
position in UTM (north,east: cm; alt: mm over ellipsoid)
uint8_t gps_nb_ovrn
number if incomplete nmea-messages
uint32_t last_3dfix_ticks
cpu time ticks at last valid 3D fix
int8_t elev
elevation in deg
void nmea_parse_char(uint8_t c)
This is the actual parser.
int32_t alt
in millimeters above WGS84 reference ellipsoid
static uint32_t get_sys_time_usec(void)
Get the time in microseconds since startup.
uint32_t last_msg_time
cpu time in sec at last received GPS message
uint8_t zone
UTM zone number.
Paparazzi floating point math for geodetic calculations.
vector in Latitude, Longitude and Altitude
bool_t have_gsv
flag set to TRUE if GPGSV message received
static void nmea_parse_GGA(void)
Parse GGA NMEA messages.
int32_t hmsl
height above mean sea level in mm
uint8_t cno
Carrier to Noise Ratio (Signal Strength) in dbHz.
uint32_t tow
GPS time of week in ms.
Device independent GPS code (interface)
uint16_t pdop
position dilution of precision scaled by 100
struct EcefCoor_i ecef_pos
position in ECEF in cm
bool_t is_configured
flag set to TRUE if configuration is finished
int32_t lon
in degrees*1e7
void ecef_of_lla_f(struct EcefCoor_f *out, struct LlaCoor_f *in)
uint8_t zone
UTM zone number.
volatile uint32_t nb_sec_rem
remainder of seconds since startup in CPU_TICKS
uint8_t status
line parser status
static void nmea_parse_GSV(void)
Parse GSV-nmea-messages.
float alt
in meters above WGS84 reference ellipsoid
uint32_t last_3dfix_time
cpu time in sec at last valid 3D fix
void WEAK nmea_configure(void)
The function to be called when a characted from the device is available.
int32_t alt
in millimeters above WGS84 reference ellipsoid
int32_t course
GPS course over ground in rad*1e7, [0, 2*Pi]*1e7 (CW/north)
volatile uint32_t nb_sec
full seconds since startup
uint8_t nmea_calc_crc(const char *buff, int buff_sz)
Calculate control sum of binary buffer.
static void nmea_parse_GSA(void)
Parse GSA NMEA messages.
void WEAK nmea_parse_prop_msg(void)
uint32_t last_msg_ticks
cpu time ticks at last received GPS message
uint8_t num_sv
number of sat in fix
arch independent LED (Light Emitting Diodes) API
static void nmea_parse_RMC(void)
Parse RMC NMEA messages.
uint16_t gspeed
norm of 2d ground speed in cm/s
struct LlaCoor_i lla_pos
position in LLA (lat,lon: deg*1e7; alt: mm over ellipsoid)
int32_t lat
in degrees*1e7
struct GpsState gps
global GPS state
uint8_t buff[25]
Buffer used for general comunication over SPI (in buffer)
void utm_of_lla_f(struct UtmCoor_f *utm, struct LlaCoor_f *lla)