From 77451d6ec9c4c8ce014704214aa98252a37f3d76 Mon Sep 17 00:00:00 2001 From: david gauchard Date: Sat, 6 Apr 2019 01:13:09 +0200 Subject: [PATCH] Hardware SPI BREAKING: unswap mode 2 and 3 for portability (#5948) * Hardware SPI BREAKING: unswap mode 2 and 3 for portability use SPI.restoreEsp8266LegacyMode2And3() for former behaviour --- libraries/SPI/SPI.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/libraries/SPI/SPI.cpp b/libraries/SPI/SPI.cpp index f67c6d69fc..09336266c4 100644 --- a/libraries/SPI/SPI.cpp +++ b/libraries/SPI/SPI.cpp @@ -161,6 +161,11 @@ void SPIClass::setDataMode(uint8_t dataMode) { bool CPOL = (dataMode & 0x10); ///< CPOL (Clock Polarity) bool CPHA = (dataMode & 0x01); ///< CPHA (Clock Phase) + // https://github.com/esp8266/Arduino/issues/2416 + // https://github.com/esp8266/Arduino/pull/2418 + if(CPOL) // Ensure same behavior as + CPHA ^= 1; // SAM, AVR and Intel Boards + if(CPHA) { SPI1U |= (SPIUSME); } else {