Subversion Repositories FlightCtrl

Rev

Rev 781 | Only display areas with differences | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 781 Rev 828
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-12 NAV - VELNED */
22
  01-12 NAV - VELNED */
23
 
23
 
24
typedef struct
24
typedef struct
25
{
25
{
26
        uint8_t         status;     // status of data: invalid | valid
26
        uint8_t         status;     // status of data: invalid | valid
27
        uint8_t         satnum;         // number of satelites
27
        uint8_t         satnum;         // number of satelites
28
        uint8_t         satfix;         // type of satfix
28
        uint8_t         satfix;         // type of satfix
29
        int32_t         longitude;  // in 1e-07 deg
29
        int32_t         longitude;  // in 1e-07 deg
30
        int32_t         latitude;       // in 1e-07 deg
30
        int32_t         latitude;       // in 1e-07 deg
31
        int32_t         altitude;   // in mm
31
        int32_t         altitude;   // in mm
32
        uint32_t    PAcc;               // in cm 3d position accuracy
32
        uint32_t    PAcc;               // in cm 3d position accuracy
33
        int32_t         velnorth;       // in cm/s
33
        int32_t         velnorth;       // in cm/s
34
        int32_t         veleast;        // in cm/s
34
        int32_t         veleast;        // in cm/s
35
        int32_t         veltop;     // in cm/s
35
        int32_t         veltop;     // in cm/s
-
 
36
        uint32_t    velground;  // 2D ground speed in cm/s
36
        uint32_t        VAcc;           // in cm/s 3d velocity accuracy
37
        uint32_t        VAcc;           // in cm/s 3d velocity accuracy
37
} GPS_INFO_t;
38
} GPS_INFO_t;
38
 
39
 
39
//here you will find the current gps info
40
//here you will find the current gps info
40
extern GPS_INFO_t GPSInfo;      // measured position (last gps record)
41
extern GPS_INFO_t GPSInfo;      // measured position (last gps record)
41
 
42
 
42
// this variable should be decremted by the application
43
// this variable should be decremted by the application
43
extern volatile uint8_t GPSTimeout; // is reset to 255 if a new UBX msg was received
44
extern volatile uint8_t GPSTimeout; // is reset to 255 if a new UBX msg was received
44
 
45
 
45
// initialized the upx parser
46
// initialized the upx parser
46
extern void ubx_init(void);
47
extern void ubx_init(void);
47
 
48
 
48
// this function should be called within the UART RX ISR
49
// this function should be called within the UART RX ISR
49
extern void ubx_parser(uint8_t c);
50
extern void ubx_parser(uint8_t c);
50
 
51
 
51
#endif //_UBX_H
52
#endif //_UBX_H
52
 
53