gps.h File Reference
File containing the GPS functions. More...
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.
Data Structures | |
struct | gps_data |
Macros | |
#define | NUMBERS_OF_SENTENCE 4 |
How many sentences do we want to receive in interrupt mode. | |
#define | NUMBERS_OF_SENTENCE_MAX 10 |
How many sentences do we want to receive in interrupt mode (MAX) | |
#define | RATE_1SEC "$PMTK220,1000*1F\r\n" |
GPS emits NMEA sentences every 1 sec. | |
#define | RATE_2SEC "$PMTK220,2000*1C\r\n" |
GPS emits NMEA sentences every 2 sec. | |
#define | RATE_5SEC "$PMTK220,5000*1B\r\n" |
GPS emits NMEA sentences every 5 sec. | |
#define | RATE_10SEC "$PMTK220,10000*2F\r\n" |
GPS emits NMEA sentences every 10 sec. | |
#define | DISABLE_ALL "$PMTK314,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0*28\r\n" |
Tell the GPS to not send sentences. | |
#define | TURN_ALL "$PMTK314,1,1,1,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0*28\r\n" |
Tell the GPS to send all sentences. | |
#define | GGA_RMC "$PMTK314,0,1,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0*28\r\n" |
Tell the GPS to send GGA and RMC sentences only. | |
#define | RMC_ONLY "$PMTK314,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0*29\r\n" |
Tell the GPS to send RMC sentences only. | |
Typedefs | |
typedef struct gps_data | gps_data |
Functions | |
void | toggleGPS (unsigned int state) |
Toggle GPS (P4.0, ENABLE_GPS) More... | |
void | toggleGPSInterrupt (unsigned int state) |
Toggle GPS interrupt. More... | |
void | enableUSARTforGPS (void) |
Enable and config USART for GPS. | |
void | gpsSend (char *message) |
Send sentences to GPS to configure it (interrupt mode) More... | |
void | usart0_rx (void) |
Receive function for GPS data (USART0, interrupt mode) | |
float | calcDistance (float lat1, float lon1, float lat2, float lon2) |
Calculate the distance between two points (Haversine formula) More... | |
float | deg2rad (float deg) |
Degrees to radians converter. More... | |
Variables | |
unsigned int | dataValid |
struct gps_data | GPSData |
Useful data received and valid. More... | |
Detailed Description
File containing the GPS functions.
Typedef Documentation
Function Documentation
float calcDistance | ( | float | lat1, |
float | lon1, | ||
float | lat2, | ||
float | lon2 | ||
) |
Calculate the distance between two points (Haversine formula)
- See also
- Wikipedia
- Parameters
-
lat1 The latitude of the first point lon1 The longitude of the first point lat2 The latitude of the second point lon2 The longitude of the second point
- Returns
- The distance (in km)
Here is the call graph for this function:

float deg2rad | ( | float | deg | ) |
Degrees to radians converter.
- Parameters
-
deg The angle in degrees
- Returns
- The angle in radians
Here is the caller graph for this function:

void gpsSend | ( | char * | message | ) |
Send sentences to GPS to configure it (interrupt mode)
- Parameters
-
message Message to send
Here is the caller graph for this function:

void toggleGPS | ( | unsigned int | state | ) |
Toggle GPS (P4.0, ENABLE_GPS)
1 = enable, 0 = disable
- Parameters
-
state The new state
Here is the caller graph for this function:

void toggleGPSInterrupt | ( | unsigned int | state | ) |
Toggle GPS interrupt.
1 = interrupt enable for GPS, 0 = disable
- Parameters
-
state The new state
Here is the caller graph for this function:

Variable Documentation
unsigned int dataValid |
Data are valid or not?
struct gps_data GPSData |
Useful data received and valid.
Useful data received and valid.