esmp3/src/main.cpp

56 lines
1.0 KiB
C++
Raw Normal View History

2019-08-02 21:48:36 +00:00
#include <Arduino.h>
#include <SPI.h>
2019-08-02 21:48:36 +00:00
#include "config.h"
#include "buttons.h"
#include "controller.h"
#include "player.h"
#include "sd_card.h"
#include "spi_master.h"
2019-08-02 21:48:36 +00:00
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();
}
}
2019-08-02 21:48:36 +00:00
void setup() {
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() {
}