I am using VS Code and PlatformIO to program the ESP32, plus I am using the ESP-Prog to debug the code. The ESP-Prog uses pins 12, 13 and 15. I am using 4 SPI devices, DAC, ADC and two for the touch screen. I am using the VSPI pins for SPI processing. I am using the standard SPI Library (“#include<SPI.h>”). My question is “How can I reassign the VSPI pin numbers to this library???
Many Thanks
Peter
Hi.
At the beginning of your code, declare the pins you want to use, for example (the VSPI pins):
#define SCK 17
#define MISO 19
#define MOSI 23
#define CS 5
In the setup(), create a new SPI class on VSPI.
SPIClass spi = SPIClass(VSPI);
Initialize SPI communication protocol on the pins defined previously:
spi.begin(SCK, MISO, MOSI, CS);
Then, use the regular SPI functions.
If you’re using libraries to interact with your devices, you might need to pass this new spi object when initializing the libraries.
Tell me if this helps.
Regards,
Sara