@@ -270,19 +270,7 @@ void setup(){
270270 Serial.print (Ethernet.localIP ());
271271 Serial.print (" >" );
272272 #endif
273-
274- LOGIC HERE FOR WHICH TO CHOOSE
275- timerConfigBase ();
276- timerConfigBooster ();
277-
278- } // setup
279-
280- // /////////////////////////////////////////////////////////////////////////////
281- // SETUP TIMERS FOR NORMAL BASE STATION
282- // /////////////////////////////////////////////////////////////////////////////
283-
284- void timerConfigBase (){
285-
273+
286274 // CONFIGURE TIMER_1 TO OUTPUT 50% DUTY CYCLE DCC SIGNALS ON OC1B INTERRUPT PINS
287275
288276 // Direction Pin for Motor Shield Channel A - MAIN OPERATIONS TRACK
@@ -403,42 +391,7 @@ void timerConfigBase(){
403391
404392#endif
405393
406- } // timerConfigBase
407-
408- // /////////////////////////////////////////////////////////////////////////////
409- // CONFIGURE PINS AND INTERRUPTS FOR BOOSTER STATION
410- // /////////////////////////////////////////////////////////////////////////////
411-
412- void timerConfigBooster (){
413-
414- // CONFIGURE INT0 (UNO) OR INT4 (MEGA) TO TRIGGER ON DCC_SIGNAL RISING (THEN FALLING) EDGES AND SET MOTOR SHIELD DIRECTION PINS ACCORDINGLY
415-
416- pinMode (DIRECTION_MOTOR_CHANNEL_PIN_A,OUTPUT); // the interrupt routine will write directly to the Motor Channel Direction-A
417- pinMode (DIRECTION_MOTOR_CHANNEL_PIN_B,OUTPUT); // the interrupt routine will write directly to the Motor Channel Direction-B
418-
419- pinMode (BOOSTER_INPUT_PIN,INPUT); // THIS ARDUINO BOOSTER INPUT PIN MUST BE CONNECTED TO THE MAIN_DCC_SIGNAL PIN FROM A SEPARATE MASTER BASE STATION
420- digitalWrite (BOOSTER_INPUT_PIN,LOW);
421-
422- pinMode (SIGNAL_ENABLE_PIN_MAIN,OUTPUT); // master enable for motor channel A
423- pinMode (SIGNAL_ENABLE_PIN_PROG,OUTPUT); // master enable for motor channel B
424-
425- #ifdef ARDUINO_AVR_UNO // Configuration for UNO
426-
427- bitSet (EICRA,ISC00); // set INT0 to generate interrupt on logical toggle
428- bitClear (EICRA,ISC01);
429-
430- bitSet (EIMSK,INT0); // enable INT0 interrupt vector
431-
432- #else // Configuration for MEGA
433-
434- bitSet (EICRB,ISC40); // set INT4 to generate interrupt on logical toggle
435- bitClear (EICRB,ISC41);
436-
437- bitSet (EIMSK,INT4); // enable INT4 interrupt vector
438-
439- #endif
440-
441- } // timerConfigBooster
394+ } // setup
442395
443396// /////////////////////////////////////////////////////////////////////////////
444397// DEFINE THE INTERRUPT LOGIC THAT GENERATES THE DCC SIGNAL
@@ -523,31 +476,9 @@ ISR(TIMER3_COMPB_vect){ // set interrupt service for OCR3B of TIMER
523476#endif
524477
525478
526- // /////////////////////////////////////////////////////////////////////////////
527- // DEFINE THE INTERRUPT LOGIC THAT GENERATES A BOOSTER SIGNAL
528- // /////////////////////////////////////////////////////////////////////////////
529-
530- #ifdef ARDUINO_AVR_UNO // Configuration for UNO
531-
532- ISR (INT0_vect){
533- digitalWrite (DIRECTION_MOTOR_CHANNEL_PIN_A,digitalRead (BOOSTER_INPUT_PIN));
534- digitalWrite (DIRECTION_MOTOR_CHANNEL_PIN_B,digitalRead (BOOSTER_INPUT_PIN));
535- }
536-
537- #else // Configuration for MEGA
538-
539- ISR (INT4_vect){
540- digitalWrite (DIRECTION_MOTOR_CHANNEL_PIN_A,digitalRead (BOOSTER_INPUT_PIN));
541- digitalWrite (DIRECTION_MOTOR_CHANNEL_PIN_B,digitalRead (BOOSTER_INPUT_PIN));
542- }
543-
544- #endif
545-
546-
547479// /////////////////////////////////////////////////////////////////////////////
548480// PRINT CONFIGURATION INFO TO SERIAL PORT REGARDLESS OF INTERFACE TYPE
549481// - ACTIVATED ON STARTUP IF SHOW_CONFIG_PIN IS TIED HIGH
550- // /////////////////////////////////////////////////////////////////////////////
551482
552483void showConfiguration (){
553484
0 commit comments