From f875f49caaeea301d956aab0b8e57e6a0c4eb241 Mon Sep 17 00:00:00 2001 From: Chris Pepper Date: Mon, 22 Jan 2018 07:54:41 +0000 Subject: [PATCH] [2.0.x] LPC1768: Fix: Serial pins disabled correctly when in use (#9193) --- Marlin/src/HAL/HAL_LPC1768/HAL.h | 6 +++--- Marlin/src/HAL/HAL_LPC1768/pinmapping.h | 18 +++++++++--------- Marlin/src/pins/pins_RAMPS_RE_ARM.h | 1 + 3 files changed, 13 insertions(+), 12 deletions(-) diff --git a/Marlin/src/HAL/HAL_LPC1768/HAL.h b/Marlin/src/HAL/HAL_LPC1768/HAL.h index 32477b590..7e2451275 100644 --- a/Marlin/src/HAL/HAL_LPC1768/HAL.h +++ b/Marlin/src/HAL/HAL_LPC1768/HAL.h @@ -65,9 +65,9 @@ extern "C" volatile uint32_t _millis; #include "HAL_timers.h" #include "HardwareSerial.h" -#define ST7920_DELAY_1 DELAY_5_NOP;DELAY_5_NOP;DELAY_5_NOP;DELAY_5_NOP;DELAY_5_NOP;DELAY_5_NOP;DELAY_5_NOP;DELAY_5_NOP;DELAY_5_NOP;DELAY_5_NOP;DELAY_5_NOP;DELAY_5_NOP -#define ST7920_DELAY_2 DELAY_5_NOP;DELAY_5_NOP;DELAY_5_NOP;DELAY_5_NOP;DELAY_5_NOP;DELAY_5_NOP;DELAY_5_NOP;DELAY_5_NOP;DELAY_5_NOP;DELAY_5_NOP;DELAY_5_NOP;DELAY_5_NOP;DELAY_5_NOP;DELAY_5_NOP;DELAY_5_NOP -#define ST7920_DELAY_3 DELAY_5_NOP;DELAY_5_NOP;DELAY_5_NOP;DELAY_5_NOP;DELAY_5_NOP;DELAY_5_NOP;DELAY_5_NOP;DELAY_5_NOP;DELAY_5_NOP;DELAY_5_NOP;DELAY_5_NOP;DELAY_5_NOP;DELAY_5_NOP;DELAY_5_NOP;DELAY_5_NOP +#define ST7920_DELAY_1 DELAY_20_NOP;DELAY_20_NOP;DELAY_20_NOP +#define ST7920_DELAY_2 DELAY_20_NOP;DELAY_20_NOP;DELAY_20_NOP;DELAY_10_NOP;DELAY_5_NOP +#define ST7920_DELAY_3 DELAY_20_NOP;DELAY_20_NOP;DELAY_20_NOP;DELAY_10_NOP;DELAY_5_NOP extern HalSerial usb_serial; diff --git a/Marlin/src/HAL/HAL_LPC1768/pinmapping.h b/Marlin/src/HAL/HAL_LPC1768/pinmapping.h index 622baaa7c..a5a0fa961 100644 --- a/Marlin/src/HAL/HAL_LPC1768/pinmapping.h +++ b/Marlin/src/HAL/HAL_LPC1768/pinmapping.h @@ -109,11 +109,11 @@ constexpr int8_t LPC1768_PIN_ADC(const pin_t pin) { return (int8_t)((pin >> 10) // ****************** #define P_NC -1 -#if SERIAL_PORT != 3 +#if SERIAL_PORT != 3 && SERIAL_PORT_2 != 3 #define P0_00 LPC1768_PIN(PORT(0), PIN( 0), INTERRUPT(1), PWM(0), ADC_NONE) #define P0_01 LPC1768_PIN(PORT(0), PIN( 1), INTERRUPT(1), PWM(0), ADC_NONE) #endif -#if SERIAL_PORT != 0 +#if SERIAL_PORT != 0 && SERIAL_PORT_2 != 0 #define P0_02 LPC1768_PIN(PORT(0), PIN( 2), INTERRUPT(1), PWM(0), ADC_CHAN(7)) #define P0_03 LPC1768_PIN(PORT(0), PIN( 3), INTERRUPT(1), PWM(0), ADC_CHAN(6)) #endif @@ -123,11 +123,11 @@ constexpr int8_t LPC1768_PIN_ADC(const pin_t pin) { return (int8_t)((pin >> 10) #define P0_07 LPC1768_PIN(PORT(0), PIN( 7), INTERRUPT(1), PWM(0), ADC_NONE) #define P0_08 LPC1768_PIN(PORT(0), PIN( 8), INTERRUPT(1), PWM(0), ADC_NONE) #define P0_09 LPC1768_PIN(PORT(0), PIN( 9), INTERRUPT(1), PWM(0), ADC_NONE) -#if SERIAL_PORT != 2 +#if SERIAL_PORT != 2 && SERIAL_PORT_2 != 2 #define P0_10 LPC1768_PIN(PORT(0), PIN(10), INTERRUPT(1), PWM(0), ADC_NONE) #define P0_11 LPC1768_PIN(PORT(0), PIN(11), INTERRUPT(1), PWM(0), ADC_NONE) #endif -#if SERIAL_PORT != 1 +#if SERIAL_PORT != 1 && SERIAL_PORT_2 != 1 #define P0_15 LPC1768_PIN(PORT(0), PIN(15), INTERRUPT(1), PWM(0), ADC_NONE) #define P0_16 LPC1768_PIN(PORT(0), PIN(16), INTERRUPT(1), PWM(0), ADC_NONE) #endif @@ -190,25 +190,25 @@ constexpr int8_t LPC1768_PIN_ADC(const pin_t pin) { return (int8_t)((pin >> 10) // Pin index for M43 and M226 constexpr pin_t pin_map[] = { - #if SERIAL_PORT != 3 + #if SERIAL_PORT != 3 && SERIAL_PORT_2 != 3 P0_00, P0_01, #else P_NC, P_NC, #endif - #if SERIAL_PORT != 0 + #if SERIAL_PORT != 0 && SERIAL_PORT_2 != 0 P0_02, P0_03, #else P_NC, P_NC, #endif P0_04, P0_05, P0_06, P0_07, P0_08, P0_09, - #if SERIAL_PORT != 2 + #if SERIAL_PORT != 2 && SERIAL_PORT_2 != 2 P0_10, P0_11, #else P_NC, P_NC, #endif P_NC, P_NC, P_NC, - #if SERIAL_PORT != 1 + #if SERIAL_PORT != 1 && SERIAL_PORT_2 != 1 P0_15, P0_16, #else @@ -243,7 +243,7 @@ constexpr uint8_t NUM_DIGITAL_PINS = COUNT(pin_map); constexpr pin_t adc_pin_table[] = { P0_23, P0_24, P0_25, P0_26, P1_30, P1_31, - #if SERIAL_PORT != 0 + #if SERIAL_PORT != 0 && SERIAL_PORT_2 != 0 P0_03, P0_02 #endif }; diff --git a/Marlin/src/pins/pins_RAMPS_RE_ARM.h b/Marlin/src/pins/pins_RAMPS_RE_ARM.h index e25ae74f5..cd814dbd8 100644 --- a/Marlin/src/pins/pins_RAMPS_RE_ARM.h +++ b/Marlin/src/pins/pins_RAMPS_RE_ARM.h @@ -195,6 +195,7 @@ #define SPINDLE_DIR_PIN P1_19 // (5) #endif #endif + // // Průša i3 MK2 Multiplexer Support //