1
0
mirror of https://github.com/DCC-EX/CommandStation-EX.git synced 2024-11-26 17:46:14 +01:00

Move stuff to Arduino folder, add callback registration

This commit is contained in:
David Cutting 2020-07-18 06:18:06 -06:00
parent 9e86d5e93c
commit 2d9caa6f58
3 changed files with 21 additions and 7 deletions

View File

@ -26,9 +26,12 @@
const uint8_t kIRQmicros = 29;
const uint8_t kNumLocos = 50;
#if defined CONFIG_WSM_FIREBOX
DCCMain* mainTrack = DCCMain::Create_WSM_FireBox_Main(kNumLocos);
DCCService* progTrack = DCCService::Create_WSM_FireBox_Prog();
#if defined CONFIG_WSM_FIREBOX_MK1
DCCMain* mainTrack = DCCMain::Create_WSM_FireBox_MK1_Main(kNumLocos);
DCCService* progTrack = DCCService::Create_WSM_FireBox_MK1_Prog();
#elif defined CONFIG_WSM_FIREBOX_MK1S
DCCMain* mainTrack = DCCMain::Create_WSM_FireBox_MK1S_Main(kNumLocos);
DCCService* progTrack = DCCService::Create_WSM_FireBox_MK1S_Prog();
#elif defined CONFIG_ARDUINO_MOTOR_SHIELD
DCCMain* mainTrack = DCCMain::Create_Arduino_L298Shield_Main(kNumLocos);
DCCService* progTrack = DCCService::Create_Arduino_L298Shield_Prog();
@ -49,6 +52,11 @@ void SERCOM4_Handler()
{
mainTrack->railcom.getSerial()->IrqHandler();
}
#elif defined(ARDUINO_ARCH_SAMC)
void SERCOM0_Handler()
{
mainTrack->railcom.getSerial()->IrqHandler();
}
#endif
void setup() {
@ -62,9 +70,15 @@ void setup() {
TimerA.attachInterrupt(waveform_IrqHandler);
TimerA.start();
mainTrack->hdw.config_setTrackPowerCallback(DCCEXParser::trackPowerCallback);
progTrack->hdw.config_setTrackPowerCallback(DCCEXParser::trackPowerCallback);
#if defined (ARDUINO_ARCH_SAMD)
CommManager::registerInterface(new USBInterface(SerialUSB));
Wire.begin(); // Needed for EEPROM to work
#elif defined (ARDUINO_ARCH_SAMC)
CommManager::registerInterface(new SerialInterface(Serial));
Wire.begin(); // Needed for EEPROM to work
#elif defined(ARDUINO_ARCH_AVR)
CommManager::registerInterface(new SerialInterface(Serial));
#endif
@ -82,4 +96,3 @@ void loop() {
mainTrack->loop();
progTrack->loop();
}

View File

@ -22,8 +22,9 @@
// Choose the motor shield that you want to use.
//#define CONFIG_WSM_FIREBOX
#define CONFIG_ARDUINO_MOTOR_SHIELD
//#define CONFIG_WSM_FIREBOX_MK1
#define CONFIG_WSM_FIREBOX_MK1S
//#define CONFIG_ARDUINO_MOTOR_SHIELD
//#define CONFIG_POLOLU_MOTOR_SHIELD
#endif

View File

@ -10,7 +10,7 @@
[platformio]
default_envs = samd21, mega2560, mega328
src_dir = .
src_dir = CommandStation
[env]
lib_deps =