SparkFun_ADXL345_Arduino_Library icon indicating copy to clipboard operation
SparkFun_ADXL345_Arduino_Library copied to clipboard

SPI.setDataMode() deprecated

Open SDAMcIntyre opened this issue 8 years ago • 0 comments

I was wondering if it would be valuable to update some of the SPI code. I'm referring to lines 49-52 in "SparkFun_ADXL345.cpp":

SPI.begin();
SPI.setDataMode(SPI_MODE3);
pinMode(_CS, OUTPUT);
digitalWrite(_CS, HIGH);

It seems that SPI.setDataMode() is deprecated (https://www.arduino.cc/en/Reference/SPISetDataMode) and that SPISettings(), SPI.beginTransaction() and SPI.endTransaction() should be used in the writeToSPI() and readFromSPI() functions.

Also, is it necessary to pull CS/SS high, since SPI.begin() says it does this already? https://www.arduino.cc/en/Reference/SPIBegin

SDAMcIntyre avatar May 26 '17 09:05 SDAMcIntyre