Subversion Repositories FlightCtrl

Rev

Go to most recent revision | Details | Last modification | View Log | RSS feed

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