Update so sd card via sdfat initializes correctly

This commit is contained in:
KemoNine 2020-09-12 18:14:37 -04:00
parent e8a53866b1
commit 2db44b6849
3 changed files with 12 additions and 12 deletions

View File

@ -141,6 +141,13 @@ void setup() {
Serial.begin(115200); Serial.begin(115200);
// If GUI Slice debug of drivers is turned on, wait for serial so we get proper debug output
#if defined(DBG_LOG) || defined(DBG_TOUCH) || defined(DBG_FRAME_RATE) || defined(DBG_DRAW_IMM) || defined(DBG_DRIVER)
while (!Serial) {
;
}
#endif
// GUI Slice debugging // GUI Slice debugging
gslc_InitDebug(&DebugOut); gslc_InitDebug(&DebugOut);

View File

@ -77,7 +77,7 @@
* USE_STANDARD_SPI_LIBRARY is two, the SPI port can be selected with the * USE_STANDARD_SPI_LIBRARY is two, the SPI port can be selected with the
* constructors SdFat(SPIClass* spiPort) and SdFatEX(SPIClass* spiPort). * constructors SdFat(SPIClass* spiPort) and SdFatEX(SPIClass* spiPort).
*/ */
#define USE_STANDARD_SPI_LIBRARY 0 #define USE_STANDARD_SPI_LIBRARY 1
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
/** /**
* If the symbol ENABLE_SOFTWARE_SPI_CLASS is nonzero, the class SdFatSoftSpi * If the symbol ENABLE_SOFTWARE_SPI_CLASS is nonzero, the class SdFatSoftSpi
@ -201,12 +201,8 @@
#endif // RAMEND #endif // RAMEND
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
/** Enable SDIO driver if available. */ /** Enable SDIO driver if available. */
#if defined(__MK64FX512__) || defined(__MK66FX1M0__)
#define ENABLE_SDIO_CLASS 1 #define ENABLE_SDIO_CLASS 1
#define ENABLE_SDIOEX_CLASS 1 #define ENABLE_SDIOEX_CLASS 1
#else // ENABLE_SDIO_CLASS
#define ENABLE_SDIO_CLASS 0
#endif // ENABLE_SDIO_CLASS
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
/** /**
* Determine the default SPI configuration. * Determine the default SPI configuration.

View File

@ -172,13 +172,10 @@
#include <SD.h> #include <SD.h>
#elif (GSLC_SD_EN == 2) #elif (GSLC_SD_EN == 2)
// Use greiman/SdFat library // Use greiman/SdFat library
// - Supports SW SPI // Tweaked by KemoNine to use sdfat hardware spi instead of softspi
// - Recommend usage of SdFat library version 1.0.1 // Could NOT get soft spi working
// - To support SW SPI interface, need to make mod to SdFat lib:
// - Arduino\libraries\SdFat\src\SdFatConfig.h:
// - #define ENABLE_SOFTWARE_SPI_CLASS 1 // Change default from 0 to 1
#include "../SdFat/SdFat.h" #include "../SdFat/SdFat.h"
SdFatSoftSpi<12, 11, 13> SD; // FIXME: Add configurability SdFat SD;
#endif #endif
#endif #endif
@ -675,7 +672,7 @@ bool gslc_DrvInit(gslc_tsGui* pGui)
// Initialize SD card usage // Initialize SD card usage
#if (GSLC_SD_EN) #if (GSLC_SD_EN)
if (!SD.begin(ADAGFX_PIN_SDCS)) { if (!SD.begin(ADAGFX_PIN_SDCS, SD_SCK_MHZ(40))) {
GSLC_DEBUG_PRINT("ERROR: DrvInit() SD init failed\n",0); GSLC_DEBUG_PRINT("ERROR: DrvInit() SD init failed\n",0);
return false; return false;
} }