SPISettings

Status
Not open for further replies.

tonton81

Well-known member
is there a way to retrieve the values (speed, msb, mode) of "settings" after setting it via SPISettings?
 
Last edited:
The answer depends on whether the scope of "a way" allows editing the source to gain access to the private member variables and then crafting rather messy hardware specific code. If you're willing to go to those lengths, then yes, there certainly is a way.

But if you intend to use only the public API, then no. The API doesn't provide a way to query the parameters used with the constructor.
 
shame, i wanted to copy the settings after its set to relay it to another function, theres no old way of getting the bitorder frequency and mode if any either?

i dont really want the conversions, just a copy of whats passed into it to forward to a custom library im working on
 
Last edited:
another question:

Code:
#include <SPI.h>
 
uint32_t spi_speed = 4000000;
 
void setup() {
  Serial.begin(115200);
  SPI.begin();
  SPI.beginTransaction(SPISettings(spi_speed, MSBFIRST, SPI_MODE0));
  Serial.println("PASS");
}
 
void loop() {
 }

PASS never shows in serial monitor, and mcu locks up.
If you replace the variable with an actual value, PASS displays.

Is there a way to change speeds dynamically or is this generated by the compiler during compilations?
 
Status
Not open for further replies.
Back
Top