Paparazzi UAS  v5.12_stable-4-g9b43e9b
Paparazzi is a free software Unmanned Aircraft System.
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Modules Pages
gps_mtk.c File Reference

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"
+ Include dependency graph for gps_mtk.c:

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
 

Detailed Description

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.

Macro Definition Documentation

#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_MSG_TOO_LONG   2

Definition at line 62 of file gps_mtk.c.

#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 MTK_DIY_FIX_NONE   1

Definition at line 70 of file gps_mtk.c.

#define MTK_DIY_OUTPUT_RATE   MTK_DIY_OUTPUT_4HZ

Definition at line 45 of file gps_mtk.c.

#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 SECS_WEEK   (60*60*24*7)

Definition at line 77 of file gps_mtk.c.

#define UNINIT   0

Definition at line 49 of file gps_mtk.c.

Referenced by gps_mtk_init(), and gps_mtk_parse().

Function Documentation

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.

+ Here is the call graph for this function:

void gps_mtk_init ( void  )
void gps_mtk_msg ( void  )
static void gps_mtk_time2itow ( uint32_t  gps_date,
uint32_t  gps_time,
uint16_t gps_week,
uint32_t gps_itow 
)
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().

+ Here is the caller graph for this function:

Variable Documentation

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