Subversion Repositories FlightCtrl

Rev

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

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