diff --git a/Adafruit_GPS.cpp b/Adafruit_GPS.cpp index f057b4d..67ed335 100755 --- a/Adafruit_GPS.cpp +++ b/Adafruit_GPS.cpp @@ -383,9 +383,7 @@ float Adafruit_GPS::secondsSinceDate() { size_t Adafruit_GPS::available(void) { - char c = 0; - - if (paused) return c; + if (paused) return 0; #if (defined(__AVR__) || defined(ESP8266)) && defined(USE_SW_SERIAL) if (gpsSwSerial) { @@ -398,7 +396,7 @@ size_t Adafruit_GPS::available(void) { if (gpsI2C) { return 1; // I2C doesnt have 'availability' so always has a byte at least to read! } - return false; + return 0; } size_t Adafruit_GPS::write(uint8_t c) { @@ -476,10 +474,6 @@ char Adafruit_GPS::read(void) { //Serial.print(c); - // if (c == '$') { //please don't eat the dollar sign - rdl 9/15/14 - // currentline[lineidx] = 0; - // lineidx = 0; - // } currentline[lineidx++] = c; if (lineidx >= MAXLINELENGTH) lineidx = MAXLINELENGTH-1; // ensure there is someplace to put the next received character @@ -592,7 +586,6 @@ bool Adafruit_GPS::begin(uint32_t baud_or_i2caddr) } else { _i2caddr = baud_or_i2caddr; } - gpsI2C->setClock(400000); // A basic scanner, see if it ACK's gpsI2C->beginTransmission(_i2caddr); return (gpsI2C->endTransmission () == 0); diff --git a/examples/GPS_I2C_OLEDdebug/GPS_I2C_OLEDdebug.ino b/examples/GPS_I2C_OLEDdebug/GPS_I2C_OLEDdebug.ino new file mode 100644 index 0000000..7ed245b --- /dev/null +++ b/examples/GPS_I2C_OLEDdebug/GPS_I2C_OLEDdebug.ino @@ -0,0 +1,35 @@ +// Test code for Adafruit GPS That Support Using I2C +// +// This code shows how to test a passthru between USB and I2C +// +// Pick one up today at the Adafruit electronics shop +// and help support open source hardware & software! -ada + +#include + +// Connect to the GPS on the hardware I2C port +Adafruit_GPS GPS(&Wire); + + +void setup() { + // wait for hardware serial to appear + while (!Serial); + + // make this baud rate fast enough to we aren't waiting on it + Serial.begin(115200); + + Serial.println("Adafruit GPS library basic I2C test!"); + GPS.begin(0x10); // The I2C address to use is 0x10 +} + + +void loop() { + if (Serial.available()) { + char c = Serial.read(); + GPS.write(c); + } + if (GPS.available()) { + char c = GPS.read(); + Serial.write(c); + } +}