Thank you Crenn!!!
Making progress again. I'm porting some of the Arduino examples from that library that aren't working yet. Here's the first, SdFatLs, It gives you a directory of what's on the uSD card.
It's short, so I'll just post it here. I'm doing a few more, would you like me to post them as well???
/*
* This sketch will list all files in the root directory and
* then do a recursive list of all directories on the SD card.
*
*/
#include <SdFat.h>
#include <HardwareSPI.h>
#include <stdint.h>
HardwareSPI spi(1);
Sd2Card card(spi, USE_NSS_PIN, true);
SdVolume volume;
SdFile root;
SdFile file;
// store error strings in flash to save RAM
void error(const char* str) {
SerialUSB.print("error: ");
SerialUSB.println(str);
if (card.errorCode()) {
SerialUSB.print("SD error: ");
SerialUSB.print(card.errorCode(), HEX);
SerialUSB.print(',');
SerialUSB.println(card.errorData(), HEX);
}
while(1);
}
void setup() {
SerialUSB.begin();
SerialUSB.println("type any char to start");
while (!SerialUSB.available());
SerialUSB.println();
// initialize the SD card
if (!card.init()) error("card.init failed!");
// initialize a FAT volume
if (!volume.init(&card,1)) error("vol.init failed!");
SerialUSB.print("Volume is FAT");
SerialUSB.println(volume.fatType(),DEC);
SerialUSB.println();
if (!root.openRoot(&volume)) error("openRoot failed");
// list file in root with date and size
SerialUSB.println("Files found in root:");
root.ls(LS_DATE | LS_SIZE);
SerialUSB.println();
// Recursive list of all directories
SerialUSB.print("Files found in all dirs:");
root.ls(LS_R);
SerialUSB.println();
SerialUSB.print("Done");
}
void loop() { }