mirror of
https://github.com/DCC-EX/CommandStation-EX.git
synced 2024-11-30 03:26:13 +01:00
Move stuff to Arduino folder, add callback registration
This commit is contained in:
parent
9e86d5e93c
commit
2d9caa6f58
|
@ -26,9 +26,12 @@
|
||||||
const uint8_t kIRQmicros = 29;
|
const uint8_t kIRQmicros = 29;
|
||||||
const uint8_t kNumLocos = 50;
|
const uint8_t kNumLocos = 50;
|
||||||
|
|
||||||
#if defined CONFIG_WSM_FIREBOX
|
#if defined CONFIG_WSM_FIREBOX_MK1
|
||||||
DCCMain* mainTrack = DCCMain::Create_WSM_FireBox_Main(kNumLocos);
|
DCCMain* mainTrack = DCCMain::Create_WSM_FireBox_MK1_Main(kNumLocos);
|
||||||
DCCService* progTrack = DCCService::Create_WSM_FireBox_Prog();
|
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
|
#elif defined CONFIG_ARDUINO_MOTOR_SHIELD
|
||||||
DCCMain* mainTrack = DCCMain::Create_Arduino_L298Shield_Main(kNumLocos);
|
DCCMain* mainTrack = DCCMain::Create_Arduino_L298Shield_Main(kNumLocos);
|
||||||
DCCService* progTrack = DCCService::Create_Arduino_L298Shield_Prog();
|
DCCService* progTrack = DCCService::Create_Arduino_L298Shield_Prog();
|
||||||
|
@ -49,6 +52,11 @@ void SERCOM4_Handler()
|
||||||
{
|
{
|
||||||
mainTrack->railcom.getSerial()->IrqHandler();
|
mainTrack->railcom.getSerial()->IrqHandler();
|
||||||
}
|
}
|
||||||
|
#elif defined(ARDUINO_ARCH_SAMC)
|
||||||
|
void SERCOM0_Handler()
|
||||||
|
{
|
||||||
|
mainTrack->railcom.getSerial()->IrqHandler();
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
void setup() {
|
void setup() {
|
||||||
|
@ -62,9 +70,15 @@ void setup() {
|
||||||
TimerA.attachInterrupt(waveform_IrqHandler);
|
TimerA.attachInterrupt(waveform_IrqHandler);
|
||||||
TimerA.start();
|
TimerA.start();
|
||||||
|
|
||||||
|
mainTrack->hdw.config_setTrackPowerCallback(DCCEXParser::trackPowerCallback);
|
||||||
|
progTrack->hdw.config_setTrackPowerCallback(DCCEXParser::trackPowerCallback);
|
||||||
|
|
||||||
#if defined (ARDUINO_ARCH_SAMD)
|
#if defined (ARDUINO_ARCH_SAMD)
|
||||||
CommManager::registerInterface(new USBInterface(SerialUSB));
|
CommManager::registerInterface(new USBInterface(SerialUSB));
|
||||||
Wire.begin(); // Needed for EEPROM to work
|
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)
|
#elif defined(ARDUINO_ARCH_AVR)
|
||||||
CommManager::registerInterface(new SerialInterface(Serial));
|
CommManager::registerInterface(new SerialInterface(Serial));
|
||||||
#endif
|
#endif
|
||||||
|
@ -82,4 +96,3 @@ void loop() {
|
||||||
mainTrack->loop();
|
mainTrack->loop();
|
||||||
progTrack->loop();
|
progTrack->loop();
|
||||||
}
|
}
|
||||||
|
|
|
@ -22,8 +22,9 @@
|
||||||
|
|
||||||
// Choose the motor shield that you want to use.
|
// Choose the motor shield that you want to use.
|
||||||
|
|
||||||
//#define CONFIG_WSM_FIREBOX
|
//#define CONFIG_WSM_FIREBOX_MK1
|
||||||
#define CONFIG_ARDUINO_MOTOR_SHIELD
|
#define CONFIG_WSM_FIREBOX_MK1S
|
||||||
|
//#define CONFIG_ARDUINO_MOTOR_SHIELD
|
||||||
//#define CONFIG_POLOLU_MOTOR_SHIELD
|
//#define CONFIG_POLOLU_MOTOR_SHIELD
|
||||||
|
|
||||||
#endif
|
#endif
|
|
@ -10,7 +10,7 @@
|
||||||
|
|
||||||
[platformio]
|
[platformio]
|
||||||
default_envs = samd21, mega2560, mega328
|
default_envs = samd21, mega2560, mega328
|
||||||
src_dir = .
|
src_dir = CommandStation
|
||||||
|
|
||||||
[env]
|
[env]
|
||||||
lib_deps =
|
lib_deps =
|
||||||
|
|
Loading…
Reference in New Issue
Block a user