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