From 7e4fc209e441abc97fa54b7e2c543351d3d11866 Mon Sep 17 00:00:00 2001 From: devyte Date: Tue, 30 Jan 2018 12:09:49 -0300 Subject: [PATCH] Check that pins needed by Wire are defined at compile-time --- libraries/Wire/Wire.cpp | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/libraries/Wire/Wire.cpp b/libraries/Wire/Wire.cpp index b4b7460118..b83072914a 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];