Browse Source

Serial and pins debug cleanup

- Rename some AVR / DUE / ESP32 serial types
- Reduce two #error to one static_assert
- Update AVR/DUE error messages
vanilla_fb_2.0.x
Scott Lahteine 4 years ago
parent
commit
4518506559
  1. 8
      Marlin/src/HAL/AVR/HAL.h
  2. 8
      Marlin/src/HAL/AVR/MarlinSerial.cpp
  3. 16
      Marlin/src/HAL/AVR/MarlinSerial.h
  4. 11
      Marlin/src/HAL/DUE/HAL.h
  5. 2
      Marlin/src/HAL/DUE/MarlinSerial.cpp
  6. 4
      Marlin/src/HAL/DUE/MarlinSerial.h
  7. 10
      Marlin/src/HAL/DUE/MarlinSerialUSB.cpp
  8. 12
      Marlin/src/HAL/DUE/MarlinSerialUSB.h
  9. 2
      Marlin/src/HAL/ESP32/WebSocketSerial.cpp
  10. 4
      Marlin/src/HAL/ESP32/WebSocketSerial.h
  11. 8
      Marlin/src/HAL/LPC1768/MarlinSerial.cpp
  12. 2
      Marlin/src/HAL/SAMD51/HAL.h
  13. 6
      Marlin/src/HAL/STM32/HAL.h
  14. 32
      Marlin/src/HAL/STM32F1/HAL.h
  15. 2
      Marlin/src/HAL/TEENSY31_32/HAL.h
  16. 14
      Marlin/src/core/serial.h
  17. 1
      Marlin/src/inc/Conditionals_post.h
  18. 105
      Marlin/src/pins/pinsDebug.h

8
Marlin/src/HAL/AVR/HAL.h

@ -93,13 +93,13 @@ typedef int8_t pin_t;
#define MYSERIAL1 TERN(BLUETOOTH, btSerial, MSerial0)
#else
#if !WITHIN(SERIAL_PORT, -1, 3)
#error "SERIAL_PORT must be from 0 to 3. You can also use -1 if the board supports Native USB."
#error "SERIAL_PORT must be from 0 to 3, or -1 for USB Serial."
#endif
#define MYSERIAL1 customizedSerial1
#ifdef SERIAL_PORT_2
#if !WITHIN(SERIAL_PORT_2, -1, 3)
#error "SERIAL_PORT_2 must be from 0 to 3. You can also use -1 if the board supports Native USB."
#error "SERIAL_PORT_2 must be from 0 to 3, or -1 for USB Serial."
#endif
#define MYSERIAL2 customizedSerial2
#endif
@ -107,14 +107,14 @@ typedef int8_t pin_t;
#ifdef MMU2_SERIAL_PORT
#if !WITHIN(MMU2_SERIAL_PORT, -1, 3)
#error "MMU2_SERIAL_PORT must be from 0 to 3. You can also use -1 if the board supports Native USB."
#error "MMU2_SERIAL_PORT must be from 0 to 3, or -1 for USB Serial."
#endif
#define MMU2_SERIAL mmuSerial
#endif
#ifdef LCD_SERIAL_PORT
#if !WITHIN(LCD_SERIAL_PORT, -1, 3)
#error "LCD_SERIAL_PORT must be from 0 to 3. You can also use -1 if the board supports Native USB."
#error "LCD_SERIAL_PORT must be from 0 to 3, or -1 for USB Serial."
#endif
#define LCD_SERIAL lcdSerial
#if HAS_DGUS_LCD

8
Marlin/src/HAL/AVR/MarlinSerial.cpp

@ -567,7 +567,7 @@ ISR(SERIAL_REGNAME(USART, SERIAL_PORT, _UDRE_vect)) {
// Because of the template definition above, it's required to instantiate the template to have all methods generated
template class MarlinSerial< MarlinSerialCfg<SERIAL_PORT> >;
MSerialT customizedSerial1(MSerialT::HasEmergencyParser);
MSerialT1 customizedSerial1(MSerialT1::HasEmergencyParser);
#ifdef SERIAL_PORT_2
@ -596,7 +596,7 @@ MSerialT customizedSerial1(MSerialT::HasEmergencyParser);
}
template class MarlinSerial< MMU2SerialCfg<MMU2_SERIAL_PORT> >;
MSerialT3 mmuSerial(MSerialT3::HasEmergencyParser);
MSerialMMU2 mmuSerial(MSerialMMU2::HasEmergencyParser);
#endif // MMU2_SERIAL_PORT
@ -611,7 +611,7 @@ MSerialT customizedSerial1(MSerialT::HasEmergencyParser);
}
template class MarlinSerial< LCDSerialCfg<LCD_SERIAL_PORT> >;
MSerialT4 lcdSerial(MSerialT4::HasEmergencyParser);
MSerialLCD lcdSerial(MSerialLCD::HasEmergencyParser);
#if HAS_DGUS_LCD
template<typename Cfg>
@ -630,7 +630,7 @@ MSerialT customizedSerial1(MSerialT::HasEmergencyParser);
// For AT90USB targets use the UART for BT interfacing
#if defined(USBCON) && ENABLED(BLUETOOTH)
MSerialT5 bluetoothSerial(false);
MSerialBT bluetoothSerial(false);
#endif
#endif // __AVR__

16
Marlin/src/HAL/AVR/MarlinSerial.h

@ -238,8 +238,8 @@
static constexpr bool MAX_RX_QUEUED = ENABLED(SERIAL_STATS_MAX_RX_QUEUED);
};
typedef Serial1Class< MarlinSerial< MarlinSerialCfg<SERIAL_PORT> > > MSerialT;
extern MSerialT customizedSerial1;
typedef Serial1Class< MarlinSerial< MarlinSerialCfg<SERIAL_PORT> > > MSerialT1;
extern MSerialT1 customizedSerial1;
#ifdef SERIAL_PORT_2
typedef Serial1Class< MarlinSerial< MarlinSerialCfg<SERIAL_PORT_2> > > MSerialT2;
@ -262,8 +262,8 @@
static constexpr bool RX_OVERRUNS = false;
};
typedef Serial1Class< MarlinSerial< MMU2SerialCfg<MMU2_SERIAL_PORT> > > MSerialT3;
extern MSerialT3 mmuSerial;
typedef Serial1Class< MarlinSerial< MMU2SerialCfg<MMU2_SERIAL_PORT> > > MSerialMMU2;
extern MSerialMMU2 mmuSerial;
#endif
#ifdef LCD_SERIAL_PORT
@ -281,12 +281,12 @@
static constexpr bool RX_OVERRUNS = BOTH(HAS_DGUS_LCD, SERIAL_STATS_RX_BUFFER_OVERRUNS);
};
typedef Serial1Class< MarlinSerial< LCDSerialCfg<LCD_SERIAL_PORT> > > MSerialT4;
extern MSerialT4 lcdSerial;
typedef Serial1Class< MarlinSerial< LCDSerialCfg<LCD_SERIAL_PORT> > > MSerialLCD;
extern MSerialLCD lcdSerial;
#endif
// Use the UART for Bluetooth in AT90USB configurations
#if defined(USBCON) && ENABLED(BLUETOOTH)
typedef Serial1Class<HardwareSerial> MSerialT5;
extern MSerialT5 bluetoothSerial;
typedef Serial1Class<HardwareSerial> MSerialBT;
extern MSerialBT bluetoothSerial;
#endif

11
Marlin/src/HAL/DUE/HAL.h

@ -50,13 +50,12 @@ extern DefaultSerial4 MSerial3;
#define _MSERIAL(X) MSerial##X
#define MSERIAL(X) _MSERIAL(X)
// Define MYSERIAL1/2 before MarlinSerial includes!
#if SERIAL_PORT == -1 || ENABLED(EMERGENCY_PARSER)
#define MYSERIAL1 customizedSerial1
#elif WITHIN(SERIAL_PORT, 0, 3)
#define MYSERIAL1 MSERIAL(SERIAL_PORT)
#else
#error "The required SERIAL_PORT must be from 0 to 3. You can also use -1 if the board supports Native USB."
#error "The required SERIAL_PORT must be from 0 to 3, or -1 for USB Serial."
#endif
#ifdef SERIAL_PORT_2
@ -65,7 +64,7 @@ extern DefaultSerial4 MSerial3;
#elif WITHIN(SERIAL_PORT_2, 0, 3)
#define MYSERIAL2 MSERIAL(SERIAL_PORT_2)
#else
#error "SERIAL_PORT_2 must be from 0 to 3. You can also use -1 if the board supports Native USB."
#error "SERIAL_PORT_2 must be from 0 to 3, or -1 for USB Serial."
#endif
#endif
@ -78,12 +77,10 @@ extern DefaultSerial4 MSerial3;
#endif
#ifdef LCD_SERIAL_PORT
#if LCD_SERIAL_PORT == -1
#define LCD_SERIAL lcdSerial
#elif WITHIN(LCD_SERIAL_PORT, 0, 3)
#if WITHIN(LCD_SERIAL_PORT, 0, 3)
#define LCD_SERIAL MSERIAL(LCD_SERIAL_PORT)
#else
#error "LCD_SERIAL_PORT must be from 0 to 3. You can also use -1 if the board supports Native USB."
#error "LCD_SERIAL_PORT must be from 0 to 3."
#endif
#endif

2
Marlin/src/HAL/DUE/MarlinSerial.cpp

@ -478,7 +478,7 @@ void MarlinSerial<Cfg>::flushTX() {
// If not using the USB port as serial port
#if defined(SERIAL_PORT) && SERIAL_PORT >= 0
template class MarlinSerial< MarlinSerialCfg<SERIAL_PORT> >;
MSerialT customizedSerial1(MarlinSerialCfg<SERIAL_PORT>::EMERGENCYPARSER);
MSerialT1 customizedSerial1(MarlinSerialCfg<SERIAL_PORT>::EMERGENCYPARSER);
#endif
#if defined(SERIAL_PORT_2) && SERIAL_PORT_2 >= 0

4
Marlin/src/HAL/DUE/MarlinSerial.h

@ -141,8 +141,8 @@ struct MarlinSerialCfg {
};
#if defined(SERIAL_PORT) && SERIAL_PORT >= 0
typedef Serial1Class< MarlinSerial< MarlinSerialCfg<SERIAL_PORT> > > MSerialT;
extern MSerialT customizedSerial1;
typedef Serial1Class< MarlinSerial< MarlinSerialCfg<SERIAL_PORT> > > MSerialT1;
extern MSerialT1 customizedSerial1;
#endif
#if defined(SERIAL_PORT_2) && SERIAL_PORT_2 >= 0

10
Marlin/src/HAL/DUE/MarlinSerialUSB.cpp

@ -19,13 +19,13 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*
*/
#ifdef ARDUINO_ARCH_SAM
/**
* MarlinSerial_Due.cpp - Hardware serial library for Arduino DUE
* Copyright (c) 2017 Eduardo José Tagle. All right reserved
* Based on MarlinSerial for AVR, copyright (c) 2006 Nicholas Zambetti. All right reserved.
*/
#ifdef ARDUINO_ARCH_SAM
#include "../../inc/MarlinConfig.h"
@ -65,7 +65,7 @@ int MarlinSerialUSB::peek() {
pending_char = udi_cdc_getc();
TERN_(EMERGENCY_PARSER, emergency_parser.update(static_cast<MSerialT*>(this)->emergency_state, (char)pending_char));
TERN_(EMERGENCY_PARSER, emergency_parser.update(static_cast<MSerialT1*>(this)->emergency_state, (char)pending_char));
return pending_char;
}
@ -87,7 +87,7 @@ int MarlinSerialUSB::read() {
int c = udi_cdc_getc();
TERN_(EMERGENCY_PARSER, emergency_parser.update(static_cast<MSerialT*>(this)->emergency_state, (char)c));
TERN_(EMERGENCY_PARSER, emergency_parser.update(static_cast<MSerialT1*>(this)->emergency_state, (char)c));
return c;
}
@ -129,10 +129,10 @@ size_t MarlinSerialUSB::write(const uint8_t c) {
// Preinstantiate
#if SERIAL_PORT == -1
MSerialT customizedSerial1(TERN0(EMERGENCY_PARSER, true));
MSerialT1 customizedSerial1(TERN0(EMERGENCY_PARSER, true));
#endif
#if SERIAL_PORT_2 == -1
MSerialT customizedSerial2(TERN0(EMERGENCY_PARSER, true));
MSerialT2 customizedSerial2(TERN0(EMERGENCY_PARSER, true));
#endif
#endif // HAS_USB_SERIAL

12
Marlin/src/HAL/DUE/MarlinSerialUSB.h

@ -27,11 +27,9 @@
*/
#include "../../inc/MarlinConfig.h"
#if HAS_USB_SERIAL
#include <WString.h>
#include "../../core/serial_hook.h"
#include <WString.h>
struct MarlinSerialUSB {
void begin(const long);
@ -50,14 +48,14 @@ struct MarlinSerialUSB {
FORCE_INLINE int rxMaxEnqueued() { return 0; }
#endif
};
typedef Serial1Class<MarlinSerialUSB> MSerialT;
#if SERIAL_PORT == -1
extern MSerialT customizedSerial1;
typedef Serial1Class<MarlinSerialUSB> MSerialT1;
extern MSerialT1 customizedSerial1;
#endif
#if SERIAL_PORT_2 == -1
extern MSerialT customizedSerial2;
typedef Serial1Class<MarlinSerialUSB> MSerialT2;
extern MSerialT2 customizedSerial2;
#endif
#endif // HAS_USB_SERIAL

2
Marlin/src/HAL/ESP32/WebSocketSerial.cpp

@ -29,7 +29,7 @@
#include "wifi.h"
#include <ESPAsyncWebServer.h>
MSerialT webSocketSerial(false);
MSerialWebSocketT webSocketSerial(false);
AsyncWebSocket ws("/ws"); // TODO Move inside the class.
// RingBuffer impl

4
Marlin/src/HAL/ESP32/WebSocketSerial.h

@ -81,5 +81,5 @@ public:
#endif
};
typedef Serial1Class<WebSocketSerial> MSerialT;
extern MSerialT webSocketSerial;
typedef Serial1Class<WebSocketSerial> MSerialWebSocketT;
extern MSerialWebSocketT webSocketSerial;

8
Marlin/src/HAL/LPC1768/MarlinSerial.cpp

@ -26,9 +26,9 @@
#include "../../inc/MarlinConfig.h"
#if USING_HW_SERIAL0
MarlinSerial _MSerial(LPC_UART0);
MSerialT MSerial0(true, _MSerial);
extern "C" void UART0_IRQHandler() { _MSerial.IRQHandler(); }
MarlinSerial _MSerial0(LPC_UART0);
MSerialT MSerial0(true, _MSerial0);
extern "C" void UART0_IRQHandler() { _MSerial0.IRQHandler(); }
#endif
#if USING_HW_SERIAL1
MarlinSerial _MSerial1((LPC_UART_TypeDef *) LPC_UART1);
@ -52,7 +52,7 @@
// Need to figure out which serial port we are and react in consequence (Marlin does not have CONTAINER_OF macro)
if (false) {}
#if USING_HW_SERIAL0
else if (this == &_MSerial) emergency_parser.update(MSerial0.emergency_state, c);
else if (this == &_MSerial0) emergency_parser.update(MSerial0.emergency_state, c);
#endif
#if USING_HW_SERIAL1
else if (this == &_MSerial1) emergency_parser.update(MSerial1.emergency_state, c);

2
Marlin/src/HAL/SAMD51/HAL.h

@ -43,8 +43,6 @@
extern DefaultSerial4 MSerial3;
extern DefaultSerial5 MSerial4;
// MYSERIAL1 required before MarlinSerial includes!
#define __MSERIAL(X) MSerial##X
#define _MSERIAL(X) __MSERIAL(X)
#define MSERIAL(X) _MSERIAL(INCREMENT(X))

6
Marlin/src/HAL/STM32/HAL.h

@ -37,6 +37,9 @@
#include <stdint.h>
//
// Serial Ports
//
#ifdef USBCON
#include <USBSerial.h>
#include "../../core/serial_hook.h"
@ -44,9 +47,6 @@
extern DefaultSerial1 MSerial0;
#endif
// ------------------------
// Defines
// ------------------------
#define _MSERIAL(X) MSerial##X
#define MSERIAL(X) _MSERIAL(X)

32
Marlin/src/HAL/STM32F1/HAL.h

@ -36,7 +36,6 @@
#include "fastio.h"
#include "watchdog.h"
#include <stdint.h>
#include <util/atomic.h>
@ -63,11 +62,10 @@
#ifdef SERIAL_USB
typedef ForwardSerial1Class< USBSerial > DefaultSerial1;
extern DefaultSerial1 MSerial0;
#if !HAS_SD_HOST_DRIVE
#define UsbSerial MSerial0
#else
#if HAS_SD_HOST_DRIVE
#define UsbSerial MarlinCompositeSerial
#else
#define UsbSerial MSerial0
#endif
#endif
@ -86,11 +84,7 @@
#define MYSERIAL1 MSERIAL(SERIAL_PORT)
#else
#define MYSERIAL1 MSERIAL(1) // dummy port
#if NUM_UARTS == 5
#error "SERIAL_PORT must be from 1 to 5. You can also use -1 if the board supports Native USB."
#else
#error "SERIAL_PORT must be from 1 to 3. You can also use -1 if the board supports Native USB."
#endif
static_assert(false, "SERIAL_PORT must be from 1 to " STRINGIFY(NUM_UARTS) ". You can also use -1 if the board supports Native USB.")
#endif
#ifdef SERIAL_PORT_2
@ -100,11 +94,7 @@
#define MYSERIAL2 MSERIAL(SERIAL_PORT_2)
#else
#define MYSERIAL2 MSERIAL(1) // dummy port
#if NUM_UARTS == 5
#error "SERIAL_PORT_2 must be from 1 to 5. You can also use -1 if the board supports Native USB."
#else
#error "SERIAL_PORT_2 must be from 1 to 3. You can also use -1 if the board supports Native USB."
#endif
static_assert(false, "SERIAL_PORT_2 must be from 1 to " STRINGIFY(NUM_UARTS) ". You can also use -1 if the board supports Native USB.")
#endif
#endif
@ -115,11 +105,7 @@
#define MMU2_SERIAL MSERIAL(MMU2_SERIAL_PORT)
#else
#define MMU2_SERIAL MSERIAL(1) // dummy port
#if NUM_UARTS == 5
#error "MMU2_SERIAL_PORT must be from 1 to 5. You can also use -1 if the board supports Native USB."
#else
#error "MMU2_SERIAL_PORT must be from 1 to 3. You can also use -1 if the board supports Native USB."
#endif
static_assert(false, "MMU2_SERIAL_PORT must be from 1 to " STRINGIFY(NUM_UARTS) ". You can also use -1 if the board supports Native USB.")
#endif
#endif
@ -130,11 +116,7 @@
#define LCD_SERIAL MSERIAL(LCD_SERIAL_PORT)
#else
#define LCD_SERIAL MSERIAL(1) // dummy port
#if NUM_UARTS == 5
#error "LCD_SERIAL_PORT must be from 1 to 5. You can also use -1 if the board supports Native USB."
#else
#error "LCD_SERIAL_PORT must be from 1 to 3. You can also use -1 if the board supports Native USB."
#endif
static_assert(false, "LCD_SERIAL_PORT must be from 1 to " STRINGIFY(NUM_UARTS) ". You can also use -1 if the board supports Native USB.")
#endif
#if HAS_DGUS_LCD
#define SERIAL_GET_TX_BUFFER_FREE() LCD_SERIAL.availableForWrite()

2
Marlin/src/HAL/TEENSY31_32/HAL.h

@ -68,6 +68,8 @@ extern USBSerialType USBSerial;
#elif WITHIN(SERIAL_PORT, 0, 3)
DECLARE_SERIAL(SERIAL_PORT);
#define MYSERIAL1 MSERIAL(SERIAL_PORT)
#else
#error "The required SERIAL_PORT must be from 0 to 3, or -1 for Native USB."
#endif
#define HAL_SERVO_LIB libServo

14
Marlin/src/core/serial.h

@ -87,16 +87,12 @@ extern uint8_t marlin_debug_flags;
// If we have a catchall, use that directly
#ifdef SERIAL_CATCHALL
#define _SERIAL_LEAF_2 SERIAL_CATCHALL
#elif HAS_ETHERNET
typedef ConditionalSerial<decltype(MYSERIAL2)> SerialLeafT2; // We need to create an instance here
extern SerialLeafT2 msSerial2;
#define _SERIAL_LEAF_2 msSerial2
#else
#if HAS_ETHERNET
// We need to create an instance here
typedef ConditionalSerial<decltype(MYSERIAL2)> SerialLeafT2;
extern SerialLeafT2 msSerial2;
#define _SERIAL_LEAF_2 msSerial2
#else
// Don't create a useless instance here, directly use the existing instance
#define _SERIAL_LEAF_2 MYSERIAL2
#endif
#define _SERIAL_LEAF_2 MYSERIAL2 // Don't create a useless instance here, directly use the existing instance
#endif
// Hook Meatpack if it's enabled on the second leaf

1
Marlin/src/inc/Conditionals_post.h

@ -1949,7 +1949,6 @@
#undef _SERIAL_ID
#undef _TMC_UART_IS
#undef TMC_UART_IS
#undef CONF_SERIAL_IS
#undef ANY_SERIAL_IS
//

105
Marlin/src/pins/pinsDebug.h

@ -45,34 +45,22 @@
// manually add pins that have names that are macros which don't play well with these macros
#if ANY(AVR_ATmega2560_FAMILY, AVR_ATmega1284_FAMILY, ARDUINO_ARCH_SAM, TARGET_LPC1768)
#if SERIAL_PORT == 0
#if CONF_SERIAL_IS(0)
static const char RXD_NAME_0[] PROGMEM = { "RXD0" };
static const char TXD_NAME_0[] PROGMEM = { "TXD0" };
#elif SERIAL_PORT == 1
#endif
#if CONF_SERIAL_IS(1)
static const char RXD_NAME_1[] PROGMEM = { "RXD1" };
static const char TXD_NAME_1[] PROGMEM = { "TXD1" };
#elif SERIAL_PORT == 2
#endif
#if CONF_SERIAL_IS(2)
static const char RXD_NAME_2[] PROGMEM = { "RXD2" };
static const char TXD_NAME_2[] PROGMEM = { "TXD2" };
#elif SERIAL_PORT == 3
#endif
#if CONF_SERIAL_IS(3)
static const char RXD_NAME_3[] PROGMEM = { "RXD3" };
static const char TXD_NAME_3[] PROGMEM = { "TXD3" };
#endif
#ifdef SERIAL_PORT_2
#if SERIAL_PORT_2 == 0
static const char RXD_NAME_0[] PROGMEM = { "RXD0" };
static const char TXD_NAME_0[] PROGMEM = { "TXD0" };
#elif SERIAL_PORT_2 == 1
static const char RXD_NAME_1[] PROGMEM = { "RXD1" };
static const char TXD_NAME_1[] PROGMEM = { "TXD1" };
#elif SERIAL_PORT_2 == 2
static const char RXD_NAME_2[] PROGMEM = { "RXD2" };
static const char TXD_NAME_2[] PROGMEM = { "TXD2" };
#elif SERIAL_PORT_2 == 3
static const char RXD_NAME_3[] PROGMEM = { "RXD3" };
static const char TXD_NAME_3[] PROGMEM = { "TXD3" };
#endif
#endif
#endif
/////////////////////////////////////////////////////////////////////////////
@ -103,12 +91,11 @@ const PinInfo pin_array[] PROGMEM = {
* Each entry takes up 6 bytes in FLASH:
* 2 byte pointer to location of the name string
* 2 bytes containing the pin number
* analog pin numbers were convereted to digital when the array was created
* analog pin numbers were converted to digital when the array was created
* 2 bytes containing the digital/analog bool flag
*/
// manually add pins ...
#if SERIAL_PORT == 0
#if CONF_SERIAL_IS(0)
#if EITHER(AVR_ATmega2560_FAMILY, ARDUINO_ARCH_SAM)
{ RXD_NAME_0, 0, true },
{ TXD_NAME_0, 1, true },
@ -119,7 +106,9 @@ const PinInfo pin_array[] PROGMEM = {
{ RXD_NAME_0, 3, true },
{ TXD_NAME_0, 2, true },
#endif
#elif SERIAL_PORT == 1
#endif
#if CONF_SERIAL_IS(1)
#if EITHER(AVR_ATmega2560_FAMILY, ARDUINO_ARCH_SAM)
{ RXD_NAME_1, 19, true },
{ TXD_NAME_1, 18, true },
@ -135,7 +124,9 @@ const PinInfo pin_array[] PROGMEM = {
{ TXD_NAME_1, 15, true },
#endif
#endif
#elif SERIAL_PORT == 2
#endif
#if CONF_SERIAL_IS(2)
#if EITHER(AVR_ATmega2560_FAMILY, ARDUINO_ARCH_SAM)
{ RXD_NAME_2, 17, true },
{ TXD_NAME_2, 16, true },
@ -148,7 +139,9 @@ const PinInfo pin_array[] PROGMEM = {
{ TXD_NAME_2, 10, true },
#endif
#endif
#elif SERIAL_PORT == 3
#endif
#if CONF_SERIAL_IS(3)
#if EITHER(AVR_ATmega2560_FAMILY, ARDUINO_ARCH_SAM)
{ RXD_NAME_3, 15, true },
{ TXD_NAME_3, 14, true },
@ -166,68 +159,8 @@ const PinInfo pin_array[] PROGMEM = {
#endif
#endif
#ifdef SERIAL_PORT_2
#if SERIAL_PORT_2 == 0
#if EITHER(AVR_ATmega2560_FAMILY, ARDUINO_ARCH_SAM)
{ RXD_NAME_0, 0, true },
{ TXD_NAME_0, 1, true },
#elif AVR_ATmega1284_FAMILY
{ RXD_NAME_0, 8, true },
{ TXD_NAME_0, 9, true },
#elif defined(TARGET_LPC1768) // TX P0_02 RX P0_03
{ RXD_NAME_0, 3, true },
{ TXD_NAME_0, 2, true },
#endif
#elif SERIAL_PORT_2 == 1
#if EITHER(AVR_ATmega2560_FAMILY, ARDUINO_ARCH_SAM)
{ RXD_NAME_1, 19, true },
{ TXD_NAME_1, 18, true },
#elif AVR_ATmega1284_FAMILY
{ RXD_NAME_1, 10, true },
{ TXD_NAME_1, 11, true },
#elif defined(TARGET_LPC1768)
#ifdef LPC_PINCFG_UART1_P2_00 // TX P2_00 RX P2_01
{ RXD_NAME_1, 0x41, true },
{ TXD_NAME_1, 0x40, true },
#else // TX P0_15 RX P0_16
{ RXD_NAME_1, 16, true },
{ TXD_NAME_1, 15, true },
#endif
#endif
#elif SERIAL_PORT_2 == 2
#if EITHER(AVR_ATmega2560_FAMILY, ARDUINO_ARCH_SAM)
{ RXD_NAME_2, 17, true },
{ TXD_NAME_2, 16, true },
#elif defined(TARGET_LPC1768)
#ifdef LPC_PINCFG_UART2_P2_08 // TX P2_08 RX P2_09
{ RXD_NAME_2, 0x49, true },
{ TXD_NAME_2, 0x48, true },
#else // TX P0_10 RX P0_11
{ RXD_NAME_2, 11, true },
{ TXD_NAME_2, 10, true },
#endif
#endif
#elif SERIAL_PORT_2 == 3
#if EITHER(AVR_ATmega2560_FAMILY, ARDUINO_ARCH_SAM)
{ RXD_NAME_3, 15, true },
{ TXD_NAME_3, 14, true },
#elif defined(TARGET_LPC1768)
#ifdef LPC_PINCFG_UART3_P0_25 // TX P0_25 RX P0_26
{ RXD_NAME_3, 0x1A, true },
{ TXD_NAME_3, 0x19, true },
#elif defined(LPC_PINCFG_UART3_P4_28) // TX P4_28 RX P4_29
{ RXD_NAME_3, 0x9D, true },
{ TXD_NAME_3, 0x9C, true },
#else // TX P0_00 RX P0_01
{ RXD_NAME_3, 1, true },
{ TXD_NAME_3, 0, true },
#endif
#endif
#endif
#endif
#include "pinsDebug_list.h"
#line 231
#line 164
};

Loading…
Cancel
Save