Rev 322 | Details | Compare with Previous | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
41 | ingob | 1 | #ifndef __UBX_H |
2 | #define __UBX_H |
||
245 | killagreg | 3 | #include "buffer.h" |
41 | ingob | 4 | |
5 | // Satfix types for GPSData.SatFix |
||
6 | #define SATFIX_NONE 0x00 |
||
7 | #define SATFIX_DEADRECKOING 0x01 |
||
8 | #define SATFIX_2D 0x02 |
||
9 | #define SATFIX_3D 0x03 |
||
10 | #define SATFIX_GPS_DEADRECKOING 0x04 |
||
11 | #define SATFIX_TIMEONLY 0x05 |
||
322 | holgerb | 12 | |
41 | ingob | 13 | // Flags for interpretation of the GPSData.Flags |
14 | #define FLAG_GPSFIXOK 0x01 // (i.e. within DOP & ACC Masks) |
||
15 | #define FLAG_DIFFSOLN 0x02 // (is DGPS used) |
||
16 | #define FLAG_WKNSET 0x04 // (is Week Number valid) |
||
17 | #define FLAG_TOWSET 0x08 // (is Time of Week valid) |
||
322 | holgerb | 18 | #define FLAG_GPS_NAVIGATION_ACT 0x10 // to FC -> NC is ready to navigate |
41 | ingob | 19 | |
52 | killagreg | 20 | #define INVALID 0x00 |
21 | #define NEWDATA 0x01 |
||
22 | #define PROCESSED 0x02 |
||
41 | ingob | 23 | |
24 | typedef struct |
||
25 | { |
||
26 | s32 Longitude; // in 1E-7 deg |
||
27 | s32 Latitude; // in 1E-7 deg |
||
28 | s32 Altitude; // in mm |
||
52 | killagreg | 29 | u8 Status;// validity of data |
41 | ingob | 30 | } __attribute__((packed)) GPS_Pos_t; |
31 | |||
32 | |||
33 | typedef struct |
||
34 | { |
||
244 | killagreg | 35 | u16 MsgCycleTime; // time in ms since last gps data |
41 | ingob | 36 | GPS_Pos_t Position; // Lat/Lon/Alt |
37 | u8 Flags; // Status Flags |
||
38 | u8 NumOfSats; // number of satelites |
||
39 | u8 SatFix; // type of satfix |
||
40 | u32 Position_Accuracy; // in cm 3d position accuracy |
||
41 | s32 Speed_North; // in cm/s |
||
42 | s32 Speed_East; // in cm/s |
||
43 | s32 Speed_Top; // in cm/s |
||
44 | u32 Speed_Ground; // 2D ground speed in cm/s |
||
86 | killagreg | 45 | s32 Heading; // 1e-05 deg Heading 2-D (current flight direction) |
41 | ingob | 46 | u32 Speed_Accuracy; // in cm/s 3d velocity accuracy |
52 | killagreg | 47 | u8 Status; // status of data |
41 | ingob | 48 | } __attribute__((packed)) gps_data_t; |
49 | |||
50 | // The data are valid if the GPSData.Status is NEWDATA or PROCESSED. |
||
51 | // To achieve new data after reading the GPSData.Status should be set to PROCESSED. |
||
52 | extern gps_data_t GPSData; |
||
245 | killagreg | 53 | |
247 | killagreg | 54 | |
55 | #define UBX_CLASS_CFG 0x06 |
||
56 | #define UBX_CLASS_ACK 0x05 |
||
57 | |||
245 | killagreg | 58 | typedef struct |
59 | { |
||
247 | killagreg | 60 | u8 Class; |
61 | u8 Id; |
||
62 | u16 Length; |
||
63 | } __attribute__((packed)) ubxmsghdr_t; |
||
245 | killagreg | 64 | |
263 | killagreg | 65 | #define UBX_MSG_DATA_SIZE 200 |
247 | killagreg | 66 | typedef struct |
67 | { |
||
68 | u8 ClassMask; |
||
69 | u8 IdMask; |
||
70 | ubxmsghdr_t Hdr; |
||
263 | killagreg | 71 | u8 Data[UBX_MSG_DATA_SIZE]; |
247 | killagreg | 72 | u8 Status; |
73 | } __attribute__((packed)) ubxmsg_t; |
||
74 | // msg obj to reveive |
||
75 | // set Class and Id and correspoinding masks of a message that should be received |
||
263 | killagreg | 76 | extern ubxmsg_t UbxMsg; |
247 | killagreg | 77 | |
78 | |||
146 | killagreg | 79 | extern u32 UBX_Timeout; |
41 | ingob | 80 | |
81 | void UBX_Init(void); |
||
245 | killagreg | 82 | void UBX_RxParser(u8 c); |
247 | killagreg | 83 | u8 UBX_CreateMsg(Buffer_t* pBuff, u8* pData, u16 Len); |
41 | ingob | 84 | |
85 | |||
86 | #endif // __UBX_H |