bsfconception / WT32-SC01

Expansion board for WT32-SC01 Dev Kit
MIT License
25 stars 9 forks source link

SD card help #3

Closed cuishuang413 closed 1 year ago

cuishuang413 commented 1 year ago

Hello,

Igot one of your board and for its SD card access. I looked at your demo code and tried to implemented into my project however unable to compile.

First, I believe I need to include the following headers:

#include "FS.h"
#include "SD.h"
#include "SPI.h"

This is the code I used after some modification from yours. I bascially removed all the debug stuff. But I got 'SPI_SD' was not declared in this scope error. Can you please point me some direction? Thanks a lot!

int _SD_MountSDCard()
{
  //Assuming use of SPI SD card
  SPI_SD.begin(_SD_SCLK, _SD_MISO, _SD_MOSI, _SD_CS);
  if (!SD.begin(_SD_CS, SPI_SD)) 
  {
    Serial.println("SDCard Mount Failed"); 
    return(0);
  } 
  else 
  {
    String siz = String((uint32_t)(SD.cardSize() / 1024 / 1024)) + "MB";
    Serial.print("SDCard Mount PASS : ");
    Serial.println(siz);

  }
  return(1);    
}
cuishuang413 commented 1 year ago

I got it.

Somhow I missed this: SPIClass SPI_SD(VSPI);