Support SDCard on SPI bus 2 (if present)
This commit is contained in:
parent
6317a8a83c
commit
3892bc7a1a
@ -656,7 +656,7 @@ const uint16_t kGpioNiceList[] PROGMEM = {
|
|||||||
AGPIO(GPIO_RC522_RST), // RC522 Rfid Reset
|
AGPIO(GPIO_RC522_RST), // RC522 Rfid Reset
|
||||||
#endif
|
#endif
|
||||||
#ifdef USE_SDCARD
|
#ifdef USE_SDCARD
|
||||||
AGPIO(GPIO_SDCARD_CS), // SDCard in SPI mode
|
AGPIO(GPIO_SDCARD_CS) + AGMAX(MAX_SPI), // SDCard in SPI mode
|
||||||
#endif // USE_SDCARD
|
#endif // USE_SDCARD
|
||||||
#if defined(USE_MCP2515) || defined(USE_CANSNIFFER)
|
#if defined(USE_MCP2515) || defined(USE_CANSNIFFER)
|
||||||
AGPIO(GPIO_MCP2515_CS),
|
AGPIO(GPIO_MCP2515_CS),
|
||||||
|
|||||||
@ -194,14 +194,26 @@ char *fileOnly(char *fname){
|
|||||||
void UfsCheckSDCardInit(void) {
|
void UfsCheckSDCardInit(void) {
|
||||||
// Try SPI mode first
|
// Try SPI mode first
|
||||||
// SPI mode requires SDCARD_CS to be configured
|
// SPI mode requires SDCARD_CS to be configured
|
||||||
|
/*
|
||||||
if (TasmotaGlobal.spi_enabled && PinUsed(GPIO_SDCARD_CS)) {
|
if (TasmotaGlobal.spi_enabled && PinUsed(GPIO_SDCARD_CS)) {
|
||||||
int8_t cs = Pin(GPIO_SDCARD_CS);
|
int8_t cs = Pin(GPIO_SDCARD_CS);
|
||||||
|
*/
|
||||||
|
uint32_t spi_bus = 0;
|
||||||
|
int8_t cs = -1;
|
||||||
|
if (TasmotaGlobal.spi_enabled && PinUsed(GPIO_SDCARD_CS)) {
|
||||||
|
cs = Pin(GPIO_SDCARD_CS);
|
||||||
|
}
|
||||||
|
if (TasmotaGlobal.spi_enabled2 && PinUsed(GPIO_SDCARD_CS, 1)) {
|
||||||
|
spi_bus = 1;
|
||||||
|
cs = Pin(GPIO_SDCARD_CS, 1);
|
||||||
|
}
|
||||||
|
if (cs > -1) {
|
||||||
|
|
||||||
#ifdef ESP8266
|
#ifdef ESP8266
|
||||||
SPI.begin();
|
SPI.begin();
|
||||||
#endif // ESP8266
|
#endif // ESP8266
|
||||||
#ifdef ESP32
|
#ifdef ESP32
|
||||||
SPI.begin(Pin(GPIO_SPI_CLK), Pin(GPIO_SPI_MISO), Pin(GPIO_SPI_MOSI), -1);
|
SPI.begin(Pin(GPIO_SPI_CLK, spi_bus), Pin(GPIO_SPI_MISO, spi_bus), Pin(GPIO_SPI_MOSI, spi_bus), -1);
|
||||||
#endif // ESP32
|
#endif // ESP32
|
||||||
|
|
||||||
if (SD.begin(cs)) {
|
if (SD.begin(cs)) {
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user