Subversion Repositories FlightCtrl

Rev

Rev 838 | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
966 MikeW 1
#define    _B1(bit) (1 << (bit))  
2
#define    _B0(bit) (0 << (bit))
838 MikeW 3
#define    MIN(a, b) ((a) < (b) ? (a) : (b)) 
4
#define    MAX(a, b) ((a) > (b) ? (a) : (b)) 
5
 
966 MikeW 6
//#define  BAUDRATE 129// = 9600 baud
7
//#define  BAUDRATE 64// = 19200 baud
8
#define  BAUDRATE 32// = 38400 baud
9
//#define  BAUDRATE 21// = 57600 baud
10
//#define BAUDRATE 10// = 115200 baud
838 MikeW 11
 
12
#define UBX_NOFIX 0
13
#define UBX_2DFIX 2
14
#define UBX_3DFIX 3
15
 
966 MikeW 16
#define GPS_EMPTY    0
17
#define GPS_SYNC1    1
18
#define GPS_SYNC2    2
19
#define GPS_CLASS    3
20
#define GPS_LEN1     4
21
#define GPS_LEN2     5
22
#define GPS_FILLING  6
23
#define GPS_CKA      7
24
#define GPS_CKB      8
838 MikeW 25
 
26
/* some uBlox UBX format defines */
966 MikeW 27
#define SYNC_CHAR1   0xb5
28
#define SYNC_CHAR2   0x62
29
#define CLASS_NAV    0x01
30
#define MSGID_POSLLH 0x02
31
#define MSGID_STATUS 0x03
32
#define MSGID_POSUTM 0x08
33
#define MSGID_VELNED 0x12
838 MikeW 34
 
35
typedef struct {
966 MikeW 36
  long north;// in cm (+ = north)
37
  long east;// in cm (+ = east)
38
  long altitude;// in cm
39
  long velNorth;
40
  long velEast;
41
  long velDown;
42
  long groundSpeed;
43
  long heading;
44
 
45
  unsigned long ITOW;
46
  uint8_t state;// status of data: 0 = invlid; 1 = valid
47
  uint8_t noSV;// number of sats
48
} gpsInfo_t;
838 MikeW 49
 
50
typedef struct {
966 MikeW 51
  unsigned long ITOW;// time of week
52
  uint8_t GPSfix;// GPSfix Type, range 0..6
53
  uint8_t Flags;// Navigation Status Flags
54
  uint8_t DiffS;// Differential Status 
55
  uint8_t res;// reserved
56
  unsigned long TTFF;// Time to first fix (millisecond time tag) 
57
  unsigned long MSSS;// Milliseconds since Startup / Reset 
58
  uint8_t packetStatus;
838 MikeW 59
} NAV_STATUS_t;
60
 
61
typedef struct {
966 MikeW 62
  unsigned long ITOW;// time of week
63
  long LON;// longitude in 1e-07 deg
64
  long LAT;// lattitude
65
  long HEIGHT;// height in mm
66
  long HMSL;// height above mean sea level im mm
67
  unsigned long Hacc;// horizontal accuracy in mm
68
  unsigned long Vacc;// vertical accuracy in mm
69
  uint8_t packetStatus;
838 MikeW 70
} NAV_POSLLH_t;
71
 
72
typedef struct {
966 MikeW 73
  unsigned long ITOW;// time of week
74
  long EAST; // cm  UTM Easting  
75
  long NORTH;  // cm  UTM Nording  
76
  long ALT;// cm  altitude
77
  uint8_t ZONE;// UTM zone number
78
  uint8_t HEM;// Hemisphere Indicator (0=North, 1=South)  
79
  uint8_t packetStatus;
838 MikeW 80
} NAV_POSUTM_t;
81
 
82
typedef struct {
966 MikeW 83
  unsigned long ITOW;  // ms  GPS Millisecond Time of Week  
84
  long VEL_N; // cm/s  NED north velocity  
85
  long VEL_E; // cm/s  NED east velocity  
86
  long VEL_D; // cm/s  NED down velocity  
87
  unsigned long Speed; // cm/s  Speed (3-D)  
88
  unsigned long GSpeed; // cm/s  Ground Speed (2-D)  
89
  long Heading; // deg (1e-05)  Heading 2-D  
90
  unsigned long SAcc;// cm/s  Speed Accuracy Estimate  
91
  unsigned long CAcc; // deg  Course / Heading Accuracy Estimate  
92
  uint8_t packetStatus;
838 MikeW 93
} NAV_VELNED_t;
94
 
95
 
96
 
97