Skip to content

Commit 9ba8f77

Browse files
authored
Check that pins needed by Wire are defined at compile-time (#4261)
1 parent 4bafbe5 commit 9ba8f77

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

libraries/Wire/Wire.cpp

+7
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,13 @@ extern "C" {
3030
#include "twi.h"
3131
#include "Wire.h"
3232

33+
34+
//Some boards don't have these pins available, and hence don't support Wire.
35+
//Check here for compile-time error.
36+
#if !defined(PIN_WIRE_SDA) || !defined(PIN_WIRE_SCL)
37+
#error Wire library is not supported on this board
38+
#endif
39+
3340
// Initialize Class Variables //////////////////////////////////////////////////
3441

3542
uint8_t TwoWire::rxBuffer[BUFFER_LENGTH];

0 commit comments

Comments
 (0)