mirror of
https://github.com/DCC-EX/CommandStation-EX.git
synced 2024-11-26 17:46:14 +01:00
Cleanup to reflect library changes, including splid Main/Service track.
This commit is contained in:
parent
cdfb37c8b5
commit
69a47d8559
30
src/main.cpp
30
src/main.cpp
|
@ -2,21 +2,20 @@
|
||||||
#include <CommandStation.h>
|
#include <CommandStation.h>
|
||||||
#include <ArduinoTimers.h>
|
#include <ArduinoTimers.h>
|
||||||
|
|
||||||
#define DCC_IRQ_MICROSECONDS 29
|
const uint8_t kIRQmicros = 29;
|
||||||
|
const uint8_t kNumLocos = 50;
|
||||||
#define NUM_LOCOS 50
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////
|
||||||
// Motor driver selection:
|
// Motor driver selection:
|
||||||
// Comment out all but the two lines that you want to use
|
// Comment out all but the two lines that you want to use
|
||||||
|
|
||||||
// DCCMain* mainTrack = DCC::Create_WSM_SAMCommandStation_Main(NUM_LOCOS);
|
// DCCMain* mainTrack = DCCMain::Create_WSM_SAMCommandStation_Main(kNumLocos);
|
||||||
// DCCService* progTrack = DCC::Create_WSM_SAMCommandStation_Prog();
|
// DCCService* progTrack = DCCService::Create_WSM_SAMCommandStation_Prog();
|
||||||
|
|
||||||
// DCCMain* mainTrack = DCC::Create_Arduino_L298Shield_Main(NUM_LOCOS);
|
// DCCMain* mainTrack = DCCMain::Create_Arduino_L298Shield_Main(kNumLocos);
|
||||||
// DCCService* progTrack = DCC::Create_Arduino_L298Shield_Prog();
|
// DCCService* progTrack = DCCService::Create_Arduino_L298Shield_Prog();
|
||||||
|
|
||||||
DCCMain* mainTrack = DCCMain::Create_Pololu_MC33926Shield_Main(NUM_LOCOS);
|
DCCMain* mainTrack = DCCMain::Create_Pololu_MC33926Shield_Main(kNumLocos);
|
||||||
DCCService* progTrack = DCCService::Create_Pololu_MC33926Shield_Prog();
|
DCCService* progTrack = DCCService::Create_Pololu_MC33926Shield_Prog();
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////
|
||||||
|
@ -34,27 +33,28 @@ void SERCOM4_Handler()
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
void setup() {
|
void setup() {
|
||||||
mainTrack->hdw.setup();
|
mainTrack->setup();
|
||||||
mainTrack->railcom.setup();
|
progTrack->setup();
|
||||||
progTrack->hdw.setup();
|
|
||||||
|
|
||||||
// TimerA is TCC0 on SAMD21, Timer1 on MEGA2560, and Timer1 on MEGA328
|
// TimerA is TCC0 on SAMD21, Timer1 on MEGA2560, and Timer1 on MEGA328
|
||||||
// We will fire an interrupt every 29us to generate the signal on the track
|
// We will fire an interrupt every 29us to generate the signal on the track
|
||||||
TimerA.initialize();
|
TimerA.initialize();
|
||||||
TimerA.setPeriod(DCC_IRQ_MICROSECONDS);
|
TimerA.setPeriod(kIRQmicros);
|
||||||
TimerA.attachInterrupt(waveform_IrqHandler);
|
TimerA.attachInterrupt(waveform_IrqHandler);
|
||||||
TimerA.start();
|
TimerA.start();
|
||||||
|
|
||||||
#if defined (ARDUINO_ARCH_SAMD)
|
#if defined (ARDUINO_ARCH_SAMD)
|
||||||
CommManager::registerInterface(new USBInterface(SerialUSB)); // Register SerialUSB as an interface
|
CommManager::registerInterface(new USBInterface(SerialUSB));
|
||||||
Wire.begin(); // Needed for EEPROM to work
|
Wire.begin(); // Needed for EEPROM to work
|
||||||
#elif defined(ARDUINO_ARCH_AVR)
|
#elif defined(ARDUINO_ARCH_AVR)
|
||||||
CommManager::registerInterface(new SerialInterface(Serial)); // Register Serial (USB port on mega/uno) as an interface
|
CommManager::registerInterface(new SerialInterface(Serial));
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
EEStore::init();
|
EEStore::init();
|
||||||
|
|
||||||
DCCEXParser::init(mainTrack, progTrack); // Set up the string parser to accept commands from the interfaces
|
// Set up the string parser to accept commands from the interfaces
|
||||||
|
DCCEXParser::init(mainTrack, progTrack);
|
||||||
|
|
||||||
CommManager::showInitInfo();
|
CommManager::showInitInfo();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user