Subversion Repositories Projects

Rev

Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
231 killagreg 1
#ifndef _UBX_H
2
#define _UBX_H
3
 
4
#include <inttypes.h>
5
 
6
 
274 killagreg 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
14
// Flags for interpretation of the GPSData.Flags
231 killagreg 15
#define FLAG_GPSFIXOK                   0x01 // (i.e. within DOP & ACC Masks)
16
#define FLAG_DIFFSOLN                   0x02 // (is DGPS used)
17
#define FLAG_WKNSET                             0x04 // (is Week Number valid)
18
#define FLAG_TOWSET                             0x08 // (is Time of Week valid)
19
 
274 killagreg 20
#define INVALID         0x00
21
#define NEWDATA         0x01
22
#define PROCESSED       0x02
231 killagreg 23
 
274 killagreg 24
typedef struct
25
{
26
        int32_t Longitude;  // in 1E-7 deg
27
        int32_t Latitude;       // in 1E-7 deg
28
        int32_t Altitude;       // in mm
29
        uint8_t Status;         // validity of data
30
} __attribute__((packed)) GPS_Pos_t;
231 killagreg 31
 
274 killagreg 32
 
231 killagreg 33
typedef struct
34
{
274 killagreg 35
        GPS_Pos_t       Position;       // Lat/Lon/Alt
36
        uint8_t         Flags;                  // Status Flags
37
        uint8_t         NumOfSats;              // number of satelites
38
        uint8_t         SatFix;                 // type of satfix
39
        uint32_t        Position_Accuracy;      // in cm 3d position accuracy
40
        int32_t         Speed_North;    // in cm/s
41
        int32_t         Speed_East;             // in cm/s
42
        int32_t         Speed_Top;              // in cm/s
43
        uint32_t        Speed_Ground;   // 2D ground speed in cm/s
44
        int32_t         Heading;                // 1e-05 deg  Heading 2-D (curent flight direction)
45
        uint32_t        Speed_Accuracy; // in cm/s 3d velocity accuracy
46
        uint8_t         Status;                 // status of data
47
} __attribute__((packed)) gps_data_t;
231 killagreg 48
 
274 killagreg 49
// The data are valid if the GPSData.Status is NEWDATA or PROCESSED.
50
// To achieve new data after reading the GPSData.Status should be set to PROCESSED.
51
extern gps_data_t  GPSData;
52
extern uint16_t CheckGPSOkay;
231 killagreg 53
 
274 killagreg 54
void UBX_Init(void);
55
void UBX_Parser(uint8_t c);
231 killagreg 56
 
57
 
274 killagreg 58
#endif // _UBX_H