Skip to content

Commit be866c8

Browse files
committed
Added static_assert to check sufficient I2C interfaces.
1 parent 90d0841 commit be866c8

File tree

2 files changed

+2
-6
lines changed

2 files changed

+2
-6
lines changed

libraries/Wire/examples/slave_receiver_Wire1Wire_connected/slave_receiver_Wire1Wire_connected.ino

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
#include <TwoWireBuffers.h>
1717
#include "Arduino.h"
1818

19-
#if WIRE_INTERFACES_COUNT > 1
19+
static_assert(WIRE_INTERFACES_COUNT > 1, "You need two I2C interfaces on the Arduino board to run this sketch");
2020

2121
static const char text[] = "You really won't believe it, but x is ";
2222

@@ -98,5 +98,3 @@ void printWire1BuffersCapacity(Stream& stream) {
9898
stream.println(buffers.srvWireBufferCapacity());
9999
delay(250); // Give time to free up Serial output buffer.
100100
}
101-
102-
#endif

libraries/Wire/examples/slave_sender_Wire1Wire_connected/slave_sender_Wire1Wire_connected.ino

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
#include <TwoWireBuffers.h>
1717
#include "Arduino.h"
1818

19-
#if WIRE_INTERFACES_COUNT > 1
19+
static_assert(WIRE_INTERFACES_COUNT > 1, "You need two I2C interfaces on the Arduino board to run this sketch");
2020

2121
static const char text[] = "hello "; // respond with message of 6 bytes
2222

@@ -89,5 +89,3 @@ void printWire1BuffersCapacity(Stream& stream) {
8989
stream.print("Wire1 service buffer size is ");
9090
stream.println(buffers.srvWireBufferCapacity());
9191
}
92-
93-
#endif

0 commit comments

Comments
 (0)