|
|
@ -128,269 +128,425 @@ void tmc_init() {
|
|
|
|
#endif
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
|
|
#if ENABLED(HAVE_TMC2130DRIVER)
|
|
|
|
#if ENABLED(HAVE_TMC2130DRIVER)
|
|
|
|
|
|
|
|
|
|
|
|
#include <SPI.h>
|
|
|
|
#include <SPI.h>
|
|
|
|
#include <Trinamic_TMC2130.h>
|
|
|
|
#include <Trinamic_TMC2130.h>
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Stepper objects of TMC2310 steppers used
|
|
|
|
|
|
|
|
#if ENABLED(X_IS_TMC2130)
|
|
|
|
|
|
|
|
Trinamic_TMC2130 stepperX(X_CS_PIN);
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#if ENABLED(X2_IS_TMC2130)
|
|
|
|
|
|
|
|
Trinamic_TMC2130 stepperX2(X2_CS_PIN);
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#if ENABLED(Y_IS_TMC2130)
|
|
|
|
|
|
|
|
Trinamic_TMC2130 stepperY(Y_CS_PIN);
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#if ENABLED(Y2_IS_TMC2130)
|
|
|
|
|
|
|
|
Trinamic_TMC2130 stepperY2(Y2_CS_PINR);
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#if ENABLED(Z_IS_TMC2130)
|
|
|
|
|
|
|
|
Trinamic_TMC2130 stepperZ(Z_CS_PIN);
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#if ENABLED(Z2_IS_TMC2130)
|
|
|
|
|
|
|
|
Trinamic_TMC2130 stepperZ2(Z2_CS_PIN);
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#if ENABLED(E0_IS_TMC2130)
|
|
|
|
|
|
|
|
Trinamic_TMC2130 stepperE0(E0_CS_PIN);
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#if ENABLED(E1_IS_TMC2130)
|
|
|
|
|
|
|
|
Trinamic_TMC2130 stepperE1(E1_CS_PIN);
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#if ENABLED(E2_IS_TMC2130)
|
|
|
|
|
|
|
|
Trinamic_TMC2130 stepperE2(E2_CS_PIN);
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#if ENABLED(E3_IS_TMC2130)
|
|
|
|
|
|
|
|
Trinamic_TMC2130 stepperE3(E3_CS_PIN);
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#if ENABLED(HAVE_TMC2130DRIVER)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#if ENABLED(TMC2130_ADVANCED_CONFIGURATION)
|
|
|
|
#if ENABLED(TMC2130_ADVANCED_CONFIGURATION)
|
|
|
|
|
|
|
|
|
|
|
|
void tmc2130_init() {
|
|
|
|
#ifdef GLOBAL_I_SCALE_ANALOG
|
|
|
|
|
|
|
|
#define _2130_set_I_scale_analog(A) stepper##A.set_I_scale_analog(GLOBAL_I_SCALE_ANALOG)
|
|
|
|
// If you've enabled TMC2130_ADVANCED_CONFIGURATION configure your
|
|
|
|
#else
|
|
|
|
// steppers manually here. The ENABLED(XYZ_IS_TMC2130) is optional,
|
|
|
|
#define _2130_set_I_scale_analog(A) NOOP
|
|
|
|
|
|
|
|
#endif
|
|
|
|
#if ENABLED(X_IS_TMC2130)
|
|
|
|
#ifdef GLOBAL_INTERNAL_RSENSE
|
|
|
|
stepperX.init();
|
|
|
|
#define _2130_set_internal_Rsense(A) stepper##A.set_internal_Rsense(GLOBAL_INTERNAL_RSENSE)
|
|
|
|
stepperX.set_I_scale_analog(GLOBAL_I_SCALE_ANALOG);
|
|
|
|
#else
|
|
|
|
//stepperX.set_internal_Rsense(GLOBAL_INTERNAL_RSENSE);
|
|
|
|
#define _2130_set_internal_Rsense(A) NOOP
|
|
|
|
stepperX.set_en_pwm_mode(GLOBAL_EN_PWM_MODE);
|
|
|
|
#endif
|
|
|
|
//stepperX.set_enc_commutation(GLOBAL_ENC_COMMUTATION);
|
|
|
|
#ifdef GLOBAL_EN_PWM_MODE
|
|
|
|
stepperX.set_shaft(GLOBAL_SHAFT);
|
|
|
|
#define _2130_set_en_pwm_mode(A) stepper##A.set_en_pwm_mode(GLOBAL_EN_PWM_MODE)
|
|
|
|
//stepperX.set_diag0_error(GLOBAL_DIAG0_ERROR);
|
|
|
|
#else
|
|
|
|
//stepperX.set_diag0_otpw(GLOBAL_DIAG0_OTPW);
|
|
|
|
#define _2130_set_en_pwm_mode(A) NOOP
|
|
|
|
//stepperX.set_diag0_stall(GLOBAL_DIAG0_STALL);
|
|
|
|
#endif
|
|
|
|
//stepperX.set_diag1_stall(GLOBAL_DIAG1_STALL);
|
|
|
|
#ifdef GLOBAL_ENC_COMMUTATION
|
|
|
|
//stepperX.set_diag1_index(GLOBAL_DIAG1_INDEX);
|
|
|
|
#define _2130_set_enc_commutation(A) stepper##A.set_enc_commutation(GLOBAL_ENC_COMMUTATION)
|
|
|
|
//stepperX.set_diag1_onstate(GLOBAL_DIAG1_ONSTATE);
|
|
|
|
#else
|
|
|
|
//stepperX.set_diag1_steps_skipped(GLOBAL_DIAG1_ONSTATE);
|
|
|
|
#define _2130_set_enc_commutation(A) NOOP
|
|
|
|
//stepperX.set_diag0_int_pushpull(GLOBAL_DIAG0_INT_PUSHPULL);
|
|
|
|
#endif
|
|
|
|
//stepperX.set_diag1_int_pushpull(GLOBAL_DIAG1_INT_PUSHPULL);
|
|
|
|
#ifdef GLOBAL_SHAFT
|
|
|
|
//stepperX.set_small_hysteresis(GLOBAL_SMALL_HYSTERESIS);
|
|
|
|
#define _2130_set_shaft(A) stepper##A.set_shaft(GLOBAL_SHAFT)
|
|
|
|
//stepperX.set_stop_enable(GLOBAL_STOP_ENABLE);
|
|
|
|
#else
|
|
|
|
//stepperX.set_direct_mode(GLOBAL_DIRECT_MODE);
|
|
|
|
#define _2130_set_shaft(A) NOOP
|
|
|
|
|
|
|
|
#endif
|
|
|
|
stepperX.set_IHOLD_IRUN(GLOBAL_IHOLD,GLOBAL_IRUN,GLOBAL_IHOLDDELAY);
|
|
|
|
#ifdef GLOBAL_DIAG0_ERROR
|
|
|
|
//stepperX.set_TPOWERDOWN(GLOBAL_TPOWERDOWN);
|
|
|
|
#define _2130_set_diag0_error(A) stepper##A.set_diag0_error(GLOBAL_DIAG0_ERROR)
|
|
|
|
//stepperX.set_TPWMTHRS(GLOBAL_TPWMTHRS);
|
|
|
|
#else
|
|
|
|
//stepperX.set_TCOOLTHRS(GLOBAL_TCOOLTHRS);
|
|
|
|
#define _2130_set_diag0_error(A) NOOP
|
|
|
|
stepperX.set_THIGH(GLOBAL_THIGH);
|
|
|
|
#endif
|
|
|
|
//stepperX.set_XDIRECT(GLOBAL_XDIRECT);
|
|
|
|
#ifdef GLOBAL_DIAG0_OTPW
|
|
|
|
//stepperX.set_VDCMIN(GLOBAL_VDCMIN);
|
|
|
|
#define _2130_set_diag0_otpw(A) stepper##A.set_diag0_otpw(GLOBAL_DIAG0_OTPW)
|
|
|
|
|
|
|
|
#else
|
|
|
|
//stepperX.set_dedge(GLOBAL_DEDGE);
|
|
|
|
#define _2130_set_diag0_otpw(A) NOOP
|
|
|
|
//stepperX.set_diss2g(GLOBAL_DISS2G);
|
|
|
|
#endif
|
|
|
|
stepperX.set_intpol(GLOBAL_INTPOL);
|
|
|
|
#ifdef GLOBAL_DIAG0_STALL
|
|
|
|
stepperX.set_mres(GLOBAL_MRES);
|
|
|
|
#define _2130_set_diag0_stall(A) stepper##A.set_diag0_stall(GLOBAL_DIAG0_STALL)
|
|
|
|
stepperX.set_sync(GLOBAL_SYNC);
|
|
|
|
#else
|
|
|
|
stepperX.set_vhighchm(GLOBAL_VHIGHCHM);
|
|
|
|
#define _2130_set_diag0_stall(A) NOOP
|
|
|
|
stepperX.set_vhighfs(GLOBAL_VHIGHFS);
|
|
|
|
#endif
|
|
|
|
//stepperX.set_vsense(GLOBAL_VSENSE);
|
|
|
|
#ifdef GLOBAL_DIAG1_STALL
|
|
|
|
stepperX.set_tbl(GLOBAL_TBL);
|
|
|
|
#define _2130_set_diag1_stall(A) stepper##A.set_diag1_stall(GLOBAL_DIAG1_STALL)
|
|
|
|
stepperX.set_chm(GLOBAL_CHM);
|
|
|
|
#else
|
|
|
|
//stepperX.set_rndtf(GLOBAL_RNDTF);
|
|
|
|
#define _2130_set_diag1_stall(A) NOOP
|
|
|
|
//stepperX.set_disfdcc(GLOBAL_DISFDCC);
|
|
|
|
#endif
|
|
|
|
//stepperX.set_fd(GLOBAL_FD);
|
|
|
|
#ifdef GLOBAL_DIAG1_INDEX
|
|
|
|
//stepperX.set_hend(GLOBAL_HEND);
|
|
|
|
#define _2130_set_diag1_index(A) stepper##A.set_diag1_index(GLOBAL_DIAG1_INDEX)
|
|
|
|
//stepperX.set_hstrt(GLOBAL_HSTRT);
|
|
|
|
#else
|
|
|
|
stepperX.set_toff(GLOBAL_TOFF);
|
|
|
|
#define _2130_set_diag1_index(A) NOOP
|
|
|
|
|
|
|
|
#endif
|
|
|
|
//stepperX.set_sfilt(GLOBAL_SFILT);
|
|
|
|
#ifdef GLOBAL_DIAG1_ONSTATE
|
|
|
|
//stepperX.set_sgt(GLOBAL_SGT);
|
|
|
|
#define _2130_set_diag1_onstate(A) stepper##A.set_diag1_onstate(GLOBAL_DIAG1_ONSTATE)
|
|
|
|
//stepperX.set_seimin(GLOBAL_SEIMIN);
|
|
|
|
#else
|
|
|
|
//stepperX.set_sedn(GLOBAL_SEDN);
|
|
|
|
#define _2130_set_diag1_onstate(A) NOOP
|
|
|
|
//stepperX.set_semax(GLOBAL_SEMAX);
|
|
|
|
#endif
|
|
|
|
//stepperX.set_seup(GLOBAL_SEUP);
|
|
|
|
#ifdef GLOBAL_DIAG1_ONSTATE
|
|
|
|
//stepperX.set_semin(GLOBAL_SEMIN);
|
|
|
|
#define _2130_set_diag1_steps_skipped(A) stepper##A.set_diag1_steps_skipped(GLOBAL_DIAG1_ONSTATE)
|
|
|
|
|
|
|
|
#else
|
|
|
|
//stepperX.set_DCCTRL(GLOBAL_DC_TIME, GLOBAL_DC_SG);
|
|
|
|
#define _2130_set_diag1_steps_skipped(A) NOOP
|
|
|
|
|
|
|
|
#endif
|
|
|
|
//stepperX.set_freewheel(GLOBAL_FREEWHEEL);
|
|
|
|
#ifdef GLOBAL_DIAG0_INT_PUSHPULL
|
|
|
|
//stepperX.set_pwm_symmetric(GLOBAL_PWM_SYMMETRIC);
|
|
|
|
#define _2130_set_diag0_int_pushpull(A) stepper##A.set_diag0_int_pushpull(GLOBAL_DIAG0_INT_PUSHPULL)
|
|
|
|
//stepperX.set_pwm_autoscale(GLOBAL_PWM_AUTOSCALE);
|
|
|
|
#else
|
|
|
|
//stepperX.set_pwm_freq(GLOBAL_PWM_FREQ);
|
|
|
|
#define _2130_set_diag0_int_pushpull(A) NOOP
|
|
|
|
//stepperX.set_PWM_GRAD(GLOBAL_PWM_GRAD);
|
|
|
|
#endif
|
|
|
|
//stepperX.set_PWM_AMPL(GLOBAL_PWM_AMPL);
|
|
|
|
#ifdef GLOBAL_DIAG1_INT_PUSHPULL
|
|
|
|
|
|
|
|
#define _2130_set_diag1_int_pushpull(A) stepper##A.set_diag1_int_pushpull(GLOBAL_DIAG1_INT_PUSHPULL)
|
|
|
|
//stepperX.set_ENCM_CTRL(GLOBAL_ENCM_CTRL);
|
|
|
|
#else
|
|
|
|
#endif
|
|
|
|
#define _2130_set_diag1_int_pushpull(A) NOOP
|
|
|
|
|
|
|
|
#endif
|
|
|
|
#if ENABLED(Y_IS_TMC2130)
|
|
|
|
#ifdef GLOBAL_SMALL_HYSTERESIS
|
|
|
|
stepperY.init();
|
|
|
|
#define _2130_set_small_hysteresis(A) stepper##A.set_small_hysteresis(GLOBAL_SMALL_HYSTERESIS)
|
|
|
|
stepperY.set_I_scale_analog(GLOBAL_I_SCALE_ANALOG);
|
|
|
|
#else
|
|
|
|
//stepperY.set_internal_Rsense(GLOBAL_INTERNAL_RSENSE);
|
|
|
|
#define _2130_set_small_hysteresis(A) NOOP
|
|
|
|
stepperY.set_en_pwm_mode(GLOBAL_EN_PWM_MODE);
|
|
|
|
#endif
|
|
|
|
//stepperY.set_enc_commutation(GLOBAL_ENC_COMMUTATION);
|
|
|
|
#ifdef GLOBAL_STOP_ENABLE
|
|
|
|
stepperY.set_shaft(GLOBAL_SHAFT);
|
|
|
|
#define _2130_set_stop_enable(A) stepper##A.set_stop_enable(GLOBAL_STOP_ENABLE)
|
|
|
|
//stepperY.set_diag0_error(GLOBAL_DIAG0_ERROR);
|
|
|
|
#else
|
|
|
|
//stepperY.set_diag0_otpw(GLOBAL_DIAG0_OTPW);
|
|
|
|
#define _2130_set_stop_enable(A) NOOP
|
|
|
|
//stepperY.set_diag0_stall(GLOBAL_DIAG0_STALL);
|
|
|
|
#endif
|
|
|
|
//stepperY.set_diag1_stall(GLOBAL_DIAG1_STALL);
|
|
|
|
#ifdef GLOBAL_DIRECT_MODE
|
|
|
|
//stepperY.set_diag1_index(GLOBAL_DIAG1_INDEX);
|
|
|
|
#define _2130_set_direct_mode(A) stepper##A.set_direct_mode(GLOBAL_DIRECT_MODE)
|
|
|
|
//stepperY.set_diag1_onstate(GLOBAL_DIAG1_ONSTATE);
|
|
|
|
#else
|
|
|
|
//stepperY.set_diag1_steps_skipped(GLOBAL_DIAG1_ONSTATE);
|
|
|
|
#define _2130_set_direct_mode(A) NOOP
|
|
|
|
//stepperY.set_diag0_int_pushpull(GLOBAL_DIAG0_INT_PUSHPULL);
|
|
|
|
#endif
|
|
|
|
//stepperY.set_diag1_int_pushpull(GLOBAL_DIAG1_INT_PUSHPULL);
|
|
|
|
#if defined(GLOBAL_IHOLD) && defined(GLOBAL_IRUN) && defined(GLOBAL_IHOLDDELAY)
|
|
|
|
//stepperY.set_small_hysteresis(GLOBAL_SMALL_HYSTERESIS);
|
|
|
|
#define _2130_set_IHOLD_IRUN(A) stepper##A.set_IHOLD_IRUN(GLOBAL_IHOLD, GLOBAL_IRUN, GLOBAL_IHOLDDELAY)
|
|
|
|
//stepperY.set_stop_enable(GLOBAL_STOP_ENABLE);
|
|
|
|
#else
|
|
|
|
//stepperY.set_direct_mode(GLOBAL_DIRECT_MODE);
|
|
|
|
#define _2130_set_IHOLD_IRUN(A) NOOP
|
|
|
|
|
|
|
|
#endif
|
|
|
|
stepperY.set_IHOLD_IRUN(GLOBAL_IHOLD,GLOBAL_IRUN,GLOBAL_IHOLDDELAY);
|
|
|
|
#ifdef GLOBAL_TPOWERDOWN
|
|
|
|
//stepperY.set_TPOWERDOWN(GLOBAL_TPOWERDOWN);
|
|
|
|
#define _2130_set_TPOWERDOWN(A) stepper##A.set_TPOWERDOWN(GLOBAL_TPOWERDOWN)
|
|
|
|
//stepperY.set_TPWMTHRS(GLOBAL_TPWMTHRS);
|
|
|
|
#else
|
|
|
|
//stepperY.set_TCOOLTHRS(GLOBAL_TCOOLTHRS);
|
|
|
|
#define _2130_set_TPOWERDOWN(A) NOOP
|
|
|
|
stepperY.set_THIGH(GLOBAL_THIGH);
|
|
|
|
#endif
|
|
|
|
//stepperY.set_XDIRECT(GLOBAL_XDIRECT);
|
|
|
|
#ifdef GLOBAL_TPWMTHRS
|
|
|
|
//stepperY.set_VDCMIN(GLOBAL_VDCMIN);
|
|
|
|
#define _2130_set_TPWMTHRS(A) stepper##A.set_TPWMTHRS(GLOBAL_TPWMTHRS)
|
|
|
|
|
|
|
|
#else
|
|
|
|
//stepperY.set_dedge(GLOBAL_DEDGE);
|
|
|
|
#define _2130_set_TPWMTHRS(A) NOOP
|
|
|
|
//stepperY.set_diss2g(GLOBAL_DISS2G);
|
|
|
|
#endif
|
|
|
|
stepperY.set_intpol(GLOBAL_INTPOL);
|
|
|
|
#ifdef GLOBAL_TCOOLTHRS
|
|
|
|
stepperY.set_mres(GLOBAL_MRES);
|
|
|
|
#define _2130_set_TCOOLTHRS(A) stepper##A.set_TCOOLTHRS(GLOBAL_TCOOLTHRS)
|
|
|
|
stepperY.set_sync(GLOBAL_SYNC);
|
|
|
|
#else
|
|
|
|
stepperY.set_vhighchm(GLOBAL_VHIGHCHM);
|
|
|
|
#define _2130_set_TCOOLTHRS(A) NOOP
|
|
|
|
stepperY.set_vhighfs(GLOBAL_VHIGHFS);
|
|
|
|
#endif
|
|
|
|
//stepperY.set_vsense(GLOBAL_VSENSE);
|
|
|
|
#ifdef GLOBAL_THIGH
|
|
|
|
stepperY.set_tbl(GLOBAL_TBL);
|
|
|
|
#define _2130_set_THIGH(A) stepper##A.set_THIGH(GLOBAL_THIGH)
|
|
|
|
stepperY.set_chm(GLOBAL_CHM);
|
|
|
|
#else
|
|
|
|
//stepperY.set_rndtf(GLOBAL_RNDTF);
|
|
|
|
#define _2130_set_THIGH(A) NOOP
|
|
|
|
//stepperY.set_disfdcc(GLOBAL_DISFDCC);
|
|
|
|
#endif
|
|
|
|
//stepperY.set_fd(GLOBAL_FD);
|
|
|
|
#ifdef GLOBAL_XDIRECT
|
|
|
|
//stepperY.set_hend(GLOBAL_HEND);
|
|
|
|
#define _2130_set_XDIRECT(A) stepper##A.set_XDIRECT(GLOBAL_XDIRECT)
|
|
|
|
//stepperY.set_hstrt(GLOBAL_HSTRT);
|
|
|
|
#else
|
|
|
|
stepperY.set_toff(GLOBAL_TOFF);
|
|
|
|
#define _2130_set_XDIRECT(A) NOOP
|
|
|
|
|
|
|
|
#endif
|
|
|
|
//stepperY.set_sfilt(GLOBAL_SFILT);
|
|
|
|
#ifdef GLOBAL_VDCMIN
|
|
|
|
//stepperY.set_sgt(GLOBAL_SGT);
|
|
|
|
#define _2130_set_VDCMIN(A) stepper##A.set_VDCMIN(GLOBAL_VDCMIN)
|
|
|
|
//stepperY.set_seimin(GLOBAL_SEIMIN);
|
|
|
|
#else
|
|
|
|
//stepperY.set_sedn(GLOBAL_SEDN);
|
|
|
|
#define _2130_set_VDCMIN(A) NOOP
|
|
|
|
//stepperY.set_semax(GLOBAL_SEMAX);
|
|
|
|
#endif
|
|
|
|
//stepperY.set_seup(GLOBAL_SEUP);
|
|
|
|
#ifdef GLOBAL_DEDGE
|
|
|
|
//stepperY.set_semin(GLOBAL_SEMIN);
|
|
|
|
#define _2130_set_dedge(A) stepper##A.set_dedge(GLOBAL_DEDGE)
|
|
|
|
|
|
|
|
#else
|
|
|
|
//stepperY.set_DCCTRL(GLOBAL_DC_TIME, GLOBAL_DC_SG);
|
|
|
|
#define _2130_set_dedge(A) NOOP
|
|
|
|
|
|
|
|
#endif
|
|
|
|
//stepperY.set_freewheel(GLOBAL_FREEWHEEL);
|
|
|
|
#ifdef GLOBAL_DISS2G
|
|
|
|
//stepperY.set_pwm_symmetric(GLOBAL_PWM_SYMMETRIC);
|
|
|
|
#define _2130_set_diss2g(A) stepper##A.set_diss2g(GLOBAL_DISS2G)
|
|
|
|
//stepperY.set_pwm_autoscale(GLOBAL_PWM_AUTOSCALE);
|
|
|
|
#else
|
|
|
|
//stepperY.set_pwm_freq(GLOBAL_PWM_FREQ);
|
|
|
|
#define _2130_set_diss2g(A) NOOP
|
|
|
|
//stepperY.set_PWM_GRAD(GLOBAL_PWM_GRAD);
|
|
|
|
#endif
|
|
|
|
//stepperY.set_PWM_AMPL(GLOBAL_PWM_AMPL);
|
|
|
|
#ifdef GLOBAL_INTPOL
|
|
|
|
|
|
|
|
#define _2130_set_intpol(A) stepper##A.set_intpol(GLOBAL_INTPOL)
|
|
|
|
//stepperY.set_ENCM_CTRL(GLOBAL_ENCM_CTRL);
|
|
|
|
#else
|
|
|
|
#endif
|
|
|
|
#define _2130_set_intpol(A) NOOP
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef GLOBAL_MRES
|
|
|
|
|
|
|
|
#define _2130_set_mres(A) stepper##A.set_mres(GLOBAL_MRES)
|
|
|
|
|
|
|
|
#else
|
|
|
|
|
|
|
|
#define _2130_set_mres(A) NOOP
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef GLOBAL_SYNC
|
|
|
|
|
|
|
|
#define _2130_set_sync(A) stepper##A.set_sync(GLOBAL_SYNC)
|
|
|
|
|
|
|
|
#else
|
|
|
|
|
|
|
|
#define _2130_set_sync(A) NOOP
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef GLOBAL_VHIGHCHM
|
|
|
|
|
|
|
|
#define _2130_set_vhighchm(A) stepper##A.set_vhighchm(GLOBAL_VHIGHCHM)
|
|
|
|
|
|
|
|
#else
|
|
|
|
|
|
|
|
#define _2130_set_vhighchm(A) NOOP
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef GLOBAL_VHIGHFS
|
|
|
|
|
|
|
|
#define _2130_set_vhighfs(A) stepper##A.set_vhighfs(GLOBAL_VHIGHFS)
|
|
|
|
|
|
|
|
#else
|
|
|
|
|
|
|
|
#define _2130_set_vhighfs(A) NOOP
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef GLOBAL_VSENSE
|
|
|
|
|
|
|
|
#define _2130_set_vsense(A) stepper##A.set_vsense(GLOBAL_VSENSE)
|
|
|
|
|
|
|
|
#else
|
|
|
|
|
|
|
|
#define _2130_set_vsense(A) NOOP
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef GLOBAL_TBL
|
|
|
|
|
|
|
|
#define _2130_set_tbl(A) stepper##A.set_tbl(GLOBAL_TBL)
|
|
|
|
|
|
|
|
#else
|
|
|
|
|
|
|
|
#define _2130_set_tbl(A) NOOP
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef GLOBAL_CHM
|
|
|
|
|
|
|
|
#define _2130_set_chm(A) stepper##A.set_chm(GLOBAL_CHM)
|
|
|
|
|
|
|
|
#else
|
|
|
|
|
|
|
|
#define _2130_set_chm(A) NOOP
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef GLOBAL_RNDTF
|
|
|
|
|
|
|
|
#define _2130_set_rndtf(A) stepper##A.set_rndtf(GLOBAL_RNDTF)
|
|
|
|
|
|
|
|
#else
|
|
|
|
|
|
|
|
#define _2130_set_rndtf(A) NOOP
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef GLOBAL_DISFDCC
|
|
|
|
|
|
|
|
#define _2130_set_disfdcc(A) stepper##A.set_disfdcc(GLOBAL_DISFDCC)
|
|
|
|
|
|
|
|
#else
|
|
|
|
|
|
|
|
#define _2130_set_disfdcc(A) NOOP
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef GLOBAL_FD
|
|
|
|
|
|
|
|
#define _2130_set_fd(A) stepper##A.set_fd(GLOBAL_FD)
|
|
|
|
|
|
|
|
#else
|
|
|
|
|
|
|
|
#define _2130_set_fd(A) NOOP
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef GLOBAL_HEND
|
|
|
|
|
|
|
|
#define _2130_set_hend(A) stepper##A.set_hend(GLOBAL_HEND)
|
|
|
|
|
|
|
|
#else
|
|
|
|
|
|
|
|
#define _2130_set_hend(A) NOOP
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef GLOBAL_HSTRT
|
|
|
|
|
|
|
|
#define _2130_set_hstrt(A) stepper##A.set_hstrt(GLOBAL_HSTRT)
|
|
|
|
|
|
|
|
#else
|
|
|
|
|
|
|
|
#define _2130_set_hstrt(A) NOOP
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef GLOBAL_TOFF
|
|
|
|
|
|
|
|
#define _2130_set_toff(A) stepper##A.set_toff(GLOBAL_TOFF)
|
|
|
|
|
|
|
|
#else
|
|
|
|
|
|
|
|
#define _2130_set_toff(A) NOOP
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef GLOBAL_SFILT
|
|
|
|
|
|
|
|
#define _2130_set_sfilt(A) stepper##A.set_sfilt(GLOBAL_SFILT)
|
|
|
|
|
|
|
|
#else
|
|
|
|
|
|
|
|
#define _2130_set_sfilt(A) NOOP
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef GLOBAL_SGT
|
|
|
|
|
|
|
|
#define _2130_set_sgt(A) stepper##A.set_sgt(GLOBAL_SGT)
|
|
|
|
|
|
|
|
#else
|
|
|
|
|
|
|
|
#define _2130_set_sgt(A) NOOP
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef GLOBAL_SEIMIN
|
|
|
|
|
|
|
|
#define _2130_set_seimin(A) stepper##A.set_seimin(GLOBAL_SEIMIN)
|
|
|
|
|
|
|
|
#else
|
|
|
|
|
|
|
|
#define _2130_set_seimin(A) NOOP
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef GLOBAL_SEDN
|
|
|
|
|
|
|
|
#define _2130_set_sedn(A) stepper##A.set_sedn(GLOBAL_SEDN)
|
|
|
|
|
|
|
|
#else
|
|
|
|
|
|
|
|
#define _2130_set_sedn(A) NOOP
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef GLOBAL_SEMAX
|
|
|
|
|
|
|
|
#define _2130_set_semax(A) stepper##A.set_semax(GLOBAL_SEMAX)
|
|
|
|
|
|
|
|
#else
|
|
|
|
|
|
|
|
#define _2130_set_semax(A) NOOP
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef GLOBAL_SEUP
|
|
|
|
|
|
|
|
#define _2130_set_seup(A) stepper##A.set_seup(GLOBAL_SEUP)
|
|
|
|
|
|
|
|
#else
|
|
|
|
|
|
|
|
#define _2130_set_seup(A) NOOP
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef GLOBAL_SEMIN
|
|
|
|
|
|
|
|
#define _2130_set_semin(A) stepper##A.set_semin(GLOBAL_SEMIN)
|
|
|
|
|
|
|
|
#else
|
|
|
|
|
|
|
|
#define _2130_set_semin(A) NOOP
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#if defined(GLOBAL_DC_TIME) && defined(GLOBAL_DC_SG)
|
|
|
|
|
|
|
|
#define _2130_set_DCCTRL(A) stepper##A.set_DCCTRL(GLOBAL_DC_TIME, GLOBAL_DC_SG)
|
|
|
|
|
|
|
|
#else
|
|
|
|
|
|
|
|
#define _2130_set_DCCTRL(A) NOOP
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef GLOBAL_FREEWHEEL
|
|
|
|
|
|
|
|
#define _2130_set_freewheel(A) stepper##A.set_freewheel(GLOBAL_FREEWHEEL)
|
|
|
|
|
|
|
|
#else
|
|
|
|
|
|
|
|
#define _2130_set_freewheel(A) NOOP
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef GLOBAL_PWM_SYMMETRIC
|
|
|
|
|
|
|
|
#define _2130_set_pwm_symmetric(A) stepper##A.set_pwm_symmetric(GLOBAL_PWM_SYMMETRIC)
|
|
|
|
|
|
|
|
#else
|
|
|
|
|
|
|
|
#define _2130_set_pwm_symmetric(A) NOOP
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef GLOBAL_PWM_AUTOSCALE
|
|
|
|
|
|
|
|
#define _2130_set_pwm_autoscale(A) stepper##A.set_pwm_autoscale(GLOBAL_PWM_AUTOSCALE)
|
|
|
|
|
|
|
|
#else
|
|
|
|
|
|
|
|
#define _2130_set_pwm_autoscale(A) NOOP
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef GLOBAL_PWM_FREQ
|
|
|
|
|
|
|
|
#define _2130_set_pwm_freq(A) stepper##A.set_pwm_freq(GLOBAL_PWM_FREQ)
|
|
|
|
|
|
|
|
#else
|
|
|
|
|
|
|
|
#define _2130_set_pwm_freq(A) NOOP
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef GLOBAL_PWM_GRAD
|
|
|
|
|
|
|
|
#define _2130_set_PWM_GRAD(A) stepper##A.set_PWM_GRAD(GLOBAL_PWM_GRAD)
|
|
|
|
|
|
|
|
#else
|
|
|
|
|
|
|
|
#define _2130_set_PWM_GRAD(A) NOOP
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef GLOBAL_PWM_AMPL
|
|
|
|
|
|
|
|
#define _2130_set_PWM_AMPL(A) stepper##A.set_PWM_AMPL(GLOBAL_PWM_AMPL)
|
|
|
|
|
|
|
|
#else
|
|
|
|
|
|
|
|
#define _2130_set_PWM_AMPL(A) NOOP
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef GLOBAL_ENCM_CTRL
|
|
|
|
|
|
|
|
#define _2130_set_ENCM_CTRL(A) stepper##A.set_ENCM_CTRL(GLOBAL_ENCM_CTRL)
|
|
|
|
|
|
|
|
#else
|
|
|
|
|
|
|
|
#define _2130_set_ENCM_CTRL(A) NOOP
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#define _TMC2130_INIT(A) do{ \
|
|
|
|
|
|
|
|
stepper##A.init(); \
|
|
|
|
|
|
|
|
_2130_set_I_scale_analog(A); \
|
|
|
|
|
|
|
|
_2130_set_internal_Rsense(A); \
|
|
|
|
|
|
|
|
_2130_set_en_pwm_mode(A); \
|
|
|
|
|
|
|
|
_2130_set_enc_commutation(A); \
|
|
|
|
|
|
|
|
_2130_set_shaft(A); \
|
|
|
|
|
|
|
|
_2130_set_diag0_error(A); \
|
|
|
|
|
|
|
|
_2130_set_diag0_otpw(A); \
|
|
|
|
|
|
|
|
_2130_set_diag0_stall(A); \
|
|
|
|
|
|
|
|
_2130_set_diag1_stall(A); \
|
|
|
|
|
|
|
|
_2130_set_diag1_index(A); \
|
|
|
|
|
|
|
|
_2130_set_diag1_onstate(A); \
|
|
|
|
|
|
|
|
_2130_set_diag1_steps_skipped(A); \
|
|
|
|
|
|
|
|
_2130_set_diag0_int_pushpull(A); \
|
|
|
|
|
|
|
|
_2130_set_diag1_int_pushpull(A); \
|
|
|
|
|
|
|
|
_2130_set_small_hysteresis(A); \
|
|
|
|
|
|
|
|
_2130_set_stop_enable(A); \
|
|
|
|
|
|
|
|
_2130_set_direct_mode(A); \
|
|
|
|
|
|
|
|
_2130_set_IHOLD_IRUN(A); \
|
|
|
|
|
|
|
|
_2130_set_TPOWERDOWN(A); \
|
|
|
|
|
|
|
|
_2130_set_TPWMTHRS(A); \
|
|
|
|
|
|
|
|
_2130_set_TCOOLTHRS(A); \
|
|
|
|
|
|
|
|
_2130_set_THIGH(A); \
|
|
|
|
|
|
|
|
_2130_set_XDIRECT(A); \
|
|
|
|
|
|
|
|
_2130_set_VDCMIN(A); \
|
|
|
|
|
|
|
|
_2130_set_dedge(A); \
|
|
|
|
|
|
|
|
_2130_set_diss2g(A); \
|
|
|
|
|
|
|
|
_2130_set_intpol(A); \
|
|
|
|
|
|
|
|
_2130_set_mres(A); \
|
|
|
|
|
|
|
|
_2130_set_sync(A); \
|
|
|
|
|
|
|
|
_2130_set_vhighchm(A); \
|
|
|
|
|
|
|
|
_2130_set_vhighfs(A); \
|
|
|
|
|
|
|
|
_2130_set_vsense(A); \
|
|
|
|
|
|
|
|
_2130_set_tbl(A); \
|
|
|
|
|
|
|
|
_2130_set_chm(A); \
|
|
|
|
|
|
|
|
_2130_set_rndtf(A); \
|
|
|
|
|
|
|
|
_2130_set_disfdcc(A); \
|
|
|
|
|
|
|
|
_2130_set_fd(A); \
|
|
|
|
|
|
|
|
_2130_set_hend(A); \
|
|
|
|
|
|
|
|
_2130_set_hstrt(A); \
|
|
|
|
|
|
|
|
_2130_set_toff(A); \
|
|
|
|
|
|
|
|
_2130_set_sfilt(A); \
|
|
|
|
|
|
|
|
_2130_set_sgt(A); \
|
|
|
|
|
|
|
|
_2130_set_seimin(A); \
|
|
|
|
|
|
|
|
_2130_set_sedn(A); \
|
|
|
|
|
|
|
|
_2130_set_semax(A); \
|
|
|
|
|
|
|
|
_2130_set_seup(A); \
|
|
|
|
|
|
|
|
_2130_set_semin(A); \
|
|
|
|
|
|
|
|
_2130_set_DCCTRL(A); \
|
|
|
|
|
|
|
|
_2130_set_freewheel(A); \
|
|
|
|
|
|
|
|
_2130_set_pwm_symmetric(A); \
|
|
|
|
|
|
|
|
_2130_set_pwm_autoscale(A); \
|
|
|
|
|
|
|
|
_2130_set_pwm_freq(A); \
|
|
|
|
|
|
|
|
_2130_set_PWM_GRAD(A); \
|
|
|
|
|
|
|
|
_2130_set_PWM_AMPL(A); \
|
|
|
|
|
|
|
|
_2130_set_ENCM_CTRL(A); \
|
|
|
|
|
|
|
|
} while(0)
|
|
|
|
|
|
|
|
|
|
|
|
#else // !TMC2130_ADVANCED_CONFIGURATION
|
|
|
|
#else // !TMC2130_ADVANCED_CONFIGURATION
|
|
|
|
|
|
|
|
|
|
|
|
void tmc2130_init() {
|
|
|
|
#define _TMC2130_INIT(A) do{ \
|
|
|
|
#if ENABLED(X_IS_TMC2130)
|
|
|
|
stepper##A.init(); \
|
|
|
|
stepperX.init();
|
|
|
|
stepper##A.set_mres(A##_MRES); \
|
|
|
|
stepperX.set_mres(X_MRES);
|
|
|
|
stepper##A.set_IHOLD_IRUN(A##_IHOLD, A##_IRUN, A##_IHOLDDELAY); \
|
|
|
|
stepperX.set_IHOLD_IRUN(X_IHOLD,X_IRUN,X_IHOLDDELAY);
|
|
|
|
stepper##A.set_I_scale_analog(A##_I_SCALE_ANALOG); \
|
|
|
|
stepperX.set_I_scale_analog(X_ISCALE);
|
|
|
|
stepper##A.set_tbl(A##_TBL); \
|
|
|
|
stepperX.set_tbl(X_TBL);
|
|
|
|
stepper##A.set_toff(A##_TOFF); \
|
|
|
|
stepperX.set_toff(X_TOFF);
|
|
|
|
} while(0)
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#if ENABLED(X2_IS_TMC2130)
|
|
|
|
|
|
|
|
stepperX2.init();
|
|
|
|
|
|
|
|
stepperX2.set_mres(X2_MRES);
|
|
|
|
|
|
|
|
stepperX2.set_IHOLD_IRUN(X2_IHOLD,X2_IRUN,X2_IHOLDDELAY);
|
|
|
|
|
|
|
|
stepperX2.set_I_scale_analog(X2_ISCALE);
|
|
|
|
|
|
|
|
stepperX2.set_tbl(X2_TBL);
|
|
|
|
|
|
|
|
stepperX2.set_toff(X2_TOFF);
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#if ENABLED(Y_IS_TMC2130)
|
|
|
|
|
|
|
|
stepperY.init();
|
|
|
|
|
|
|
|
stepperY.set_mres(Y_MRES);
|
|
|
|
|
|
|
|
stepperY.set_IHOLD_IRUN(Y_IHOLD,Y_IRUN,Y_IHOLDDELAY);
|
|
|
|
|
|
|
|
stepperY.set_I_scale_analog(Y_ISCALE);
|
|
|
|
|
|
|
|
stepperY.set_tbl(Y_TBL);
|
|
|
|
|
|
|
|
stepperY.set_toff(Y_TOFF);
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#if ENABLED(Y2_IS_TMC2130)
|
|
|
|
|
|
|
|
stepperY2.init();
|
|
|
|
|
|
|
|
stepperY2.set_mres(Y2_MRES);
|
|
|
|
|
|
|
|
stepperY2.set_IHOLD_IRUN(Y2_IHOLD,Y2_IRUN,Y2_IHOLDDELAY);
|
|
|
|
|
|
|
|
stepperY2.set_I_scale_analog(Y2_ISCALE);
|
|
|
|
|
|
|
|
stepperY2.set_tbl(Y2_TBL);
|
|
|
|
|
|
|
|
stepperY2.set_toff(Y2_TOFF);
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#if ENABLED(Z_IS_TMC2130)
|
|
|
|
|
|
|
|
stepperZ.init();
|
|
|
|
|
|
|
|
stepperZ.set_mres(Z_MRES);
|
|
|
|
|
|
|
|
stepperZ.set_IHOLD_IRUN(Z_IHOLD,Z_IRUN,Z_IHOLDDELAY);
|
|
|
|
|
|
|
|
stepperZ.set_I_scale_analog(Z_ISCALE);
|
|
|
|
|
|
|
|
stepperZ.set_tbl(Z_TBL);
|
|
|
|
|
|
|
|
stepperZ.set_toff(Z_TOFF);
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#if ENABLED(Z2_IS_TMC2130)
|
|
|
|
|
|
|
|
stepperZ2.init();
|
|
|
|
|
|
|
|
stepperZ2.set_mres(Z2_MRES);
|
|
|
|
|
|
|
|
stepperZ2.set_IHOLD_IRUN(Z2_IHOLD,Z2_IRUN,Z2_IHOLDDELAY);
|
|
|
|
|
|
|
|
stepperZ2.set_I_scale_analog(Z2_ISCALE);
|
|
|
|
|
|
|
|
stepperZ2.set_tbl(Z2_TBL);
|
|
|
|
|
|
|
|
stepperZ2.set_toff(Z2_TOFF);
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#if ENABLED(E0_IS_TMC2130)
|
|
|
|
|
|
|
|
stepperE0.init();
|
|
|
|
|
|
|
|
stepperE0.set_mres(E0_MRES);
|
|
|
|
|
|
|
|
stepperE0.set_IHOLD_IRUN(E0_IHOLD,E0_IRUN,E0_IHOLDDELAY);
|
|
|
|
|
|
|
|
stepperE0.set_I_scale_analog(E0_ISCALE);
|
|
|
|
|
|
|
|
stepperE0.set_tbl(E0_TBL);
|
|
|
|
|
|
|
|
stepperE0.set_toff(E0_TOFF);
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#if ENABLED(E1_IS_TMC2130)
|
|
|
|
|
|
|
|
stepperE1.init();
|
|
|
|
|
|
|
|
stepperE1.set_mres(E1_MRES);
|
|
|
|
|
|
|
|
stepperE1.set_IHOLD_IRUN(E1_IHOLD,E1_IRUN,E1_IHOLDDELAY);
|
|
|
|
|
|
|
|
stepperE1.set_I_scale_analog(E1_ISCALE);
|
|
|
|
|
|
|
|
stepperE1.set_tbl(E1_TBL);
|
|
|
|
|
|
|
|
stepperE1.set_toff(E1_TOFF);
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#if ENABLED(E2_IS_TMC2130)
|
|
|
|
|
|
|
|
stepperE2.init();
|
|
|
|
|
|
|
|
stepperE2.set_mres(E2_MRES);
|
|
|
|
|
|
|
|
stepperE2.set_IHOLD_IRUN(E2_IHOLD,E2_IRUN,E2_IHOLDDELAY);
|
|
|
|
|
|
|
|
stepperE2.set_I_scale_analog(E2_ISCALE);
|
|
|
|
|
|
|
|
stepperE2.set_tbl(E2_TBL);
|
|
|
|
|
|
|
|
stepperE2.set_toff(E2_TOFF);
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#if ENABLED(E3_IS_TMC2130)
|
|
|
|
|
|
|
|
stepperE3.init();
|
|
|
|
|
|
|
|
stepperE3.set_mres(E3_MRES);
|
|
|
|
|
|
|
|
stepperE3.set_IHOLD_IRUN(E3_IHOLD,E3_IRUN,E3_IHOLDDELAY);
|
|
|
|
|
|
|
|
stepperE3.set_I_scale_analog(E3_ISCALE);
|
|
|
|
|
|
|
|
stepperE3.set_tbl(E3_TBL);
|
|
|
|
|
|
|
|
stepperE3.set_toff(E3_TOFF);
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#endif // TMC2130_ADVANCED_CONFIGURATION
|
|
|
|
#endif // TMC2130_ADVANCED_CONFIGURATION
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Stepper objects of TMC2310 steppers used
|
|
|
|
|
|
|
|
#if ENABLED(X_IS_TMC2130)
|
|
|
|
|
|
|
|
Trinamic_TMC2130 stepperX(X_CS_PIN);
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#if ENABLED(X2_IS_TMC2130)
|
|
|
|
|
|
|
|
Trinamic_TMC2130 stepperX2(X2_CS_PIN);
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#if ENABLED(Y_IS_TMC2130)
|
|
|
|
|
|
|
|
Trinamic_TMC2130 stepperY(Y_CS_PIN);
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#if ENABLED(Y2_IS_TMC2130)
|
|
|
|
|
|
|
|
Trinamic_TMC2130 stepperY2(Y2_CS_PINR);
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#if ENABLED(Z_IS_TMC2130)
|
|
|
|
|
|
|
|
Trinamic_TMC2130 stepperZ(Z_CS_PIN);
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#if ENABLED(Z2_IS_TMC2130)
|
|
|
|
|
|
|
|
Trinamic_TMC2130 stepperZ2(Z2_CS_PIN);
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#if ENABLED(E0_IS_TMC2130)
|
|
|
|
|
|
|
|
Trinamic_TMC2130 stepperE0(E0_CS_PIN);
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#if ENABLED(E1_IS_TMC2130)
|
|
|
|
|
|
|
|
Trinamic_TMC2130 stepperE1(E1_CS_PIN);
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#if ENABLED(E2_IS_TMC2130)
|
|
|
|
|
|
|
|
Trinamic_TMC2130 stepperE2(E2_CS_PIN);
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#if ENABLED(E3_IS_TMC2130)
|
|
|
|
|
|
|
|
Trinamic_TMC2130 stepperE3(E3_CS_PIN);
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void tmc2130_init() {
|
|
|
|
|
|
|
|
#if ENABLED(X_IS_TMC2130)
|
|
|
|
|
|
|
|
_TMC2130_INIT(X);
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#if ENABLED(X2_IS_TMC2130)
|
|
|
|
|
|
|
|
_TMC2130_INIT(X2);
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#if ENABLED(Y_IS_TMC2130)
|
|
|
|
|
|
|
|
_TMC2130_INIT(Y);
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#if ENABLED(Y2_IS_TMC2130)
|
|
|
|
|
|
|
|
_TMC2130_INIT(Y2);
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#if ENABLED(Z_IS_TMC2130)
|
|
|
|
|
|
|
|
_TMC2130_INIT(Z);
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#if ENABLED(Z2_IS_TMC2130)
|
|
|
|
|
|
|
|
_TMC2130_INIT(Z2);
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#if ENABLED(E0_IS_TMC2130)
|
|
|
|
|
|
|
|
_TMC2130_INIT(E0);
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#if ENABLED(E1_IS_TMC2130)
|
|
|
|
|
|
|
|
_TMC2130_INIT(E1);
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#if ENABLED(E2_IS_TMC2130)
|
|
|
|
|
|
|
|
_TMC2130_INIT(E2);
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#if ENABLED(E3_IS_TMC2130)
|
|
|
|
|
|
|
|
_TMC2130_INIT(E3);
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
#endif // HAVE_TMC2130DRIVER
|
|
|
|
#endif // HAVE_TMC2130DRIVER
|
|
|
|
|
|
|
|
|
|
|
|
// L6470 Driver objects and inits
|
|
|
|
// L6470 Driver objects and inits
|
|
|
|