Changeset - 6a57c40fdde2
[Not reviewed]
default
0 2 0
mkanning@CL-SEC241-10.cedarville.edu - 13 years ago 2012-11-15 11:39:24
mkanning@CL-SEC241-10.cedarville.edu
gps.c and gps.h changes
2 files changed with 11 insertions and 6 deletions:
0 comments (0 inline, 0 general)
master/master/lib/trackuinoGPS/gps.c
Show inline comments
 
@@ -73,29 +73,25 @@ static const t_nmea_parser rmc_parsers[]
 
	parse_course,     // Track angle in degrees (true)
 
	NULL,             // Date (DDMMYY)
 
	NULL,             // Magnetic variation
 
	NULL              // E/W
 
};
 

	
 

	
 

	
 
static const int NUM_OF_UNK_PARSERS = (sizeof(unk_parsers) / sizeof(t_nmea_parser));
 
static const int NUM_OF_GGA_PARSERS = (sizeof(gga_parsers) / sizeof(t_nmea_parser));
 
static const int NUM_OF_RMC_PARSERS = (sizeof(rmc_parsers) / sizeof(t_nmea_parser));
 

	
 
enum t_sentence_type {
 
	SENTENCE_UNK,
 
	SENTENCE_GGA,
 
	SENTENCE_RMC
 
};
 

	
 

	
 
// Module variables
 
static t_sentence_type sentence_type = SENTENCE_UNK;
 
static bool at_checksum = false;
 
static unsigned char our_checksum = '$';
 
static unsigned char their_checksum = 0;
 
static char token[16];
 
static int num_tokens = 0;
 
static unsigned int offset = 0;
 
static bool active = false;
 
static char gga_time[7] = "", rmc_time[7] = "";
 
static char new_time[7];
 
@@ -247,35 +243,37 @@ void parse_altitude(const char *token)
 
}
 

	
 

	
 
//
 
// Exported functions
 
//
 
/// void zeroing of data. presumably to be called at start
 
void gps_setup() {
 
	strcpy(gps_time, "000000");
 
	strcpy(gps_aprs_lat, "0000.00N");
 
	strcpy(gps_aprs_lon, "00000.00E");
 
}
 

	
 
/// MKa GPS transmission parser
 
void parse_gps_transmission(char c){
 
	// i think c is the most recent character of transmission and is constantly 
 
	// tested if terminal character. if terminal then do parse on previous transmission.
 
	 
 
	// $--GGA,hhmmss.ss,llll.ll,a,yyyyy.yy,a,x,xx,x.x,x.x,M,x.x,M,x.x,xxxx
 
	if(c == '\n') //end of transmission sentence. may need more checks
 
	{
 
				
 
		
 
	}
 
}
 

	
 
/// process gps transmission 
 
bool gps_decode(char c)
 
{
 
	int ret = false;
 

	
 
	switch(c) {
 
		case '\r':
 
		case '\n': // End of sentence
 
			if (num_tokens && our_checksum == their_checksum) { ///checksum is valid (good transmission)
 
				#ifdef DEBUG_GPS
 
				Serial.print(" (OK!) ");
 
				Serial.print(millis());
master/master/lib/trackuinoGPS/gps.h
Show inline comments
 
@@ -25,16 +25,23 @@
 

	
 
extern char gps_time[7];       // HHMMSS
 
extern uint32_t gps_seconds;   // seconds after midnight
 
extern char gps_date[7];       // DDMMYY
 
extern float gps_lat;
 
extern float gps_lon;
 
extern char gps_aprs_lat[9];
 
extern char gps_aprs_lon[10];
 
extern float gps_course;
 
extern float gps_speed;
 
extern float gps_altitude;
 

	
 

	
 

	
 
void gps_setup();
 
bool gps_decode(char c);
 

	
 
#endif
 
enum t_sentence_type {
 
	SENTENCE_UNK,
 
	SENTENCE_GGA,
 
	SENTENCE_RMC
 
};
 
\ No newline at end of file
0 comments (0 inline, 0 general)