Paparazzi UAS
v5.8.2_stable-0-g6260b7c
Paparazzi is a free software Unmanned Aircraft System.
|
#include "subsystems/gps.h"
#include "subsystems/abi.h"
#include "led.h"
#include "subsystems/navigation/common_nav.h"
#include "math/pprz_geodetic_float.h"
#include "mcu_periph/sys_time.h"
Go to the source code of this file.
Macros | |
#define | MTK_DIY_OUTPUT_RATE MTK_DIY_OUTPUT_4HZ |
#define | OUTPUT_RATE 4 |
#define | UNINIT 0 |
#define | GOT_SYNC1_14 1 |
#define | GOT_SYNC2_14 2 |
#define | GOT_CLASS_14 3 |
#define | GOT_SYNC1_16 4 |
#define | GOT_SYNC2_16 5 |
#define | GOT_ID 6 |
#define | GOT_PAYLOAD 7 |
#define | GOT_CHECKSUM1 8 |
#define | GPS_MTK_ERR_NONE 0 |
#define | GPS_MTK_ERR_OVERRUN 1 |
#define | GPS_MTK_ERR_MSG_TOO_LONG 2 |
#define | GPS_MTK_ERR_CHECKSUM 3 |
#define | GPS_MTK_ERR_UNEXPECTED 4 |
#define | GPS_MTK_ERR_OUT_OF_SYNC 5 |
#define | MTK_DIY_FIX_3D 3 |
#define | MTK_DIY_FIX_2D 2 |
#define | MTK_DIY_FIX_NONE 1 |
#define | SECS_MINUTE (60) |
#define | SECS_HOUR (60*60) |
#define | SECS_DAY (60*60*24) |
#define | SECS_WEEK (60*60*24*7) |
#define | isleap(x) ((((x)%400)==0) || (!(((x)%100)==0) && (((x)%4)==0))) |
Functions | |
void | gps_impl_init (void) |
GPS initialization. More... | |
void | gps_mtk_msg (void) |
static void | gps_mtk_time2itow (uint32_t gps_date, uint32_t gps_time, int16_t *gps_week, uint32_t *gps_itow) |
void | gps_mtk_read_message (void) |
void | gps_mtk_parse (uint8_t c) |
Variables | |
const int8_t | DAYS_MONTH [12] = { 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 } |
struct GpsMtk | gps_mtk |
#define GOT_CHECKSUM1 8 |
Definition at line 56 of file gps_mtk.c.
Referenced by gps_mtk_parse().
#define GOT_CLASS_14 3 |
Definition at line 51 of file gps_mtk.c.
Referenced by gps_mtk_parse().
#define GOT_ID 6 |
Definition at line 54 of file gps_mtk.c.
Referenced by gps_mtk_parse().
#define GOT_PAYLOAD 7 |
Definition at line 55 of file gps_mtk.c.
Referenced by gps_mtk_parse().
#define GOT_SYNC1_14 1 |
Definition at line 49 of file gps_mtk.c.
Referenced by gps_mtk_parse().
#define GOT_SYNC1_16 4 |
Definition at line 52 of file gps_mtk.c.
Referenced by gps_mtk_parse().
#define GOT_SYNC2_14 2 |
Definition at line 50 of file gps_mtk.c.
Referenced by gps_mtk_parse().
#define GOT_SYNC2_16 5 |
Definition at line 53 of file gps_mtk.c.
Referenced by gps_mtk_parse().
#define GPS_MTK_ERR_CHECKSUM 3 |
Definition at line 62 of file gps_mtk.c.
Referenced by gps_mtk_parse().
#define GPS_MTK_ERR_NONE 0 |
Definition at line 59 of file gps_mtk.c.
Referenced by gps_impl_init().
#define GPS_MTK_ERR_OUT_OF_SYNC 5 |
Definition at line 64 of file gps_mtk.c.
Referenced by gps_mtk_parse().
#define GPS_MTK_ERR_OVERRUN 1 |
Definition at line 60 of file gps_mtk.c.
Referenced by gps_mtk_parse().
#define GPS_MTK_ERR_UNEXPECTED 4 |
Definition at line 63 of file gps_mtk.c.
Referenced by gps_mtk_parse().
#define isleap | ( | x | ) | ((((x)%400)==0) || (!(((x)%100)==0) && (((x)%4)==0))) |
Definition at line 78 of file gps_mtk.c.
Referenced by gps_mtk_time2itow().
#define MTK_DIY_FIX_2D 2 |
Definition at line 68 of file gps_mtk.c.
Referenced by gps_mtk_read_message().
#define MTK_DIY_FIX_3D 3 |
Definition at line 67 of file gps_mtk.c.
Referenced by gps_mtk_read_message().
#define OUTPUT_RATE 4 |
Definition at line 45 of file gps_mtk.c.
Referenced by gps_mtk_read_message().
#define SECS_DAY (60*60*24) |
Definition at line 75 of file gps_mtk.c.
Referenced by gps_mtk_time2itow().
#define SECS_HOUR (60*60) |
Definition at line 74 of file gps_mtk.c.
Referenced by gps_mtk_time2itow().
#define SECS_MINUTE (60) |
Definition at line 73 of file gps_mtk.c.
Referenced by gps_mtk_time2itow().
#define UNINIT 0 |
Definition at line 48 of file gps_mtk.c.
Referenced by gps_impl_init(), and gps_mtk_parse().
void gps_impl_init | ( | void | ) |
GPS initialization.
GPS model specific init implementation.
Definition at line 106 of file gps_mtk.c.
References GpsMtk::error_cnt, GpsMtk::error_last, FALSE, gps_mtk, GPS_MTK_ERR_NONE, GpsMtk::msg_available, GpsMtk::status, TRUE, and UNINIT.
void gps_mtk_msg | ( | void | ) |
Definition at line 118 of file gps_mtk.c.
References FALSE, GpsState::fix, get_sys_time_usec(), gps, GPS_FIX_3D, gps_mtk, GPS_MTK_ID, gps_mtk_read_message(), GpsState::last_3dfix_ticks, GpsState::last_3dfix_time, GpsState::last_msg_ticks, GpsState::last_msg_time, GpsMtk::msg_available, GpsMtk::msg_class, GpsMtk::msg_id, sys_time::nb_sec, and sys_time::nb_sec_rem.
Referenced by GpsEvent().
void gps_mtk_parse | ( | uint8_t | c | ) |
Definition at line 309 of file gps_mtk.c.
References GpsMtk::ck_a, GpsMtk::ck_b, GpsMtk::error_cnt, GpsMtk::error_last, GOT_CHECKSUM1, GOT_CLASS_14, GOT_ID, GOT_PAYLOAD, GOT_SYNC1_14, GOT_SYNC1_16, GOT_SYNC2_14, GOT_SYNC2_16, gps_mtk, GPS_MTK_ERR_CHECKSUM, GPS_MTK_ERR_OUT_OF_SYNC, GPS_MTK_ERR_OVERRUN, GPS_MTK_ERR_UNEXPECTED, GpsMtk::len, GpsMtk::msg_available, GpsMtk::msg_buf, GpsMtk::msg_class, GpsMtk::msg_id, GpsMtk::msg_idx, GpsMtk::status, TRUE, and UNINIT.
Referenced by GpsEvent().
void gps_mtk_read_message | ( | void | ) |
Definition at line 189 of file gps_mtk.c.
References LlaCoor_i::alt, UtmCoor_i::alt, GpsState::course, UtmCoor_f::east, UtmCoor_i::east, GpsState::fix, gps, GPS_FIX_2D, GPS_FIX_3D, GPS_FIX_NONE, gps_mtk, gps_mtk_time2itow(), gps_time_sync, GpsState::gspeed, GpsState::hmsl, GpsState::last_3dfix_time, LlaCoor_i::lat, LED_ON, LED_TOGGLE, LLA_FLOAT_OF_BFP, GpsState::lla_pos, LlaCoor_i::lon, GpsMtk::msg_buf, GpsMtk::msg_class, GpsMtk::msg_id, MTK_DIY_FIX_2D, MTK_DIY_FIX_3D, nav_utm_zone0, sys_time::nb_sec, sys_time::nb_tick, GpsState::ned_vel, UtmCoor_f::north, UtmCoor_i::north, GpsState::num_sv, OUTPUT_RATE, GpsState::speed_3d, SysTimeTimerStart, GpsTimeSync::t0_ticks, GpsTimeSync::t0_tow, GpsTimeSync::t0_tow_frac, GpsState::tow, utm_of_lla_f(), GpsState::utm_pos, GpsState::week, NedCoor_i::z, UtmCoor_f::zone, and UtmCoor_i::zone.
Referenced by gps_mtk_msg().
|
static |
Definition at line 145 of file gps_mtk.c.
References DAYS_MONTH, isleap, SECS_DAY, SECS_HOUR, and SECS_MINUTE.
Referenced by gps_mtk_read_message().
const int8_t DAYS_MONTH[12] = { 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 } |
Definition at line 80 of file gps_mtk.c.
Referenced by gps_mtk_time2itow().
struct GpsMtk gps_mtk |
Definition at line 82 of file gps_mtk.c.
Referenced by gps_impl_init(), gps_mtk_msg(), gps_mtk_parse(), gps_mtk_read_message(), and GpsEvent().