Move SPI.begin() per Issue#20

https://github.com/LowPowerLab/SPIFlash/issues/20
This commit is contained in:
Felix Rusu 2018-05-23 12:35:20 -04:00
parent 09f09b923c
commit eec4aa34b2
1 changed files with 1 additions and 1 deletions

View File

@ -68,7 +68,6 @@ void SPIFlash::select() {
SPI.setDataMode(SPI_MODE0);
SPI.setBitOrder(MSBFIRST);
SPI.setClockDivider(SPI_CLOCK_DIV4); //decided to slow down from DIV2 after SPI stalling in some instances, especially visible on mega1284p when RFM69 and FLASH chip both present
SPI.begin();
#endif
digitalWrite(_slaveSelectPin, LOW);
}
@ -96,6 +95,7 @@ boolean SPIFlash::initialize()
_SPSR = SPSR;
#endif
pinMode(_slaveSelectPin, OUTPUT);
SPI.begin();
#ifdef SPI_HAS_TRANSACTION
_settings = SPISettings(4000000, MSBFIRST, SPI_MODE0);
#endif