From 1a349c75229604c113c83d29c2ff06f61153b44a Mon Sep 17 00:00:00 2001 From: Scott Lahteine Date: Mon, 8 Jul 2019 22:59:51 -0500 Subject: [PATCH] Add HAS_TMC220x --- Marlin/src/Marlin.cpp | 2 +- Marlin/src/core/drivers.h | 2 ++ Marlin/src/feature/tmc_util.cpp | 14 +++++++------- Marlin/src/inc/Conditionals_post.h | 2 +- Marlin/src/inc/SanityCheck.h | 4 ++-- Marlin/src/module/stepper_indirection.cpp | 2 +- Marlin/src/module/stepper_indirection.h | 2 +- Marlin/src/pins/pins_BIGTREE_SKR_PRO_V1.1.h | 2 +- Marlin/src/pins/pins_BIGTREE_SKR_V1.3.h | 2 +- Marlin/src/pins/pins_FYSETC_F6_13.h | 2 +- Marlin/src/pins/pins_MKS_SBASE.h | 2 +- Marlin/src/pins/pins_MKS_SGEN.h | 2 +- Marlin/src/pins/pins_MKS_SGEN_L.h | 2 +- Marlin/src/pins/pins_RAMPS.h | 2 +- Marlin/src/pins/pins_RAMPS_FD_V1.h | 2 +- Marlin/src/pins/pins_RAMPS_LINUX.h | 2 +- Marlin/src/pins/pins_RAMPS_RE_ARM.h | 2 +- 17 files changed, 25 insertions(+), 23 deletions(-) diff --git a/Marlin/src/Marlin.cpp b/Marlin/src/Marlin.cpp index 12bac48b6..d94fa51ac 100644 --- a/Marlin/src/Marlin.cpp +++ b/Marlin/src/Marlin.cpp @@ -860,7 +860,7 @@ void setup() { setup_killpin(); - #if HAS_DRIVER(TMC2208) || HAS_DRIVER(TMC2209) + #if HAS_TMC220x tmc_serial_begin(); #endif diff --git a/Marlin/src/core/drivers.h b/Marlin/src/core/drivers.h index a6e480c14..6e89ae853 100644 --- a/Marlin/src/core/drivers.h +++ b/Marlin/src/core/drivers.h @@ -84,6 +84,8 @@ || HAS_DRIVER(TMC5130) \ || HAS_DRIVER(TMC5160) ) +#define HAS_TMC220x (HAS_DRIVER(TMC2208) || HAS_DRIVER(TMC2209)) + #define AXIS_IS_TMC(A) ( AXIS_DRIVER_TYPE(A,TMC2130) \ || AXIS_DRIVER_TYPE(A,TMC2160) \ || AXIS_DRIVER_TYPE(A,TMC2208) \ diff --git a/Marlin/src/feature/tmc_util.cpp b/Marlin/src/feature/tmc_util.cpp index c432a3cf9..a9c55e8c1 100644 --- a/Marlin/src/feature/tmc_util.cpp +++ b/Marlin/src/feature/tmc_util.cpp @@ -69,7 +69,7 @@ #endif ; #if ENABLED(TMC_DEBUG) - #if HAS_TMCX1X0 || HAS_DRIVER(TMC2208) || HAS_DRIVER(TMC2209) + #if HAS_TMCX1X0 || HAS_TMC220x uint8_t cs_actual; #endif #if HAS_STALLGUARD @@ -139,7 +139,7 @@ #endif // HAS_TMCX1X0 - #if HAS_DRIVER(TMC2208) || HAS_DRIVER(TMC2209) + #if HAS_TMC220x #if ENABLED(TMC_DEBUG) static uint32_t get_pwm_scale(TMC2208Stepper &st) { return st.pwm_scale_sum(); } @@ -239,7 +239,7 @@ st.printLabel(); SERIAL_CHAR(':'); SERIAL_PRINT(pwm_scale, DEC); #if ENABLED(TMC_DEBUG) - #if HAS_TMCX1X0 || HAS_DRIVER(TMC2208) || HAS_DRIVER(TMC2209) + #if HAS_TMCX1X0 || HAS_TMC220x SERIAL_CHAR('/'); SERIAL_PRINT(data.cs_actual, DEC); #endif #if HAS_STALLGUARD @@ -516,7 +516,7 @@ } #endif - #if HAS_DRIVER(TMC2208) || HAS_DRIVER(TMC2209) + #if HAS_TMC220x static void _tmc_status(TMC2208Stepper &st, const TMC_debug_enum i) { switch (i) { case TMC_PWM_SCALE: SERIAL_PRINT(st.pwm_scale_sum(), DEC); break; @@ -789,7 +789,7 @@ #endif TMC_REPORT("CS actual\t", TMC_CS_ACTUAL); TMC_REPORT("PWM scale", TMC_PWM_SCALE); - #if HAS_DRIVER(TMC2130) || HAS_DRIVER(TMC2224) || HAS_DRIVER(TMC2660) || HAS_DRIVER(TMC2208) || HAS_DRIVER(TMC2209) + #if HAS_DRIVER(TMC2130) || HAS_DRIVER(TMC2224) || HAS_DRIVER(TMC2660) || HAS_TMC220x TMC_REPORT("vsense\t", TMC_VSENSE); #endif TMC_REPORT("stealthChop", TMC_STEALTHCHOP); @@ -821,7 +821,7 @@ DRV_REPORT("s2ga\t", TMC_S2GA); DRV_REPORT("otpw\t", TMC_DRV_OTPW); DRV_REPORT("ot\t", TMC_OT); - #if HAS_DRIVER(TMC2208) || HAS_DRIVER(TMC2209) + #if HAS_TMC220x DRV_REPORT("157C\t", TMC_T157); DRV_REPORT("150C\t", TMC_T150); DRV_REPORT("143C\t", TMC_T143); @@ -845,7 +845,7 @@ } } #endif - #if HAS_DRIVER(TMC2208) || HAS_DRIVER(TMC2209) + #if HAS_TMC220x static void tmc_get_ic_registers(TMC2208Stepper, const TMC_get_registers_enum) { SERIAL_CHAR('\t'); } #endif diff --git a/Marlin/src/inc/Conditionals_post.h b/Marlin/src/inc/Conditionals_post.h index 8d6da94e8..961900318 100644 --- a/Marlin/src/inc/Conditionals_post.h +++ b/Marlin/src/inc/Conditionals_post.h @@ -909,7 +909,7 @@ #define HAS_TMCX1X0 (HAS_DRIVER(TMC2130) || HAS_DRIVER(TMC2160) || HAS_DRIVER(TMC5130) || HAS_DRIVER(TMC5160)) #define TMC_HAS_SPI (HAS_TMCX1X0 || HAS_DRIVER(TMC2660)) #define HAS_STALLGUARD (HAS_TMCX1X0 || HAS_DRIVER(TMC2209) || HAS_DRIVER(TMC2660)) - #define HAS_STEALTHCHOP (HAS_TMCX1X0 || HAS_DRIVER(TMC2208) || HAS_DRIVER(TMC2209)) + #define HAS_STEALTHCHOP (HAS_TMCX1X0 || HAS_TMC220x) #define STEALTHCHOP_ENABLED ANY(STEALTHCHOP_XY, STEALTHCHOP_Z, STEALTHCHOP_E) #define USE_SENSORLESS EITHER(SENSORLESS_HOMING, SENSORLESS_PROBING) diff --git a/Marlin/src/inc/SanityCheck.h b/Marlin/src/inc/SanityCheck.h index 0296b72c4..e6cd29715 100644 --- a/Marlin/src/inc/SanityCheck.h +++ b/Marlin/src/inc/SanityCheck.h @@ -2015,7 +2015,7 @@ static_assert(Y_MAX_LENGTH >= Y_BED_SIZE, "Movement bounds (Y_MIN_POS, Y_MAX_POS /** * TMC2208/2209 software UART and ENDSTOP_INTERRUPTS both use pin change interrupts (PCI) */ -#if (HAS_DRIVER(TMC2208) || HAS_DRIVER(TMC2209)) && ENABLED(ENDSTOP_INTERRUPTS_FEATURE) && !( \ +#if HAS_TMC220x && ENABLED(ENDSTOP_INTERRUPTS_FEATURE) && !( \ defined(X_HARDWARE_SERIAL ) \ || defined(X2_HARDWARE_SERIAL) \ || defined(Y_HARDWARE_SERIAL ) \ @@ -2035,7 +2035,7 @@ static_assert(Y_MAX_LENGTH >= Y_BED_SIZE, "Movement bounds (Y_MIN_POS, Y_MAX_POS /** * TMC2208/2209 software UART is only supported on AVR, LPC, STM32F1 and STM32F4 */ -#if (HAS_DRIVER(TMC2208) || HAS_DRIVER(TMC2209)) && !defined(__AVR__) && !defined(TARGET_LPC1768) && !defined(TARGET_STM32F1) && !defined(TARGET_STM32F4) && !( \ +#if HAS_TMC220x && !defined(__AVR__) && !defined(TARGET_LPC1768) && !defined(TARGET_STM32F1) && !defined(TARGET_STM32F4) && !( \ defined(X_HARDWARE_SERIAL ) \ || defined(X2_HARDWARE_SERIAL) \ || defined(Y_HARDWARE_SERIAL ) \ diff --git a/Marlin/src/module/stepper_indirection.cpp b/Marlin/src/module/stepper_indirection.cpp index 362ed01ba..a97402b94 100644 --- a/Marlin/src/module/stepper_indirection.cpp +++ b/Marlin/src/module/stepper_indirection.cpp @@ -309,7 +309,7 @@ // // TMC2208/2209 Driver objects and inits // -#if HAS_DRIVER(TMC2208) || HAS_DRIVER(TMC2209) +#if HAS_TMC220x #if AXIS_HAS_UART(X) #ifdef X_HARDWARE_SERIAL TMC_UART_DEFINE(HW, X, X); diff --git a/Marlin/src/module/stepper_indirection.h b/Marlin/src/module/stepper_indirection.h index 0e9c188ad..47fe8b09a 100644 --- a/Marlin/src/module/stepper_indirection.h +++ b/Marlin/src/module/stepper_indirection.h @@ -69,7 +69,7 @@ static constexpr chopper_timing_t chopper_timing = CHOPPER_TIMING; - #if HAS_DRIVER(TMC2208) || HAS_DRIVER(TMC2209) + #if HAS_TMC220x void tmc_serial_begin(); #endif #endif diff --git a/Marlin/src/pins/pins_BIGTREE_SKR_PRO_V1.1.h b/Marlin/src/pins/pins_BIGTREE_SKR_PRO_V1.1.h index 3b7a89fc8..954c83d92 100644 --- a/Marlin/src/pins/pins_BIGTREE_SKR_PRO_V1.1.h +++ b/Marlin/src/pins/pins_BIGTREE_SKR_PRO_V1.1.h @@ -109,7 +109,7 @@ #define TMC_SW_SCK PC10 #endif -#if HAS_DRIVER(TMC2208) || HAS_DRIVER(TMC2209) +#if HAS_TMC220x /** * TMC2208 stepper drivers * diff --git a/Marlin/src/pins/pins_BIGTREE_SKR_V1.3.h b/Marlin/src/pins/pins_BIGTREE_SKR_V1.3.h index 87617fbd8..0db91a83e 100644 --- a/Marlin/src/pins/pins_BIGTREE_SKR_V1.3.h +++ b/Marlin/src/pins/pins_BIGTREE_SKR_V1.3.h @@ -114,7 +114,7 @@ #endif #endif -#if HAS_DRIVER(TMC2208) || HAS_DRIVER(TMC2209) +#if HAS_TMC220x /** * TMC2208/TMC2209 stepper drivers * diff --git a/Marlin/src/pins/pins_FYSETC_F6_13.h b/Marlin/src/pins/pins_FYSETC_F6_13.h index e41cca85c..be5ff2a30 100644 --- a/Marlin/src/pins/pins_FYSETC_F6_13.h +++ b/Marlin/src/pins/pins_FYSETC_F6_13.h @@ -117,7 +117,7 @@ // the jumper next to the limit switch socket when using sensorless homing. // -#if HAS_DRIVER(TMC2208) || HAS_DRIVER(TMC2209) +#if HAS_TMC220x // Software serial // At the moment, F6 rx pins are not pc interrupt pins #define X_SERIAL_RX_PIN -1 // 71 diff --git a/Marlin/src/pins/pins_MKS_SBASE.h b/Marlin/src/pins/pins_MKS_SBASE.h index 2d37f7274..8bdece702 100644 --- a/Marlin/src/pins/pins_MKS_SBASE.h +++ b/Marlin/src/pins/pins_MKS_SBASE.h @@ -303,7 +303,7 @@ #endif #endif -#if MB(MKS_SBASE) && (HAS_DRIVER(TMC2208) || HAS_DRIVER(TMC2209)) +#if MB(MKS_SBASE) && HAS_TMC220x // The shortage of pins becomes apparent. // Worst case you may have to give up the LCD // RX pins need to be interrupt capable diff --git a/Marlin/src/pins/pins_MKS_SGEN.h b/Marlin/src/pins/pins_MKS_SGEN.h index 921ec60c3..330fee2dc 100644 --- a/Marlin/src/pins/pins_MKS_SGEN.h +++ b/Marlin/src/pins/pins_MKS_SGEN.h @@ -43,7 +43,7 @@ //#define BTN_EN1 P1_23 // EXP2.5 //#define BTN_EN2 P1_22 // EXP2.3 -#if HAS_DRIVER(TMC2208) || HAS_DRIVER(TMC2209) +#if HAS_TMC220x // The shortage of pins becomes apparent. // In the worst case you may have to give up the LCD. // RX pins must be interrupt-capable. diff --git a/Marlin/src/pins/pins_MKS_SGEN_L.h b/Marlin/src/pins/pins_MKS_SGEN_L.h index 9d20eb3be..c43ed141a 100644 --- a/Marlin/src/pins/pins_MKS_SGEN_L.h +++ b/Marlin/src/pins/pins_MKS_SGEN_L.h @@ -108,7 +108,7 @@ #endif #endif -#if HAS_DRIVER(TMC2208) || HAS_DRIVER(TMC2209) +#if HAS_TMC220x /** * TMC2208 stepper drivers * diff --git a/Marlin/src/pins/pins_RAMPS.h b/Marlin/src/pins/pins_RAMPS.h index e79247fce..8d28f11ff 100644 --- a/Marlin/src/pins/pins_RAMPS.h +++ b/Marlin/src/pins/pins_RAMPS.h @@ -296,7 +296,7 @@ #endif #endif -#if HAS_DRIVER(TMC2208) || HAS_DRIVER(TMC2209) +#if HAS_TMC220x /** * TMC2208/TMC2209 stepper drivers * diff --git a/Marlin/src/pins/pins_RAMPS_FD_V1.h b/Marlin/src/pins/pins_RAMPS_FD_V1.h index 684489403..a141adab5 100644 --- a/Marlin/src/pins/pins_RAMPS_FD_V1.h +++ b/Marlin/src/pins/pins_RAMPS_FD_V1.h @@ -205,7 +205,7 @@ #endif // HAS_SPI_LCD -#if HAS_DRIVER(TMC2208) || HAS_DRIVER(TMC2209) +#if HAS_TMC220x /** * TMC2208/TMC2209 stepper drivers * diff --git a/Marlin/src/pins/pins_RAMPS_LINUX.h b/Marlin/src/pins/pins_RAMPS_LINUX.h index 0176ead97..104f717d1 100644 --- a/Marlin/src/pins/pins_RAMPS_LINUX.h +++ b/Marlin/src/pins/pins_RAMPS_LINUX.h @@ -269,7 +269,7 @@ #endif #endif -#if HAS_DRIVER(TMC2208) || HAS_DRIVER(TMC2209) +#if HAS_TMC220x /** * TMC2208/TMC2209 stepper drivers * diff --git a/Marlin/src/pins/pins_RAMPS_RE_ARM.h b/Marlin/src/pins/pins_RAMPS_RE_ARM.h index 5ee4e1ad6..12d20b294 100644 --- a/Marlin/src/pins/pins_RAMPS_RE_ARM.h +++ b/Marlin/src/pins/pins_RAMPS_RE_ARM.h @@ -113,7 +113,7 @@ #endif #endif -#if HAS_DRIVER(TMC2208) || HAS_DRIVER(TMC2209) +#if HAS_TMC220x /** * TMC2208/TMC2209 stepper drivers *