Paparazzi UAS
v5.12_stable-4-g9b43e9b
Paparazzi is a free software Unmanned Aircraft System.
|
Mediatek MT3329 specific code. More...
#include "gps_mtk.h"
#include "subsystems/abi.h"
#include "led.h"
#include "mcu_periph/sys_time.h"
#include "pprzlink/pprzlink_device.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_mtk_read_message (void) |
void | gps_mtk_parse (uint8_t c) |
void | gps_mtk_msg (void) |
void | gps_mtk_init (void) |
void | gps_mtk_event (void) |
static void | gps_mtk_time2itow (uint32_t gps_date, uint32_t gps_time, uint16_t *gps_week, uint32_t *gps_itow) |
Variables | |
const int8_t | DAYS_MONTH [12] = { 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 } |
struct GpsMtk | gps_mtk |
Mediatek MT3329 specific code.
supports: DIYDrones V1.4 protocol (AXN1.30_2278) DIYDrones V1.6 protocol (AXN1.30_2389)
documentation is partly incorrect, see mtk.xml for what seems to be "real"
Definition in file gps_mtk.c.
#define GOT_CHECKSUM1 8 |
Definition at line 57 of file gps_mtk.c.
Referenced by gps_mtk_parse().
#define GOT_CLASS_14 3 |
Definition at line 52 of file gps_mtk.c.
Referenced by gps_mtk_parse().
#define GOT_ID 6 |
Definition at line 55 of file gps_mtk.c.
Referenced by gps_mtk_parse().
#define GOT_PAYLOAD 7 |
Definition at line 56 of file gps_mtk.c.
Referenced by gps_mtk_parse().
#define GOT_SYNC1_14 1 |
Definition at line 50 of file gps_mtk.c.
Referenced by gps_mtk_parse().
#define GOT_SYNC1_16 4 |
Definition at line 53 of file gps_mtk.c.
Referenced by gps_mtk_parse().
#define GOT_SYNC2_14 2 |
Definition at line 51 of file gps_mtk.c.
Referenced by gps_mtk_parse().
#define GOT_SYNC2_16 5 |
Definition at line 54 of file gps_mtk.c.
Referenced by gps_mtk_parse().
#define GPS_MTK_ERR_CHECKSUM 3 |
Definition at line 63 of file gps_mtk.c.
Referenced by gps_mtk_parse().
#define GPS_MTK_ERR_NONE 0 |
Definition at line 60 of file gps_mtk.c.
Referenced by gps_mtk_init().
#define GPS_MTK_ERR_OUT_OF_SYNC 5 |
Definition at line 65 of file gps_mtk.c.
Referenced by gps_mtk_parse().
#define GPS_MTK_ERR_OVERRUN 1 |
Definition at line 61 of file gps_mtk.c.
Referenced by gps_mtk_parse().
#define GPS_MTK_ERR_UNEXPECTED 4 |
Definition at line 64 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 79 of file gps_mtk.c.
Referenced by gps_mtk_time2itow().
#define MTK_DIY_FIX_2D 2 |
Definition at line 69 of file gps_mtk.c.
Referenced by gps_mtk_read_message().
#define MTK_DIY_FIX_3D 3 |
Definition at line 68 of file gps_mtk.c.
Referenced by gps_mtk_read_message().
#define OUTPUT_RATE 4 |
Definition at line 46 of file gps_mtk.c.
Referenced by gps_mtk_read_message().
#define SECS_DAY (60*60*24) |
Definition at line 76 of file gps_mtk.c.
Referenced by gps_mtk_time2itow().
#define SECS_HOUR (60*60) |
Definition at line 75 of file gps_mtk.c.
Referenced by gps_mtk_time2itow().
#define SECS_MINUTE (60) |
Definition at line 74 of file gps_mtk.c.
Referenced by gps_mtk_time2itow().
#define UNINIT 0 |
Definition at line 49 of file gps_mtk.c.
Referenced by gps_mtk_init(), and gps_mtk_parse().
void gps_mtk_event | ( | void | ) |
Definition at line 123 of file gps_mtk.c.
References dev, gps_mtk, gps_mtk_msg(), gps_mtk_parse(), GpsConfigure, and GpsMtk::msg_available.
void gps_mtk_init | ( | void | ) |
Definition at line 111 of file gps_mtk.c.
References GpsMtk::error_cnt, GpsMtk::error_last, gps_mtk, GPS_MTK_ERR_NONE, GpsMtk::msg_available, GpsMtk::status, and UNINIT.
void gps_mtk_msg | ( | void | ) |
Definition at line 136 of file gps_mtk.c.
References GpsState::fix, get_sys_time_usec(), 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, sys_time::nb_sec_rem, and GpsMtk::state.
Referenced by gps_mtk_event().
void gps_mtk_parse | ( | uint8_t | c | ) |
Definition at line 305 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, and UNINIT.
Referenced by gps_mtk_event().
void gps_mtk_read_message | ( | void | ) |
Definition at line 207 of file gps_mtk.c.
References LlaCoor_i::alt, GpsState::course, GpsState::fix, GPS_FIX_2D, GPS_FIX_3D, GPS_FIX_NONE, gps_mtk, gps_mtk_time2itow(), GPS_VALID_COURSE_BIT, GPS_VALID_HMSL_BIT, GPS_VALID_POS_LLA_BIT, GpsState::gspeed, GpsState::hmsl, GpsState::last_3dfix_time, LlaCoor_i::lat, LED_ON, LED_TOGGLE, GpsState::lla_pos, LlaCoor_i::lon, GpsMtk::msg_buf, GpsMtk::msg_class, GpsMtk::msg_id, MTK_DIY_FIX_2D, MTK_DIY_FIX_3D, sys_time::nb_sec, GpsState::ned_vel, GpsState::num_sv, OUTPUT_RATE, GpsState::speed_3d, GpsMtk::state, SysTimeTimerStart, GpsState::tow, GpsState::valid_fields, GpsState::week, and NedCoor_i::z.
Referenced by gps_mtk_msg().
|
static |
Definition at line 163 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 81 of file gps_mtk.c.
Referenced by gps_mtk_time2itow().
struct GpsMtk gps_mtk |
Definition at line 83 of file gps_mtk.c.
Referenced by gps_mtk_event(), gps_mtk_init(), gps_mtk_msg(), gps_mtk_parse(), and gps_mtk_read_message().