Prusa MINI Firmware overview
|
Go to the documentation of this file.
29 #include <TMCStepper.h>
30 #if TMCSTEPPER_VERSION < 0x000500
31 #error "Update TMCStepper library to 0.5.0 or newer."
34 #include "../../inc/MarlinConfig.h"
35 #include "../../feature/tmc_util.h"
37 #define ____TMC_CLASS(MODEL, A, I, E) TMCMarlin<TMC##MODEL##Stepper, A, I, E>
38 #define ___TMC_CLASS(MODEL, A, I, E) ____TMC_CLASS(MODEL, A, I, E)
39 #define __TMC_CLASS(MODEL, A, I, E) ___TMC_CLASS(_##MODEL, A, I, E)
40 #define _TMC_CLASS(MODEL, L, E) __TMC_CLASS(MODEL, L, E)
41 #define TMC_CLASS(ST, A) _TMC_CLASS(ST##_DRIVER_TYPE, TMC_##ST##_LABEL, A##_AXIS)
42 #if ENABLED(DISTINCT_E_FACTORS)
43 #define TMC_CLASS_E(I) TMC_CLASS(E##I, E##I)
45 #define TMC_CLASS_E(I) TMC_CLASS(E##I, E)
57 void tmc_serial_begin();
63 #define AXIS_HAS_SQUARE_WAVE(A) (AXIS_IS_TMC(A) && ENABLED(SQUARE_WAVE_STEPPING))
68 #if ENABLED(SOFTWARE_DRIVER_ENABLE)
69 #define X_ENABLE_INIT NOOP
70 #define X_ENABLE_WRITE(STATE) stepperX.toff((STATE)==X_ENABLE_ON ? chopper_timing.toff : 0)
71 #define X_ENABLE_READ() stepperX.isEnabled()
73 #if AXIS_HAS_SQUARE_WAVE(X)
74 #define X_STEP_WRITE(STATE) do{ if(STATE) TOGGLE(X_STEP_PIN); }while(0)
81 #if ENABLED(SOFTWARE_DRIVER_ENABLE)
82 #define Y_ENABLE_INIT NOOP
83 #define Y_ENABLE_WRITE(STATE) stepperY.toff((STATE)==Y_ENABLE_ON ? chopper_timing.toff : 0)
84 #define Y_ENABLE_READ() stepperY.isEnabled()
86 #if AXIS_HAS_SQUARE_WAVE(Y)
87 #define Y_STEP_WRITE(STATE) do{ if (STATE) TOGGLE(Y_STEP_PIN); }while(0)
94 #if ENABLED(SOFTWARE_DRIVER_ENABLE)
95 #define Z_ENABLE_INIT NOOP
96 #define Z_ENABLE_WRITE(STATE) stepperZ.toff((STATE)==Z_ENABLE_ON ? chopper_timing.toff : 0)
97 #define Z_ENABLE_READ() stepperZ.isEnabled()
99 #if AXIS_HAS_SQUARE_WAVE(Z)
100 #define Z_STEP_WRITE(STATE) do{ if(STATE) TOGGLE(Z_STEP_PIN); }while(0)
105 #if HAS_X2_ENABLE && AXIS_IS_TMC(X2)
107 #if ENABLED(SOFTWARE_DRIVER_ENABLE)
108 #define X2_ENABLE_INIT NOOP
109 #define X2_ENABLE_WRITE(STATE) stepperX2.toff((STATE)==X_ENABLE_ON ? chopper_timing.toff : 0)
110 #define X2_ENABLE_READ() stepperX2.isEnabled()
112 #if AXIS_HAS_SQUARE_WAVE(X2)
113 #define X2_STEP_WRITE(STATE) do{ if(STATE) TOGGLE(X2_STEP_PIN); }while(0)
118 #if HAS_Y2_ENABLE && AXIS_IS_TMC(Y2)
120 #if ENABLED(SOFTWARE_DRIVER_ENABLE)
121 #define Y2_ENABLE_INIT NOOP
122 #define Y2_ENABLE_WRITE(STATE) stepperY2.toff((STATE)==Y_ENABLE_ON ? chopper_timing.toff : 0)
123 #define Y2_ENABLE_READ() stepperY2.isEnabled()
125 #if AXIS_HAS_SQUARE_WAVE(Y2)
126 #define Y2_STEP_WRITE(STATE) do{ if(STATE) TOGGLE(Y2_STEP_PIN); }while(0)
131 #if HAS_Z2_ENABLE && AXIS_IS_TMC(Z2)
133 #if ENABLED(SOFTWARE_DRIVER_ENABLE) && AXIS_IS_TMC(Z2)
134 #define Z2_ENABLE_INIT NOOP
135 #define Z2_ENABLE_WRITE(STATE) stepperZ2.toff((STATE)==Z_ENABLE_ON ? chopper_timing.toff : 0)
136 #define Z2_ENABLE_READ() stepperZ2.isEnabled()
138 #if AXIS_HAS_SQUARE_WAVE(Z2)
139 #define Z2_STEP_WRITE(STATE) do{ if(STATE) TOGGLE(Z2_STEP_PIN); }while(0)
144 #if HAS_Z3_ENABLE && AXIS_IS_TMC(Z3)
146 #if ENABLED(SOFTWARE_DRIVER_ENABLE)
147 #define Z3_ENABLE_INIT NOOP
148 #define Z3_ENABLE_WRITE(STATE) stepperZ3.toff((STATE)==Z_ENABLE_ON ? chopper_timing.toff : 0)
149 #define Z3_ENABLE_READ() stepperZ3.isEnabled()
151 #if AXIS_HAS_SQUARE_WAVE(Z3)
152 #define Z3_STEP_WRITE(STATE) do{ if(STATE) TOGGLE(Z3_STEP_PIN); }while(0)
159 #if ENABLED(SOFTWARE_DRIVER_ENABLE) && AXIS_IS_TMC(E0)
160 #define E0_ENABLE_INIT NOOP
161 #define E0_ENABLE_WRITE(STATE) stepperE0.toff((STATE)==E_ENABLE_ON ? chopper_timing.toff : 0)
162 #define E0_ENABLE_READ() stepperE0.isEnabled()
164 #if AXIS_HAS_SQUARE_WAVE(E0)
165 #define E0_STEP_WRITE(STATE) do{ if(STATE) TOGGLE(E0_STEP_PIN); }while(0)
172 #if ENABLED(SOFTWARE_DRIVER_ENABLE) && AXIS_IS_TMC(E1)
173 #define E1_ENABLE_INIT NOOP
174 #define E1_ENABLE_WRITE(STATE) stepperE1.toff((STATE)==E_ENABLE_ON ? chopper_timing.toff : 0)
175 #define E1_ENABLE_READ() stepperE1.isEnabled()
177 #if AXIS_HAS_SQUARE_WAVE(E1)
178 #define E1_STEP_WRITE(STATE) do{ if(STATE) TOGGLE(E1_STEP_PIN); }while(0)
185 #if ENABLED(SOFTWARE_DRIVER_ENABLE) && AXIS_IS_TMC(E2)
186 #define E2_ENABLE_INIT NOOP
187 #define E2_ENABLE_WRITE(STATE) stepperE2.toff((STATE)==E_ENABLE_ON ? chopper_timing.toff : 0)
188 #define E2_ENABLE_READ() stepperE2.isEnabled()
190 #if AXIS_HAS_SQUARE_WAVE(E2)
191 #define E2_STEP_WRITE(STATE) do{ if(STATE) TOGGLE(E2_STEP_PIN); }while(0)
198 #if ENABLED(SOFTWARE_DRIVER_ENABLE) && AXIS_IS_TMC(E3)
199 #define E3_ENABLE_INIT NOOP
200 #define E3_ENABLE_WRITE(STATE) stepperE3.toff((STATE)==E_ENABLE_ON ? chopper_timing.toff : 0)
201 #define E3_ENABLE_READ() stepperE3.isEnabled()
203 #if AXIS_HAS_SQUARE_WAVE(E3)
204 #define E3_STEP_WRITE(STATE) do{ if(STATE) TOGGLE(E3_STEP_PIN); }while(0)
211 #if ENABLED(SOFTWARE_DRIVER_ENABLE) && AXIS_IS_TMC(E4)
212 #define E4_ENABLE_INIT NOOP
213 #define E4_ENABLE_WRITE(STATE) stepperE4.toff((STATE)==E_ENABLE_ON ? chopper_timing.toff : 0)
214 #define E4_ENABLE_READ() stepperE4.isEnabled()
216 #if AXIS_HAS_SQUARE_WAVE(E4)
217 #define E4_STEP_WRITE(STATE) do{ if(STATE) TOGGLE(E4_STEP_PIN); }while(0)
224 #if ENABLED(SOFTWARE_DRIVER_ENABLE) && AXIS_IS_TMC(E5)
225 #define E5_ENABLE_INIT NOOP
226 #define E5_ENABLE_WRITE(STATE) stepperE5.toff((STATE)==E_ENABLE_ON ? chopper_timing.toff : 0)
227 #define E5_ENABLE_READ() stepperE5.isEnabled()
229 #if AXIS_HAS_SQUARE_WAVE(E5)
230 #define E5_STEP_WRITE(STATE) do{ if(STATE) TOGGLE(E5_STEP_PIN); }while(0)
#define PIN_X_DIR
Definition: hwio_pindef.h:18
#define PIN_E_DIR
Definition: hwio_pindef.h:33
uint8_t toff
Definition: trinamic.h:49
#define PIN_Z_DIAG
Definition: hwio_pindef.h:31
#define E0_HARDWARE_SERIAL
Definition: pins_FYSETC_CHEETAH.h:83
Definition: L6470_Marlin.h:30
Definition: L6470_Marlin.h:30
void tmc_set_move(uint8_t tmc, uint32_t step, uint8_t dir, uint8_t speed)
Stepper stepper
Definition: stepper.cpp:82
Definition: L6470_Marlin.h:30
Definition: trinamic.h:48
int8_t hend
Definition: trinamic.h:50
Definition: L6470_Marlin.h:30
#define Y_HARDWARE_SERIAL
Definition: pins_FYSETC_CHEETAH.h:81
Definition: L6470_Marlin.h:30
Definition: L6470_Marlin.h:30
static int gpio_get(uint8_t pin8)
Definition: gpio.h:94
Definition: L6470_Marlin.h:30
Definition: L6470_Marlin.h:30
Definition: L6470_Marlin.h:30
#define PIN_Y_DIAG
Definition: hwio_pindef.h:26
static void set_directions()
Definition: stepper.cpp:354
#define DBG
Definition: trinamic.cpp:9
#define PIN_Z_STEP
Definition: hwio_pindef.h:29
uint8_t hstrt
Definition: trinamic.h:51
#define PIN_Y_STEP
Definition: hwio_pindef.h:24
void restore_trinamic_drivers()
#define PIN_Y_DIR
Definition: hwio_pindef.h:23
const uint8_t[]
Definition: 404_html.c:3
Definition: L6470_Marlin.h:30
#define PIN_E_STEP
Definition: hwio_pindef.h:34
void delay(uint32_t ms)
Definition: wiring_time.c:42
#define PIN_X_STEP
Definition: hwio_pindef.h:19
#define TMC_CLASS_E(I)
Definition: trinamic.h:45
#define X_HARDWARE_SERIAL
Definition: pins_FYSETC_CHEETAH.h:80
#define Z_HARDWARE_SERIAL
Definition: pins_FYSETC_CHEETAH.h:82
#define PIN_E_DIAG
Definition: hwio_pindef.h:36
static void gpio_set(uint8_t pin8, int state)
Definition: gpio.h:98
Definition: L6470_Marlin.h:30
static constexpr chopper_timing_t chopper_timing
Definition: trinamic.h:54
#define PIN_X_DIAG
Definition: hwio_pindef.h:21
#define PIN_Z_DIR
Definition: hwio_pindef.h:28
Definition: L6470_Marlin.h:30
#define TMC_CLASS(ST, A)
Definition: trinamic.h:41
void tmc_set_sgthrs(uint8_t SGT)
Definition: L6470_Marlin.h:30
#define UNUSED(X)
Definition: stm32f4xx_hal_def.h:74
void reset_trinamic_drivers()