Skip to content

Commit d8da9b9

Browse files
authored
Merge pull request adafruit#136 from brunob45/no_sw_serial
Add #define to disable SW Serial
2 parents f5030a2 + 43b28b9 commit d8da9b9

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

src/Adafruit_GPS.h

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -39,8 +39,10 @@
3939
#endif
4040
#endif
4141

42-
#define USE_SW_SERIAL ///< comment this out if you don't want to include
43-
///< software serial in the library
42+
#if (defined(__AVR__) || defined(ESP8266)) && !defined(NO_SW_SERIAL)
43+
#define USE_SW_SERIAL ///< insert line `#define NO_SW_SERIAL` before this header
44+
///< if you don't want to include software serial in the
45+
#endif ///< library
4446
#define GPS_DEFAULT_I2C_ADDR \
4547
0x10 ///< The default address for I2C transport of GPS data
4648
#define GPS_MAX_I2C_TRANSFER \
@@ -54,7 +56,7 @@
5456
3 ///< maximum length of a source ID name, including terminating 0
5557

5658
#include "Arduino.h"
57-
#if (defined(__AVR__) || defined(ESP8266)) && defined(USE_SW_SERIAL)
59+
#ifdef USE_SW_SERIAL
5860
#include <SoftwareSerial.h>
5961
#endif
6062
#include <Adafruit_PMTK.h>
@@ -83,7 +85,7 @@ class Adafruit_GPS : public Print {
8385
// Adafruit_GPS.cpp
8486
bool begin(uint32_t baud_or_i2caddr);
8587

86-
#if (defined(__AVR__) || defined(ESP8266)) && defined(USE_SW_SERIAL)
88+
#ifdef USE_SW_SERIAL
8789
Adafruit_GPS(SoftwareSerial *ser); // Constructor when using SoftwareSerial
8890
#endif
8991
Adafruit_GPS(HardwareSerial *ser); // Constructor when using HardwareSerial
@@ -281,7 +283,7 @@ class Adafruit_GPS : public Print {
281283
bool paused;
282284

283285
uint8_t parseResponse(char *response);
284-
#if (defined(__AVR__) || defined(ESP8266)) && defined(USE_SW_SERIAL)
286+
#ifdef USE_SW_SERIAL
285287
SoftwareSerial *gpsSwSerial;
286288
#endif
287289
bool noComms = false;

0 commit comments

Comments
 (0)