Paparazzi UAS  v5.14.0_stable-0-g3f680d1
Paparazzi is a free software Unmanned Aircraft System.
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Modules Pages
gps_skytraq.c File Reference
#include "subsystems/gps.h"
#include "subsystems/gps/gps_skytraq.h"
#include "subsystems/abi.h"
#include "led.h"
#include "pprzlink/pprzlink_device.h"
+ Include dependency graph for gps_skytraq.c:

Go to the source code of this file.

Macros

#define UNINIT   0
 
#define GOT_SYNC1   1
 
#define GOT_SYNC2   2
 
#define GOT_LEN1   3
 
#define GOT_LEN2   4
 
#define GOT_ID   5
 
#define GOT_PAYLOAD   6
 
#define GOT_CHECKSUM   7
 
#define GOT_SYNC3   8
 
#define SKYTRAQ_FIX_NONE   0x00
 
#define SKYTRAQ_FIX_2D   0x01
 
#define SKYTRAQ_FIX_3D   0x02
 
#define SKYTRAQ_FIX_3D_DGPS   0x03
 
#define SKYTRAQ_SYNC1   0xA0
 
#define SKYTRAQ_SYNC2   0xA1
 
#define SKYTRAQ_SYNC3   0x0D
 
#define SKYTRAQ_SYNC4   0x0A
 
#define SKYTRAQ_NAVIGATION_DATA_FixMode(_payload)   (uint8_t) (*((uint8_t*)_payload+2-2))
 
#define SKYTRAQ_NAVIGATION_DATA_NumSV(_payload)   (uint8_t) (*((uint8_t*)_payload+3-2))
 
#define SKYTRAQ_NAVIGATION_DATA_WEEK(_payload)   bswap16(*(uint16_t*)&_payload[4-2])
 
#define SKYTRAQ_NAVIGATION_DATA_TOW(_payload)   __builtin_bswap32(*(uint32_t*)&_payload[6-2])
 
#define SKYTRAQ_NAVIGATION_DATA_LAT(_payload)   (int32_t)__builtin_bswap32(*( int32_t*)&_payload[10-2])
 
#define SKYTRAQ_NAVIGATION_DATA_LON(_payload)   (int32_t)__builtin_bswap32(*( int32_t*)&_payload[14-2])
 
#define SKYTRAQ_NAVIGATION_DATA_AEL(_payload)   __builtin_bswap32(*(uint32_t*)&_payload[18-2])
 
#define SKYTRAQ_NAVIGATION_DATA_ASL(_payload)   __builtin_bswap32(*(uint32_t*)&_payload[22-2])
 
#define SKYTRAQ_NAVIGATION_DATA_GDOP(_payload)   bswap16(*(uint16_t*)&_payload[26-2])
 
#define SKYTRAQ_NAVIGATION_DATA_PDOP(_payload)   bswap16(*(uint16_t*)&_payload[28-2])
 
#define SKYTRAQ_NAVIGATION_DATA_HDOP(_payload)   bswap16(*(uint16_t*)&_payload[30-2])
 
#define SKYTRAQ_NAVIGATION_DATA_VDOP(_payload)   bswap16(*(uint16_t*)&_payload[32-2])
 
#define SKYTRAQ_NAVIGATION_DATA_TDOP(_payload)   bswap16(*(uint16_t*)&_payload[34-2])
 
#define SKYTRAQ_NAVIGATION_DATA_ECEFX(_payload)   (int32_t)__builtin_bswap32(*(uint32_t*)&_payload[36-2])
 
#define SKYTRAQ_NAVIGATION_DATA_ECEFY(_payload)   (int32_t)__builtin_bswap32(*(uint32_t*)&_payload[40-2])
 
#define SKYTRAQ_NAVIGATION_DATA_ECEFZ(_payload)   (int32_t)__builtin_bswap32(*(uint32_t*)&_payload[44-2])
 
#define SKYTRAQ_NAVIGATION_DATA_ECEFVX(_payload)   (int32_t)__builtin_bswap32(*(uint32_t*)&_payload[48-2])
 
#define SKYTRAQ_NAVIGATION_DATA_ECEFVY(_payload)   (int32_t)__builtin_bswap32(*(uint32_t*)&_payload[52-2])
 
#define SKYTRAQ_NAVIGATION_DATA_ECEFVZ(_payload)   (int32_t)__builtin_bswap32(*(uint32_t*)&_payload[56-2])
 
#define MAX_DISTANCE   1000000
 

Functions

void gps_skytraq_read_message (void)
 
void gps_skytraq_parse (uint8_t c)
 
void gps_skytraq_msg (void)
 
static uint16_t bswap16 (uint16_t a)
 
static int distance_too_great (struct EcefCoor_i *ecef_ref, struct EcefCoor_i *ecef_pos)
 
void gps_skytraq_init (void)
 
void gps_skytraq_event (void)
 

Variables

struct GpsSkytraq gps_skytraq
 

Macro Definition Documentation

#define GOT_CHECKSUM   7

Definition at line 36 of file gps_skytraq.c.

Referenced by gps_skytraq_parse().

#define GOT_ID   5

Definition at line 34 of file gps_skytraq.c.

Referenced by gps_skytraq_parse().

#define GOT_LEN1   3

Definition at line 32 of file gps_skytraq.c.

Referenced by gps_skytraq_parse().

#define GOT_LEN2   4

Definition at line 33 of file gps_skytraq.c.

Referenced by gps_skytraq_parse().

#define GOT_PAYLOAD   6

Definition at line 35 of file gps_skytraq.c.

Referenced by gps_skytraq_parse().

#define GOT_SYNC1   1

Definition at line 30 of file gps_skytraq.c.

Referenced by gps_skytraq_parse().

#define GOT_SYNC2   2

Definition at line 31 of file gps_skytraq.c.

Referenced by gps_skytraq_parse().

#define GOT_SYNC3   8

Definition at line 37 of file gps_skytraq.c.

Referenced by gps_skytraq_parse().

#define MAX_DISTANCE   1000000

Definition at line 89 of file gps_skytraq.c.

Referenced by distance_too_great().

#define SKYTRAQ_FIX_2D   0x01

Definition at line 40 of file gps_skytraq.c.

Referenced by gps_skytraq_read_message().

#define SKYTRAQ_FIX_3D   0x02

Definition at line 41 of file gps_skytraq.c.

Referenced by gps_skytraq_read_message().

#define SKYTRAQ_FIX_3D_DGPS   0x03

Definition at line 42 of file gps_skytraq.c.

Referenced by gps_skytraq_read_message().

#define SKYTRAQ_FIX_NONE   0x00

Definition at line 39 of file gps_skytraq.c.

#define SKYTRAQ_NAVIGATION_DATA_AEL (   _payload)    __builtin_bswap32(*(uint32_t*)&_payload[18-2])

Definition at line 71 of file gps_skytraq.c.

Referenced by gps_skytraq_read_message().

#define SKYTRAQ_NAVIGATION_DATA_ASL (   _payload)    __builtin_bswap32(*(uint32_t*)&_payload[22-2])

Definition at line 72 of file gps_skytraq.c.

Referenced by gps_skytraq_read_message().

#define SKYTRAQ_NAVIGATION_DATA_ECEFVX (   _payload)    (int32_t)__builtin_bswap32(*(uint32_t*)&_payload[48-2])

Definition at line 83 of file gps_skytraq.c.

Referenced by gps_skytraq_read_message().

#define SKYTRAQ_NAVIGATION_DATA_ECEFVY (   _payload)    (int32_t)__builtin_bswap32(*(uint32_t*)&_payload[52-2])

Definition at line 84 of file gps_skytraq.c.

Referenced by gps_skytraq_read_message().

#define SKYTRAQ_NAVIGATION_DATA_ECEFVZ (   _payload)    (int32_t)__builtin_bswap32(*(uint32_t*)&_payload[56-2])

Definition at line 85 of file gps_skytraq.c.

Referenced by gps_skytraq_read_message().

#define SKYTRAQ_NAVIGATION_DATA_ECEFX (   _payload)    (int32_t)__builtin_bswap32(*(uint32_t*)&_payload[36-2])

Definition at line 80 of file gps_skytraq.c.

Referenced by gps_skytraq_read_message().

#define SKYTRAQ_NAVIGATION_DATA_ECEFY (   _payload)    (int32_t)__builtin_bswap32(*(uint32_t*)&_payload[40-2])

Definition at line 81 of file gps_skytraq.c.

Referenced by gps_skytraq_read_message().

#define SKYTRAQ_NAVIGATION_DATA_ECEFZ (   _payload)    (int32_t)__builtin_bswap32(*(uint32_t*)&_payload[44-2])

Definition at line 82 of file gps_skytraq.c.

Referenced by gps_skytraq_read_message().

#define SKYTRAQ_NAVIGATION_DATA_FixMode (   _payload)    (uint8_t) (*((uint8_t*)_payload+2-2))

Definition at line 62 of file gps_skytraq.c.

Referenced by gps_skytraq_read_message().

#define SKYTRAQ_NAVIGATION_DATA_GDOP (   _payload)    bswap16(*(uint16_t*)&_payload[26-2])

Definition at line 74 of file gps_skytraq.c.

#define SKYTRAQ_NAVIGATION_DATA_HDOP (   _payload)    bswap16(*(uint16_t*)&_payload[30-2])

Definition at line 76 of file gps_skytraq.c.

#define SKYTRAQ_NAVIGATION_DATA_LAT (   _payload)    (int32_t)__builtin_bswap32(*( int32_t*)&_payload[10-2])

Definition at line 68 of file gps_skytraq.c.

Referenced by gps_skytraq_read_message().

#define SKYTRAQ_NAVIGATION_DATA_LON (   _payload)    (int32_t)__builtin_bswap32(*( int32_t*)&_payload[14-2])

Definition at line 69 of file gps_skytraq.c.

Referenced by gps_skytraq_read_message().

#define SKYTRAQ_NAVIGATION_DATA_NumSV (   _payload)    (uint8_t) (*((uint8_t*)_payload+3-2))

Definition at line 63 of file gps_skytraq.c.

Referenced by gps_skytraq_read_message().

#define SKYTRAQ_NAVIGATION_DATA_PDOP (   _payload)    bswap16(*(uint16_t*)&_payload[28-2])

Definition at line 75 of file gps_skytraq.c.

Referenced by gps_skytraq_read_message().

#define SKYTRAQ_NAVIGATION_DATA_TDOP (   _payload)    bswap16(*(uint16_t*)&_payload[34-2])

Definition at line 78 of file gps_skytraq.c.

#define SKYTRAQ_NAVIGATION_DATA_TOW (   _payload)    __builtin_bswap32(*(uint32_t*)&_payload[6-2])

Definition at line 66 of file gps_skytraq.c.

Referenced by gps_skytraq_read_message().

#define SKYTRAQ_NAVIGATION_DATA_VDOP (   _payload)    bswap16(*(uint16_t*)&_payload[32-2])

Definition at line 77 of file gps_skytraq.c.

#define SKYTRAQ_NAVIGATION_DATA_WEEK (   _payload)    bswap16(*(uint16_t*)&_payload[4-2])

Definition at line 65 of file gps_skytraq.c.

#define SKYTRAQ_SYNC1   0xA0

Definition at line 45 of file gps_skytraq.c.

Referenced by gps_skytraq_parse().

#define SKYTRAQ_SYNC2   0xA1

Definition at line 46 of file gps_skytraq.c.

Referenced by gps_skytraq_parse().

#define SKYTRAQ_SYNC3   0x0D

Definition at line 48 of file gps_skytraq.c.

Referenced by gps_skytraq_parse().

#define SKYTRAQ_SYNC4   0x0A

Definition at line 49 of file gps_skytraq.c.

#define UNINIT   0

Definition at line 29 of file gps_skytraq.c.

Referenced by gps_skytraq_init(), and gps_skytraq_parse().

Function Documentation

static uint16_t bswap16 ( uint16_t  a)
inlinestatic

Definition at line 57 of file gps_skytraq.c.

static int distance_too_great ( struct EcefCoor_i ecef_ref,
struct EcefCoor_i ecef_pos 
)
static

Definition at line 273 of file gps_skytraq.c.

References MAX_DISTANCE, EcefCoor_i::x, EcefCoor_i::y, and EcefCoor_i::z.

Referenced by gps_skytraq_read_message().

+ Here is the caller graph for this function:

void gps_skytraq_event ( void  )

Definition at line 115 of file gps_skytraq.c.

References dev, gps_skytraq, gps_skytraq_msg(), gps_skytraq_parse(), and GpsSkytraq::msg_available.

+ Here is the call graph for this function:

void gps_skytraq_init ( void  )

Definition at line 93 of file gps_skytraq.c.

References gps_skytraq, GpsSkytraq::status, and UNINIT.

Variable Documentation