34 #include "ubx_protocol.h"
45 #define GOT_CHECKSUM1 8
48 #define GPS_UBX_ERR_NONE 0
49 #define GPS_UBX_ERR_OVERRUN 1
50 #define GPS_UBX_ERR_MSG_TOO_LONG 2
51 #define GPS_UBX_ERR_CHECKSUM 3
52 #define GPS_UBX_ERR_UNEXPECTED 4
53 #define GPS_UBX_ERR_OUT_OF_SYNC 5
55 #define UTM_HEM_NORTH 0
56 #define UTM_HEM_SOUTH 1
60 #if USE_GPS_UBX_RXM_RAW
61 struct GpsUbxRaw gps_ubx_raw;
165 #if USE_GPS_UBX_RXM_RAW
172 for (i = 0; i < gps_ubx_raw.numSV; i++) {
173 gps_ubx_raw.measures[i].cpMes = UBX_RXM_RAW_cpMes(
gps_ubx.
msg_buf, i);
174 gps_ubx_raw.measures[i].prMes = UBX_RXM_RAW_prMes(
gps_ubx.
msg_buf, i);
175 gps_ubx_raw.measures[i].doMes = UBX_RXM_RAW_doMes(
gps_ubx.
msg_buf, i);
177 gps_ubx_raw.measures[i].mesQI = UBX_RXM_RAW_mesQI(
gps_ubx.
msg_buf, i);
178 gps_ubx_raw.measures[i].cno = UBX_RXM_RAW_cno(
gps_ubx.
msg_buf, i);
179 gps_ubx_raw.measures[i].lli = UBX_RXM_RAW_lli(
gps_ubx.
msg_buf, i);
188 #include "subsystems/chibios-libopencm3/chibios_sdlog.h"
195 sdLogWriteByte(pprzLogFile, c);
203 if (c == UBX_SYNC1) {
208 if (c != UBX_SYNC2) {
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)
put_byte_t put_byte
put one byte
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
void gps_ubx_parse(uint8_t c)
Main include for ABI (AirBorneInterface).
position in UTM coordinates Units: meters
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 ellipsoid)
static void ubx_send_1byte(struct link_device *dev, uint8_t byte)
#define GPS_UBX_ERR_OUT_OF_SYNC
void * periph
pointer to parent implementation
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
static uint32_t get_sys_time_usec(void)
Get the time in microseconds since startup.
#define GPS_UBX_MAX_PAYLOAD
uint32_t sacc
speed accuracy in cm/s
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.
Paparazzi floating point math for geodetic calculations.
vector in Latitude, Longitude and Altitude
#define GPS_UBX_ERR_UNEXPECTED
int32_t hmsl
height above mean sea level in mm
uint8_t cno
Carrier to Noise Ratio (Signal Strength) in dbHz.
uint32_t tow
GPS time of week in ms.
Device independent GPS code (interface)
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)
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)
int32_t lon
in degrees*1e7
#define GPS_UBX_ERR_MSG_TOO_LONG
uint8_t zone
UTM zone number.
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
#define GPS_UBX_ERR_OVERRUN
int32_t course
GPS course over ground in rad*1e7, [0, 2*Pi]*1e7 (CW/north)
volatile uint32_t nb_sec
full seconds since startup
int32_t t0_tow_frac
fractional ns remainder of tow [ms], range -500000 .. 500000
uint8_t flags
bitfield with GPS receiver specific flags
struct GpsTimeSync gps_time_sync
uint32_t last_msg_ticks
cpu time ticks at last received GPS message
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
struct LlaCoor_i lla_pos
position in LLA (lat,lon: deg*1e7; alt: mm over ellipsoid)
void gps_impl_init(void)
GPS initialization.
int32_t lat
in degrees*1e7
struct NedCoor_i ned_vel
speed NED in cm/s
struct GpsState gps
global GPS state
#define LLA_FLOAT_OF_BFP(_o, _i)
send_message_t send_message
send completed buffer
#define GPS_UBX_ERR_CHECKSUM
void utm_of_lla_f(struct UtmCoor_f *utm, struct LlaCoor_f *lla)