gps.c File Reference

File containing the GPS functions. More...

#include <__cross_studio_io.h>
#include <msp430x16x.h>
#include <math.h>
#include "main.h"
#include "gps.h"
#include "parser_nmea.h"
#include "oled.h"
Include dependency graph for gps.c:

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
 
gps_data GPSData
 Store GPS valid data. More...
 

Detailed Description

File containing the GPS functions.

Author
Gaƫl Foppolo (gaelfoppolo)

Function Documentation

float calcDistance ( float  lat1,
float  lon1,
float  lat2,
float  lon2 
)

Calculate the distance between two points (Haversine formula)

See also
Wikipedia
Parameters
lat1The latitude of the first point
lon1The longitude of the first point
lat2The latitude of the second point
lon2The 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
degThe 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
messageMessage 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
stateThe 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
stateThe new state

Here is the caller graph for this function:

Variable Documentation

unsigned int dataValid

Data are valid or not?

gps_data GPSData

Store GPS valid data.

Useful data received and valid.