Skip to content
This repository was archived by the owner on Jan 28, 2021. It is now read-only.

Commit 75eedde

Browse files
committed
Fix to avoid conflicting #defines for Serial
1 parent 5ecba89 commit 75eedde

File tree

1 file changed

+21
-13
lines changed

1 file changed

+21
-13
lines changed

src/SparkFun_Ublox_Arduino_Library.h

Lines changed: 21 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -52,19 +52,6 @@
5252

5353
#include "u-blox_config_keys.h"
5454

55-
// Define Serial for SparkFun SAMD based boards.
56-
// Boards like the RedBoard Turbo use SerialUSB (not Serial).
57-
// But other boards like the SAMD51 Thing Plus use Serial (not SerialUSB).
58-
// The next nine lines let the code compile cleanly on as many SAMD boards as possible.
59-
#if defined(ARDUINO_ARCH_SAMD) // Is this a SAMD board?
60-
#if defined(USB_VID) // Is the USB Vendor ID defined?
61-
#if (USB_VID == 0x1B4F) // Is this a SparkFun board?
62-
#if !defined(ARDUINO_SAMD51_THING_PLUS) & !defined(ARDUINO_SAMD51_MICROMOD) // If it is not a SAMD51 Thing Plus or SAMD51 MicroMod
63-
#define Serial SerialUSB // Define Serial as SerialUSB
64-
#endif
65-
#endif
66-
#endif
67-
#endif
6855
//-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
6956

7057
//Define a digital pin to aid checksum failure capture and analysis
@@ -623,7 +610,28 @@ class SFE_UBLOX_GPS
623610

624611
boolean getRELPOSNED(uint16_t maxWait = 1100); //Get Relative Positioning Information of the NED frame
625612

613+
// Enable debug messages using the chosen Serial port (Stream)
614+
// Boards like the RedBoard Turbo use SerialUSB (not Serial).
615+
// But other boards like the SAMD51 Thing Plus use Serial (not SerialUSB).
616+
// These lines let the code compile cleanly on as many SAMD boards as possible.
617+
#if defined(ARDUINO_ARCH_SAMD) // Is this a SAMD board?
618+
#if defined(USB_VID) // Is the USB Vendor ID defined?
619+
#if (USB_VID == 0x1B4F) // Is this a SparkFun board?
620+
#if !defined(ARDUINO_SAMD51_THING_PLUS) & !defined(ARDUINO_SAMD51_MICROMOD) // If it is not a SAMD51 Thing Plus or SAMD51 MicroMod
621+
void enableDebugging(Stream &debugPort = SerialUSB, boolean printLimitedDebug = false); //Given a port to print to, enable debug messages. Default to all, not limited.
622+
#else
626623
void enableDebugging(Stream &debugPort = Serial, boolean printLimitedDebug = false); //Given a port to print to, enable debug messages. Default to all, not limited.
624+
#endif
625+
#else
626+
void enableDebugging(Stream &debugPort = Serial, boolean printLimitedDebug = false); //Given a port to print to, enable debug messages. Default to all, not limited.
627+
#endif
628+
#else
629+
void enableDebugging(Stream &debugPort = Serial, boolean printLimitedDebug = false); //Given a port to print to, enable debug messages. Default to all, not limited.
630+
#endif
631+
#else
632+
void enableDebugging(Stream &debugPort = Serial, boolean printLimitedDebug = false); //Given a port to print to, enable debug messages. Default to all, not limited.
633+
#endif
634+
627635
void disableDebugging(void); //Turn off debug statements
628636
void debugPrint(char *message); //Safely print debug statements
629637
void debugPrintln(char *message); //Safely print debug statements

0 commit comments

Comments
 (0)