32#include "ubx_protocol.h"
35#if PRINT_DEBUG_GPS_UBX_UCENTER
37#define DEBUG_PRINT(...) printf(__VA_ARGS__)
39#define DEBUG_PRINT(...) {}
43#warning "Only one GPS_UBX is supported for ucenter configuration."
55#define GPS_UBX_UCENTER_STATUS_STOPPED 0
56#define GPS_UBX_UCENTER_STATUS_AUTOBAUD 1
57#define GPS_UBX_UCENTER_STATUS_CONFIG 2
58#define GPS_UBX_UCENTER_STATUS_WAITING 3
60#define GPS_UBX_UCENTER_REPLY_NONE 0
61#define GPS_UBX_UCENTER_REPLY_ACK 1
62#define GPS_UBX_UCENTER_REPLY_NACK 2
63#define GPS_UBX_UCENTER_REPLY_VERSION 3
64#define GPS_UBX_UCENTER_REPLY_CFG_PRT 4
67#define UBX_GPS_BAUD (UBX_GPS_PORT).baudrate
120#if PRINT_DEBUG_GPS_UBX_UCENTER
124 DEBUG_PRINT(
"WARNING: Unable to determine the ublox baudrate. Autoconfiguration is unlikely to work.\n");
171 switch (
gps_ubx[0].msg_class) {
333#define NAV_DYN_STATIONARY 1
334#define NAV_DYN_PEDESTRIAN 2
335#define NAV_DYN_AUTOMOTIVE 3
337#define NAV_DYN_AIRBORNE_1G 5
338#define NAV_DYN_AIRBORNE_2G 6
339#define NAV_DYN_AIRBORNE_4G 7
341#define NAV5_DYN_PORTABLE 0
342#define NAV5_DYN_FIXED 1
343#define NAV5_DYN_STATIONARY 2
344#define NAV5_DYN_PEDESTRIAN 3
345#define NAV5_DYN_AUTOMOTIVE 4
346#define NAV5_DYN_SEA 5
347#define NAV5_DYN_AIRBORNE_1G 6
348#define NAV5_DYN_AIRBORNE_2G 7
349#define NAV5_DYN_AIRBORNE_4G 8
351#ifndef GPS_UBX_NAV5_DYNAMICS
352#define GPS_UBX_NAV5_DYNAMICS NAV5_DYN_AIRBORNE_2G
355#if GPS_UBX_UCENTER_ENABLE_NMEA
356#define GPS_UBX_ENABLE_NMEA_DATA_MASK 0xff
358#define GPS_UBX_ENABLE_NMEA_DATA_MASK 0x00
361#define NAV5_MASK 0x05
363#define NAV5_2D_ONLY 1
364#define NAV5_3D_ONLY 2
367#define NAV5_DEFAULT_MIN_ELEV 5
368#define NAV5_DEFAULT_PDOP_MASK 25
369#define NAV5_DEFAULT_TDOP_MASK 25
370#define NAV5_DEFAULT_P_ACC 100
371#define NAV5_DEFAULT_T_ACC 300
372#define NAV5_DEFAULT_STATIC_HOLD_THRES 0
386 0x3C, 0x14, 0x03E8 , 0x0000, 0x0, 0x17, 0x00FA, 0x00FA,
387 0x0064, 0x012C, 0x000F, 0x00, 0x00);
402#warning "GPS_PORT_ID is no longer needed by the ublox ucenter for automatically configuration. Please remove this defined variable and double check that autoconfig is working as expected."
406#define UBX_UART_MODE_MASK 0x000008D0
408#define UBX_PROTO_MASK 0x0001
409#define NMEA_PROTO_MASK 0x0002
410#define RTCM_PROTO_MASK 0x0004
411#define RTCM3_PROTO_MASK 0x0020
413#define GPS_PORT_DDC 0x00
414#define GPS_PORT_UART1 0x01
415#define GPS_PORT_UART2 0x02
416#define GPS_PORT_USB 0x03
417#define GPS_PORT_SPI 0x04
418#define GPS_PORT_RESERVED 0x05
420#ifndef GPS_UBX_UCENTER_RATE
421#define GPS_UBX_UCENTER_RATE 0x00FA
424#ifndef GPS_UBX_UCENTER_SAVE
425#define GPS_UBX_UCENTER_SAVE TRUE
437 DEBUG_PRINT(
"WARNING: Please include the gps_i2c module.\n");
455 DEBUG_PRINT(
"WARNING: ublox SPI port is currently not supported.\n");
463#define GPS_SBAS_ENABLED 0x01
465#define GPS_SBAS_RANGING 0x01
466#define GPS_SBAS_CORRECTIONS 0x02
467#define GPS_SBAS_INTEGRITY 0x04
469#define GPS_SBAS_MAX_SBAS 3
471#define GPS_SBAS_AUTOSCAN 0x00
486 DEBUG_PRINT(
"gps_ubx_ucenter_configure nr: %u\n", nr);
500#if PRINT_DEBUG_GPS_UBX_UCENTER
502 DEBUG_PRINT(
"ublox did not acknowledge port configuration.\n");
524#if GPS_UBX_UCENTER_PVT_ONLY
567#if GPS_UBX_UCENTER_SLOW_NAV_SOL
592#if USE_GPS_UBX_RXM_RAW
598#if USE_GPS_UBX_RXM_SFRB
621#if GPS_UBX_UCENTER_SAVE
632#if DEBUG_GPS_UBX_UCENTER
640#ifdef DOWNLINK_TRANSPORT
Common code for AP and FBW telemetry.
struct GpsUbx gps_ubx[GPS_UBX_NB]
UBX protocol specific code.
void gps_i2c_begin(void)
config is done, begin reading messages
bool gps_i2c_tx_is_ready(void)
is driver ready to send a message
#define NAV_DYN_AIRBORNE_2G
struct gps_ubx_ucenter_struct gps_ubx_ucenter
#define NAV5_DEFAULT_PDOP_MASK
static void gps_ubx_ucenter_config_nav(void)
#define GPS_UBX_UCENTER_RATE
static void gps_ubx_ucenter_config_port_poll(void)
Polls the u-blox port configuration When the payload is omitted (zero length), the configuration for ...
#define NAV5_DEFAULT_T_ACC
#define GPS_SBAS_CORRECTIONS
#define GPS_UBX_UCENTER_REPLY_NACK
void gps_ubx_ucenter_periodic(void)
#define GPS_UBX_UCENTER_STATUS_STOPPED
static void gps_ubx_ucenter_enable_msg(uint8_t class, uint8_t id, uint8_t rate)
Enable u-blox message at desired period.
#define GPS_UBX_UCENTER_REPLY_ACK
#define GPS_UBX_UCENTER_STATUS_AUTOBAUD
#define GPS_UBX_UCENTER_STATUS_CONFIG
#define NAV5_DEFAULT_STATIC_HOLD_THRES
void gps_ubx_ucenter_event(void)
static bool gps_ubx_ucenter_autobaud(uint8_t nr)
Automatically determine the baudrate of the u-blox module.
#define NAV5_DEFAULT_TDOP_MASK
#define GPS_UBX_ENABLE_NMEA_DATA_MASK
#define NAV5_DEFAULT_MIN_ELEV
#define NAV5_DEFAULT_P_ACC
#define GPS_SBAS_AUTOSCAN
#define GPS_UBX_UCENTER_REPLY_VERSION
#define GPS_UBX_UCENTER_REPLY_NONE
#define GPS_SBAS_MAX_SBAS
void gps_ubx_ucenter_init(void)
static void gps_ubx_ucenter_config_port(void)
#define GPS_SBAS_INTEGRITY
#define GPS_UBX_UCENTER_STATUS_WAITING
#define UBX_UART_MODE_MASK
int gps_ubx_ucenter_get_status(void)
#define GPS_UBX_NAV5_DYNAMICS
static bool gps_ubx_ucenter_configure(uint8_t nr)
#define GPS_UBX_UCENTER_REPLY_CFG_PRT
static void gps_ubx_ucenter_config_sbas(void)
#define GPS_UBX_UCENTER_CONFIG_STEPS
U-Center Variables.
char replies[GPS_UBX_UCENTER_CONFIG_STEPS]
uint8_t port_id
Port identifier number.
void uart_periph_set_baudrate(struct uart_periph *periph, uint32_t baud)
unsigned char uint8_t
Typedef defining 8 bit unsigned char type.