2019-08-02 21:48:36 +00:00
|
|
|
#include <Arduino.h>
|
2019-08-04 11:42:07 +00:00
|
|
|
#include <SPI.h>
|
2019-08-02 21:48:36 +00:00
|
|
|
#include "config.h"
|
|
|
|
#include "buttons.h"
|
|
|
|
#include "controller.h"
|
|
|
|
#include "player.h"
|
2019-08-04 11:42:07 +00:00
|
|
|
#include "sd_card.h"
|
|
|
|
#include "spi_master.h"
|
2019-08-02 21:48:36 +00:00
|
|
|
|
|
|
|
Buttons* buttons;
|
|
|
|
Controller* controller;
|
|
|
|
Player* player;
|
2019-08-04 11:42:07 +00:00
|
|
|
SDCard* sd;
|
|
|
|
|
|
|
|
void printDirectory(File dir, int numTabs) {
|
|
|
|
while (true) {
|
|
|
|
|
|
|
|
File entry = dir.openNextFile();
|
|
|
|
if (! entry) {
|
|
|
|
// no more files
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
for (uint8_t i = 0; i < numTabs; i++) {
|
|
|
|
Serial.print('\t');
|
|
|
|
}
|
|
|
|
Serial.print(entry.name());
|
|
|
|
if (entry.isDirectory()) {
|
|
|
|
Serial.println("/");
|
|
|
|
printDirectory(entry, numTabs + 1);
|
|
|
|
} else {
|
|
|
|
// files have sizes, directories do not
|
|
|
|
Serial.print("\t\t");
|
|
|
|
Serial.println(entry.size(), DEC);
|
|
|
|
}
|
|
|
|
entry.close();
|
|
|
|
}
|
|
|
|
}
|
2019-08-02 21:48:36 +00:00
|
|
|
|
|
|
|
void setup() {
|
2019-08-04 11:42:07 +00:00
|
|
|
Serial.begin(74880);
|
|
|
|
Serial.println("Starting.");
|
|
|
|
|
|
|
|
Serial.println("Setting up SPI...");
|
|
|
|
SPI.begin();
|
|
|
|
SPIMaster::init();
|
|
|
|
|
|
|
|
sd = new SDCard();
|
|
|
|
player = new Player(sd);
|
|
|
|
controller = new Controller(player, sd);
|
2019-08-02 21:48:36 +00:00
|
|
|
buttons = new Buttons(controller);
|
|
|
|
}
|
|
|
|
|
|
|
|
void loop() {
|
|
|
|
|
|
|
|
}
|