1
0
mirror of https://github.com/DCC-EX/CommandStation-EX.git synced 2024-12-23 21:01:25 +01:00

Added railcom stuff

This commit is contained in:
David Cutting 2020-05-30 03:03:19 -06:00
parent 9c66b0aea7
commit a33270dff3

View File

@ -2,20 +2,30 @@
#include <CommandStation.h>
#include <ArduinoTimers.h>
#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();
}
}