From e53584c2c065fcd4dfe242368d6e5e74a36c2f74 Mon Sep 17 00:00:00 2001 From: Charles Cross Date: Tue, 19 Jan 2016 13:19:51 -0800 Subject: [PATCH 1/2] Added externs for additional Wire instances --- libraries/Wire/Wire.h | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/libraries/Wire/Wire.h b/libraries/Wire/Wire.h index ab7ccae60..ceaf6fe2a 100644 --- a/libraries/Wire/Wire.h +++ b/libraries/Wire/Wire.h @@ -107,5 +107,10 @@ class TwoWire : public Stream }; extern TwoWire Wire; +extern TwoWire Wire1; +extern TwoWire Wire2; +extern TwoWire Wire3; +extern TwoWire Wire4; +extern TwoWire Wire5; #endif From 5c19b45275d12a756fcfae020585bf10b5bd0215 Mon Sep 17 00:00:00 2001 From: Charles Cross Date: Tue, 19 Jan 2016 14:41:34 -0800 Subject: [PATCH 2/2] Followed the precedent in SPI and Wire libraries, adding #ifdefs to conditionally declare Wire interface externs --- libraries/Wire/Wire.h | 24 ++++++++++++++++++------ 1 file changed, 18 insertions(+), 6 deletions(-) diff --git a/libraries/Wire/Wire.h b/libraries/Wire/Wire.h index ceaf6fe2a..baec2c8c0 100644 --- a/libraries/Wire/Wire.h +++ b/libraries/Wire/Wire.h @@ -106,11 +106,23 @@ class TwoWire : public Stream //static const uint32_t XMIT_TIMEOUT = 100000; }; -extern TwoWire Wire; -extern TwoWire Wire1; -extern TwoWire Wire2; -extern TwoWire Wire3; -extern TwoWire Wire4; -extern TwoWire Wire5; +#if WIRE_INTERFACES_COUNT > 0 + extern TwoWire Wire; +#endif +#if WIRE_INTERFACES_COUNT > 1 + extern TwoWire Wire1; +#endif +#if WIRE_INTERFACES_COUNT > 2 + extern TwoWire Wire2; +#endif +#if WIRE_INTERFACES_COUNT > 3 + extern TwoWire Wire3; +#endif +#if WIRE_INTERFACES_COUNT > 4 + extern TwoWire Wire4; +#endif +#if WIRE_INTERFACES_COUNT > 5 + extern TwoWire Wire5; +#endif #endif