1
0
mirror of https://github.com/DCC-EX/CommandStation-EX.git synced 2024-11-23 08:06:13 +01:00

More main file cleanup to reflect library changes

This commit is contained in:
David Cutting 2020-05-30 15:47:12 -06:00
parent 1dd214931f
commit ea3153279b

View File

@ -4,16 +4,6 @@
#define DCC_IRQ_MICROSECONDS 29
#if defined(ARDUINO_ARCH_SAMD)
Uart mainRailcomUART(&sercom2, 5, 2, SERCOM_RX_PAD_3, UART_TX_PAD_2);
void SERCOM2_Handler()
{
mainRailcomUART.IrqHandler();
}
#endif
////////////////////////////////////////////////////////////////
// Motor driver selection:
// Comment out all but the two lines that you want to use
@ -29,11 +19,18 @@ DCC* progTrack = DCC::Create_WSM_SAMCommandStation_Prog(2);
////////////////////////////////////////////////////////////////
void main_IrqHandler() {
void waveform_IrqHandler() {
mainTrack->interruptHandler();
progTrack->interruptHandler();
}
#if defined(ARDUINO_ARCH_SAMD)
void SERCOM2_Handler()
{
mainTrack->hdw.railcom_serial->IrqHandler();
}
#endif
void setup() {
mainTrack->hdw.init();
progTrack->hdw.init();
@ -42,11 +39,9 @@ void setup() {
// We will fire an interrupt every 58us to generate the signal on the track
TimerA.initialize();
TimerA.setPeriod(DCC_IRQ_MICROSECONDS);
TimerA.attachInterrupt(main_IrqHandler);
TimerA.attachInterrupt(waveform_IrqHandler);
TimerA.start();
mainRailcomUART.begin(250000);
#if defined (ARDUINO_ARCH_SAMD)
CommManager::registerInterface(new USBInterface(SerialUSB)); // Register SerialUSB as an interface
Wire.begin(); // Needed for EEPROM to work