Skip to content

Commit

Permalink
Hardware SPI BREAKING: unswap mode 2 and 3 for portability (#5948)
Browse files Browse the repository at this point in the history
* Hardware SPI BREAKING: unswap mode 2 and 3 for portability
use SPI.restoreEsp8266LegacyMode2And3() for former behaviour
  • Loading branch information
d-a-v authored Apr 5, 2019
1 parent a1796f4 commit 77451d6
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions libraries/SPI/SPI.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down

0 comments on commit 77451d6

Please sign in to comment.