PropWare
3.0.0.229
C++ objects and CMake build system for Parallax Propeller
Simple-Libraries
Learn
Simple Libraries
Sensor
libgps
gps_velocity.c
1
10
#include "
gps.h
"
11
12
volatile
nmea_data
gps_data;
13
14
float
gps_velocity
(
int
unit_type)
15
{
16
/*
17
Returns the velocity measurement from the GPS, in the desired predefined unit type.
18
*/
19
float
vel = gps_data.velocity;
20
21
switch
(unit_type)
22
{
23
case
KNOTS:
24
break
;
25
case
MPH:
26
//Conversion, knots to miles per hour (MPH).
27
//1 Knot = 1.15078 MPH
28
vel *= 1.15078;
29
break
;
30
case
KPH:
31
//Conversion, knots to kilometers per hour (KPH).
32
//1 Knot = 1.852 KPH
33
vel *= 1.852;
34
break
;
35
case
MPS:
36
//Conversion, knots to meters per second (mps).
37
//1 Knot = .5144444 m/s
38
vel *= 0.514444444444444;
39
break
;
40
default
:
41
//invalid type specifier
42
vel = -1;
43
}
44
return
(vel);
45
}
46
nmea_data_s
Definition:
gps.h:46
gps_velocity
float gps_velocity(int units_type)
Provides the caller with the current speed the GPS module is travelling at. If the GPS module is not ...
Definition:
gps_velocity.c:14
gps.h
This library provides basic NMEA parsing capabilities. It is designed to take raw NMEA strings,...
Generated on Fri May 20 2022 16:48:05 for PropWare by
1.8.17