Paparazzi UAS  v7.0_unstable
Paparazzi is a free software Unmanned Aircraft System.
gps_skytraq.c File Reference
#include "modules/gps/gps.h"
#include "modules/gps/gps_skytraq.h"
#include "modules/core/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

◆ GOT_CHECKSUM

#define GOT_CHECKSUM   7

Definition at line 36 of file gps_skytraq.c.

◆ GOT_ID

#define GOT_ID   5

Definition at line 34 of file gps_skytraq.c.

◆ GOT_LEN1

#define GOT_LEN1   3

Definition at line 32 of file gps_skytraq.c.

◆ GOT_LEN2

#define GOT_LEN2   4

Definition at line 33 of file gps_skytraq.c.

◆ GOT_PAYLOAD

#define GOT_PAYLOAD   6

Definition at line 35 of file gps_skytraq.c.

◆ GOT_SYNC1

#define GOT_SYNC1   1

Definition at line 30 of file gps_skytraq.c.

◆ GOT_SYNC2

#define GOT_SYNC2   2

Definition at line 31 of file gps_skytraq.c.

◆ GOT_SYNC3

#define GOT_SYNC3   8

Definition at line 37 of file gps_skytraq.c.

◆ MAX_DISTANCE

#define MAX_DISTANCE   1000000

Definition at line 89 of file gps_skytraq.c.

◆ SKYTRAQ_FIX_2D

#define SKYTRAQ_FIX_2D   0x01

Definition at line 40 of file gps_skytraq.c.

◆ SKYTRAQ_FIX_3D

#define SKYTRAQ_FIX_3D   0x02

Definition at line 41 of file gps_skytraq.c.

◆ SKYTRAQ_FIX_3D_DGPS

#define SKYTRAQ_FIX_3D_DGPS   0x03

Definition at line 42 of file gps_skytraq.c.

◆ SKYTRAQ_FIX_NONE

#define SKYTRAQ_FIX_NONE   0x00

Definition at line 39 of file gps_skytraq.c.

◆ SKYTRAQ_NAVIGATION_DATA_AEL

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

Definition at line 71 of file gps_skytraq.c.

◆ SKYTRAQ_NAVIGATION_DATA_ASL

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

Definition at line 72 of file gps_skytraq.c.

◆ SKYTRAQ_NAVIGATION_DATA_ECEFVX

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

Definition at line 83 of file gps_skytraq.c.

◆ SKYTRAQ_NAVIGATION_DATA_ECEFVY

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

Definition at line 84 of file gps_skytraq.c.

◆ SKYTRAQ_NAVIGATION_DATA_ECEFVZ

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

Definition at line 85 of file gps_skytraq.c.

◆ SKYTRAQ_NAVIGATION_DATA_ECEFX

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

Definition at line 80 of file gps_skytraq.c.

◆ SKYTRAQ_NAVIGATION_DATA_ECEFY

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

Definition at line 81 of file gps_skytraq.c.

◆ SKYTRAQ_NAVIGATION_DATA_ECEFZ

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

Definition at line 82 of file gps_skytraq.c.

◆ SKYTRAQ_NAVIGATION_DATA_FixMode

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

Definition at line 62 of file gps_skytraq.c.

◆ SKYTRAQ_NAVIGATION_DATA_GDOP

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

Definition at line 74 of file gps_skytraq.c.

◆ SKYTRAQ_NAVIGATION_DATA_HDOP

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

Definition at line 76 of file gps_skytraq.c.

◆ SKYTRAQ_NAVIGATION_DATA_LAT

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

Definition at line 68 of file gps_skytraq.c.

◆ SKYTRAQ_NAVIGATION_DATA_LON

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

Definition at line 69 of file gps_skytraq.c.

◆ SKYTRAQ_NAVIGATION_DATA_NumSV

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

Definition at line 63 of file gps_skytraq.c.

◆ SKYTRAQ_NAVIGATION_DATA_PDOP

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

Definition at line 75 of file gps_skytraq.c.

◆ SKYTRAQ_NAVIGATION_DATA_TDOP

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

Definition at line 78 of file gps_skytraq.c.

◆ SKYTRAQ_NAVIGATION_DATA_TOW

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

Definition at line 66 of file gps_skytraq.c.

◆ SKYTRAQ_NAVIGATION_DATA_VDOP

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

Definition at line 77 of file gps_skytraq.c.

◆ SKYTRAQ_NAVIGATION_DATA_WEEK

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

Definition at line 65 of file gps_skytraq.c.

◆ SKYTRAQ_SYNC1

#define SKYTRAQ_SYNC1   0xA0

Definition at line 45 of file gps_skytraq.c.

◆ SKYTRAQ_SYNC2

#define SKYTRAQ_SYNC2   0xA1

Definition at line 46 of file gps_skytraq.c.

◆ SKYTRAQ_SYNC3

#define SKYTRAQ_SYNC3   0x0D

Definition at line 48 of file gps_skytraq.c.

◆ SKYTRAQ_SYNC4

#define SKYTRAQ_SYNC4   0x0A

Definition at line 49 of file gps_skytraq.c.

◆ UNINIT

#define UNINIT   0

Definition at line 29 of file gps_skytraq.c.

Function Documentation

◆ bswap16()

static uint16_t bswap16 ( uint16_t  a)
inlinestatic

Definition at line 57 of file gps_skytraq.c.

◆ distance_too_great()

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:

◆ gps_skytraq_event()

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:

◆ gps_skytraq_init()

void gps_skytraq_init ( void  )

Definition at line 93 of file gps_skytraq.c.

References gps_skytraq, GpsSkytraq::status, and UNINIT.

◆ gps_skytraq_msg()

◆ gps_skytraq_parse()

◆ gps_skytraq_read_message()

Variable Documentation

◆ gps_skytraq