From 9ba8f776780e63e36e713df992a10b871bca2a5a Mon Sep 17 00:00:00 2001 From: Develo Date: Tue, 30 Jan 2018 14:59:47 -0300 Subject: [PATCH] Check that pins needed by Wire are defined at compile-time (#4261) --- libraries/Wire/Wire.cpp | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/libraries/Wire/Wire.cpp b/libraries/Wire/Wire.cpp index b4b746011..b83072914 100644 --- a/libraries/Wire/Wire.cpp +++ b/libraries/Wire/Wire.cpp @@ -30,6 +30,13 @@ extern "C" { #include "twi.h" #include "Wire.h" + +//Some boards don't have these pins available, and hence don't support Wire. +//Check here for compile-time error. +#if !defined(PIN_WIRE_SDA) || !defined(PIN_WIRE_SCL) +#error Wire library is not supported on this board +#endif + // Initialize Class Variables ////////////////////////////////////////////////// uint8_t TwoWire::rxBuffer[BUFFER_LENGTH];