Move SPI.begin() per Issue#20
https://github.com/LowPowerLab/SPIFlash/issues/20
This commit is contained in:
parent
09f09b923c
commit
eec4aa34b2
|
|
@ -68,7 +68,6 @@ void SPIFlash::select() {
|
||||||
SPI.setDataMode(SPI_MODE0);
|
SPI.setDataMode(SPI_MODE0);
|
||||||
SPI.setBitOrder(MSBFIRST);
|
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.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
|
#endif
|
||||||
digitalWrite(_slaveSelectPin, LOW);
|
digitalWrite(_slaveSelectPin, LOW);
|
||||||
}
|
}
|
||||||
|
|
@ -96,6 +95,7 @@ boolean SPIFlash::initialize()
|
||||||
_SPSR = SPSR;
|
_SPSR = SPSR;
|
||||||
#endif
|
#endif
|
||||||
pinMode(_slaveSelectPin, OUTPUT);
|
pinMode(_slaveSelectPin, OUTPUT);
|
||||||
|
SPI.begin();
|
||||||
#ifdef SPI_HAS_TRANSACTION
|
#ifdef SPI_HAS_TRANSACTION
|
||||||
_settings = SPISettings(4000000, MSBFIRST, SPI_MODE0);
|
_settings = SPISettings(4000000, MSBFIRST, SPI_MODE0);
|
||||||
#endif
|
#endif
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue