mirror of
https://github.com/justcallmekoko/ESP32Marauder.git
synced 2025-12-22 23:26:45 -08:00
Get external SPI SD reader working on M5StickC-Plus
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
#include "SDInterface.h"
|
||||
#include "lang_var.h"
|
||||
|
||||
|
||||
bool SDInterface::initSD() {
|
||||
#ifdef HAS_SD
|
||||
String display_string = "";
|
||||
@@ -20,8 +21,23 @@ bool SDInterface::initSD() {
|
||||
pinMode(SD_CS, OUTPUT);
|
||||
|
||||
delay(10);
|
||||
|
||||
if (!SD.begin(SD_CS)) {
|
||||
#if defined(MARAUDER_M5STICKC)
|
||||
/* Set up SPI SD Card using external pin header
|
||||
StickCPlus Header - SPI SD Card Reader
|
||||
3v3 - 3v3
|
||||
GND - GND
|
||||
G0 - CLK
|
||||
G36/G25 - MISO
|
||||
G26 - MOSI
|
||||
- CS (jumper to SD Card GND Pin)
|
||||
*/
|
||||
enum { SPI_SCK = 0, SPI_MISO = 36, SPI_MOSI = 26 };
|
||||
SPIClass SPI_EXT;
|
||||
SPI_EXT.begin(SPI_SCK, SPI_MISO, SPI_MOSI, SD_CS);
|
||||
if (!SD.begin(SD_CS, SPI_EXT)) {
|
||||
#else
|
||||
if (!SD.begin(SD_CS)) {
|
||||
#endif
|
||||
Serial.println(F("Failed to mount SD Card"));
|
||||
this->supported = false;
|
||||
return false;
|
||||
@@ -274,4 +290,4 @@ void SDInterface::main() {
|
||||
this->initSD();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user