Skip to content

Commit 5c19b45

Browse files
author
Charles Cross
committed
Followed the precedent in SPI and Wire libraries, adding #ifdefs to conditionally declare Wire interface externs
1 parent e53584c commit 5c19b45

File tree

1 file changed

+18
-6
lines changed

1 file changed

+18
-6
lines changed

libraries/Wire/Wire.h

+18-6
Original file line numberDiff line numberDiff line change
@@ -106,11 +106,23 @@ class TwoWire : public Stream
106106
//static const uint32_t XMIT_TIMEOUT = 100000;
107107
};
108108

109-
extern TwoWire Wire;
110-
extern TwoWire Wire1;
111-
extern TwoWire Wire2;
112-
extern TwoWire Wire3;
113-
extern TwoWire Wire4;
114-
extern TwoWire Wire5;
109+
#if WIRE_INTERFACES_COUNT > 0
110+
extern TwoWire Wire;
111+
#endif
112+
#if WIRE_INTERFACES_COUNT > 1
113+
extern TwoWire Wire1;
114+
#endif
115+
#if WIRE_INTERFACES_COUNT > 2
116+
extern TwoWire Wire2;
117+
#endif
118+
#if WIRE_INTERFACES_COUNT > 3
119+
extern TwoWire Wire3;
120+
#endif
121+
#if WIRE_INTERFACES_COUNT > 4
122+
extern TwoWire Wire4;
123+
#endif
124+
#if WIRE_INTERFACES_COUNT > 5
125+
extern TwoWire Wire5;
126+
#endif
115127

116128
#endif

0 commit comments

Comments
 (0)