16 #define UNDEFINED_PIN 255 22 #if defined(ARDUINO_AVR_UNO) || defined(ARDUINO_AVR_NANO) // Configuration for UNO or NANO 25 #define MAX_MAIN_REGISTERS 12 27 #elif defined(ARDUINO_AVR_MEGA2560) 30 #define MAX_MAIN_REGISTERS 21 32 #elif defined(ARDUINO_ARCH_ESP32) 35 #define MAX_MAIN_REGISTERS 41 40 #define MAX_PROG_REGISTERS 3 47 #ifdef ARDUINO_AVR_MEGA // is using Mega 1280, define as Mega 2560 (pinouts and functionality are identical) 48 #ifndef ARDUINO_AVR_MEGA2560 49 #define ARDUINO_AVR_MEGA2560 53 #if defined(ARDUINO_AVR_UNO) || defined(ARDUINO_AVR_NANO) // Configuration for UNO or NANO 56 #define DCC_SIGNAL_PIN_MAIN 10 // Arduino Uno - uses OC1B 58 #define DCC_SIGNAL_PIN_PROG 5 // Arduino Uno - uses OC0B 60 #elif defined(ARDUINO_AVR_MEGA2560) 62 #define DCC_SIGNAL_PIN_MAIN 12 // Arduino Mega - uses OC1B 63 #define DCC_SIGNAL_PIN_PROG 2 // Arduino Mega - uses OC3B 72 #define MOTOR_SHIELD_SIGNAL_ENABLE_PIN_MAIN 3 73 #define MOTOR_SHIELD_SIGNAL_ENABLE_PIN_PROG 11 75 #define MOTOR_SHIELD_CURRENT_MONITOR_PIN_MAIN A0 76 #define MOTOR_SHIELD_CURRENT_MONITOR_PIN_PROG A1 78 #define MOTOR_SHIELD_DIRECTION_MOTOR_CHANNEL_PIN_A 12 79 #define MOTOR_SHIELD_DIRECTION_MOTOR_CHANNEL_PIN_B 13 81 #define POLOLU_SIGNAL_ENABLE_PIN_MAIN 9 82 #define POLOLU_SIGNAL_ENABLE_PIN_PROG 11 84 #define POLOLU_CURRENT_MONITOR_PIN_MAIN A0 85 #define POLOLU_CURRENT_MONITOR_PIN_PROG A1 87 #define POLOLU_DIRECTION_MOTOR_CHANNEL_PIN_A 7 88 #define POLOLU_DIRECTION_MOTOR_CHANNEL_PIN_B 8 90 #if defined(USE_ETHERNET) 100 #if defined(USE_ETHERNET) 101 static uint8_t EthernetIp[4];
102 static uint8_t EthernetMac[6];
103 static int EthernetPort;
104 static EthernetProtocol Protocol;
107 #ifdef USE_ONLY1_INTERRUPT 108 static uint8_t SignalPortMaskMain;
109 static uint8_t SignalPortMaskProg;
110 static volatile uint8_t *SignalPortInMain;
111 static volatile uint8_t *SignalPortInProg;
114 static byte SignalEnablePinMain;
115 static byte CurrentMonitorMain;
117 static byte SignalEnablePinProg;
118 static byte CurrentMonitorProg;
120 #ifndef USE_ONLY1_INTERRUPT 122 static byte DirectionMotorA;
123 static byte DirectionMotorB;