Skip to content

Commit

Permalink
Set SPI Pins for Lilygo T8
Browse files Browse the repository at this point in the history
  • Loading branch information
Francis Duvivier committed Aug 25, 2024
1 parent fcdfbf6 commit 78bc993
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 5 deletions.
12 changes: 8 additions & 4 deletions esp32_marauder/SDInterface.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,12 @@ bool SDInterface::initSD() {
pinMode(SD_CS, OUTPUT);

delay(10);
#ifdef LILYGO_T8_ESP32S2
pinMode(14, INPUT_PULLUP);
#endif

#if defined(MARAUDER_M5STICKC)
#if defined(LILYGO_T8_ESP32S2)
// setup custom spi pins for Lilygo T8
pinMode(14, INPUT_PULLUP);
enum { SPI_SCK = 12, SPI_MISO = 13, SPI_MOSI = 11 };
#elif defined(MARAUDER_M5STICKC)
/* Set up SPI SD Card using external pin header
StickCPlus Header - SPI SD Card Reader
3v3 - 3v3
Expand All @@ -36,6 +37,9 @@ bool SDInterface::initSD() {
- CS (jumper to SD Card GND Pin)
*/
enum { SPI_SCK = 0, SPI_MISO = 36, SPI_MOSI = 26 };
#endif

#if defined(MARAUDER_M5STICKC) || defined(LILYGO_T8_ESP32S2)
this->spiExt = new SPIClass();
this->spiExt->begin(SPI_SCK, SPI_MISO, SPI_MOSI, SD_CS);
if (!SD.begin(SD_CS, *(this->spiExt))) {
Expand Down
2 changes: 1 addition & 1 deletion esp32_marauder/SDInterface.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ extern Settings settings_obj;
class SDInterface {

private:
#if defined(MARAUDER_M5STICKC)
#if defined(MARAUDER_M5STICKC) || defined(LILYGO_T8_ESP32S2)
SPIClass *spiExt;
#endif
bool checkDetectPin();
Expand Down

0 comments on commit 78bc993

Please sign in to comment.