Rev 52 | Go to most recent revision | Only display areas with differences | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 52 | Rev 86 | ||
---|---|---|---|
1 | #ifndef __UBX_H |
1 | #ifndef __UBX_H |
2 | #define __UBX_H |
2 | #define __UBX_H |
3 | 3 | ||
4 | // Satfix types for GPSData.SatFix |
4 | // Satfix types for GPSData.SatFix |
5 | #define SATFIX_NONE 0x00 |
5 | #define SATFIX_NONE 0x00 |
6 | #define SATFIX_DEADRECKOING 0x01 |
6 | #define SATFIX_DEADRECKOING 0x01 |
7 | #define SATFIX_2D 0x02 |
7 | #define SATFIX_2D 0x02 |
8 | #define SATFIX_3D 0x03 |
8 | #define SATFIX_3D 0x03 |
9 | #define SATFIX_GPS_DEADRECKOING 0x04 |
9 | #define SATFIX_GPS_DEADRECKOING 0x04 |
10 | #define SATFIX_TIMEONLY 0x05 |
10 | #define SATFIX_TIMEONLY 0x05 |
11 | // Flags for interpretation of the GPSData.Flags |
11 | // Flags for interpretation of the GPSData.Flags |
12 | #define FLAG_GPSFIXOK 0x01 // (i.e. within DOP & ACC Masks) |
12 | #define FLAG_GPSFIXOK 0x01 // (i.e. within DOP & ACC Masks) |
13 | #define FLAG_DIFFSOLN 0x02 // (is DGPS used) |
13 | #define FLAG_DIFFSOLN 0x02 // (is DGPS used) |
14 | #define FLAG_WKNSET 0x04 // (is Week Number valid) |
14 | #define FLAG_WKNSET 0x04 // (is Week Number valid) |
15 | #define FLAG_TOWSET 0x08 // (is Time of Week valid) |
15 | #define FLAG_TOWSET 0x08 // (is Time of Week valid) |
16 | 16 | ||
17 | #define INVALID 0x00 |
17 | #define INVALID 0x00 |
18 | #define NEWDATA 0x01 |
18 | #define NEWDATA 0x01 |
19 | #define PROCESSED 0x02 |
19 | #define PROCESSED 0x02 |
20 | 20 | ||
21 | typedef struct |
21 | typedef struct |
22 | { |
22 | { |
23 | s32 Longitude; // in 1E-7 deg |
23 | s32 Longitude; // in 1E-7 deg |
24 | s32 Latitude; // in 1E-7 deg |
24 | s32 Latitude; // in 1E-7 deg |
25 | s32 Altitude; // in mm |
25 | s32 Altitude; // in mm |
26 | u8 Status;// validity of data |
26 | u8 Status;// validity of data |
27 | } __attribute__((packed)) GPS_Pos_t; |
27 | } __attribute__((packed)) GPS_Pos_t; |
28 | 28 | ||
29 | 29 | ||
30 | typedef struct |
30 | typedef struct |
31 | { |
31 | { |
32 | GPS_Pos_t Position; // Lat/Lon/Alt |
32 | GPS_Pos_t Position; // Lat/Lon/Alt |
33 | u8 Flags; // Status Flags |
33 | u8 Flags; // Status Flags |
34 | u8 NumOfSats; // number of satelites |
34 | u8 NumOfSats; // number of satelites |
35 | u8 SatFix; // type of satfix |
35 | u8 SatFix; // type of satfix |
36 | u32 Position_Accuracy; // in cm 3d position accuracy |
36 | u32 Position_Accuracy; // in cm 3d position accuracy |
37 | s32 Speed_North; // in cm/s |
37 | s32 Speed_North; // in cm/s |
38 | s32 Speed_East; // in cm/s |
38 | s32 Speed_East; // in cm/s |
39 | s32 Speed_Top; // in cm/s |
39 | s32 Speed_Top; // in cm/s |
40 | u32 Speed_Ground; // 2D ground speed in cm/s |
40 | u32 Speed_Ground; // 2D ground speed in cm/s |
41 | s32 Heading; // 1e-05 deg Heading 2-D (curent flight direction) |
41 | s32 Heading; // 1e-05 deg Heading 2-D (current flight direction) |
42 | u32 Speed_Accuracy; // in cm/s 3d velocity accuracy |
42 | u32 Speed_Accuracy; // in cm/s 3d velocity accuracy |
43 | u8 Status; // status of data |
43 | u8 Status; // status of data |
44 | } __attribute__((packed)) gps_data_t; |
44 | } __attribute__((packed)) gps_data_t; |
45 | 45 | ||
46 | // The data are valid if the GPSData.Status is NEWDATA or PROCESSED. |
46 | // The data are valid if the GPSData.Status is NEWDATA or PROCESSED. |
47 | // To achieve new data after reading the GPSData.Status should be set to PROCESSED. |
47 | // To achieve new data after reading the GPSData.Status should be set to PROCESSED. |
48 | extern gps_data_t GPSData; |
48 | extern gps_data_t GPSData; |
49 | extern u32 CheckGPSOkay; |
49 | extern u32 CheckGPSOkay; |
50 | 50 | ||
51 | void UBX_Init(void); |
51 | void UBX_Init(void); |
52 | void UBX_Parser(u8 c); |
52 | void UBX_Parser(u8 c); |
53 | 53 | ||
54 | 54 | ||
55 | #endif // __UBX_H |
55 | #endif // __UBX_H |
56 | 56 |