LwGPS¶
-
group
LWGPS
Lightweight GPS NMEA parser.
Defines
-
lwgps_is_valid
(_gh)¶ Check if current GPS data contain valid signal.
- Note
LWGPS_CFG_STATEMENT_GPRMC must be enabled and
GPRMC
statement must be sent from GPS receiver- Return
1
on success,0
otherwise- Parameters
[in] _gh
: GPS handle
Typedefs
-
typedef double
lwgps_float_t
¶ GPS float definition, can be either
float
ordouble
- Note
Check for LWGPS_CFG_DOUBLE configuration
-
typedef void (*
lwgps_process_fn
)(lwgps_statement_t res)¶ Signature for caller-suplied callback function from gps_process.
- Parameters
[in] res
: statement type of recently parsed statement
Enums
-
enum
lwgps_statement_t
¶ ENUM of possible GPS statements parsed.
Values:
-
enumerator
STAT_UNKNOWN
¶ Unknown NMEA statement
-
enumerator
STAT_GGA
¶ GPGGA statement
-
enumerator
STAT_GSA
¶ GPGSA statement
-
enumerator
STAT_GSV
¶ GPGSV statement
-
enumerator
STAT_RMC
¶ GPRMC statement
-
enumerator
STAT_UBX
¶ UBX statement (uBlox specific)
-
enumerator
STAT_UBX_TIME
¶ UBX TIME statement (uBlox specific)
-
enumerator
STAT_CHECKSUM_FAIL
¶ Special case, used when checksum fails
-
enumerator
-
enum
lwgps_speed_t
¶ List of optional speed transformation from GPS values (in knots)
Values:
-
enumerator
lwgps_speed_kps
¶ Kilometers per second
-
enumerator
lwgps_speed_kph
¶ Kilometers per hour
-
enumerator
lwgps_speed_mps
¶ Meters per second
-
enumerator
lwgps_speed_mpm
¶ Meters per minute
-
enumerator
lwgps_speed_mips
¶ Miles per second
-
enumerator
lwgps_speed_mph
¶ Miles per hour
-
enumerator
lwgps_speed_fps
¶ Foots per second
-
enumerator
lwgps_speed_fpm
¶ Foots per minute
-
enumerator
lwgps_speed_mpk
¶ Minutes per kilometer
-
enumerator
lwgps_speed_spk
¶ Seconds per kilometer
-
enumerator
lwgps_speed_sp100m
¶ Seconds per 100 meters
-
enumerator
lwgps_speed_mipm
¶ Minutes per mile
-
enumerator
lwgps_speed_spm
¶ Seconds per mile
-
enumerator
lwgps_speed_sp100y
¶ Seconds per 100 yards
-
enumerator
lwgps_speed_smph
¶ Sea miles per hour
-
enumerator
Functions
-
uint8_t
lwgps_init
(lwgps_t *gh)¶ Init GPS handle.
- Return
1
on success,0
otherwise- Parameters
[in] gh
: GPS handle structure
-
uint8_t
lwgps_process
(lwgps_t *gh, const void *data, size_t len, lwgps_process_fn evt_fn)¶ Process NMEA data from GPS receiver.
- Return
1
on success,0
otherwise- Parameters
[in] gh
: GPS handle structure[in] data
: Received data[in] len
: Number of bytes to process[in] evt_fn
: Event function to notify application layer. This parameter is available only if LWGPS_CFG_STATUS is enabled
-
uint8_t
lwgps_distance_bearing
(lwgps_float_t las, lwgps_float_t los, lwgps_float_t lae, lwgps_float_t loe, lwgps_float_t *d, lwgps_float_t *b)¶ Calculate distance and bearing between
2
latitude and longitude coordinates.- Return
1
on success,0
otherwise- Parameters
[in] las
: Latitude start coordinate, in units of degrees[in] los
: Longitude start coordinate, in units of degrees[in] lae
: Latitude end coordinate, in units of degrees[in] loe
: Longitude end coordinate, in units of degrees[out] d
: Pointer to output distance in units of meters[out] b
: Pointer to output bearing between start and end coordinate in relation to north in units of degrees
-
lwgps_float_t
lwgps_to_speed
(lwgps_float_t sik, lwgps_speed_t ts)¶ Convert NMEA GPS speed (in knots = nautical mile per hour) to different speed format.
- Return
Speed calculated from knots
- Parameters
[in] sik
: Speed in knots, received from GPS NMEA statement[in] ts
: Target speed to convert to from knots
-
struct
lwgps_sat_t
¶ - #include <lwgps.h>
Satellite descriptor.
-
struct
lwgps_t
¶ - #include <lwgps.h>
GPS main structure.
Public Members
-
lwgps_float_t
latitude
¶ Latitude in units of degrees
-
lwgps_float_t
longitude
¶ Longitude in units of degrees
-
lwgps_float_t
altitude
¶ Altitude in units of meters
-
lwgps_float_t
geo_sep
¶ Geoid separation in units of meters
-
uint8_t
sats_in_use
¶ Number of satellites in use
-
uint8_t
fix
¶ Fix status.
0
= invalid,1
= GPS fix,2
= DGPS fix,3
= PPS fix
-
uint8_t
hours
¶ Hours in UTC
-
uint8_t
minutes
¶ Minutes in UTC
-
uint8_t
seconds
¶ Seconds in UTC
-
lwgps_float_t
dop_h
¶ Dolution of precision, horizontal
-
lwgps_float_t
dop_v
¶ Dolution of precision, vertical
-
lwgps_float_t
dop_p
¶ Dolution of precision, position
-
uint8_t
fix_mode
¶ Fix mode.
1
= NO fix,2
= 2D fix,3
= 3D fix
-
uint8_t
satellites_ids
[12]¶ List of satellite IDs in use. Valid range is
0
tosats_in_use
-
uint8_t
sats_in_view
¶ Number of satellites in view
-
lwgps_sat_t
sats_in_view_desc
[12]¶
-
uint8_t
is_valid
¶ GPS valid status
-
lwgps_float_t
speed
¶ Ground speed in knots
-
lwgps_float_t
course
¶ Ground coarse
-
lwgps_float_t
variation
¶ Magnetic variation
-
uint8_t
date
¶ Fix date
-
uint8_t
month
¶ Fix month
-
uint8_t
year
¶ Fix year
-
lwgps_float_t
utc_tow
¶ UTC TimeOfWeek, eg 113851.00
-
uint16_t
utc_wk
¶ UTC week number, continues beyond 1023
-
uint8_t
leap_sec
¶ UTC leap seconds; UTC + leap_sec = TAI
-
uint32_t
clk_bias
¶ Receiver clock bias, eg 1930035
-
lwgps_float_t
clk_drift
¶ Receiver clock drift, eg -2660.664
-
uint32_t
tp_gran
¶ Time pulse granularity, eg 43
-
lwgps_float_t
-