Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Define LPC UART pins (for debugging) based on LPC_PINCFG_UART #19475

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 11 additions & 5 deletions Marlin/src/HAL/AVR/fastio.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,17 @@

#include <avr/io.h>

#define AVR_AT90USB1286_FAMILY (defined(__AVR_AT90USB1287__) || defined(__AVR_AT90USB1286__) || defined(__AVR_AT90USB1286P__) || defined(__AVR_AT90USB646__) || defined(__AVR_AT90USB646P__) || defined(__AVR_AT90USB647__))
#define AVR_ATmega1284_FAMILY (defined(__AVR_ATmega644__) || defined(__AVR_ATmega644P__) || defined(__AVR_ATmega644PA__) || defined(__AVR_ATmega1284P__))
#define AVR_ATmega2560_FAMILY (defined(__AVR_ATmega1280__) || defined(__AVR_ATmega2560__))
#define AVR_ATmega2561_FAMILY (defined(__AVR_ATmega1281__) || defined(__AVR_ATmega2561__))
#define AVR_ATmega328_FAMILY (defined(__AVR_ATmega168__) || defined(__AVR_ATmega328__) || defined(__AVR_ATmega328P__))
#if defined(__AVR_AT90USB1287__) || defined(__AVR_AT90USB1286__) || defined(__AVR_AT90USB1286P__) || defined(__AVR_AT90USB646__) || defined(__AVR_AT90USB646P__) || defined(__AVR_AT90USB647__)
#define AVR_AT90USB1286_FAMILY 1
#elif defined(__AVR_ATmega644__) || defined(__AVR_ATmega644P__) || defined(__AVR_ATmega644PA__) || defined(__AVR_ATmega1284P__)
#define AVR_ATmega1284_FAMILY 1
#elif defined(__AVR_ATmega1280__) || defined(__AVR_ATmega2560__)
#define AVR_ATmega2560_FAMILY 1
#elif defined(__AVR_ATmega1281__) || defined(__AVR_ATmega2561__)
#define AVR_ATmega2561_FAMILY 1
#elif defined(__AVR_ATmega168__) || defined(__AVR_ATmega328__) || defined(__AVR_ATmega328P__)
#define AVR_ATmega328_FAMILY 1
#endif

/**
* Include Ports and Functions
Expand Down
4 changes: 3 additions & 1 deletion Marlin/src/HAL/AVR/pinsDebug.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,9 @@

#define NUMBER_PINS_TOTAL NUM_DIGITAL_PINS

#define AVR_ATmega2560_FAMILY_PLUS_70 MB(BQ_ZUM_MEGA_3D, MIGHTYBOARD_REVE, MINIRAMBO, SCOOVO_X9H)
#if MB(BQ_ZUM_MEGA_3D, MIGHTYBOARD_REVE, MINIRAMBO, SCOOVO_X9H)
#define AVR_ATmega2560_FAMILY_PLUS_70 1
#endif

#if AVR_AT90USB1286_FAMILY

Expand Down
82 changes: 59 additions & 23 deletions Marlin/src/pins/pinsDebug.h
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@
#line 46

// manually add pins that have names that are macros which don't play well with these macros
#if (AVR_ATmega2560_FAMILY || AVR_ATmega1284_FAMILY || defined(ARDUINO_ARCH_SAM) || defined(TARGET_LPC1768))
#if ANY(AVR_ATmega2560_FAMILY, AVR_ATmega1284_FAMILY, ARDUINO_ARCH_SAM, TARGET_LPC1768)
#if SERIAL_PORT == 0
static const char RXD_NAME_0[] PROGMEM = { "RXD0" };
static const char TXD_NAME_0[] PROGMEM = { "TXD0" };
Expand Down Expand Up @@ -110,83 +110,119 @@ const PinInfo pin_array[] PROGMEM = {

// manually add pins ...
#if SERIAL_PORT == 0
#if (AVR_ATmega2560_FAMILY || defined(ARDUINO_ARCH_SAM))
#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)
#elif defined(TARGET_LPC1768) // TX P0_02 RX P0_03
{ RXD_NAME_0, 3, true },
{ TXD_NAME_0, 2, true },
#endif
#elif SERIAL_PORT == 1
#if (AVR_ATmega2560_FAMILY || defined(ARDUINO_ARCH_SAM))
#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)
{ RXD_NAME_1, 16, true },
{ TXD_NAME_1, 15, true },
#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
#if (AVR_ATmega2560_FAMILY || defined(ARDUINO_ARCH_SAM))
#if EITHER(AVR_ATmega2560_FAMILY, ARDUINO_ARCH_SAM)
{ RXD_NAME_2, 17, true },
{ TXD_NAME_2, 16, true },
#elif defined(TARGET_LPC1768)
{ RXD_NAME_2, 11, true },
{ TXD_NAME_2, 10, true },
#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 == 3
#if (AVR_ATmega2560_FAMILY || defined(ARDUINO_ARCH_SAM))
#if EITHER(AVR_ATmega2560_FAMILY, ARDUINO_ARCH_SAM)
{ RXD_NAME_3, 15, true },
{ TXD_NAME_3, 14, true },
#elif defined(TARGET_LPC1768)
{ RXD_NAME_3, 1, true },
{ TXD_NAME_3, 0, true },
#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

#ifdef SERIAL_PORT_2
#if SERIAL_PORT_2 == 0
#if (AVR_ATmega2560_FAMILY || defined(ARDUINO_ARCH_SAM))
#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)
#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 (AVR_ATmega2560_FAMILY || defined(ARDUINO_ARCH_SAM))
#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)
{ RXD_NAME_1, 16, true },
{ TXD_NAME_1, 15, true },
#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 (AVR_ATmega2560_FAMILY || defined(ARDUINO_ARCH_SAM))
#if EITHER(AVR_ATmega2560_FAMILY, ARDUINO_ARCH_SAM)
{ RXD_NAME_2, 17, true },
{ TXD_NAME_2, 16, true },
#elif defined(TARGET_LPC1768)
{ RXD_NAME_2, 11, true },
{ TXD_NAME_2, 10, true },
#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 (AVR_ATmega2560_FAMILY || defined(ARDUINO_ARCH_SAM))
#if EITHER(AVR_ATmega2560_FAMILY, ARDUINO_ARCH_SAM)
{ RXD_NAME_3, 15, true },
{ TXD_NAME_3, 14, true },
#elif defined(TARGET_LPC1768)
{ RXD_NAME_3, 1, true },
{ TXD_NAME_3, 0, true },
#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
Expand Down