I am making a function for one of my devices, my device needs a particular SPI setting. I was hoping to save the current setting of the SPI class into some variable, load in the required setting, do a transfer, and after that load back the old setting.
I know there is an object for the SPISettings, but i dont know how to pull the current settings without me having to create a global variable that keeps track of it.
void sendSPI(){
SPISettings oldSettings = ??? ; //save old SPI Settings
SPISettings mySettings(14000000, MSBFIRST, SPI_MODE0);
digitalWrite(CSPIN,LOW);
SPI.beginTransaction(mySettings); //load in new SPI Settings
SPI.transfer(0x0);
digitalWrite(CSPIN,HIGH);
SPI.beginTransaction(mySettings); //Revert to old SPI Settings
}