Paparazzi UAS  v7.0_unstable
Paparazzi is a free software Unmanned Aircraft System.
gps_ubx_ucenter.c File Reference

Configure Ublox GPS. More...

#include "modules/gps/gps_ubx_ucenter.h"
#include "modules/gps/gps_ubx.h"
#include "ubx_protocol.h"
#include "modules/datalink/downlink.h"
+ Include dependency graph for gps_ubx_ucenter.c:

Go to the source code of this file.

Macros

#define DEBUG_PRINT(...)   {}
 
#define GPS_UBX_UCENTER_STATUS_STOPPED   0
 
#define GPS_UBX_UCENTER_STATUS_AUTOBAUD   1
 
#define GPS_UBX_UCENTER_STATUS_CONFIG   2
 
#define GPS_UBX_UCENTER_STATUS_WAITING   3
 
#define GPS_UBX_UCENTER_REPLY_NONE   0
 
#define GPS_UBX_UCENTER_REPLY_ACK   1
 
#define GPS_UBX_UCENTER_REPLY_NACK   2
 
#define GPS_UBX_UCENTER_REPLY_VERSION   3
 
#define GPS_UBX_UCENTER_REPLY_CFG_PRT   4
 
#define UBX_GPS_BAUD   (UBX_GPS_PORT).baudrate
 
#define NAV_DYN_STATIONARY   1
 
#define NAV_DYN_PEDESTRIAN   2
 
#define NAV_DYN_AUTOMOTIVE   3
 
#define NAV_DYN_SEA   4
 
#define NAV_DYN_AIRBORNE_1G   5
 
#define NAV_DYN_AIRBORNE_2G   6
 
#define NAV_DYN_AIRBORNE_4G   7
 
#define NAV5_DYN_PORTABLE   0
 
#define NAV5_DYN_FIXED   1
 
#define NAV5_DYN_STATIONARY   2
 
#define NAV5_DYN_PEDESTRIAN   3
 
#define NAV5_DYN_AUTOMOTIVE   4
 
#define NAV5_DYN_SEA   5
 
#define NAV5_DYN_AIRBORNE_1G   6
 
#define NAV5_DYN_AIRBORNE_2G   7
 
#define NAV5_DYN_AIRBORNE_4G   8
 
#define GPS_UBX_NAV5_DYNAMICS   NAV5_DYN_AIRBORNE_2G
 
#define GPS_UBX_ENABLE_NMEA_DATA_MASK   0x00
 
#define NAV5_MASK   0x05
 
#define NAV5_2D_ONLY   1
 
#define NAV5_3D_ONLY   2
 
#define NAV5_AUTO   3
 
#define NAV5_DEFAULT_MIN_ELEV   5
 
#define NAV5_DEFAULT_PDOP_MASK   25
 
#define NAV5_DEFAULT_TDOP_MASK   25
 
#define NAV5_DEFAULT_P_ACC   100
 
#define NAV5_DEFAULT_T_ACC   300
 
#define NAV5_DEFAULT_STATIC_HOLD_THRES   0
 
#define IGNORED   0
 
#define RESERVED   0
 
#define UBX_UART_MODE_MASK   0x000008D0
 
#define UBX_PROTO_MASK   0x0001
 
#define NMEA_PROTO_MASK   0x0002
 
#define RTCM_PROTO_MASK   0x0004
 
#define RTCM3_PROTO_MASK   0x0020
 
#define GPS_PORT_DDC   0x00
 
#define GPS_PORT_UART1   0x01
 
#define GPS_PORT_UART2   0x02
 
#define GPS_PORT_USB   0x03
 
#define GPS_PORT_SPI   0x04
 
#define GPS_PORT_RESERVED   0x05
 
#define GPS_UBX_UCENTER_RATE   0x00FA
 
#define GPS_SBAS_ENABLED   0x01
 
#define GPS_SBAS_RANGING   0x01
 
#define GPS_SBAS_CORRECTIONS   0x02
 
#define GPS_SBAS_INTEGRITY   0x04
 
#define GPS_SBAS_MAX_SBAS   3
 
#define GPS_SBAS_AUTOSCAN   0x00
 

Functions

static bool gps_ubx_ucenter_autobaud (uint8_t nr)
 Automatically determine the baudrate of the u-blox module. More...
 
static bool gps_ubx_ucenter_configure (uint8_t nr)
 
void gps_ubx_ucenter_init (void)
 
void gps_ubx_ucenter_periodic (void)
 
void gps_ubx_ucenter_event (void)
 
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 the incoming (currently used) port is reported. More...
 
static void gps_ubx_ucenter_enable_msg (uint8_t class, uint8_t id, uint8_t rate)
 Enable u-blox message at desired period. More...
 
static void gps_ubx_ucenter_config_nav (void)
 
static void gps_ubx_ucenter_config_port (void)
 
static void gps_ubx_ucenter_config_sbas (void)
 
int gps_ubx_ucenter_get_status (void)
 

Variables

struct gps_ubx_ucenter_struct gps_ubx_ucenter
 

Detailed Description

Configure Ublox GPS.

Definition in file gps_ubx_ucenter.c.

Macro Definition Documentation

◆ DEBUG_PRINT

#define DEBUG_PRINT (   ...)    {}

Definition at line 39 of file gps_ubx_ucenter.c.

◆ GPS_PORT_DDC

#define GPS_PORT_DDC   0x00

Definition at line 411 of file gps_ubx_ucenter.c.

◆ GPS_PORT_RESERVED

#define GPS_PORT_RESERVED   0x05

Definition at line 416 of file gps_ubx_ucenter.c.

◆ GPS_PORT_SPI

#define GPS_PORT_SPI   0x04

Definition at line 415 of file gps_ubx_ucenter.c.

◆ GPS_PORT_UART1

#define GPS_PORT_UART1   0x01

Definition at line 412 of file gps_ubx_ucenter.c.

◆ GPS_PORT_UART2

#define GPS_PORT_UART2   0x02

Definition at line 413 of file gps_ubx_ucenter.c.

◆ GPS_PORT_USB

#define GPS_PORT_USB   0x03

Definition at line 414 of file gps_ubx_ucenter.c.

◆ GPS_SBAS_AUTOSCAN

#define GPS_SBAS_AUTOSCAN   0x00

Definition at line 465 of file gps_ubx_ucenter.c.

◆ GPS_SBAS_CORRECTIONS

#define GPS_SBAS_CORRECTIONS   0x02

Definition at line 460 of file gps_ubx_ucenter.c.

◆ GPS_SBAS_ENABLED

#define GPS_SBAS_ENABLED   0x01

Definition at line 457 of file gps_ubx_ucenter.c.

◆ GPS_SBAS_INTEGRITY

#define GPS_SBAS_INTEGRITY   0x04

Definition at line 461 of file gps_ubx_ucenter.c.

◆ GPS_SBAS_MAX_SBAS

#define GPS_SBAS_MAX_SBAS   3

Definition at line 463 of file gps_ubx_ucenter.c.

◆ GPS_SBAS_RANGING

#define GPS_SBAS_RANGING   0x01

Definition at line 459 of file gps_ubx_ucenter.c.

◆ GPS_UBX_ENABLE_NMEA_DATA_MASK

#define GPS_UBX_ENABLE_NMEA_DATA_MASK   0x00

Definition at line 356 of file gps_ubx_ucenter.c.

◆ GPS_UBX_NAV5_DYNAMICS

#define GPS_UBX_NAV5_DYNAMICS   NAV5_DYN_AIRBORNE_2G

Definition at line 352 of file gps_ubx_ucenter.c.

◆ GPS_UBX_UCENTER_RATE

#define GPS_UBX_UCENTER_RATE   0x00FA

Definition at line 419 of file gps_ubx_ucenter.c.

◆ GPS_UBX_UCENTER_REPLY_ACK

#define GPS_UBX_UCENTER_REPLY_ACK   1

Definition at line 61 of file gps_ubx_ucenter.c.

◆ GPS_UBX_UCENTER_REPLY_CFG_PRT

#define GPS_UBX_UCENTER_REPLY_CFG_PRT   4

Definition at line 64 of file gps_ubx_ucenter.c.

◆ GPS_UBX_UCENTER_REPLY_NACK

#define GPS_UBX_UCENTER_REPLY_NACK   2

Definition at line 62 of file gps_ubx_ucenter.c.

◆ GPS_UBX_UCENTER_REPLY_NONE

#define GPS_UBX_UCENTER_REPLY_NONE   0

Definition at line 60 of file gps_ubx_ucenter.c.

◆ GPS_UBX_UCENTER_REPLY_VERSION

#define GPS_UBX_UCENTER_REPLY_VERSION   3

Definition at line 63 of file gps_ubx_ucenter.c.

◆ GPS_UBX_UCENTER_STATUS_AUTOBAUD

#define GPS_UBX_UCENTER_STATUS_AUTOBAUD   1

Definition at line 56 of file gps_ubx_ucenter.c.

◆ GPS_UBX_UCENTER_STATUS_CONFIG

#define GPS_UBX_UCENTER_STATUS_CONFIG   2

Definition at line 57 of file gps_ubx_ucenter.c.

◆ GPS_UBX_UCENTER_STATUS_STOPPED

#define GPS_UBX_UCENTER_STATUS_STOPPED   0

Definition at line 55 of file gps_ubx_ucenter.c.

◆ GPS_UBX_UCENTER_STATUS_WAITING

#define GPS_UBX_UCENTER_STATUS_WAITING   3

Definition at line 58 of file gps_ubx_ucenter.c.

◆ IGNORED

#define IGNORED   0

Definition at line 372 of file gps_ubx_ucenter.c.

◆ NAV5_2D_ONLY

#define NAV5_2D_ONLY   1

Definition at line 361 of file gps_ubx_ucenter.c.

◆ NAV5_3D_ONLY

#define NAV5_3D_ONLY   2

Definition at line 362 of file gps_ubx_ucenter.c.

◆ NAV5_AUTO

#define NAV5_AUTO   3

Definition at line 363 of file gps_ubx_ucenter.c.

◆ NAV5_DEFAULT_MIN_ELEV

#define NAV5_DEFAULT_MIN_ELEV   5

Definition at line 365 of file gps_ubx_ucenter.c.

◆ NAV5_DEFAULT_P_ACC

#define NAV5_DEFAULT_P_ACC   100

Definition at line 368 of file gps_ubx_ucenter.c.

◆ NAV5_DEFAULT_PDOP_MASK

#define NAV5_DEFAULT_PDOP_MASK   25

Definition at line 366 of file gps_ubx_ucenter.c.

◆ NAV5_DEFAULT_STATIC_HOLD_THRES

#define NAV5_DEFAULT_STATIC_HOLD_THRES   0

Definition at line 370 of file gps_ubx_ucenter.c.

◆ NAV5_DEFAULT_T_ACC

#define NAV5_DEFAULT_T_ACC   300

Definition at line 369 of file gps_ubx_ucenter.c.

◆ NAV5_DEFAULT_TDOP_MASK

#define NAV5_DEFAULT_TDOP_MASK   25

Definition at line 367 of file gps_ubx_ucenter.c.

◆ NAV5_DYN_AIRBORNE_1G

#define NAV5_DYN_AIRBORNE_1G   6

Definition at line 347 of file gps_ubx_ucenter.c.

◆ NAV5_DYN_AIRBORNE_2G

#define NAV5_DYN_AIRBORNE_2G   7

Definition at line 348 of file gps_ubx_ucenter.c.

◆ NAV5_DYN_AIRBORNE_4G

#define NAV5_DYN_AIRBORNE_4G   8

Definition at line 349 of file gps_ubx_ucenter.c.

◆ NAV5_DYN_AUTOMOTIVE

#define NAV5_DYN_AUTOMOTIVE   4

Definition at line 345 of file gps_ubx_ucenter.c.

◆ NAV5_DYN_FIXED

#define NAV5_DYN_FIXED   1

Definition at line 342 of file gps_ubx_ucenter.c.

◆ NAV5_DYN_PEDESTRIAN

#define NAV5_DYN_PEDESTRIAN   3

Definition at line 344 of file gps_ubx_ucenter.c.

◆ NAV5_DYN_PORTABLE

#define NAV5_DYN_PORTABLE   0

Definition at line 341 of file gps_ubx_ucenter.c.

◆ NAV5_DYN_SEA

#define NAV5_DYN_SEA   5

Definition at line 346 of file gps_ubx_ucenter.c.

◆ NAV5_DYN_STATIONARY

#define NAV5_DYN_STATIONARY   2

Definition at line 343 of file gps_ubx_ucenter.c.

◆ NAV5_MASK

#define NAV5_MASK   0x05

Definition at line 359 of file gps_ubx_ucenter.c.

◆ NAV_DYN_AIRBORNE_1G

#define NAV_DYN_AIRBORNE_1G   5

Definition at line 337 of file gps_ubx_ucenter.c.

◆ NAV_DYN_AIRBORNE_2G

#define NAV_DYN_AIRBORNE_2G   6

Definition at line 338 of file gps_ubx_ucenter.c.

◆ NAV_DYN_AIRBORNE_4G

#define NAV_DYN_AIRBORNE_4G   7

Definition at line 339 of file gps_ubx_ucenter.c.

◆ NAV_DYN_AUTOMOTIVE

#define NAV_DYN_AUTOMOTIVE   3

Definition at line 335 of file gps_ubx_ucenter.c.

◆ NAV_DYN_PEDESTRIAN

#define NAV_DYN_PEDESTRIAN   2

Definition at line 334 of file gps_ubx_ucenter.c.

◆ NAV_DYN_SEA

#define NAV_DYN_SEA   4

Definition at line 336 of file gps_ubx_ucenter.c.

◆ NAV_DYN_STATIONARY

#define NAV_DYN_STATIONARY   1

Definition at line 333 of file gps_ubx_ucenter.c.

◆ NMEA_PROTO_MASK

#define NMEA_PROTO_MASK   0x0002

Definition at line 407 of file gps_ubx_ucenter.c.

◆ RESERVED

#define RESERVED   0

Definition at line 373 of file gps_ubx_ucenter.c.

◆ RTCM3_PROTO_MASK

#define RTCM3_PROTO_MASK   0x0020

Definition at line 409 of file gps_ubx_ucenter.c.

◆ RTCM_PROTO_MASK

#define RTCM_PROTO_MASK   0x0004

Definition at line 408 of file gps_ubx_ucenter.c.

◆ UBX_GPS_BAUD

#define UBX_GPS_BAUD   (UBX_GPS_PORT).baudrate

Definition at line 67 of file gps_ubx_ucenter.c.

◆ UBX_PROTO_MASK

#define UBX_PROTO_MASK   0x0001

Definition at line 406 of file gps_ubx_ucenter.c.

◆ UBX_UART_MODE_MASK

#define UBX_UART_MODE_MASK   0x000008D0

Definition at line 404 of file gps_ubx_ucenter.c.

Function Documentation

◆ gps_ubx_ucenter_autobaud()

static bool gps_ubx_ucenter_autobaud ( uint8_t  nr)
static

Automatically determine the baudrate of the u-blox module.

Only needed when connecting to a UART port on the u-blox. The discovered baudrate is copied to gps_ubx_ucenter.baud_init.

Parameters
nrAutobaud step number to perform
Returns
FALSE when completed

Definition at line 255 of file gps_ubx_ucenter.c.

References B115200, B230400, B38400, B4800, B57600, B9600, gps_ubx_ucenter_struct::baud_init, gps_ubx_ucenter_struct::baud_run, gps_ubx_ucenter, gps_ubx_ucenter_config_port_poll(), GPS_UBX_UCENTER_REPLY_ACK, GPS_UBX_UCENTER_REPLY_NONE, logger_uart_parse::nr, gps_ubx_ucenter_struct::reply, and uart_periph_set_baudrate().

Referenced by gps_ubx_ucenter_periodic().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ gps_ubx_ucenter_config_nav()

◆ gps_ubx_ucenter_config_port()

◆ gps_ubx_ucenter_config_port_poll()

static void gps_ubx_ucenter_config_port_poll ( void  )
inlinestatic

Polls the u-blox port configuration When the payload is omitted (zero length), the configuration for the incoming (currently used) port is reported.

Definition at line 224 of file gps_ubx_ucenter.c.

References gps_ubx_ucenter_struct::dev, and gps_ubx_ucenter.

Referenced by gps_ubx_ucenter_autobaud().

+ Here is the caller graph for this function:

◆ gps_ubx_ucenter_config_sbas()

static void gps_ubx_ucenter_config_sbas ( void  )
inlinestatic

◆ gps_ubx_ucenter_configure()

◆ gps_ubx_ucenter_enable_msg()

static void gps_ubx_ucenter_enable_msg ( uint8_t  class,
uint8_t  id,
uint8_t  rate 
)
inlinestatic

Enable u-blox message at desired period.

Will enable the message on the port that this command is received on. For example, sending this configuration message over UART1 will cause the desired message to be published on UART1.

For more information on u-blox messages, see the protocol specification. http://www.ublox.com/en/download/documents-a-resources.html

Parameters
classu-blox message class
idu-blox message ID
rateDesired period to send message. Example: Setting 3 would send the message on every 3rd navigation solution.

Definition at line 241 of file gps_ubx_ucenter.c.

References gps_ubx_ucenter_struct::dev, and gps_ubx_ucenter.

Referenced by gps_ubx_ucenter_configure().

+ Here is the caller graph for this function:

◆ gps_ubx_ucenter_event()

◆ gps_ubx_ucenter_get_status()

int gps_ubx_ucenter_get_status ( void  )

Definition at line 623 of file gps_ubx_ucenter.c.

References gps_ubx_ucenter, and gps_ubx_ucenter_struct::status.

◆ gps_ubx_ucenter_init()

◆ gps_ubx_ucenter_periodic()

Variable Documentation

◆ gps_ubx_ucenter