Subversion Repositories FlightCtrl

Rev

Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
1612 dongfang 1
#ifndef _UBX_H
2
#define _UBX_H
3
 
4
#include <inttypes.h>
5
 
6
 
7
typedef enum
8
{
9
        INVALID,
10
        NEWDATA,
11
        PROCESSED
12
} Status_t;
13
 
14
// Satfix types for GPSData.satfix
15
#define SATFIX_NONE                      0x00
16
#define SATFIX_DEADRECKOING      0x01
17
#define SATFIX_2D                                0x02
18
#define SATFIX_3D                                0x03
19
#define SATFIX_GPS_DEADRECKOING  0x04
20
#define SATFIX_TIMEONLY                  0x05
21
// Flags for interpretation of the GPSData.flags
22
#define FLAG_GPSFIXOK                   0x01 // (i.e. within DOP & ACC Masks)
23
#define FLAG_DIFFSOLN                   0x02 // (is DGPS used)
24
#define FLAG_WKNSET                             0x04 // (is Week Number valid)
25
#define FLAG_TOWSET                             0x08 // (is Time of Week valid)
26
 
27
 
28
/* enable the UBX protocol at the gps receiver with the following messages enabled
29
  01-02 NAV - POSLLH
30
  01-06 Nav - SOL
31
  01-12 NAV - VELNED */
32
 
33
typedef struct
34
{
35
        uint8_t         flags;          // flags
36
        uint8_t         satnum;         // number of satelites
37
        uint8_t         satfix;         // type of satfix
38
        int32_t         longitude;  // in 1e-07 deg
39
        int32_t         latitude;       // in 1e-07 deg
40
        int32_t         altitude;   // in mm
41
        uint32_t    PAcc;               // in cm 3d position accuracy
42
        int32_t         velnorth;       // in cm/s
43
        int32_t         veleast;        // in cm/s
44
        int32_t         veltop;     // in cm/s
45
        uint32_t    velground;  // 2D ground speed in cm/s
46
        uint32_t        VAcc;           // in cm/s 3d velocity accuracy
47
        Status_t        status;     // status of data: invalid | valid
48
} GPS_INFO_t;
49
 
50
//here you will find the current gps info
51
extern GPS_INFO_t GPSInfo;      // measured position (last gps record)
52
 
53
// this variable should be decremted by the application
54
extern volatile uint8_t GPSTimeout; // is reset to 255 if a new UBX msg was received
55
 
56
 
57
#define USART1_BAUD 57600
58
// this function should be called within the UART RX ISR
59
extern void ubx_parser(uint8_t c);
60
 
61
#endif //_UBX_H