Intermediary commit. Nothing's working, everything is broken. Let's start over now...

This commit is contained in:
2019-08-04 13:42:07 +02:00
parent 128d76cebc
commit 2a7dd5d8a1
9 changed files with 232 additions and 6 deletions

View File

@ -1,16 +1,52 @@
#include <Arduino.h>
#include <SPI.h>
#include "config.h"
#include "buttons.h"
#include "controller.h"
#include "player.h"
#include "sd_card.h"
#include "spi_master.h"
Buttons* buttons;
Controller* controller;
Player* player;
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();
}
}
void setup() {
player = new Player();
controller = new Controller(player);
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);
buttons = new Buttons(controller);
}