From 0bfeefca37ca135107be86dd21f2f284c8328aef Mon Sep 17 00:00:00 2001 From: David Cutting Date: Sun, 28 Jun 2020 00:28:08 -0600 Subject: [PATCH] Change configuration, rename FireBox --- include/Config.h | 29 +++++++++++++++++++++++++++++ src/main.cpp | 41 +++++++++++++++++++++++++++++------------ 2 files changed, 58 insertions(+), 12 deletions(-) create mode 100644 include/Config.h diff --git a/include/Config.h b/include/Config.h new file mode 100644 index 0000000..56ba0e7 --- /dev/null +++ b/include/Config.h @@ -0,0 +1,29 @@ +/* + * Config.h + * + * This file is part of CommandStation-DCC. + * + * CommandStation-DCC is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * CommandStation-DCC is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with CommandStation-DCC. If not, see . + */ + +#ifndef COMMANDSTATION_DCC_CONFIG +#define COMMANDSTATION_DCC_CONFIG + +// Choose the motor shield that you want to use. + +#define CONFIG_WSM_FIREBOX +//#define CONFIG_ARDUINO_MOTOR_SHIELD +//#define CONFIG_POLOLU_MOTOR_SHIELD + +#endif \ No newline at end of file diff --git a/src/main.cpp b/src/main.cpp index 217381f..6d7a079 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -1,24 +1,41 @@ +/* + * main.cpp + * + * This file is part of CommandStation-DCC. + * + * CommandStation-DCC is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * CommandStation-DCC is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with CommandStation-DCC. If not, see . + */ + #include #include #include +#include "Config.h" + const uint8_t kIRQmicros = 29; const uint8_t kNumLocos = 50; -//////////////////////////////////////////////////////////////// -// Motor driver selection: -// Comment out all but the two lines that you want to use - -// DCCMain* mainTrack = DCCMain::Create_WSM_SAMCommandStation_Main(kNumLocos); -// DCCService* progTrack = DCCService::Create_WSM_SAMCommandStation_Prog(); - -// DCCMain* mainTrack = DCCMain::Create_Arduino_L298Shield_Main(kNumLocos); -// DCCService* progTrack = DCCService::Create_Arduino_L298Shield_Prog(); - +#if defined CONFIG_WSM_FIREBOX +DCCMain* mainTrack = DCCMain::Create_WSM_FireBox_Main(kNumLocos); +DCCService* progTrack = DCCService::Create_WSM_FireBox_Prog(); +#elif defined CONFIG_ARDUINO_MOTOR_SHIELD +DCCMain* mainTrack = DCCMain::Create_Arduino_L298Shield_Main(kNumLocos); +DCCService* progTrack = DCCService::Create_Arduino_L298Shield_Prog(); +#elif defined CONFIG_POLOLU_MOTOR_SHIELD DCCMain* mainTrack = DCCMain::Create_Pololu_MC33926Shield_Main(kNumLocos); DCCService* progTrack = DCCService::Create_Pololu_MC33926Shield_Prog(); - -//////////////////////////////////////////////////////////////// +#endif void waveform_IrqHandler() { mainTrack->interruptHandler();