Subversion Repositories NaviCtrl

Rev

Rev 700 | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
41 ingob 1
#ifndef __UBX_H
2
#define __UBX_H
491 killagreg 3
 
245 killagreg 4
#include "buffer.h"
491 killagreg 5
#include "gpspos.h"
41 ingob 6
 
7
// Satfix types for GPSData.SatFix
8
#define SATFIX_NONE                             0x00
9
#define SATFIX_DEADRECKOING             0x01
10
#define SATFIX_2D                               0x02
11
#define SATFIX_3D                               0x03
12
#define SATFIX_GPS_DEADRECKOING 0x04
13
#define SATFIX_TIMEONLY                 0x05
322 holgerb 14
 
41 ingob 15
// Flags for interpretation of the GPSData.Flags
16
#define FLAG_GPSFIXOK                   0x01 // (i.e. within DOP & ACC Masks)
17
#define FLAG_DIFFSOLN                   0x02 // (is DGPS used)
18
#define FLAG_WKNSET                             0x04 // (is Week Number valid)
19
#define FLAG_TOWSET                             0x08 // (is Time of Week valid)
322 holgerb 20
#define FLAG_GPS_NAVIGATION_ACT 0x10 // to FC -> NC is ready to navigate
41 ingob 21
 
22
 
23
typedef struct
24
{
659 holgerb 25
        u32                     MsgCycleTime;   // time in ms since last gps data
41 ingob 26
        GPS_Pos_t       Position;       // Lat/Lon/Alt
27
        u8                      Flags;                  // Status Flags
28
        u8                      NumOfSats;              // number of satelites
29
        u8                      SatFix;                 // type of satfix
30
        u32             Position_Accuracy;      // in cm 3d position accuracy
31
        s32                     Speed_North;    // in cm/s
32
        s32                     Speed_East;             // in cm/s
33
        s32                     Speed_Top;              // in cm/s
34
        u32                     Speed_Ground;   // 2D ground speed in cm/s
86 killagreg 35
        s32                     Heading;                // 1e-05 deg  Heading 2-D (current flight direction)
41 ingob 36
        u32                     Speed_Accuracy; // in cm/s 3d velocity accuracy
52 killagreg 37
        u8                      Status;                 // status of data
41 ingob 38
} __attribute__((packed)) gps_data_t;
39
 
40
// The data are valid if the GPSData.Status is NEWDATA or PROCESSED.
41
// To achieve new data after reading the GPSData.Status should be set to PROCESSED.
42
extern gps_data_t  GPSData;
245 killagreg 43
 
247 killagreg 44
 
45
#define UBX_CLASS_CFG   0x06
46
#define UBX_CLASS_ACK   0x05
47
 
245 killagreg 48
typedef struct
49
{
247 killagreg 50
        u8 Class;
51
        u8 Id;
52
        u16 Length;
53
}  __attribute__((packed)) ubxmsghdr_t;
245 killagreg 54
 
263 killagreg 55
#define UBX_MSG_DATA_SIZE 200
247 killagreg 56
typedef struct
57
{
58
        u8 ClassMask;
59
        u8 IdMask;
60
        ubxmsghdr_t Hdr;
263 killagreg 61
        u8 Data[UBX_MSG_DATA_SIZE];
247 killagreg 62
        u8 Status;
63
} __attribute__((packed)) ubxmsg_t;
64
// msg obj to reveive
65
// set Class and Id and correspoinding masks of a message that should be received
263 killagreg 66
extern ubxmsg_t UbxMsg;
247 killagreg 67
 
68
 
146 killagreg 69
extern u32 UBX_Timeout;
41 ingob 70
 
71
void UBX_Init(void);
245 killagreg 72
void UBX_RxParser(u8 c);
247 killagreg 73
u8 UBX_CreateMsg(Buffer_t* pBuff, u8* pData, u16 Len);
700 holgerb 74
extern u8 UbxVersionParser(void);
41 ingob 75
 
76
#endif // __UBX_H