Merged in f5soh/librepilot/update_credits (pull request #529)
[librepilot.git] / flight / modules / gpsp / inc / gps9protocol.h
blob59a5a23da14a450356ee9a3245fbb14bc5aa39b4
1 /**
2 ******************************************************************************
4 * @file gpsv9protocol.h
5 * @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2014.
6 * @brief brief goes here.
7 * --
8 * @see The GNU Public License (GPL) Version 3
10 *****************************************************************************/
12 * This program is free software; you can redistribute it and/or modify
13 * it under the terms of the GNU General Public License as published by
14 * the Free Software Foundation; either version 3 of the License, or
15 * (at your option) any later version.
17 * This program is distributed in the hope that it will be useful, but
18 * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
19 * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
20 * for more details.
22 * You should have received a copy of the GNU General Public License along
23 * with this program; if not, write to the Free Software Foundation, Inc.,
24 * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
26 #ifndef GPSV9PROTOCOL_H_
27 #define GPSV9PROTOCOL_H_
29 #include <openpilot.h>
30 #include <pios_struct_helper.h>
31 #include <pios_helpers.h>
32 #include <ubx_utils.h>
34 #define UBX_CFG_CLASS 0x06
35 #define UBX_CFG_PRT 0x00
36 #define UBX_OP_CUST_CLASS 0x99
37 #define UBX_OP_SYS 0x01
38 #define UBX_OP_MAG 0x02
41 #define SYS_DATA_OPTIONS_FLASH 0x01
42 #define SYS_DATA_OPTIONS_MAG 0x02
44 #define CFG_PRT_DATA_PORTID_DDC 0x00
45 #define CFG_PRT_DATA_TXREADI_DISABLED 0x00
46 #define CFG_PRT_DATA_PORTID_DDC 0x00
47 #define CFG_PRT_DATA_MODE_ADDR (0x42 << 1)
48 #define CFG_PRT_DATA_PROTO_UBX 0x01
49 #define CFG_PRT_DATA_PROTO_NMEA 0x02
50 #define CFG_PRT_DATA_PROTO_RTCM 0x04
51 #define CFG_PRT_DATA_FLAGS_EXTTIMEOUT 0x02
54 typedef struct {
55 int16_t X;
56 int16_t Y;
57 int16_t Z;
58 uint16_t status;
59 } __attribute__((packed)) MagData;
61 typedef union {
62 struct {
63 UBXHeader_t header;
64 MagData data;
65 UBXFooter_t footer;
66 } __attribute__((packed)) fragments;
67 UBXPacket_t packet;
68 } MagUbxPkt;
70 typedef struct {
71 uint32_t flightTime;
72 uint16_t options;
73 uint8_t board_type;
74 uint8_t board_revision;
75 uint8_t commit_tag_name[26];
76 uint8_t sha1sum[8];
77 } __attribute__((packed)) SysData;
79 typedef union {
80 struct {
81 UBXHeader_t header;
82 SysData data;
83 UBXFooter_t footer;
84 } fragments;
85 UBXPacket_t packet;
86 } SysUbxPkt;
89 typedef struct {
90 uint8_t portID;
91 uint8_t reserved0;
92 uint16_t txReady;
93 uint32_t mode;
94 uint32_t reserved3;
95 uint16_t inProtoMask;
96 uint16_t outProtoMask;
97 uint16_t flags;
98 uint16_t reserved5;
99 } __attribute__((packed)) CfgPrtData;
101 typedef union {
102 struct {
103 UBXHeader_t header;
104 CfgPrtData data;
105 UBXFooter_t footer;
106 } fragments;
107 UBXPacket_t packet;
108 } CfgPrtPkt;
110 #endif /* GPSV9PROTOCOL_H_ */