Merge branch 'master' of github.com:adafruit/Adafruit-GPS-Library
This commit is contained in:
commit
e0beddd274
|
|
@ -9,7 +9,7 @@ Written by Limor Fried/Ladyada for Adafruit Industries.
|
||||||
BSD license, check license.txt for more information
|
BSD license, check license.txt for more information
|
||||||
All text above must be included in any redistribution
|
All text above must be included in any redistribution
|
||||||
****************************************/
|
****************************************/
|
||||||
#ifdef __AVR__
|
#if defined(__AVR__) && defined(USE_SW_SERIAL)
|
||||||
// Only include software serial on AVR platforms (i.e. not on Due).
|
// Only include software serial on AVR platforms (i.e. not on Due).
|
||||||
#include <SoftwareSerial.h>
|
#include <SoftwareSerial.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
@ -268,7 +268,7 @@ char Adafruit_GPS::read(void) {
|
||||||
|
|
||||||
if (paused) return c;
|
if (paused) return c;
|
||||||
|
|
||||||
#ifdef __AVR__
|
#if defined(__AVR__) && defined(USE_SW_SERIAL)
|
||||||
if(gpsSwSerial) {
|
if(gpsSwSerial) {
|
||||||
if(!gpsSwSerial->available()) return c;
|
if(!gpsSwSerial->available()) return c;
|
||||||
c = gpsSwSerial->read();
|
c = gpsSwSerial->read();
|
||||||
|
|
@ -310,7 +310,7 @@ char Adafruit_GPS::read(void) {
|
||||||
return c;
|
return c;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef __AVR__
|
#if defined(__AVR__) && defined(USE_SW_SERIAL)
|
||||||
// Constructor when using SoftwareSerial or NewSoftSerial
|
// Constructor when using SoftwareSerial or NewSoftSerial
|
||||||
#if ARDUINO >= 100
|
#if ARDUINO >= 100
|
||||||
Adafruit_GPS::Adafruit_GPS(SoftwareSerial *ser)
|
Adafruit_GPS::Adafruit_GPS(SoftwareSerial *ser)
|
||||||
|
|
@ -331,7 +331,7 @@ 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) {
|
||||||
#ifdef __AVR__
|
#if defined(__AVR__) && defined(USE_SW_SERIAL)
|
||||||
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
|
||||||
|
|
@ -352,7 +352,7 @@ void Adafruit_GPS::common_init(void) {
|
||||||
|
|
||||||
void Adafruit_GPS::begin(uint32_t baud)
|
void Adafruit_GPS::begin(uint32_t baud)
|
||||||
{
|
{
|
||||||
#ifdef __AVR__
|
#if defined(__AVR__) && defined(USE_SW_SERIAL)
|
||||||
if(gpsSwSerial)
|
if(gpsSwSerial)
|
||||||
gpsSwSerial->begin(baud);
|
gpsSwSerial->begin(baud);
|
||||||
else
|
else
|
||||||
|
|
@ -363,7 +363,7 @@ void Adafruit_GPS::begin(uint32_t baud)
|
||||||
}
|
}
|
||||||
|
|
||||||
void Adafruit_GPS::sendCommand(const char *str) {
|
void Adafruit_GPS::sendCommand(const char *str) {
|
||||||
#ifdef __AVR__
|
#if defined(__AVR__) && defined(USE_SW_SERIAL)
|
||||||
if(gpsSwSerial)
|
if(gpsSwSerial)
|
||||||
gpsSwSerial->println(str);
|
gpsSwSerial->println(str);
|
||||||
else
|
else
|
||||||
|
|
|
||||||
|
|
@ -21,7 +21,10 @@ All text above must be included in any redistribution
|
||||||
#ifndef _ADAFRUIT_GPS_H
|
#ifndef _ADAFRUIT_GPS_H
|
||||||
#define _ADAFRUIT_GPS_H
|
#define _ADAFRUIT_GPS_H
|
||||||
|
|
||||||
#ifdef __AVR__
|
//comment this out if you don't want to include software serial in the library
|
||||||
|
#define USE_SW_SERIAL
|
||||||
|
|
||||||
|
#if defined(__AVR__) && defined(USE_SW_SERIAL)
|
||||||
#if ARDUINO >= 100
|
#if ARDUINO >= 100
|
||||||
#include <SoftwareSerial.h>
|
#include <SoftwareSerial.h>
|
||||||
#else
|
#else
|
||||||
|
|
@ -102,7 +105,7 @@ class Adafruit_GPS {
|
||||||
public:
|
public:
|
||||||
void begin(uint32_t baud);
|
void begin(uint32_t baud);
|
||||||
|
|
||||||
#ifdef __AVR__
|
#if defined(__AVR__) && defined(USE_SW_SERIAL)
|
||||||
#if ARDUINO >= 100
|
#if ARDUINO >= 100
|
||||||
Adafruit_GPS(SoftwareSerial *ser); // Constructor when using SoftwareSerial
|
Adafruit_GPS(SoftwareSerial *ser); // Constructor when using SoftwareSerial
|
||||||
#else
|
#else
|
||||||
|
|
@ -155,7 +158,7 @@ class Adafruit_GPS {
|
||||||
boolean paused;
|
boolean paused;
|
||||||
|
|
||||||
uint8_t parseResponse(char *response);
|
uint8_t parseResponse(char *response);
|
||||||
#ifdef __AVR__
|
#if defined(__AVR__) && defined(USE_SW_SERIAL)
|
||||||
#if ARDUINO >= 100
|
#if ARDUINO >= 100
|
||||||
SoftwareSerial *gpsSwSerial;
|
SoftwareSerial *gpsSwSerial;
|
||||||
#else
|
#else
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
name=Adafruit GPS Library
|
name=Adafruit GPS Library
|
||||||
version=1.0.1
|
version=1.0.2
|
||||||
author=Adafruit
|
author=Adafruit
|
||||||
maintainer=Adafruit <info@adafruit.com>
|
maintainer=Adafruit <info@adafruit.com>
|
||||||
sentence=An interrupt-based GPS library for no-parsing-required use
|
sentence=An interrupt-based GPS library for no-parsing-required use
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue