Skip to content

Commit 77451d6

Browse files
authored
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
1 parent a1796f4 commit 77451d6

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

Diff for: libraries/SPI/SPI.cpp

+5
Original file line numberDiff line numberDiff line change
@@ -161,6 +161,11 @@ void SPIClass::setDataMode(uint8_t dataMode) {
161161
bool CPOL = (dataMode & 0x10); ///< CPOL (Clock Polarity)
162162
bool CPHA = (dataMode & 0x01); ///< CPHA (Clock Phase)
163163

164+
// https://github.com/esp8266/Arduino/issues/2416
165+
// https://github.com/esp8266/Arduino/pull/2418
166+
if(CPOL) // Ensure same behavior as
167+
CPHA ^= 1; // SAM, AVR and Intel Boards
168+
164169
if(CPHA) {
165170
SPI1U |= (SPIUSME);
166171
} else {

0 commit comments

Comments
 (0)