diff --git a/Adafruit_GPS.cpp b/Adafruit_GPS.cpp index 5a68d26..a8143d8 100644 --- a/Adafruit_GPS.cpp +++ b/Adafruit_GPS.cpp @@ -168,12 +168,24 @@ char Adafruit_GPS::read(void) { if(gpsSwSerial) { if(!gpsSwSerial->available()) return c; c = gpsSwSerial->read(); +<<<<<<< HEAD } else #endif +======= + } + else +>>>>>>> FETCH_HEAD { if(!gpsHwSerial->available()) return c; c = gpsHwSerial->read(); } +#else + // if(!gpsHwSerial->available()) return c; + // c = gpsHwSerial->read(); + if(!Serial1.available()) return c; + c = Serial1.read(); +#endif + //Serial.print(c); @@ -219,7 +231,6 @@ Adafruit_GPS::Adafruit_GPS(NewSoftSerial *ser) } #endif -// Constructor when using HardwareSerial Adafruit_GPS::Adafruit_GPS(HardwareSerial *ser) { common_init(); // Set everything to common state, then... gpsHwSerial = ser; // ...override gpsHwSerial with value passed. @@ -227,10 +238,13 @@ Adafruit_GPS::Adafruit_GPS(HardwareSerial *ser) { // Initialization code used by all constructor types void Adafruit_GPS::common_init(void) { +<<<<<<< HEAD #ifdef __AVR__ gpsSwSerial = NULL; // Set both to NULL, then override correct #endif gpsHwSerial = NULL; // port pointer in corresponding constructor +======= +>>>>>>> FETCH_HEAD recvdflag = false; paused = false; lineidx = 0; @@ -253,6 +267,12 @@ void Adafruit_GPS::begin(uint16_t baud) gpsSwSerial->begin(baud); else gpsHwSerial->begin(baud); +<<<<<<< HEAD +======= +#else + // gpsHwSerial->begin(baud); + Serial1.begin(baud); +>>>>>>> FETCH_HEAD #endif delay(10); @@ -262,9 +282,19 @@ void Adafruit_GPS::sendCommand(char *str) { #ifdef __AVR__ if(gpsSwSerial) gpsSwSerial->println(str); +<<<<<<< HEAD else #endif gpsHwSerial->println(str); +======= + else + gpsHwSerial->println(str); +#else + // gpsHwSerial->println(str); + Serial1.println(str); +#endif + +>>>>>>> FETCH_HEAD } boolean Adafruit_GPS::newNMEAreceived(void) { diff --git a/examples/due_shield_sdlog/due_shield_sdlog.ino b/examples/due_shield_sdlog/due_shield_sdlog.ino new file mode 100644 index 0000000..9b32e27 --- /dev/null +++ b/examples/due_shield_sdlog/due_shield_sdlog.ino @@ -0,0 +1,174 @@ + +#include + +#ifdef __AVR__ + #include + #include +#endif + +#include +#include + + +// Ladyada's logger modified by Bill Greiman to use the SdFat library +// +// This code shows how to listen to the GPS module in an interrupt +// which allows the program to have more 'freedom' - just parse +// when a new NMEA sentence is available! Then access data when +// desired. +// +// Tested and works great with the Adafruit Ultimate GPS Shield +// using MTK33x9 chipset +// ------> http://www.adafruit.com/products/ +// Pick one up today at the Adafruit electronics shop +// and help support open source hardware & software! -ada + +#ifdef __AVR__ +SoftwareSerial mySerial(8, 7); +#else +#define mySerial Serial1 +#endif + +Adafruit_GPS GPS(&mySerial); + +// Set GPSECHO to 'false' to turn off echoing the GPS data to the Serial console +// Set to 'true' if you want to debug and listen to the raw GPS sentences +#define GPSECHO true +/* set to true to only log to SD when GPS has a fix, for debugging, keep it false */ +#define LOG_FIXONLY false + +// Set the pins used +#define chipSelect 10 +#define ledPin 13 + +File logfile; + +// 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; +} + +// blink out an error code +void error(uint8_t errno) { +/* + if (SD.errorCode()) { + putstring("SD error: "); + Serial.print(card.errorCode(), HEX); + Serial.print(','); + Serial.println(card.errorData(), HEX); + } + */ + while(1) { + uint8_t i; + for (i=0; i #include #include #include @@ -160,4 +160,4 @@ void loop() { } -/* End code */ \ No newline at end of file +/* End code */