47 lines
772 B
C++
47 lines
772 B
C++
#include "NerfStatTrakConfig.h"
|
|
#include "Globals.h"
|
|
|
|
#include "StateHandler.h"
|
|
#include "StateDefault.h"
|
|
|
|
|
|
void setup()
|
|
{
|
|
// Configure display
|
|
display = new SegmentDisplay();
|
|
|
|
#ifdef SDUseSPI
|
|
display->setClockSpeed(NerfClockSpeed);
|
|
#else
|
|
display->setClockPin(NerfClockPin);
|
|
display->setDataPin(NerfDataPin);
|
|
#endif
|
|
|
|
display->setLatchPin(NerfLatchPin);
|
|
display->setDigits(NerfDigits);
|
|
display->begin();
|
|
display->clear();
|
|
|
|
|
|
// Configure buttons
|
|
buttonA = new Button();
|
|
buttonA->init(NerfButtonA);
|
|
|
|
buttonB = new Button();
|
|
buttonB->init(NerfButtonB);
|
|
|
|
buttonArmed = new Button();
|
|
buttonArmed->init(NerfButtonArmed, LOW);
|
|
|
|
|
|
readCounters();
|
|
setCurrentState(new DefaultState());
|
|
}
|
|
|
|
|
|
void loop()
|
|
{
|
|
update();
|
|
currentState->loop();
|
|
}
|