2 ******************************************************************************
3 * @addtogroup OpenPilotModules OpenPilot Modules
5 * @addtogroup GPSModule GPS Module
6 * @brief Process GPS information (UBX binary format)
10 * @author The LibrePilot Project, http://www.librepilot.org Copyright (C) 2015-2016.
11 * The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010.
12 * @brief GPS module, handles GPS and UBX stream
13 * @see The GNU Public License (GPL) Version 3
15 *****************************************************************************/
17 * This program is free software; you can redistribute it and/or modify
18 * it under the terms of the GNU General Public License as published by
19 * the Free Software Foundation; either version 3 of the License, or
20 * (at your option) any later version.
22 * This program is distributed in the hope that it will be useful, but
23 * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
24 * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
27 * You should have received a copy of the GNU General Public License along
28 * with this program; if not, write to the Free Software Foundation, Inc.,
29 * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
34 #include "openpilot.h"
35 #include "gpspositionsensor.h"
36 #include "gpsextendedstatus.h"
37 #ifndef PIOS_GPS_MINIMAL
38 #include "auxmagsensor.h"
43 #define UBX_HW_VERSION_8 80000
44 #define UBX_HW_VERSION_7 70000
45 #define UBX_HW_VERSION_6 60000
46 #define UBX_HW_VERSION_5 50000
48 #define UBX_SYNC1 0xb5 // UBX protocol synchronization characters
49 #define UBX_SYNC2 0x62
51 // From u-blox6 receiver protocol specification
59 UBX_CLASS_OP_CUST
= 0x99,
61 // unused class IDs, used for disabling them
67 UBX_ID_NAV_POSLLH
= 0x02,
68 UBX_ID_NAV_STATUS
= 0x03,
69 UBX_ID_NAV_DOP
= 0x04,
70 UBX_ID_NAV_SOL
= 0x06,
71 UBX_ID_NAV_VELNED
= 0x12,
72 UBX_ID_NAV_TIMEUTC
= 0x21,
73 UBX_ID_NAV_SVINFO
= 0x30,
74 UBX_ID_NAV_PVT
= 0x07,
76 UBX_ID_NAV_AOPSTATUS
= 0x60,
77 UBX_ID_NAV_CLOCK
= 0x22,
78 UBX_ID_NAV_DGPS
= 0x31,
79 UBX_ID_NAV_POSECEF
= 0x01,
80 UBX_ID_NAV_SBAS
= 0x32,
81 UBX_ID_NAV_TIMEGPS
= 0x20,
82 UBX_ID_NAV_VELECEF
= 0x11
91 UBX_ID_MON_VER
= 0x04,
92 // unused messages IDs, used for disabling them
93 UBX_ID_MON_HW2
= 0x0B,
96 UBX_ID_MON_MSGPP
= 0x06,
97 UBX_ID_MON_RXBUFF
= 0x07,
98 UBX_ID_MON_RXR
= 0x21,
99 UBX_ID_MON_TXBUF
= 0x08,
103 UBX_ID_CFG_NAV5
= 0x24,
104 UBX_ID_CFG_NAVX5
= 0x23,
105 UBX_ID_CFG_RATE
= 0x08,
106 UBX_ID_CFG_MSG
= 0x01,
107 UBX_ID_CFG_CFG
= 0x09,
108 UBX_ID_CFG_SBAS
= 0x16,
109 UBX_ID_CFG_GNSS
= 0x3E,
110 UBX_ID_CFG_PRT
= 0x00
114 UBX_ID_ACK_ACK
= 0x01,
115 UBX_ID_ACK_NAK
= 0x00,
119 UBX_ID_AID_ALM
= 0x0B,
120 UBX_ID_AID_ALPSRV
= 0x32,
121 UBX_ID_AID_ALP
= 0x50,
122 UBX_ID_AID_AOP
= 0x33,
123 UBX_ID_AID_DATA
= 0x10,
124 UBX_ID_AID_EPH
= 0x31,
125 UBX_ID_AID_HUI
= 0x02,
126 UBX_ID_AID_INI
= 0x01,
127 UBX_ID_AID_REQ
= 0x00,
131 UBX_ID_RXM_ALM
= 0x30,
132 UBX_ID_RXM_EPH
= 0x31,
133 UBX_ID_RXM_RAW
= 0x10,
134 UBX_ID_RXM_SFRB
= 0x11,
135 UBX_ID_RXM_SVSI
= 0x20,
140 UBX_GNSS_ID_SBAS
= 1,
141 UBX_GNSS_ID_GALILEO
= 2,
142 UBX_GNSS_ID_BEIDOU
= 3,
143 UBX_GNSS_ID_IMES
= 4,
144 UBX_GNSS_ID_QZSS
= 5,
145 UBX_GNSS_ID_GLONASS
= 6,
147 } ubx_config_gnss_id_t
;
149 // Enumeration options for field UBXDynamicModel
151 UBX_DYNMODEL_PORTABLE
= 0,
152 UBX_DYNMODEL_STATIONARY
= 2,
153 UBX_DYNMODEL_PEDESTRIAN
= 3,
154 UBX_DYNMODEL_AUTOMOTIVE
= 4,
155 UBX_DYNMODEL_SEA
= 5,
156 UBX_DYNMODEL_AIRBORNE1G
= 6,
157 UBX_DYNMODEL_AIRBORNE2G
= 7,
158 UBX_DYNMODEL_AIRBORNE4G
= 8
159 } ubx_config_dynamicmodel_t
;
162 UBX_SBAS_SATS_AUTOSCAN
= 0,
163 UBX_SBAS_SATS_WAAS
= 1,
164 UBX_SBAS_SATS_EGNOS
= 2,
165 UBX_SBAS_SATS_MSAS
= 3,
166 UBX_SBAS_SATS_GAGAN
= 4,
167 UBX_SBAS_SATS_SDCM
= 5
170 // private structures
172 // Geodetic Position Solution
173 struct UBX_NAV_POSLLH
{
174 uint32_t iTOW
; // GPS Millisecond Time of Week (ms)
175 int32_t lon
; // Longitude (deg*1e-7)
176 int32_t lat
; // Latitude (deg*1e-7)
177 int32_t height
; // Height above Ellipsoid (mm)
178 int32_t hMSL
; // Height above mean sea level (mm)
179 uint32_t hAcc
; // Horizontal Accuracy Estimate (mm)
180 uint32_t vAcc
; // Vertical Accuracy Estimate (mm)
181 } __attribute__((packed
));
183 // Receiver Navigation Status
184 #define STATUS_GPSFIX_NOFIX 0x00
185 #define STATUS_GPSFIX_DRONLY 0x01
186 #define STATUS_GPSFIX_2DFIX 0x02
187 #define STATUS_GPSFIX_3DFIX 0x03
188 #define STATUS_GPSFIX_GPSDR 0x04
189 #define STATUS_GPSFIX_TIMEONLY 0x05
191 #define STATUS_FLAGS_GPSFIX_OK (1 << 0)
192 #define STATUS_FLAGS_DIFFSOLN (1 << 1)
193 #define STATUS_FLAGS_WKNSET (1 << 2)
194 #define STATUS_FLAGS_TOWSET (1 << 3)
196 struct UBX_NAV_STATUS
{
197 uint32_t iTOW
; // GPS Millisecond Time of Week (ms)
198 uint8_t gpsFix
; // GPS fix type
199 uint8_t flags
; // Navigation Status Flags
200 uint8_t fixStat
; // Fix Status Information
201 uint8_t flags2
; // Additional navigation output information
202 uint32_t ttff
; // Time to first fix (ms)
203 uint32_t msss
; // Milliseconds since startup/reset (ms)
204 } __attribute__((packed
));
206 // Dilution of precision
208 uint32_t iTOW
; // GPS Millisecond Time of Week (ms)
209 uint16_t gDOP
; // Geometric DOP
210 uint16_t pDOP
; // Position DOP
211 uint16_t tDOP
; // Time DOP
212 uint16_t vDOP
; // Vertical DOP
213 uint16_t hDOP
; // Horizontal DOP
214 uint16_t nDOP
; // Northing DOP
215 uint16_t eDOP
; // Easting DOP
216 } __attribute__((packed
));
218 // Navigation solution
220 uint32_t iTOW
; // GPS Millisecond Time of Week (ms)
221 int32_t fTOW
; // fractional nanoseconds (ns)
222 int16_t week
; // GPS week
223 uint8_t gpsFix
; // GPS fix type
224 uint8_t flags
; // Fix status flags
225 int32_t ecefX
; // ECEF X coordinate (cm)
226 int32_t ecefY
; // ECEF Y coordinate (cm)
227 int32_t ecefZ
; // ECEF Z coordinate (cm)
228 uint32_t pAcc
; // 3D Position Accuracy Estimate (cm)
229 int32_t ecefVX
; // ECEF X coordinate (cm/s)
230 int32_t ecefVY
; // ECEF Y coordinate (cm/s)
231 int32_t ecefVZ
; // ECEF Z coordinate (cm/s)
232 uint32_t sAcc
; // Speed Accuracy Estimate
233 uint16_t pDOP
; // Position DOP
234 uint8_t reserved1
; // Reserved
235 uint8_t numSV
; // Number of SVs used in Nav Solution
236 uint32_t reserved2
; // Reserved
237 } __attribute__((packed
));
239 // PVT Navigation Position Velocity Time Solution
240 #define PVT_VALID_VALIDDATE 0x01
241 #define PVT_VALID_VALIDTIME 0x02
242 #define PVT_VALID_FULLYRESOLVED 0x04
244 #define PVT_FIX_TYPE_NO_FIX 0
245 #define PVT_FIX_TYPE_DEAD_RECKON 0x01 // Dead Reckoning only
246 #define PVT_FIX_TYPE_2D 0x02 // 2D-Fix
247 #define PVT_FIX_TYPE_3D 0x03 // 3D-Fix
248 #define PVT_FIX_TYPE_GNSS_DEAD_RECKON 0x04 // GNSS + dead reckoning combined
249 #define PVT_FIX_TYPE_TIME_ONLY 0x05 // Time only fix
251 #define PVT_FLAGS_GNSSFIX_OK (1 << 0)
252 #define PVT_FLAGS_DIFFSOLN (1 << 1)
253 #define PVT_FLAGS_PSMSTATE_ENABLED (1 << 2)
254 #define PVT_FLAGS_PSMSTATE_ACQUISITION (2 << 2)
255 #define PVT_FLAGS_PSMSTATE_TRACKING (3 << 2)
256 #define PVT_FLAGS_PSMSTATE_PO_TRACKING (4 << 2)
257 #define PVT_FLAGS_PSMSTATE_INACTIVE (5 << 2)
290 } __attribute__((packed
));
292 // North/East/Down velocity
293 struct UBX_NAV_VELNED
{
294 uint32_t iTOW
; // ms GPS Millisecond Time of Week
295 int32_t velN
; // cm/s NED north velocity
296 int32_t velE
; // cm/s NED east velocity
297 int32_t velD
; // cm/s NED down velocity
298 uint32_t speed
; // cm/s Speed (3-D)
299 uint32_t gSpeed
; // cm/s Ground Speed (2-D)
300 int32_t heading
; // 1e-5 *deg Heading of motion 2-D
301 uint32_t sAcc
; // cm/s Speed Accuracy Estimate
302 uint32_t cAcc
; // 1e-5 *deg Course / Heading Accuracy Estimate
303 } __attribute__((packed
));
306 #define TIMEUTC_VALIDTOW (1 << 0)
307 #define TIMEUTC_VALIDWKN (1 << 1)
308 #define TIMEUTC_VALIDUTC (1 << 2)
310 struct UBX_NAV_TIMEUTC
{
311 uint32_t iTOW
; // GPS Millisecond Time of Week (ms)
312 uint32_t tAcc
; // Time Accuracy Estimate (ns)
313 int32_t nano
; // Nanoseconds of second
320 uint8_t valid
; // Validity Flags
321 } __attribute__((packed
));
323 // Space Vehicle (SV) Information
324 // Single SV information block
325 #define SVUSED (1 << 0) // This SV is used for navigation
326 #define DIFFCORR (1 << 1) // Differential correction available
327 #define ORBITAVAIL (1 << 2) // Orbit information available
328 #define ORBITEPH (1 << 3) // Orbit information is Ephemeris
329 #define UNHEALTHY (1 << 4) // SV is unhealthy
330 #define ORBITALM (1 << 5) // Orbit information is Almanac Plus
331 #define ORBITAOP (1 << 6) // Orbit information is AssistNow Autonomous
332 #define SMOOTHED (1 << 7) // Carrier smoothed pseudoranges used
334 struct UBX_NAV_SVINFO_SV
{
335 uint8_t chn
; // Channel number
336 uint8_t svid
; // Satellite ID
337 uint8_t flags
; // Misc SV information
338 uint8_t quality
; // Misc quality indicators
339 uint8_t cno
; // Carrier to Noise Ratio (dbHz)
340 int8_t elev
; // Elevation (integer degrees)
341 int16_t azim
; // Azimuth (integer degrees)
342 int32_t prRes
; // Pseudo range residual (cm)
343 } __attribute__((packed
));
345 // SV information message
348 struct UBX_NAV_SVINFO
{
349 uint32_t iTOW
; // GPS Millisecond Time of Week (ms)
350 uint8_t numCh
; // Number of channels
351 uint8_t globalFlags
; //
352 uint16_t reserved2
; // Reserved
353 struct UBX_NAV_SVINFO_SV sv
[MAX_SVS
]; // Repeated 'numCh' times
354 } __attribute__((packed
));
358 uint8_t clsID
; // ClassID
359 uint8_t msgID
; // MessageID
360 } __attribute__((packed
));
363 uint8_t clsID
; // ClassID
364 uint8_t msgID
; // MessageID
365 } __attribute__((packed
));
367 // Communication port information
368 // default cfg_prt packet at 9600,N,8,1 (from u-center)
369 // 0000 B5 62 06 00 14 00-01 00
370 // 0008 00 00 D0 08 00 00 80 25
371 // 0010 00 00 07 00 03 00 00 00
373 #define UBX_CFG_PRT_PORTID_DDC 0
374 #define UBX_CFG_PRT_PORTID_UART1 1
375 #define UBX_CFG_PRT_PORTID_UART2 2
376 #define UBX_CFG_PRT_PORTID_USB 3
377 #define UBX_CFG_PRT_PORTID_SPI 4
378 #define UBX_CFG_PRT_MODE_DATABITS5 0x00
379 #define UBX_CFG_PRT_MODE_DATABITS6 0x40
380 #define UBX_CFG_PRT_MODE_DATABITS7 0x80
381 #define UBX_CFG_PRT_MODE_DATABITS8 0xC0
382 #define UBX_CFG_PRT_MODE_EVENPARITY 0x000
383 #define UBX_CFG_PRT_MODE_ODDPARITY 0x200
384 #define UBX_CFG_PRT_MODE_NOPARITY 0x800
385 #define UBX_CFG_PRT_MODE_STOPBITS1_0 0x0000
386 #define UBX_CFG_PRT_MODE_STOPBITS1_5 0x1000
387 #define UBX_CFG_PRT_MODE_STOPBITS2_0 0x2000
388 #define UBX_CFG_PRT_MODE_STOPBITS0_5 0x3000
389 #define UBX_CFG_PRT_MODE_RESERVED 0x10
391 #define UBX_CFG_PRT_MODE_DEFAULT (UBX_CFG_PRT_MODE_DATABITS8 | UBX_CFG_PRT_MODE_NOPARITY | UBX_CFG_PRT_MODE_STOPBITS1_0 | UBX_CFG_PRT_MODE_RESERVED)
394 uint8_t portID
; // 1 or 2 for UART ports
395 uint8_t res0
; // reserved
396 uint16_t res1
; // reserved
397 uint32_t mode
; // bit masks for databits, stopbits, parity, and non-zero reserved
398 uint32_t baudRate
; // bits per second, 9600 means 9600
399 uint16_t inProtoMask
; // bit 0 on = UBX, bit 1 on = NEMA
400 uint16_t outProtoMask
; // bit 0 on = UBX, bit 1 on = NEMA
401 uint16_t flags
; // reserved
402 uint16_t pad
; // reserved
403 } __attribute__((packed
));
409 } __attribute__((packed
));
411 struct UBX_CFG_RATE
{
415 } __attribute__((packed
));
417 // Mask for "all supported devices": battery backed RAM, Flash, EEPROM, SPI Flash
418 #define UBX_CFG_CFG_DEVICE_BBR 0x01
419 #define UBX_CFG_CFG_DEVICE_FLASH 0x02
420 #define UBX_CFG_CFG_DEVICE_EEPROM 0x04
421 #define UBX_CFG_CFG_DEVICE_SPIFLASH 0x10
422 #define UBX_CFG_CFG_DEVICE_ALL (UBX_CFG_CFG_DEVICE_BBR | UBX_CFG_CFG_DEVICE_FLASH | UBX_CFG_CFG_DEVICE_EEPROM | UBX_CFG_CFG_DEVICE_SPIFLASH)
423 #define UBX_CFG_CFG_SETTINGS_NONE 0x000
424 #define UBX_CFG_CFG_SETTINGS_IOPORT 0x001
425 #define UBX_CFG_CFG_SETTINGS_MSGCONF 0x002
426 #define UBX_CFG_CFG_SETTINGS_INFMSG 0x004
427 #define UBX_CFG_CFG_SETTINGS_NAVCONF 0x008
428 #define UBX_CFG_CFG_SETTINGS_TPCONF 0x010
429 #define UBX_CFG_CFG_SETTINGS_SFDRCONF 0x100
430 #define UBX_CFG_CFG_SETTINGS_RINVCONF 0x200
431 #define UBX_CFG_CFG_SETTINGS_ANTCONF 0x400
433 #define UBX_CFG_CFG_SETTINGS_ALL \
434 (UBX_CFG_CFG_SETTINGS_IOPORT | \
435 UBX_CFG_CFG_SETTINGS_MSGCONF | \
436 UBX_CFG_CFG_SETTINGS_INFMSG | \
437 UBX_CFG_CFG_SETTINGS_NAVCONF | \
438 UBX_CFG_CFG_SETTINGS_TPCONF | \
439 UBX_CFG_CFG_SETTINGS_SFDRCONF | \
440 UBX_CFG_CFG_SETTINGS_RINVCONF | \
441 UBX_CFG_CFG_SETTINGS_ANTCONF)
443 // Sent messages for configuration support
449 } __attribute__((packed
));
451 #define UBX_CFG_SBAS_MODE_ENABLED 0x01
452 #define UBX_CFG_SBAS_MODE_TEST 0x02
453 #define UBX_CFG_SBAS_USAGE_RANGE 0x01
454 #define UBX_CFG_SBAS_USAGE_DIFFCORR 0x02
455 #define UBX_CFG_SBAS_USAGE_INTEGRITY 0x04
457 // SBAS used satellite PNR bitmask (120-151)
458 // -------------------------------------1---------1---------1---------1
459 // -------------------------------------5---------4---------3---------2
460 // ------------------------------------10987654321098765432109876543210
461 // WAAS 122, 133, 134, 135, 138---------|---------|---------|---------|
462 #define UBX_CFG_SBAS_SCANMODE1_WAAS 0b00000000000001001110000000000100
463 // EGNOS 120, 123, 136------------------|---------|---------|---------|
464 #define UBX_CFG_SBAS_SCANMODE1_EGNOS 0b00000000000000010000000000001001
465 // MSAS 129, 137------------------------|---------|---------|---------|
466 #define UBX_CFG_SBAS_SCANMODE1_MSAS 0b00000000000000100000001000000000
467 // GAGAN 127, 128-----------------------|---------|---------|---------|
468 #define UBX_CFG_SBAS_SCANMODE1_GAGAN 0b00000000000000000000000110000000
469 // SDCM 125, 140, 141-------------------|---------|---------|---------|
470 #define UBX_CFG_SBAS_SCANMODE1_SDCM 0b00000000001100000000000000100000
472 #define UBX_CFG_SBAS_SCANMODE2 0x00
473 struct UBX_CFG_SBAS
{
479 } __attribute__((packed
));
481 #define UBX_CFG_GNSS_FLAGS_ENABLED 0x000001
482 #define UBX_CFG_GNSS_FLAGS_GPS_L1CA 0x010000
483 #define UBX_CFG_GNSS_FLAGS_SBAS_L1CA 0x010000
484 #define UBX_CFG_GNSS_FLAGS_BEIDOU_B1I 0x010000
485 #define UBX_CFG_GNSS_FLAGS_QZSS_L1CA 0x010000
486 #define UBX_CFG_GNSS_FLAGS_QZSS_L1SAIF 0x040000
487 #define UBX_CFG_GNSS_FLAGS_GLONASS_L1OF 0x010000
488 #define UBX_CFG_GNSS_FLAGS_GALILEO_E1 0x010000
490 #define UBX_CFG_GNSS_NUMCH_VER7 22
491 #define UBX_CFG_GNSS_NUMCH_VER8 32
493 struct UBX_CFG_GNSS_CFGBLOCK
{
499 } __attribute__((packed
));
501 struct UBX_CFG_GNSS
{
505 uint8_t numConfigBlocks
;
506 struct UBX_CFG_GNSS_CFGBLOCK cfgBlocks
[UBX_GNSS_ID_MAX
];
507 } __attribute__((packed
));
509 // CFG-NAV5: Position Fixing Mode
510 #define UBX_CFG_NAV5_FIXMODE_2D_ONLY 0x01
511 #define UBX_CFG_NAV5_FIXMODE_3D_ONLY 0x02
512 #define UBX_CFG_NAV5_FIXMODE_AUTO_2D3D 0x03
514 // CFG-NAV5: Bitfield mask
515 #define UBX_CFG_NAV5_DYNMODEL (1 << 0) // Apply dynamic model settings
516 #define UBX_CFG_NAV5_MINELEV (1 << 1) // Apply minimum elevation settings
517 #define UBX_CFG_NAV5_FIXMODE (1 << 2) // Apply fix mode settings
518 #define UBX_CFG_NAV5_DRLIMIT (1 << 3) // Reserved
519 #define UBX_CFG_NAV5_POSITION (1 << 4) // Apply position mask settings
520 #define UBX_CFG_NAV5_TIME (1 << 5) // Apply time mask settings
521 #define UBX_CFG_NAV5_STATICHOLD (1 << 6) // Apply static hold settings
522 #define UBX_CFG_NAV5_DGPS (1 << 7) // Reserved
524 struct UBX_CFG_NAV5
{
529 uint32_t fixedAltVar
;
536 uint8_t staticHoldThresh
;
538 uint8_t cnoThreshNumSVs
;
543 } __attribute__((packed
));
545 // CFG-NAVX5: Bitfield mask1
546 #define UBX_CFG_NAVX5_MIN_MAX (1 << 2) // Apply min/max SVs settings
547 #define UBX_CFG_NAVX5_MIN_CNO (1 << 3) // Apply minimum C/N0 setting
548 #define UBX_CFG_NAVX5_INIT_3DFIX (1 << 6) // Apply initial 3D fix settings
549 #define UBX_CFG_NAVX5_WKN_ROLL (1 << 9) // Apply GPS weeknumber rollover settings
550 #define UBX_CFG_NAVX5_PPP (1 << 13) // Apply PPP flag, only supported on certain product variants
551 #define UBX_CFG_NAVX5_AOP (1 << 14) // Apply useAOP flag and aopOrbMaxErr setting (AssistNow Autonomous)
553 struct UBX_CFG_NAVX5
{
567 uint16_t wknRollover
;
575 uint16_t aopOrbMaxErr
;
578 } __attribute__((packed
));
581 #define UBX_MON_MAX_EXT 5
585 #if UBX_MON_MAX_EXT > 0
586 char extension
[UBX_MON_MAX_EXT
][30];
588 } __attribute__((packed
));
590 // OP custom messages
591 struct UBX_OP_SYSINFO
{
595 uint8_t board_revision
;
596 uint8_t commit_tag_name
[26];
598 } __attribute__((packed
));
600 // OP custom messages
606 } __attribute__((packed
));
611 struct UBX_NAV_POSLLH nav_posllh
;
612 struct UBX_NAV_STATUS nav_status
;
613 struct UBX_NAV_DOP nav_dop
;
614 struct UBX_NAV_SOL nav_sol
;
615 struct UBX_NAV_VELNED nav_velned
;
616 #if !defined(PIOS_GPS_MINIMAL)
617 struct UBX_NAV_PVT nav_pvt
;
618 struct UBX_NAV_TIMEUTC nav_timeutc
;
619 struct UBX_NAV_SVINFO nav_svinfo
;
620 struct UBX_CFG_PRT cfg_prt
;
622 struct UBX_ACK_ACK ack_ack
;
623 struct UBX_ACK_NAK ack_nak
;
625 struct UBX_MON_VER mon_ver
;
626 struct UBX_OP_SYSINFO op_sysinfo
;
627 struct UBX_OP_MAG op_mag
;
637 } __attribute__((packed
));
640 struct UBXHeader header
;
642 } __attribute__((packed
));
644 struct UBXSENTHEADER
{
649 } __attribute__((packed
));
651 union UBXSENTPACKET
{
654 struct UBXSENTHEADER header
;
656 struct UBX_CFG_CFG cfg_cfg
;
657 struct UBX_CFG_MSG cfg_msg
;
658 struct UBX_CFG_NAV5 cfg_nav5
;
659 struct UBX_CFG_NAVX5 cfg_navx5
;
660 struct UBX_CFG_PRT cfg_prt
;
661 struct UBX_CFG_RATE cfg_rate
;
662 struct UBX_CFG_SBAS cfg_sbas
;
663 struct UBX_CFG_GNSS cfg_gnss
;
665 uint8_t resvd
[2]; // added space for checksum bytes
667 } __attribute__((packed
));
669 // Used by AutoConfig code
670 extern int32_t ubxHwVersion
;
671 extern GPSPositionSensorSensorTypeOptions ubxSensorType
;
672 extern struct UBX_ACK_ACK ubxLastAck
;
673 extern struct UBX_ACK_NAK ubxLastNak
;
675 bool checksum_ubx_message(struct UBXPacket
*);
676 uint32_t parse_ubx_message(struct UBXPacket
*, GPSPositionSensorData
*);
678 int parse_ubx_stream(uint8_t *rx
, uint16_t len
, char *, GPSPositionSensorData
*, struct GPS_RX_STATS
*);
679 void op_gpsv9_load_mag_settings();
680 void aux_hmc5x83_load_mag_settings();