Subversion Repositories FlightCtrl

Rev

Rev 752 | Go to most recent revision | Only display areas with differences | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 752 Rev 781
1
#ifndef _UBX_H
1
#ifndef _UBX_H
2
#define _UBX_H
2
#define _UBX_H
3
 
3
 
4
#include <inttypes.h>
4
#include <inttypes.h>
5
 
5
 
6
#define INVALID    0x00
6
#define INVALID    0x00
7
#define VALID      0x01
7
#define VALID      0x01
8
#define PROCESSED  0x02
8
#define PROCESSED  0x02
9
 
9
 
10
 
10
 
11
#define SATFIX_NONE                      0x00
11
#define SATFIX_NONE                      0x00
12
#define SATFIX_DEADRECKOING      0x01
12
#define SATFIX_DEADRECKOING      0x01
13
#define SATFIX_2D                                0x02
13
#define SATFIX_2D                                0x02
14
#define SATFIX_3D                                0x03
14
#define SATFIX_3D                                0x03
15
#define SATFIX_GPS_DEADRECKOING  0x04
15
#define SATFIX_GPS_DEADRECKOING  0x04
16
#define SATFIX_TIMEONLY                  0x05
16
#define SATFIX_TIMEONLY                  0x05
17
 
17
 
18
 
18
 
19
/* enable the UBX protocol at the gps receiver with the following messages enabled
19
/* enable the UBX protocol at the gps receiver with the following messages enabled
20
  01-02 NAV - POSLLH
20
  01-02 NAV - POSLLH
21
  01-06 Nav - SOL
21
  01-06 Nav - SOL
22
  01-08 NAV - POSUTM
-
 
23
  01-12 NAV - VELNED */
22
  01-12 NAV - VELNED */
24
 
-
 
25
 
23
 
26
typedef struct
24
typedef struct
-
 
25
{
27
{
26
        uint8_t         status;     // status of data: invalid | valid
28
        uint8_t         satnum;         // number of satelites
27
        uint8_t         satnum;         // number of satelites
29
        uint8_t         satfix;         // type of satfix
28
        uint8_t         satfix;         // type of satfix
30
        int32_t         utmnorth;       // in cm (+ = north)
29
        int32_t         longitude;  // in 1e-07 deg
31
        int32_t         utmeast;        // in cm (+ = east)
30
        int32_t         latitude;       // in 1e-07 deg
32
        int32_t         utmalt;     // in cm (+ = top)
31
        int32_t         altitude;   // in mm
33
        uint32_t    PAcc;               // in cm 3d position accuracy
32
        uint32_t    PAcc;               // in cm 3d position accuracy
34
        int32_t         velnorth;       // in cm/s
33
        int32_t         velnorth;       // in cm/s
35
        int32_t         veleast;        // in cm/s
34
        int32_t         veleast;        // in cm/s
36
        int32_t         veltop;     // in cm/s
35
        int32_t         veltop;     // in cm/s
37
        uint32_t        VAcc;           // in cm/s 3d velocity accuracy
36
        uint32_t        VAcc;           // in cm/s 3d velocity accuracy
38
        int32_t         longitude;  // in 1e-07 deg
-
 
39
        int32_t         latitude;       // in 1e-07 deg
-
 
40
        int32_t         altitude;   // in mm
-
 
41
        uint8_t         status;     // status of data: invalid | valid
-
 
42
} GPS_INFO_t;
37
} GPS_INFO_t;
43
 
38
 
44
//here you will find the current gps info
39
//here you will find the current gps info
45
extern GPS_INFO_t GPSInfo;      // measured position (last gps record)
40
extern GPS_INFO_t GPSInfo;      // measured position (last gps record)
46
 
41
 
47
// this variable should be decremted by the application
42
// this variable should be decremted by the application
48
extern volatile uint8_t GPSTimeout; // is reset to 255 if a new UBX msg was received
43
extern volatile uint8_t GPSTimeout; // is reset to 255 if a new UBX msg was received
49
 
44
 
50
// initialized the upx parser
45
// initialized the upx parser
51
extern void ubx_init(void);
46
extern void ubx_init(void);
52
 
47
 
53
// this function should be called within the UART RX ISR
48
// this function should be called within the UART RX ISR
54
extern void ubx_parser(uint8_t c);
49
extern void ubx_parser(uint8_t c);
55
 
50
 
56
#endif //_UBX_H
51
#endif //_UBX_H
57
 
52