Paparazzi UAS v7.1_unstable
Paparazzi is a free software Unmanned Aircraft System.
Loading...
Searching...
No Matches
gps_mtk.c File Reference

Mediatek MT3329 specific code. More...

#include "gps_mtk.h"
#include "modules/core/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)

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 = {0}

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

◆ GOT_CHECKSUM1

#define GOT_CHECKSUM1   8

Definition at line 57 of file gps_mtk.c.

Referenced by gps_mtk_parse(), gps_ubx_parse(), and ubx_process().

◆ GOT_CLASS_14

#define GOT_CLASS_14   3

Definition at line 52 of file gps_mtk.c.

Referenced by gps_mtk_parse().

◆ GOT_ID

#define GOT_ID   6

Definition at line 55 of file gps_mtk.c.

Referenced by gps_mtk_parse(), gps_skytraq_parse(), gps_ubx_parse(), and ubx_process().

◆ GOT_PAYLOAD

#define GOT_PAYLOAD   7

Definition at line 56 of file gps_mtk.c.

◆ GOT_SYNC1_14

#define GOT_SYNC1_14   1

Definition at line 50 of file gps_mtk.c.

Referenced by gps_mtk_parse().

◆ GOT_SYNC1_16

#define GOT_SYNC1_16   4

Definition at line 53 of file gps_mtk.c.

Referenced by gps_mtk_parse().

◆ GOT_SYNC2_14

#define GOT_SYNC2_14   2

Definition at line 51 of file gps_mtk.c.

Referenced by gps_mtk_parse().

◆ GOT_SYNC2_16

#define GOT_SYNC2_16   5

Definition at line 54 of file gps_mtk.c.

Referenced by gps_mtk_parse().

◆ GPS_MTK_ERR_CHECKSUM

#define GPS_MTK_ERR_CHECKSUM   3

Definition at line 63 of file gps_mtk.c.

Referenced by gps_mtk_parse().

◆ GPS_MTK_ERR_MSG_TOO_LONG

#define GPS_MTK_ERR_MSG_TOO_LONG   2

Definition at line 62 of file gps_mtk.c.

◆ GPS_MTK_ERR_NONE

#define GPS_MTK_ERR_NONE   0

Definition at line 60 of file gps_mtk.c.

Referenced by gps_mtk_init().

◆ GPS_MTK_ERR_OUT_OF_SYNC

#define GPS_MTK_ERR_OUT_OF_SYNC   5

Definition at line 65 of file gps_mtk.c.

Referenced by gps_mtk_parse().

◆ GPS_MTK_ERR_OVERRUN

#define GPS_MTK_ERR_OVERRUN   1

Definition at line 61 of file gps_mtk.c.

Referenced by gps_mtk_parse().

◆ GPS_MTK_ERR_UNEXPECTED

#define GPS_MTK_ERR_UNEXPECTED   4

Definition at line 64 of file gps_mtk.c.

Referenced by gps_mtk_parse().

◆ isleap

#define isleap ( x)
Value:
((((x)%400)==0) || (!(((x)%100)==0) && (((x)%4)==0)))

Definition at line 79 of file gps_mtk.c.

Referenced by gps_mtk_time2itow().

◆ MTK_DIY_FIX_2D

#define MTK_DIY_FIX_2D   2

Definition at line 69 of file gps_mtk.c.

Referenced by gps_mtk_read_message().

◆ MTK_DIY_FIX_3D

#define MTK_DIY_FIX_3D   3

Definition at line 68 of file gps_mtk.c.

Referenced by gps_mtk_read_message().

◆ MTK_DIY_FIX_NONE

#define MTK_DIY_FIX_NONE   1

Definition at line 70 of file gps_mtk.c.

◆ MTK_DIY_OUTPUT_RATE

#define MTK_DIY_OUTPUT_RATE   MTK_DIY_OUTPUT_4HZ

Definition at line 45 of file gps_mtk.c.

◆ OUTPUT_RATE

#define OUTPUT_RATE   4

Definition at line 46 of file gps_mtk.c.

Referenced by gps_mtk_read_message().

◆ SECS_DAY

#define SECS_DAY   (60*60*24)

Definition at line 76 of file gps_mtk.c.

Referenced by gps_mtk_time2itow().

◆ SECS_HOUR

#define SECS_HOUR   (60*60)

Definition at line 75 of file gps_mtk.c.

Referenced by gps_mtk_time2itow().

◆ SECS_MINUTE

#define SECS_MINUTE   (60)

Definition at line 74 of file gps_mtk.c.

Referenced by gps_mtk_time2itow().

◆ SECS_WEEK

#define SECS_WEEK   (60*60*24*7)

Definition at line 77 of file gps_mtk.c.

◆ UNINIT

#define UNINIT   0

Definition at line 49 of file gps_mtk.c.

Function Documentation

◆ gps_mtk_event()

void gps_mtk_event ( void )

Definition at line 123 of file gps_mtk.c.

References dev, gps_mtk, gps_mtk_msg(), gps_mtk_parse(), and GpsConfigure.

Here is the call graph for this function:

◆ gps_mtk_init()

void gps_mtk_init ( void )

Definition at line 111 of file gps_mtk.c.

References gps_mtk, GPS_MTK_ERR_NONE, and UNINIT.

◆ gps_mtk_msg()

void gps_mtk_msg ( void )

Definition at line 136 of file gps_mtk.c.

References get_sys_time_usec(), GPS_FIX_3D, gps_mtk, GPS_MTK_ID, gps_mtk_read_message(), sys_time::nb_sec, and sys_time::nb_sec_rem.

Referenced by gps_mtk_event().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ gps_mtk_parse()

void gps_mtk_parse ( uint8_t c)

◆ gps_mtk_read_message()

void gps_mtk_read_message ( void )

Definition at line 207 of file gps_mtk.c.

References 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, LED_ON, LED_TOGGLE, MTK_DIY_FIX_2D, MTK_DIY_FIX_3D, sys_time::nb_sec, OUTPUT_RATE, and SysTimeTimerStart.

Referenced by gps_mtk_msg().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ gps_mtk_time2itow()

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

◆ DAYS_MONTH

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().

◆ gps_mtk

struct GpsMtk gps_mtk = {0}