#include "SPI.h"
// #include "Adafruit_GFX.h"
// #include "Adafruit_ILI9341.h"
#include <SdFat.h>
// #include <Adafruit_SPIFlash.h> // SPI / QSPI flash library
// #include <Adafruit_ImageReader.h> // Image-reading functions
#define TFT_DC 2
#define TFT_CS 15
// Adafruit_ILI9341 tft = Adafruit_ILI9341( TFT_CS, TFT_DC );
#define SPI_SPEED SD_SCK_MHZ( 4 )
#define CS_PIN 5
SdFat sd;
// Adafruit_ImageReader reader( sd );
void setup() {
// put your setup code here, to run once:
Serial.begin(115200);
Serial.println("Hello, ESP32!");
if ( !sd.begin( CS_PIN, SPI_SPEED ) )
{
if ( auto code = sd.card()->errorCode() )
{
Serial.println( "SD initialization failed." );
Serial.println( ( int )code );
}
else if ( sd.vol()->fatType() == 0 )
{
Serial.println( "Can't find a valid FAT16/FAT32 partition." );
}
else
{
Serial.println( "Can't determine error type" );
}
return;
}
Serial.println( "Files on card:" );
Serial.println( " Size Name" );
sd.ls( LS_R | LS_SIZE );
Serial.println( "end of LS" );
}
void loop() {
// put your main code here, to run repeatedly:
delay(10); // this speeds up the simulation
}