28 #include "ubx_protocol.h"
39 #define GOT_CHECKSUM1 8
42 #define GPS_UBX_ERR_NONE 0
43 #define GPS_UBX_ERR_OVERRUN 1
44 #define GPS_UBX_ERR_MSG_TOO_LONG 2
45 #define GPS_UBX_ERR_CHECKSUM 3
46 #define GPS_UBX_ERR_UNEXPECTED 4
47 #define GPS_UBX_ERR_OUT_OF_SYNC 5
49 #define UTM_HEM_NORTH 0
50 #define UTM_HEM_SOUTH 1
54 #if USE_GPS_UBX_RXM_RAW
55 struct GpsUbxRaw gps_ubx_raw;
72 struct link_device *
dev = &((UBX_GPS_LINK).device);
74 while (dev->char_available(dev->periph)) {
165 #if USE_GPS_UBX_RXM_RAW
173 for (i = 0; i < max_SV; i++) {
174 gps_ubx_raw.measures[i].cpMes = UBX_RXM_RAW_cpMes(
gps_ubx.
msg_buf, i);
175 gps_ubx_raw.measures[i].prMes = UBX_RXM_RAW_prMes(
gps_ubx.
msg_buf, i);
176 gps_ubx_raw.measures[i].doMes = UBX_RXM_RAW_doMes(
gps_ubx.
msg_buf, i);
178 gps_ubx_raw.measures[i].mesQI = UBX_RXM_RAW_mesQI(
gps_ubx.
msg_buf, i);
179 gps_ubx_raw.measures[i].cno = UBX_RXM_RAW_cno(
gps_ubx.
msg_buf, i);
180 gps_ubx_raw.measures[i].lli = UBX_RXM_RAW_lli(
gps_ubx.
msg_buf, i);
203 if (c == UBX_SYNC1) {
208 if (c != UBX_SYNC2) {
278 dev->put_byte(dev->periph, 0, byte);
285 dev->put_byte(dev->periph, 0, UBX_SYNC1);
286 dev->put_byte(dev->periph, 0, UBX_SYNC2);
299 dev->send_message(dev->periph, 0);
305 for (i = 0; i < len; i++) {
313 UbxSend_CFG_RST(dev, bbr, reset_mode, 0x00);
317 #ifndef GPS_UBX_UCENTER
318 #define gps_ubx_ucenter_event() {}
uint8_t qi
quality bitfield (GPS receiver specific)
uint32_t t0_tow
GPS time of week in ms from last message.
int32_t north
in centimeters
struct SVinfo svinfos[GPS_NB_CHANNELS]
holds information from the Space Vehicles (Satellites)
int16_t azim
azimuth in deg
uint32_t pacc
position accuracy in cm
void ubx_trailer(struct link_device *dev)
void ubx_send_bytes(struct link_device *dev, uint8_t len, uint8_t *bytes)
#define gps_ubx_ucenter_event()
uint8_t nb_channels
Number of scanned satellites.
uint32_t t0_ticks
hw clock ticks when GPS message is received
#define GPS_VALID_VEL_NED_BIT
uint8_t valid_fields
bitfield indicating valid fields (GPS_VALID_x_BIT)
UBX protocol specific code.
void gps_ubx_parse(uint8_t c)
Main include for ABI (AirBorneInterface).
uint8_t msg_buf[GPS_UBX_MAX_PAYLOAD]
int32_t east
in centimeters
uint8_t svid
Satellite ID.
volatile uint32_t nb_tick
SYS_TIME_TICKS since startup.
uint16_t speed_3d
norm of 3d speed in cm/s
#define GPS_FIX_3D
3D GPS fix
struct UtmCoor_i utm_pos
position in UTM (north,east: cm; alt: mm over MSL)
static void ubx_send_1byte(struct link_device *dev, uint8_t byte)
#define GPS_UBX_ERR_OUT_OF_SYNC
uint32_t last_3dfix_ticks
cpu time ticks at last valid 3D fix
int8_t elev
elevation in deg
int32_t alt
in millimeters above WGS84 reference ellipsoid
#define GPS_UBX_MAX_PAYLOAD
uint32_t sacc
speed accuracy in cm/s
struct GpsTimeSync gps_ubx_time_sync
uint32_t last_msg_time
cpu time in sec at last received GPS message
uint32_t cacc
course accuracy in rad*1e7
uint8_t zone
UTM zone number.
#define GPS_VALID_COURSE_BIT
#define GPS_UBX_ERR_UNEXPECTED
int32_t hmsl
height above mean sea level (MSL) in mm
uint8_t cno
Carrier to Noise Ratio (Signal Strength) in dbHz.
uint32_t tow
GPS time of week in ms.
uint16_t pdop
position dilution of precision scaled by 100
void ubx_header(struct link_device *dev, uint8_t nav_id, uint8_t msg_id, uint16_t len)
#define GPS_UBX_NB_CHANNELS
struct EcefCoor_i ecef_pos
position in ECEF in cm
void ubx_send_cfg_rst(struct link_device *dev, uint16_t bbr, uint8_t reset_mode)
#define GPS_VALID_HMSL_BIT
int32_t lon
in degrees*1e7
#define GPS_UBX_ERR_MSG_TOO_LONG
volatile uint32_t nb_sec_rem
remainder of seconds since startup in CPU_TICKS
static const struct usb_device_descriptor dev
void gps_ubx_read_message(void)
uint32_t last_3dfix_time
cpu time in sec at last valid 3D fix
int32_t alt
in millimeters (above WGS84 reference ellipsoid or above MSL)
#define GPS_UBX_ERR_OVERRUN
int32_t course
GPS course over ground in rad*1e7, [0, 2*Pi]*1e7 (CW/north)
uint8_t comp_id
id of current gps
volatile uint32_t nb_sec
full seconds since startup
int32_t t0_tow_frac
fractional ns remainder of tow [ms], range -500000 .. 500000
#define GPS_VALID_POS_ECEF_BIT
uint8_t flags
bitfield with GPS receiver specific flags
uint32_t last_msg_ticks
cpu time ticks at last received GPS message
#define GPS_VALID_POS_LLA_BIT
uint8_t num_sv
number of sat in fix
arch independent LED (Light Emitting Diodes) API
#define UNINIT
Includes macros generated from ubx.xml.
uint16_t gspeed
norm of 2d ground speed in cm/s
struct EcefCoor_i ecef_vel
speed ECEF in cm/s
data structure for GPS time sync
#define GPS_VALID_VEL_ECEF_BIT
struct LlaCoor_i lla_pos
position in LLA (lat,lon: deg*1e7; alt: mm over ellipsoid)
uint32_t get_sys_time_usec(void)
Get the time in microseconds since startup.
int32_t lat
in degrees*1e7
#define GPS_VALID_POS_UTM_BIT
struct NedCoor_i ned_vel
speed NED in cm/s
#define GPS_UBX_ERR_CHECKSUM