-
Notifications
You must be signed in to change notification settings - Fork 169
Description
I recently bought a new Arduino GIGA R1 WIFI which has multiple ports for SPI communication. The SPI1 port (defined as the SPI
object by the "SPI" library) that is used by this library is broken out to the SPI header in the center of the board. The SPI5 port (defined as the SPI1
object by the "SPI" library) is located between pins 10 and 13 in the female pins.
In some cases, it may be necessary or more convenient to connect the SD card to the SPI5 bus. However, it is not feasible to use this library with that configuration because it is hardcoded to use the SPI
object:
Lines 27 to 29 in e5438e2
#ifndef SDCARD_SPI | |
#define SDCARD_SPI SPI | |
#endif |
There is a macro-based mechanism for configuring the object name. However, defining that SDCARD_SPI
macro could only be done either by setting platform properties (which is something only very advanced users will be able to accomplish), or by editing the library's source code (which is also difficult for the average user).
Please add an interface that allows the user to pass an object to the library for use in communicating with the SD card.
Additional context
Such a capability has already been implemented in the SdFat library:
https://github.com/greiman/SdFat/blob/2.3.1/src/SdCard/SdSpiCard/SpiDriver/SdSpiDriver.h#L110-L118
and in the "SD" library that is bundled with the "Arduino ESP32 Boards" and "esp32" platforms:
https://github.com/espressif/arduino-esp32/blob/3.3.0/libraries/SD/src/SD.h#L30-L32
Related forum discussion:
https://forum.arduino.cc/t/choice-of-spi-port/1178433