diff --git a/src/main.cpp b/src/main.cpp index 9a03cc4..7f5f6ae 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -2,20 +2,30 @@ #include #include -#define DCC_IRQ_MICROSECONDS 58 +#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 -// DCC* mainTrack = DCC::Create_WSM_SAMCommandStation_Main(50); -// DCC* progTrack = DCC::Create_WSM_SAMCommandStation_Prog(2); +DCC* mainTrack = DCC::Create_WSM_SAMCommandStation_Main(50); +DCC* progTrack = DCC::Create_WSM_SAMCommandStation_Prog(2); // DCC* mainTrack = DCC::Create_Arduino_L298Shield_Main(50); // DCC* progTrack = DCC::Create_Arduino_L298Shield_Prog(2); -DCC* mainTrack = DCC::Create_Pololu_MC33926Shield_Main(50); -DCC* progTrack = DCC::Create_Pololu_MC33926Shield_Prog(2); +// DCC* mainTrack = DCC::Create_Pololu_MC33926Shield_Main(50); +// DCC* progTrack = DCC::Create_Pololu_MC33926Shield_Prog(2); //////////////////////////////////////////////////////////////// @@ -32,6 +42,8 @@ void setup() { TimerA.attachInterrupt(main_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 @@ -49,4 +61,5 @@ void loop() { CommManager::update(); mainTrack->loop(); progTrack->loop(); -} \ No newline at end of file +} +