Added MCP23S17 support as well as changed some pins and added more de-bouncing for the buttons.

This commit is contained in:
2019-08-11 17:15:22 +02:00
parent ebd9a9f24f
commit 55826823fc
8 changed files with 93 additions and 19 deletions

View File

@ -1,6 +1,7 @@
#include <Arduino.h>
#include <SPI.h>
#include <SD.h>
#include <MCP23S17/MCP23S17.h>
#include "config.h"
#include "controller.h"
#include "player.h"
@ -8,6 +9,7 @@
Controller* controller;
Player* player;
MCP* mcp;
void setup() {
delay(500);
@ -20,6 +22,11 @@ void setup() {
SPIMaster::init();
INFO("SPI initialized.\n");
DEBUG("Setting up MCP...\n");
SPIMaster::enable(PIN_MCP);
mcp = new MCP(0, PIN_MCP);
INFO("MCP initialized.");
DEBUG("Setting up SD card...\n");
SPIMaster::enable(PIN_SD_CS);
if (SD.begin(PIN_SD_CS)) {
@ -28,9 +35,9 @@ void setup() {
ERROR("Could not initialize SD card. Halting.\n");
while(1);
}
player = new Player();
controller = new Controller(player);
player = new Player(mcp);
controller = new Controller(player, mcp);
INFO("Initialization completed.\n");
}