// this is a generic logger that does checksum testing so the data written should be always good // Assumes a sirf III chipset logger attached to pin 0 and 1 #include "AF_SDLog.h" #include "util.h" #include #define isdigit(x) ( x >= '0' && x <= '9') extern uint16_t _end; AF_SDLog card; File f; #define led1Pin 4 // LED1 connected to digital pin 4 #define led2Pin 3 // LED2 connected to digital pin 3 #define powerpin 2 // GPS power control // set the RX_BUFFER_SIZE to 32! #define BUFFSIZE 73 // we buffer one NMEA sentense at a time, 83 bytes is longer than the max length char buffer[BUFFSIZE]; // this is the double buffer char buffer2[12]; uint8_t bufferidx = 0; uint32_t tmp; #define LOG_RMC 1 // essential location data #define RMC_ON "$PSRF103,4,0,1,1*21\r\n" // the command we send to turn RMC on (1 hz rate) #define RMC_OFF "$PSRF103,4,0,0,1*20\r\n" // the command we send to turn RMC off #define LOG_GGA 0 // contains fix, hdop & vdop data #define GGA_ON "$PSRF103,0,0,1,1*25\r\n" // the command we send to turn GGA on (1 hz rate) #define GGA_OFF "$PSRF103,0,0,0,1*24\r\n" // the command we send to turn GGA off #define LOG_GSA 0 // satelite data #define GSA_ON "$PSRF103,2,0,1,1*27\r\n" // the command we send to turn GSA on (1 hz rate) #define GSA_OFF "$PSRF103,2,0,0,1*26\r\n" // the command we send to turn GSA off #define LOG_GSV 0 // detailed satellite data #define GSV_ON "$PSRF103,3,0,1,1*26\r\n" // the command we send to turn GSV on (1 hz rate) #define GSV_OFF "$PSRF103,3,0,0,1*27\r\n" // the command we send to turn GSV off #define LOG_GLL 0 // Loran-compatibility data // this isnt output by default #define USE_WAAS 1 // useful in US, but slower fix #define WAAS_ON "$PSRF151,1*3F\r\n" // the command for turning on WAAS #define WAAS_OFF "$PSRF151,0*3E\r\n" // the command for turning off WAAS #define LOG_RMC_FIXONLY 1 // log only when we get RMC's with fix? uint8_t fix = 0; // current fix data // read a Hex value and return the decimal equivalent uint8_t parseHex(char c) { if (c < '0') return 0; if (c <= '9') return c - '0'; if (c < 'A') return 0; if (c <= 'F') return (c - 'A')+10; } uint8_t i; // blink out an error code void error(uint8_t errno) { while(1) { for (i=0; i