From 8b26deb581464a26e5583e26490d57e7632e204c Mon Sep 17 00:00:00 2001 From: hathach Date: Fri, 26 Nov 2021 11:37:29 +0700 Subject: [PATCH] fix 32u4 which is avr core without WIRE_HAS_END --- Adafruit_I2CDevice.cpp | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/Adafruit_I2CDevice.cpp b/Adafruit_I2CDevice.cpp index bbe869c..b109f9d 100644 --- a/Adafruit_I2CDevice.cpp +++ b/Adafruit_I2CDevice.cpp @@ -39,12 +39,13 @@ bool Adafruit_I2CDevice::begin(bool addr_detect) { * @brief De-initialize device, turn off the Wire interface */ void Adafruit_I2CDevice::end(void) { -#ifndef ESP8266 - // ESP8266 does not implement Wire::end() + // Not all port implement Wire::end(), such as + // - ESP8266 + // - AVR core without WIRE_HAS_END +#if ! ( defined(ESP8266) || (defined(ARDUINO_ARCH_AVR) && !defined(WIRE_HAS_END)) ) _wire->end(); -#endif - _begun = false; +#endif } /*!