Subversion Repositories FlightCtrl

Rev

Rev 2039 | Details | Compare with Previous | 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
2088 - 34
  uint32_t position3DAcc; // in cm 3d position accuracy
35
  uint32_t verticalAcc; // in bm vertical position accuracy
2039 - 36
  int32_t velnorth; // in cm/s
37
  int32_t veleast; // in cm/s
38
  int32_t veltop; // in cm/s
39
  uint32_t velground; // 2D ground speed in cm/s
2088 - 40
  uint32_t velocityAcc; // in cm/s 3d velocity accuracy
2039 - 41
  Status_t status; // status of data: invalid | valid
42
} GPS_INFO_t;
43
 
44
//here you will find the current gps info
45
extern GPS_INFO_t GPSInfo; // measured position (last gps record)
46
 
47
// 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
49
 
50
#define USART1_BAUD 57600
51
// this function should be called within the UART RX ISR
52
extern void ubx_parser(uint8_t c);
53
 
54
#endif //_UBX_H