Don't protect unused CS pins (#13647)

This commit is contained in:
ManuelMcLure 2019-04-10 19:57:57 -07:00 committed by Scott Lahteine
parent 9898f53361
commit 492883859e
3 changed files with 51 additions and 29 deletions

View File

@ -65,20 +65,45 @@
#define AXIS_DRIVER_TYPE(A,T) AXIS_DRIVER_TYPE_##A(T)
#define HAS_DRIVER(T) (AXIS_DRIVER_TYPE_X(T) || AXIS_DRIVER_TYPE_X2(T) || \
AXIS_DRIVER_TYPE_Y(T) || AXIS_DRIVER_TYPE_Y2(T) || \
AXIS_DRIVER_TYPE_Z(T) || AXIS_DRIVER_TYPE_Z2(T) || AXIS_DRIVER_TYPE_Z3(T) || \
AXIS_DRIVER_TYPE_E0(T) || AXIS_DRIVER_TYPE_E1(T) || \
AXIS_DRIVER_TYPE_E2(T) || AXIS_DRIVER_TYPE_E3(T) || \
AXIS_DRIVER_TYPE_E4(T) || AXIS_DRIVER_TYPE_E5(T) )
#define HAS_DRIVER(T) ( AXIS_DRIVER_TYPE_X(T) || AXIS_DRIVER_TYPE_X2(T) \
|| AXIS_DRIVER_TYPE_Y(T) || AXIS_DRIVER_TYPE_Y2(T) \
|| AXIS_DRIVER_TYPE_Z(T) || AXIS_DRIVER_TYPE_Z2(T) || AXIS_DRIVER_TYPE_Z3(T) \
|| AXIS_DRIVER_TYPE_E0(T) || AXIS_DRIVER_TYPE_E1(T) \
|| AXIS_DRIVER_TYPE_E2(T) || AXIS_DRIVER_TYPE_E3(T) \
|| AXIS_DRIVER_TYPE_E4(T) || AXIS_DRIVER_TYPE_E5(T) )
// Test for supported TMC drivers that require advanced configuration
// Does not match standalone configurations
#define HAS_TRINAMIC ( HAS_DRIVER(TMC2130) || HAS_DRIVER(TMC2160) || HAS_DRIVER(TMC2208) || HAS_DRIVER(TMC2660) || HAS_DRIVER(TMC5130) || HAS_DRIVER(TMC5160) )
#define HAS_TRINAMIC ( HAS_DRIVER(TMC2130) \
|| HAS_DRIVER(TMC2160) \
|| HAS_DRIVER(TMC2208) \
|| HAS_DRIVER(TMC2660) \
|| HAS_DRIVER(TMC5130) \
|| HAS_DRIVER(TMC5160) )
#define AXIS_IS_TMC(A) ( AXIS_DRIVER_TYPE_##A(TMC2130) || \
AXIS_DRIVER_TYPE_##A(TMC2160) || \
AXIS_DRIVER_TYPE_##A(TMC2208) || \
AXIS_DRIVER_TYPE_##A(TMC2660) || \
AXIS_DRIVER_TYPE_##A(TMC5130) || \
AXIS_DRIVER_TYPE_##A(TMC5160))
#define AXIS_IS_TMC(A) ( AXIS_DRIVER_TYPE(A,TMC2130) \
|| AXIS_DRIVER_TYPE(A,TMC2160) \
|| AXIS_DRIVER_TYPE(A,TMC2208) \
|| AXIS_DRIVER_TYPE(A,TMC2660) \
|| AXIS_DRIVER_TYPE(A,TMC5130) \
|| AXIS_DRIVER_TYPE(A,TMC5160) )
// Test for a driver that uses SPI - this allows checking whether a _CS_ pin
// is considered sensitive
#define AXIS_HAS_SPI(A) ( AXIS_DRIVER_TYPE(A,TMC2130) \
|| AXIS_DRIVER_TYPE(A,TMC2160) \
|| AXIS_DRIVER_TYPE(A,TMC2660) \
|| AXIS_DRIVER_TYPE(A,TMC5130) \
|| AXIS_DRIVER_TYPE(A,TMC5160) )
#define AXIS_HAS_STALLGUARD(A) ( AXIS_DRIVER_TYPE(A,TMC2130) \
|| AXIS_DRIVER_TYPE(A,TMC2160) \
|| AXIS_DRIVER_TYPE(A,TMC2660) \
|| AXIS_DRIVER_TYPE(A,TMC5130) \
|| AXIS_DRIVER_TYPE(A,TMC5160) )
#define AXIS_HAS_STEALTHCHOP(A) ( AXIS_DRIVER_TYPE(A,TMC2130) \
|| AXIS_DRIVER_TYPE(A,TMC2160) \
|| AXIS_DRIVER_TYPE(A,TMC2208) \
|| AXIS_DRIVER_TYPE(A,TMC5130) \
|| AXIS_DRIVER_TYPE(A,TMC5160) )

View File

@ -873,9 +873,6 @@
#define TMC_HAS_SPI (HAS_TMCX1X0 || HAS_DRIVER(TMC2660))
#define HAS_STALLGUARD (HAS_TMCX1X0 || HAS_DRIVER(TMC2660))
#define HAS_STEALTHCHOP (HAS_TMCX1X0 || HAS_DRIVER(TMC2208))
#define AXIS_HAS_SPI(ST) (AXIS_DRIVER_TYPE(ST, TMC2130) || AXIS_DRIVER_TYPE(ST, TMC2160) || AXIS_DRIVER_TYPE(ST, TMC2660))
#define AXIS_HAS_STALLGUARD(ST) (AXIS_DRIVER_TYPE(ST, TMC2130) || AXIS_DRIVER_TYPE(ST, TMC2160) || AXIS_DRIVER_TYPE(ST, TMC2660) || AXIS_DRIVER_TYPE(ST, TMC5130) || AXIS_DRIVER_TYPE(ST, TMC5160))
#define AXIS_HAS_STEALTHCHOP(ST) (AXIS_DRIVER_TYPE(ST, TMC2130) || AXIS_DRIVER_TYPE(ST, TMC2160) || AXIS_DRIVER_TYPE(ST, TMC2208) || AXIS_DRIVER_TYPE(ST, TMC5130) || AXIS_DRIVER_TYPE(ST, TMC5160))
#define STEALTHCHOP_ENABLED ANY(STEALTHCHOP_XY, STEALTHCHOP_Z, STEALTHCHOP_E)
#define USE_SENSORLESS EITHER(SENSORLESS_HOMING, SENSORLESS_PROBING)

View File

@ -35,7 +35,7 @@
#else
#define _X_MAX
#endif
#if PIN_EXISTS(X_CS)
#if PIN_EXISTS(X_CS) && AXIS_HAS_SPI(X)
#define _X_CS X_CS_PIN,
#else
#define _X_CS
@ -68,7 +68,7 @@
#else
#define _Y_MAX
#endif
#if PIN_EXISTS(Y_CS)
#if PIN_EXISTS(Y_CS) && AXIS_HAS_SPI(Y)
#define _Y_CS Y_CS_PIN,
#else
#define _Y_CS
@ -101,7 +101,7 @@
#else
#define _Z_MAX
#endif
#if PIN_EXISTS(Z_CS)
#if PIN_EXISTS(Z_CS) && AXIS_HAS_SPI(Z)
#define _Z_CS Z_CS_PIN,
#else
#define _Z_CS
@ -139,7 +139,7 @@
#define _E0_MS3
#if E_NEEDED(0)
#if PIN_EXISTS(E0_CS)
#if PIN_EXISTS(E0_CS) && AXIS_HAS_SPI(E0)
#undef _E0_CS
#define _E0_CS E0_CS_PIN,
#endif
@ -163,7 +163,7 @@
#define _E1_MS3
#if E_NEEDED(1)
#if PIN_EXISTS(E1_CS)
#if PIN_EXISTS(E1_CS) && AXIS_HAS_SPI(E1)
#undef _E1_CS
#define _E1_CS E1_CS_PIN,
#endif
@ -187,7 +187,7 @@
#define _E2_MS3
#if E_NEEDED(2)
#if PIN_EXISTS(E2_CS)
#if PIN_EXISTS(E2_CS) && AXIS_HAS_SPI(E2)
#undef _E2_CS
#define _E2_CS E2_CS_PIN,
#endif
@ -211,7 +211,7 @@
#define _E3_MS3
#if E_NEEDED(3)
#if PIN_EXISTS(E3_CS)
#if PIN_EXISTS(E3_CS) && AXIS_HAS_SPI(E3)
#undef _E3_CS
#define _E3_CS E3_CS_PIN,
#endif
@ -235,7 +235,7 @@
#define _E4_MS3
#if E_NEEDED(4)
#if PIN_EXISTS(E4_CS)
#if PIN_EXISTS(E4_CS) && AXIS_HAS_SPI(E4)
#undef _E4_CS
#define _E4_CS E4_CS_PIN,
#endif
@ -259,7 +259,7 @@
#define _E5_MS3
#if E_NEEDED(5)
#if PIN_EXISTS(E5_CS)
#if PIN_EXISTS(E5_CS) && AXIS_HAS_SPI(E5)
#undef _E5_CS
#define _E5_CS E5_CS_PIN,
#endif
@ -368,7 +368,7 @@
//
#if EITHER(DUAL_X_CARRIAGE, X_DUAL_STEPPER_DRIVERS)
#if PIN_EXISTS(X2_CS)
#if PIN_EXISTS(X2_CS) && AXIS_HAS_SPI(X2)
#define _X2_CS X2_CS_PIN,
#else
#define _X2_CS
@ -394,7 +394,7 @@
#endif
#if ENABLED(Y_DUAL_STEPPER_DRIVERS)
#if PIN_EXISTS(Y2_CS)
#if PIN_EXISTS(Y2_CS) && AXIS_HAS_SPI(Y2)
#define _Y2_CS Y2_CS_PIN,
#else
#define _Y2_CS
@ -420,7 +420,7 @@
#endif
#if Z_MULTI_STEPPER_DRIVERS
#if PIN_EXISTS(Z2_CS)
#if PIN_EXISTS(Z2_CS) && AXIS_HAS_SPI(Z2)
#define _Z2_CS Z2_CS_PIN,
#else
#define _Z2_CS
@ -446,7 +446,7 @@
#endif
#if ENABLED(Z_TRIPLE_STEPPER_DRIVERS)
#if PIN_EXISTS(Z3_CS)
#if PIN_EXISTS(Z3_CS) && AXIS_HAS_SPI(Z3)
#define _Z3_CS Z3_CS_PIN,
#else
#define _Z3_CS