fix bad commit
This commit is contained in:
parent
bdf1b838a7
commit
cdcfd289ef
|
|
@ -168,24 +168,12 @@ char Adafruit_GPS::read(void) {
|
||||||
if(gpsSwSerial) {
|
if(gpsSwSerial) {
|
||||||
if(!gpsSwSerial->available()) return c;
|
if(!gpsSwSerial->available()) return c;
|
||||||
c = gpsSwSerial->read();
|
c = gpsSwSerial->read();
|
||||||
<<<<<<< HEAD
|
|
||||||
} else
|
} else
|
||||||
#endif
|
#endif
|
||||||
=======
|
|
||||||
}
|
|
||||||
else
|
|
||||||
>>>>>>> FETCH_HEAD
|
|
||||||
{
|
{
|
||||||
if(!gpsHwSerial->available()) return c;
|
if(!gpsHwSerial->available()) return c;
|
||||||
c = gpsHwSerial->read();
|
c = gpsHwSerial->read();
|
||||||
}
|
}
|
||||||
#else
|
|
||||||
// if(!gpsHwSerial->available()) return c;
|
|
||||||
// c = gpsHwSerial->read();
|
|
||||||
if(!Serial1.available()) return c;
|
|
||||||
c = Serial1.read();
|
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
//Serial.print(c);
|
//Serial.print(c);
|
||||||
|
|
||||||
|
|
@ -231,6 +219,7 @@ Adafruit_GPS::Adafruit_GPS(NewSoftSerial *ser)
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
// Constructor when using HardwareSerial
|
||||||
Adafruit_GPS::Adafruit_GPS(HardwareSerial *ser) {
|
Adafruit_GPS::Adafruit_GPS(HardwareSerial *ser) {
|
||||||
common_init(); // Set everything to common state, then...
|
common_init(); // Set everything to common state, then...
|
||||||
gpsHwSerial = ser; // ...override gpsHwSerial with value passed.
|
gpsHwSerial = ser; // ...override gpsHwSerial with value passed.
|
||||||
|
|
@ -238,13 +227,10 @@ Adafruit_GPS::Adafruit_GPS(HardwareSerial *ser) {
|
||||||
|
|
||||||
// Initialization code used by all constructor types
|
// Initialization code used by all constructor types
|
||||||
void Adafruit_GPS::common_init(void) {
|
void Adafruit_GPS::common_init(void) {
|
||||||
<<<<<<< HEAD
|
|
||||||
#ifdef __AVR__
|
#ifdef __AVR__
|
||||||
gpsSwSerial = NULL; // Set both to NULL, then override correct
|
gpsSwSerial = NULL; // Set both to NULL, then override correct
|
||||||
#endif
|
#endif
|
||||||
gpsHwSerial = NULL; // port pointer in corresponding constructor
|
gpsHwSerial = NULL; // port pointer in corresponding constructor
|
||||||
=======
|
|
||||||
>>>>>>> FETCH_HEAD
|
|
||||||
recvdflag = false;
|
recvdflag = false;
|
||||||
paused = false;
|
paused = false;
|
||||||
lineidx = 0;
|
lineidx = 0;
|
||||||
|
|
@ -267,12 +253,6 @@ void Adafruit_GPS::begin(uint16_t baud)
|
||||||
gpsSwSerial->begin(baud);
|
gpsSwSerial->begin(baud);
|
||||||
else
|
else
|
||||||
gpsHwSerial->begin(baud);
|
gpsHwSerial->begin(baud);
|
||||||
<<<<<<< HEAD
|
|
||||||
=======
|
|
||||||
#else
|
|
||||||
// gpsHwSerial->begin(baud);
|
|
||||||
Serial1.begin(baud);
|
|
||||||
>>>>>>> FETCH_HEAD
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
delay(10);
|
delay(10);
|
||||||
|
|
@ -282,19 +262,9 @@ void Adafruit_GPS::sendCommand(char *str) {
|
||||||
#ifdef __AVR__
|
#ifdef __AVR__
|
||||||
if(gpsSwSerial)
|
if(gpsSwSerial)
|
||||||
gpsSwSerial->println(str);
|
gpsSwSerial->println(str);
|
||||||
<<<<<<< HEAD
|
|
||||||
else
|
else
|
||||||
#endif
|
#endif
|
||||||
gpsHwSerial->println(str);
|
gpsHwSerial->println(str);
|
||||||
=======
|
|
||||||
else
|
|
||||||
gpsHwSerial->println(str);
|
|
||||||
#else
|
|
||||||
// gpsHwSerial->println(str);
|
|
||||||
Serial1.println(str);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
>>>>>>> FETCH_HEAD
|
|
||||||
}
|
}
|
||||||
|
|
||||||
boolean Adafruit_GPS::newNMEAreceived(void) {
|
boolean Adafruit_GPS::newNMEAreceived(void) {
|
||||||
|
|
|
||||||
|
|
@ -37,12 +37,18 @@ HardwareSerial mySerial = Serial1;
|
||||||
// Set to 'true' if you want to debug and listen to the raw GPS sentences
|
// Set to 'true' if you want to debug and listen to the raw GPS sentences
|
||||||
#define GPSECHO true
|
#define GPSECHO true
|
||||||
|
|
||||||
|
// this keeps track of whether we're using the interrupt
|
||||||
|
// off by default!
|
||||||
|
boolean usingInterrupt = false;
|
||||||
|
void useInterrupt(boolean); // Func prototype keeps Arduino 0023 happy
|
||||||
|
|
||||||
void setup()
|
void setup()
|
||||||
{
|
{
|
||||||
// connect at 115200 so we can read the GPS fast enuf and
|
// connect at 115200 so we can read the GPS fast enuf and
|
||||||
// also spit it out
|
// also spit it out
|
||||||
Serial.begin(115200);
|
Serial.begin(115200);
|
||||||
delay(2000);
|
while (!Serial);
|
||||||
|
delay(1000);
|
||||||
Serial.println("Adafruit GPS logging start test!");
|
Serial.println("Adafruit GPS logging start test!");
|
||||||
|
|
||||||
// 9600 NMEA is the default baud rate for MTK - some use 4800
|
// 9600 NMEA is the default baud rate for MTK - some use 4800
|
||||||
|
|
@ -54,6 +60,10 @@ void setup()
|
||||||
// Default is 1 Hz update rate
|
// Default is 1 Hz update rate
|
||||||
GPS.sendCommand(PMTK_SET_NMEA_UPDATE_1HZ);
|
GPS.sendCommand(PMTK_SET_NMEA_UPDATE_1HZ);
|
||||||
|
|
||||||
|
// the nice thing about this code is you can have a timer0 interrupt go off
|
||||||
|
// every 1 millisecond, and read data from the GPS for you. that makes the
|
||||||
|
// loop code a heck of a lot easier!
|
||||||
|
useInterrupt(true);
|
||||||
delay(500);
|
delay(500);
|
||||||
Serial.print("\nSTARTING LOGGING....");
|
Serial.print("\nSTARTING LOGGING....");
|
||||||
if (GPS.LOCUS_StartLogger())
|
if (GPS.LOCUS_StartLogger())
|
||||||
|
|
@ -65,9 +75,38 @@ void setup()
|
||||||
|
|
||||||
void loop() // run over and over again
|
void loop() // run over and over again
|
||||||
{
|
{
|
||||||
char c = GPS.read();
|
// do nothing! all reading and printing is done in the interrupt
|
||||||
// if you want to debug, this is a good time to do it!
|
|
||||||
if ((c) && (GPSECHO))
|
|
||||||
Serial.write(c);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/******************************************************************/
|
||||||
|
|
||||||
|
// Interrupt is called once a millisecond, looks for any new GPS data, and stores it
|
||||||
|
SIGNAL(TIMER0_COMPA_vect) {
|
||||||
|
char c = GPS.read();
|
||||||
|
// if you want to debug, this is a good time to do it!
|
||||||
|
if (GPSECHO && c) {
|
||||||
|
#ifdef UDR0
|
||||||
|
UDR0 = c;
|
||||||
|
// writing direct to UDR0 is much much faster than Serial.print
|
||||||
|
// but only one character can be written at a time.
|
||||||
|
#else
|
||||||
|
Serial.write(c);
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void useInterrupt(boolean v) {
|
||||||
|
if (v) {
|
||||||
|
// Timer0 is already used for millis() - we'll just interrupt somewhere
|
||||||
|
// in the middle and call the "Compare A" function above
|
||||||
|
OCR0A = 0xAF;
|
||||||
|
TIMSK0 |= _BV(OCIE0A);
|
||||||
|
usingInterrupt = true;
|
||||||
|
} else {
|
||||||
|
// do not call the interrupt function COMPA anymore
|
||||||
|
TIMSK0 &= ~_BV(OCIE0A);
|
||||||
|
usingInterrupt = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue