From 2db44b68497ddf0dab2893af90eb71e1a4ba0fc9 Mon Sep 17 00:00:00 2001 From: KemoNine Date: Sat, 12 Sep 2020 18:14:37 -0400 Subject: [PATCH] Update so sd card via sdfat initializes correctly --- hardware/_controller/_controller.ino | 7 +++++++ hardware/_controller/src/SdFat/SdFatConfig.h | 6 +----- .../_controller/src/guislice/GUIslice_drv_adagfx.cpp | 11 ++++------- 3 files changed, 12 insertions(+), 12 deletions(-) diff --git a/hardware/_controller/_controller.ino b/hardware/_controller/_controller.ino index 59c5e5d..652e00c 100644 --- a/hardware/_controller/_controller.ino +++ b/hardware/_controller/_controller.ino @@ -141,6 +141,13 @@ void setup() { 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 gslc_InitDebug(&DebugOut); diff --git a/hardware/_controller/src/SdFat/SdFatConfig.h b/hardware/_controller/src/SdFat/SdFatConfig.h index d43a42c..1013ba8 100644 --- a/hardware/_controller/src/SdFat/SdFatConfig.h +++ b/hardware/_controller/src/SdFat/SdFatConfig.h @@ -77,7 +77,7 @@ * USE_STANDARD_SPI_LIBRARY is two, the SPI port can be selected with the * 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 @@ -201,12 +201,8 @@ #endif // RAMEND //----------------------------------------------------------------------------- /** Enable SDIO driver if available. */ -#if defined(__MK64FX512__) || defined(__MK66FX1M0__) #define ENABLE_SDIO_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. diff --git a/hardware/_controller/src/guislice/GUIslice_drv_adagfx.cpp b/hardware/_controller/src/guislice/GUIslice_drv_adagfx.cpp index ca1ccd1..2581c7d 100644 --- a/hardware/_controller/src/guislice/GUIslice_drv_adagfx.cpp +++ b/hardware/_controller/src/guislice/GUIslice_drv_adagfx.cpp @@ -172,13 +172,10 @@ #include #elif (GSLC_SD_EN == 2) // Use greiman/SdFat library - // - Supports SW SPI - // - Recommend usage of SdFat library version 1.0.1 - // - 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 + // Tweaked by KemoNine to use sdfat hardware spi instead of softspi + // Could NOT get soft spi working #include "../SdFat/SdFat.h" - SdFatSoftSpi<12, 11, 13> SD; // FIXME: Add configurability + SdFat SD; #endif #endif @@ -675,7 +672,7 @@ bool gslc_DrvInit(gslc_tsGui* pGui) // Initialize SD card usage #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); return false; }