Paparazzi UAS  v5.2.2_stable-0-gd6b9f29
Paparazzi is a free software Unmanned Aircraft System.
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Modules Pages
gps.h File Reference

Device independent GPS code (interface) More...

#include "std.h"
#include "math/pprz_geodetic_int.h"
#include "mcu_periph/sys_time.h"
+ Include dependency graph for gps.h:

Go to the source code of this file.

Data Structures

struct  SVinfo
 data structure for Space Vehicle Information of a single satellite More...
struct  GpsState
 data structure for GPS information More...
struct  GpsTimeSync
 data structure for GPS time sync More...


#define GPS_FIX_NONE   0x00
#define GPS_FIX_2D   0x02
#define GPS_FIX_3D   0x03
#define GpsFixValid()   (gps.fix == GPS_FIX_3D)
#define GPS_NB_CHANNELS   1
#define GPS_TIMEOUT   2
 GPS timeout in seconds. More...
#define gps_Reset(_val)
 GPS Reset. More...


void gps_init (void)
 initialize the global GPS state More...
void gps_impl_init (void)
 GPS initialization. More...
static bool_t GpsIsLost (void)
void gps_periodic_check (void)
 Periodic GPS check. More...
uint32_t gps_tow_from_sys_ticks (uint32_t sys_ticks)
 Convert time in sys_time ticks to GPS time of week. More...


struct GpsState gps
 global GPS state More...
struct GpsTimeSync gps_time_sync

Detailed Description

Device independent GPS code (interface)

Definition in file gps.h.

Macro Definition Documentation

#define GPS_FIX_2D   0x02

Definition at line 42 of file gps.h.

Referenced by gps_mtk_read_message(), gps_skytraq_read_message(), parse_ins_msg(), and sirf_parse_41().

#define GPS_NB_CHANNELS   1

Definition at line 49 of file gps.h.

#define gps_Reset (   _val)
{ \

GPS Reset.

this still needs to call gps specific stuff

Definition at line 130 of file gps.h.

#define GPS_TIMEOUT   2

GPS timeout in seconds.

Definition at line 111 of file gps.h.

Referenced by gps_periodic_check().

#define GpsFixValid ( )    (gps.fix == GPS_FIX_3D)

Definition at line 45 of file gps.h.

Referenced by alt_filter_periodic().

Function Documentation

void gps_init ( void  )

initialize the global GPS state

Definition at line 107 of file gps.c.

References GpsState::cacc, GpsState::fix, gpio_setup_output(), gps, GPS_FIX_NONE, gps_impl_init(), GPS_POWER_GPIO, GpsState::last_3dfix_ticks, GpsState::last_3dfix_time, GpsState::last_msg_ticks, GpsState::last_msg_time, LED_OFF, register_periodic_telemetry(), GpsState::tow, and GpsState::week.

Referenced by init_ap(), and main_init().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void gps_periodic_check ( void  )

Periodic GPS check.

Marks GPS as lost when no GPS message was received for GPS_TIMEOUT seconds

Definition at line 136 of file gps.c.

References GpsState::fix, gps, GPS_FIX_NONE, GPS_TIMEOUT, GpsState::last_msg_time, and sys_time::nb_sec.

Referenced by failsafe_check(), and sensors_task().

+ Here is the caller graph for this function:

uint32_t gps_tow_from_sys_ticks ( uint32_t  sys_ticks)

Convert time in sys_time ticks to GPS time of week.

The resolution is sys_time.resolution

GPS tow in ms

Definition at line 142 of file gps.c.

References gps_time_sync, msec_of_sys_time_ticks(), MSEC_PER_WEEK, GpsTimeSync::t0_ticks, and GpsTimeSync::t0_tow.

Referenced by trigger_ext_periodic(), and windturbine_periodic().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static bool_t GpsIsLost ( void  )

Definition at line 114 of file gps.h.

References FALSE, GpsState::fix, gps, GPS_FIX_3D, and TRUE.

Referenced by autopilot_on_rc_frame(), and failsafe_check().

+ Here is the caller graph for this function:

Variable Documentation

struct GpsTimeSync gps_time_sync

Definition at line 43 of file gps.c.

Referenced by gps_mtk_read_message(), gps_tow_from_sys_ticks(), and gps_ubx_read_message().