TMC2130 Library: @teemuatlut replaces @makertum

This commit is contained in:
Scott Lahteine
2017-03-06 23:00:43 -06:00
parent 33f8a8a344
commit 45f949d833
8 changed files with 570 additions and 679 deletions

View File

@ -53,10 +53,8 @@
void tmc_init();
#endif
// TMC130 drivers have STEP/DIR/ENABLE on normal pins
#if ENABLED(HAVE_TMC2130DRIVER)
#include <SPI.h>
#include <Trinamic_TMC2130.h>
#if ENABLED(HAVE_TMC2130)
#include <TMC2130Stepper.h>
void tmc2130_init();
#endif
@ -83,8 +81,8 @@
#define X_ENABLE_WRITE(STATE) stepperX.setEnabled(STATE)
#define X_ENABLE_READ stepperX.isEnabled()
#else
#if ENABLED(HAVE_TMC2130DRIVER) && ENABLED(X_IS_TMC2130)
extern Trinamic_TMC2130 stepperX;
#if ENABLED(HAVE_TMC2130) && ENABLED(X_IS_TMC2130)
extern TMC2130Stepper stepperX;
#endif
#define X_ENABLE_INIT SET_OUTPUT(X_ENABLE_PIN)
#define X_ENABLE_WRITE(STATE) WRITE(X_ENABLE_PIN,STATE)
@ -114,8 +112,8 @@
#define Y_ENABLE_WRITE(STATE) stepperY.setEnabled(STATE)
#define Y_ENABLE_READ stepperY.isEnabled()
#else
#if ENABLED(HAVE_TMC2130DRIVER) && ENABLED(Y_IS_TMC2130)
extern Trinamic_TMC2130 stepperY;
#if ENABLED(HAVE_TMC2130) && ENABLED(Y_IS_TMC2130)
extern TMC2130Stepper stepperY;
#endif
#define Y_ENABLE_INIT SET_OUTPUT(Y_ENABLE_PIN)
#define Y_ENABLE_WRITE(STATE) WRITE(Y_ENABLE_PIN,STATE)
@ -145,8 +143,8 @@
#define Z_ENABLE_WRITE(STATE) stepperZ.setEnabled(STATE)
#define Z_ENABLE_READ stepperZ.isEnabled()
#else
#if ENABLED(HAVE_TMC2130DRIVER) && ENABLED(Z_IS_TMC2130)
extern Trinamic_TMC2130 stepperZ;
#if ENABLED(HAVE_TMC2130) && ENABLED(Z_IS_TMC2130)
extern TMC2130Stepper stepperZ;
#endif
#define Z_ENABLE_INIT SET_OUTPUT(Z_ENABLE_PIN)
#define Z_ENABLE_WRITE(STATE) WRITE(Z_ENABLE_PIN,STATE)
@ -177,8 +175,8 @@
#define X2_ENABLE_WRITE(STATE) stepperX2.setEnabled(STATE)
#define X2_ENABLE_READ stepperX2.isEnabled()
#else
#if ENABLED(HAVE_TMC2130DRIVER) && ENABLED(X2_IS_TMC2130)
extern Trinamic_TMC2130 stepperX2;
#if ENABLED(HAVE_TMC2130) && ENABLED(X2_IS_TMC2130)
extern TMC2130Stepper stepperX2;
#endif
#define X2_ENABLE_INIT SET_OUTPUT(X2_ENABLE_PIN)
#define X2_ENABLE_WRITE(STATE) WRITE(X2_ENABLE_PIN,STATE)
@ -210,8 +208,8 @@
#define Y2_ENABLE_WRITE(STATE) stepperY2.setEnabled(STATE)
#define Y2_ENABLE_READ stepperY2.isEnabled()
#else
#if ENABLED(HAVE_TMC2130DRIVER) && ENABLED(Y2_IS_TMC2130)
extern Trinamic_TMC2130 stepperY2;
#if ENABLED(HAVE_TMC2130) && ENABLED(Y2_IS_TMC2130)
extern TMC2130Stepper stepperY2;
#endif
#define Y2_ENABLE_INIT SET_OUTPUT(Y2_ENABLE_PIN)
#define Y2_ENABLE_WRITE(STATE) WRITE(Y2_ENABLE_PIN,STATE)
@ -243,8 +241,8 @@
#define Z2_ENABLE_WRITE(STATE) stepperZ2.setEnabled(STATE)
#define Z2_ENABLE_READ stepperZ2.isEnabled()
#else
#if ENABLED(HAVE_TMC2130DRIVER) && ENABLED(Z2_IS_TMC2130)
extern Trinamic_TMC2130 stepperZ2;
#if ENABLED(HAVE_TMC2130) && ENABLED(Z2_IS_TMC2130)
extern TMC2130Stepper stepperZ2;
#endif
#define Z2_ENABLE_INIT SET_OUTPUT(Z2_ENABLE_PIN)
#define Z2_ENABLE_WRITE(STATE) WRITE(Z2_ENABLE_PIN,STATE)
@ -275,8 +273,8 @@
#define E0_ENABLE_WRITE(STATE) stepperE0.setEnabled(STATE)
#define E0_ENABLE_READ stepperE0.isEnabled()
#else
#if ENABLED(HAVE_TMC2130DRIVER) && ENABLED(E0_IS_TMC2130)
extern Trinamic_TMC2130 stepperE0;
#if ENABLED(HAVE_TMC2130) && ENABLED(E0_IS_TMC2130)
extern TMC2130Stepper stepperE0;
#endif
#define E0_ENABLE_INIT SET_OUTPUT(E0_ENABLE_PIN)
#define E0_ENABLE_WRITE(STATE) WRITE(E0_ENABLE_PIN,STATE)
@ -306,8 +304,8 @@
#define E1_ENABLE_WRITE(STATE) stepperE1.setEnabled(STATE)
#define E1_ENABLE_READ stepperE1.isEnabled()
#else
#if ENABLED(HAVE_TMC2130DRIVER) && ENABLED(E1_IS_TMC2130)
extern Trinamic_TMC2130 stepperE1;
#if ENABLED(HAVE_TMC2130) && ENABLED(E1_IS_TMC2130)
extern TMC2130Stepper stepperE1;
#endif
#define E1_ENABLE_INIT SET_OUTPUT(E1_ENABLE_PIN)
#define E1_ENABLE_WRITE(STATE) WRITE(E1_ENABLE_PIN,STATE)
@ -337,8 +335,8 @@
#define E2_ENABLE_WRITE(STATE) stepperE2.setEnabled(STATE)
#define E2_ENABLE_READ stepperE2.isEnabled()
#else
#if ENABLED(HAVE_TMC2130DRIVER) && ENABLED(E2_IS_TMC2130)
extern Trinamic_TMC2130 stepperE2;
#if ENABLED(HAVE_TMC2130) && ENABLED(E2_IS_TMC2130)
extern TMC2130Stepper stepperE2;
#endif
#define E2_ENABLE_INIT SET_OUTPUT(E2_ENABLE_PIN)
#define E2_ENABLE_WRITE(STATE) WRITE(E2_ENABLE_PIN,STATE)
@ -368,8 +366,8 @@
#define E3_ENABLE_WRITE(STATE) stepperE3.setEnabled(STATE)
#define E3_ENABLE_READ stepperE3.isEnabled()
#else
#if ENABLED(HAVE_TMC2130DRIVER) && ENABLED(E3_IS_TMC2130)
extern Trinamic_TMC2130 stepperE3;
#if ENABLED(HAVE_TMC2130) && ENABLED(E3_IS_TMC2130)
extern TMC2130Stepper stepperE3;
#endif
#define E3_ENABLE_INIT SET_OUTPUT(E3_ENABLE_PIN)
#define E3_ENABLE_WRITE(STATE) WRITE(E3_ENABLE_PIN,STATE)