#include <SD.h>
#include <adafruit_1947_Obj.h>
#include "ourOSObj.h"
ourOSObj ourOS;
File file;
int fileNum = 0;
int everyFileNum = 0;
void setup() {
Serial.begin(57600); // Fire up serial for debugging.
if (!SD.begin(ADA_1947_SHIELD_SDCS)) { // With icons, we now MUST have an SD card.
Serial.println("NO SD CARD!"); // Tell user we have no SD card.
Serial.flush(); // Make sure the message gets out.
while(true); // Lock the process here.
}
ourEventMgr.begin(); // Startup our event manager.
ourOS.begin(); // Boot OS manager.
nextPanel = breakoutApp; // <<-- URISH LOOK HERE!!
file = SD.open("/System/icons/standard");
reloadFileList();
}
void loop() { // During loop..
idle(); // Idlers get their time.
ourOS.loop(); // ourOS gets time to pass on to the current panel.
}
void reloadFileList() {
while (true) { //Check the number of files
File entry = file.openNextFile();
if (!entry) {
Serial.print("Detected files: ");
Serial.println(fileNum);
break;
}
if (!entry.isDirectory()) {
fileNum ++;
}
everyFileNum ++;
entry.close();
}
String fileList[fileNum];
file.close();
file = SD.open("/");
int i = 0;
while (i < fileNum) {
File entry = file.openNextFile();
Serial.println(i);
if (!entry.isDirectory()) {
fileList[i] = (String)entry.name();
// i ++;
}
entry.close();
Serial.println(fileList[i++]);
}
}