Browse Source

Updates for L64XX

Scott Lahteine 5 years ago
parent
commit
707349d492

+ 2
- 2
Marlin/src/gcode/calibrate/G28.cpp View File

530
     // Set L6470 absolute position registers to counts
530
     // Set L6470 absolute position registers to counts
531
     // constexpr *might* move this to PROGMEM.
531
     // constexpr *might* move this to PROGMEM.
532
     // If not, this will need a PROGMEM directive and an accessor.
532
     // If not, this will need a PROGMEM directive and an accessor.
533
-    static constexpr AxisEnum L6470_axis_xref[MAX_L6470] = {
533
+    static constexpr AxisEnum L64XX_axis_xref[MAX_L64XX] = {
534
       X_AXIS, Y_AXIS, Z_AXIS,
534
       X_AXIS, Y_AXIS, Z_AXIS,
535
       X_AXIS, Y_AXIS, Z_AXIS, Z_AXIS,
535
       X_AXIS, Y_AXIS, Z_AXIS, Z_AXIS,
536
       E_AXIS, E_AXIS, E_AXIS, E_AXIS, E_AXIS, E_AXIS
536
       E_AXIS, E_AXIS, E_AXIS, E_AXIS, E_AXIS, E_AXIS
537
     };
537
     };
538
     for (uint8_t j = 1; j <= L64XX::chain[0]; j++) {
538
     for (uint8_t j = 1; j <= L64XX::chain[0]; j++) {
539
       const uint8_t cv = L64XX::chain[j];
539
       const uint8_t cv = L64XX::chain[j];
540
-      L64xxManager.set_param((L64XX_axis_t)cv, L6470_ABS_POS, stepper.position(L6470_axis_xref[cv]));
540
+      L64xxManager.set_param((L64XX_axis_t)cv, L6470_ABS_POS, stepper.position(L64XX_axis_xref[cv]));
541
     }
541
     }
542
   #endif
542
   #endif
543
 }
543
 }

+ 15
- 15
Marlin/src/gcode/feature/L6470/M906.cpp View File

77
  *    KVAL_DEC
77
  *    KVAL_DEC
78
  *    Vs compensation (if enabled)
78
  *    Vs compensation (if enabled)
79
  */
79
  */
80
-void L6470_report_current(L64XX &motor, const L64XX_axis_t axis) {
80
+void L64XX_report_current(L64XX &motor, const L64XX_axis_t axis) {
81
 
81
 
82
   if (L64xxManager.spi_abort) return;  // don't do anything if set_directions() has occurred
82
   if (L64xxManager.spi_abort) return;  // don't do anything if set_directions() has occurred
83
 
83
 
303
   }
303
   }
304
 
304
 
305
   if (report_current) {
305
   if (report_current) {
306
-    #define L6470_REPORT_CURRENT(Q) L6470_report_current(stepper##Q, Q)
306
+    #define L64XX_REPORT_CURRENT(Q) L64XX_report_current(stepper##Q, Q)
307
 
307
 
308
     L64xxManager.spi_active = true; // Tell set_directions() a series of SPI transfers is underway
308
     L64xxManager.spi_active = true; // Tell set_directions() a series of SPI transfers is underway
309
 
309
 
310
     #if AXIS_IS_L64XX(X)
310
     #if AXIS_IS_L64XX(X)
311
-      L6470_REPORT_CURRENT(X);
311
+      L64XX_REPORT_CURRENT(X);
312
     #endif
312
     #endif
313
     #if AXIS_IS_L64XX(X2)
313
     #if AXIS_IS_L64XX(X2)
314
-      L6470_REPORT_CURRENT(X2);
314
+      L64XX_REPORT_CURRENT(X2);
315
     #endif
315
     #endif
316
     #if AXIS_IS_L64XX(Y)
316
     #if AXIS_IS_L64XX(Y)
317
-      L6470_REPORT_CURRENT(Y);
317
+      L64XX_REPORT_CURRENT(Y);
318
     #endif
318
     #endif
319
     #if AXIS_IS_L64XX(Y2)
319
     #if AXIS_IS_L64XX(Y2)
320
-      L6470_REPORT_CURRENT(Y2);
320
+      L64XX_REPORT_CURRENT(Y2);
321
     #endif
321
     #endif
322
     #if AXIS_IS_L64XX(Z)
322
     #if AXIS_IS_L64XX(Z)
323
-      L6470_REPORT_CURRENT(Z);
323
+      L64XX_REPORT_CURRENT(Z);
324
     #endif
324
     #endif
325
     #if AXIS_IS_L64XX(Z2)
325
     #if AXIS_IS_L64XX(Z2)
326
-      L6470_REPORT_CURRENT(Z2);
326
+      L64XX_REPORT_CURRENT(Z2);
327
     #endif
327
     #endif
328
     #if AXIS_IS_L64XX(Z3)
328
     #if AXIS_IS_L64XX(Z3)
329
-      L6470_REPORT_CURRENT(Z3);
329
+      L64XX_REPORT_CURRENT(Z3);
330
     #endif
330
     #endif
331
     #if AXIS_IS_L64XX(E0)
331
     #if AXIS_IS_L64XX(E0)
332
-      L6470_REPORT_CURRENT(E0);
332
+      L64XX_REPORT_CURRENT(E0);
333
     #endif
333
     #endif
334
     #if AXIS_IS_L64XX(E1)
334
     #if AXIS_IS_L64XX(E1)
335
-      L6470_REPORT_CURRENT(E1);
335
+      L64XX_REPORT_CURRENT(E1);
336
     #endif
336
     #endif
337
     #if AXIS_IS_L64XX(E2)
337
     #if AXIS_IS_L64XX(E2)
338
-      L6470_REPORT_CURRENT(E2);
338
+      L64XX_REPORT_CURRENT(E2);
339
     #endif
339
     #endif
340
     #if AXIS_IS_L64XX(E3)
340
     #if AXIS_IS_L64XX(E3)
341
-      L6470_REPORT_CURRENT(E3);
341
+      L64XX_REPORT_CURRENT(E3);
342
     #endif
342
     #endif
343
     #if AXIS_IS_L64XX(E4)
343
     #if AXIS_IS_L64XX(E4)
344
-      L6470_REPORT_CURRENT(E4);
344
+      L64XX_REPORT_CURRENT(E4);
345
     #endif
345
     #endif
346
     #if AXIS_IS_L64XX(E5)
346
     #if AXIS_IS_L64XX(E5)
347
-      L6470_REPORT_CURRENT(E5);
347
+      L64XX_REPORT_CURRENT(E5);
348
     #endif
348
     #endif
349
 
349
 
350
     L64xxManager.spi_active = false;   // done with all SPI transfers - clear handshake flags
350
     L64xxManager.spi_active = false;   // done with all SPI transfers - clear handshake flags

+ 5
- 1
Marlin/src/inc/Conditionals_post.h View File

1030
 #define HAS_Z_MIN_PROBE_PIN (HAS_CUSTOM_PROBE_PIN && PIN_EXISTS(Z_MIN_PROBE))
1030
 #define HAS_Z_MIN_PROBE_PIN (HAS_CUSTOM_PROBE_PIN && PIN_EXISTS(Z_MIN_PROBE))
1031
 #define HAS_CALIBRATION_PIN (PIN_EXISTS(CALIBRATION))
1031
 #define HAS_CALIBRATION_PIN (PIN_EXISTS(CALIBRATION))
1032
 
1032
 
1033
+//
1033
 // ADC Temp Sensors (Thermistor or Thermocouple with amplifier ADC interface)
1034
 // ADC Temp Sensors (Thermistor or Thermocouple with amplifier ADC interface)
1035
+//
1034
 #define HAS_ADC_TEST(P) (PIN_EXISTS(TEMP_##P) && TEMP_SENSOR_##P != 0 && DISABLED(HEATER_##P##_USES_MAX6675))
1036
 #define HAS_ADC_TEST(P) (PIN_EXISTS(TEMP_##P) && TEMP_SENSOR_##P != 0 && DISABLED(HEATER_##P##_USES_MAX6675))
1035
 #define HAS_TEMP_ADC_0        HAS_ADC_TEST(0)
1037
 #define HAS_TEMP_ADC_0        HAS_ADC_TEST(0)
1036
 #define HAS_TEMP_ADC_1        HAS_ADC_TEST(1)
1038
 #define HAS_TEMP_ADC_1        HAS_ADC_TEST(1)
1145
 #define HAS_DIGIPOTSS         (PIN_EXISTS(DIGIPOTSS))
1147
 #define HAS_DIGIPOTSS         (PIN_EXISTS(DIGIPOTSS))
1146
 #define HAS_MOTOR_CURRENT_PWM ANY_PIN(MOTOR_CURRENT_PWM_X, MOTOR_CURRENT_PWM_Y, MOTOR_CURRENT_PWM_XY, MOTOR_CURRENT_PWM_Z, MOTOR_CURRENT_PWM_E)
1148
 #define HAS_MOTOR_CURRENT_PWM ANY_PIN(MOTOR_CURRENT_PWM_X, MOTOR_CURRENT_PWM_Y, MOTOR_CURRENT_PWM_XY, MOTOR_CURRENT_PWM_Z, MOTOR_CURRENT_PWM_E)
1147
 
1149
 
1148
-#define HAS_MICROSTEPS (HAS_X_MICROSTEPS || HAS_X2_MICROSTEPS || HAS_Y_MICROSTEPS || HAS_Y2_MICROSTEPS || HAS_Z_MICROSTEPS || HAS_Z2_MICROSTEPS || HAS_Z3_MICROSTEPS || HAS_E0_MICROSTEPS || HAS_E1_MICROSTEPS || HAS_E2_MICROSTEPS || HAS_E3_MICROSTEPS || HAS_E4_MICROSTEPS || HAS_E5_MICROSTEPS)
1150
+#define HAS_SOME_Z_MICROSTEPS (HAS_Z_MICROSTEPS || HAS_Z2_MICROSTEPS || HAS_Z3_MICROSTEPS)
1151
+#define HAS_SOME_E_MICROSTEPS (HAS_E0_MICROSTEPS || HAS_E1_MICROSTEPS || HAS_E2_MICROSTEPS || HAS_E3_MICROSTEPS || HAS_E4_MICROSTEPS || HAS_E5_MICROSTEPS)
1152
+#define HAS_MICROSTEPS (HAS_X_MICROSTEPS || HAS_X2_MICROSTEPS || HAS_Y_MICROSTEPS || HAS_Y2_MICROSTEPS || HAS_SOME_Z_MICROSTEPS || HAS_SOME_E_MICROSTEPS)
1149
 
1153
 
1150
 #if HAS_MICROSTEPS
1154
 #if HAS_MICROSTEPS
1151
 
1155
 

+ 21
- 21
Marlin/src/libs/L64XX/L64XX_Marlin.cpp View File

39
 
39
 
40
 void echo_yes_no(const bool yes) { serialprintPGM(yes ? PSTR(" YES") : PSTR(" NO ")); }
40
 void echo_yes_no(const bool yes) { serialprintPGM(yes ? PSTR(" YES") : PSTR(" NO ")); }
41
 
41
 
42
-char L64XX_Marlin::index_to_axis[MAX_L6470][3] = { "X ", "Y ", "Z ", "X2", "Y2", "Z2", "Z3", "E0", "E1", "E2", "E3", "E4", "E5" };
42
+char L64XX_Marlin::index_to_axis[MAX_L64XX][3] = { "X ", "Y ", "Z ", "X2", "Y2", "Z2", "Z3", "E0", "E1", "E2", "E3", "E4", "E5" };
43
 
43
 
44
 #define DEBUG_OUT ENABLED(L6470_CHITCHAT)
44
 #define DEBUG_OUT ENABLED(L6470_CHITCHAT)
45
 #include "../../core/debug_out.h"
45
 #include "../../core/debug_out.h"
46
 
46
 
47
-uint8_t L64XX_Marlin::dir_commands[MAX_L6470];  // array to hold direction command for each driver
47
+uint8_t L64XX_Marlin::dir_commands[MAX_L64XX];  // array to hold direction command for each driver
48
 
48
 
49
-uint8_t L64XX_Marlin::index_to_dir[MAX_L6470] = { (INVERT_X_DIR)                        , //  0 X
50
-                                                  (INVERT_Y_DIR)                        , //  1 Y
51
-                                                  (INVERT_Z_DIR)                        , //  2 Z
52
-                                                  #if ENABLED(X_DUAL_STEPPER_DRIVERS)
53
-                                                    (INVERT_X_DIR) ^ (INVERT_X2_VS_X_DIR) , //  3 X2
49
+uint8_t L64XX_Marlin::index_to_dir[MAX_L64XX] = { (INVERT_X_DIR),                         //  0 X
50
+                                                  (INVERT_Y_DIR),                         //  1 Y
51
+                                                  (INVERT_Z_DIR),                         //  2 Z
52
+                                                  #if ENABLED(X_DUAL_STEPPER_DRIVERS)     //  3 X2
53
+                                                    (INVERT_X_DIR) ^ (INVERT_X2_VS_X_DIR),
54
                                                   #else
54
                                                   #else
55
-                                                    (INVERT_X_DIR)                      , //  3 X2
55
+                                                    (INVERT_X_DIR),
56
                                                   #endif
56
                                                   #endif
57
-                                                  #if ENABLED(Y_DUAL_STEPPER_DRIVERS)
58
-                                                    (INVERT_Y_DIR) ^ (INVERT_Y2_VS_Y_DIR) , //  4 Y2
57
+                                                  #if ENABLED(Y_DUAL_STEPPER_DRIVERS)     //  4 Y2
58
+                                                    (INVERT_Y_DIR) ^ (INVERT_Y2_VS_Y_DIR),
59
                                                   #else
59
                                                   #else
60
-                                                    (INVERT_Y_DIR)                      , //  4 Y2
60
+                                                    (INVERT_Y_DIR),
61
                                                   #endif
61
                                                   #endif
62
-                                                  (INVERT_Z_DIR)                        , //  5 Z2
63
-                                                  (INVERT_Z_DIR)                        , //  6 Z3
64
-                                                  (INVERT_E0_DIR)                       , //  7 E0
65
-                                                  (INVERT_E1_DIR)                       , //  8 E1
66
-                                                  (INVERT_E2_DIR)                       , //  9 E2
67
-                                                  (INVERT_E3_DIR)                       , // 10 E3
68
-                                                  (INVERT_E4_DIR)                       , // 11 E4
69
-                                                  (INVERT_E5_DIR)                       , // 12 E5
62
+                                                  (INVERT_Z_DIR),                         //  5 Z2
63
+                                                  (INVERT_Z_DIR),                         //  6 Z3
64
+                                                  (INVERT_E0_DIR),                        //  7 E0
65
+                                                  (INVERT_E1_DIR),                        //  8 E1
66
+                                                  (INVERT_E2_DIR),                        //  9 E2
67
+                                                  (INVERT_E3_DIR),                        // 10 E3
68
+                                                  (INVERT_E4_DIR),                        // 11 E4
69
+                                                  (INVERT_E5_DIR),                        // 12 E5
70
                                                 };
70
                                                 };
71
 
71
 
72
 volatile uint8_t L64XX_Marlin::spi_abort = false;
72
 volatile uint8_t L64XX_Marlin::spi_abort = false;
367
     uint8_t driver_count_local = 0;         // Can't use "driver_count" directly as a subscript because it's passed by reference
367
     uint8_t driver_count_local = 0;         // Can't use "driver_count" directly as a subscript because it's passed by reference
368
     if (axis_offset >= 2 || axis_mon[0][0] == 'E') {  // Single axis, E0, or E1
368
     if (axis_offset >= 2 || axis_mon[0][0] == 'E') {  // Single axis, E0, or E1
369
       axis_mon[0][1] = axis_offset + '0';
369
       axis_mon[0][1] = axis_offset + '0';
370
-      for (j = 0; j < MAX_L6470; j++) {       // See how many drivers on this axis
370
+      for (j = 0; j < MAX_L64XX; j++) {       // See how many drivers on this axis
371
         const char * const str = index_to_axis[j];
371
         const char * const str = index_to_axis[j];
372
         if (axis_mon[0][0] == str[0]) {
372
         if (axis_mon[0][0] == str[0]) {
373
           char * const mon = axis_mon[driver_count_local];
373
           char * const mon = axis_mon[driver_count_local];
380
       }
380
       }
381
     }
381
     }
382
     else if (axis_offset == 0) {              // One or more axes
382
     else if (axis_offset == 0) {              // One or more axes
383
-      for (j = 0; j < MAX_L6470; j++) {       // See how many drivers on this axis
383
+      for (j = 0; j < MAX_L64XX; j++) {       // See how many drivers on this axis
384
         const char * const str = index_to_axis[j];
384
         const char * const str = index_to_axis[j];
385
         if (axis_mon[0][0] == str[0]) {
385
         if (axis_mon[0][0] == str[0]) {
386
           char * const mon = axis_mon[driver_count_local];
386
           char * const mon = axis_mon[driver_count_local];

+ 4
- 6
Marlin/src/libs/L64XX/L64XX_Marlin.h View File

30
 
30
 
31
 #define L6470_GETPARAM(P,Q) stepper##Q.GetParam(P)
31
 #define L6470_GETPARAM(P,Q) stepper##Q.GetParam(P)
32
 
32
 
33
-#define MAX_L6470  (7 + MAX_EXTRUDERS) // Maximum number of axes in Marlin
34
-
35
 #define dSPIN_STEP_CLOCK      0x58
33
 #define dSPIN_STEP_CLOCK      0x58
36
 #define dSPIN_STEP_CLOCK_FWD dSPIN_STEP_CLOCK
34
 #define dSPIN_STEP_CLOCK_FWD dSPIN_STEP_CLOCK
37
 #define dSPIN_STEP_CLOCK_REV dSPIN_STEP_CLOCK+1
35
 #define dSPIN_STEP_CLOCK_REV dSPIN_STEP_CLOCK+1
38
 #define HAS_L64XX_EXTRUDER (AXIS_IS_L64XX(E0) || AXIS_IS_L64XX(E1) || AXIS_IS_L64XX(E2) || AXIS_IS_L64XX(E3) || AXIS_IS_L64XX(E4) || AXIS_IS_L64XX(E5))
36
 #define HAS_L64XX_EXTRUDER (AXIS_IS_L64XX(E0) || AXIS_IS_L64XX(E1) || AXIS_IS_L64XX(E2) || AXIS_IS_L64XX(E3) || AXIS_IS_L64XX(E4) || AXIS_IS_L64XX(E5))
39
 
37
 
40
-typedef enum : uint8_t { X, Y, Z, X2, Y2, Z2, Z3, E0, E1, E2, E3, E4, E5 } L64XX_axis_t;
38
+enum L64XX_axis_t : uint8_t { X, Y, Z, X2, Y2, Z2, Z3, E0, E1, E2, E3, E4, E5, MAX_L64XX };
41
 
39
 
42
 class L64XX_Marlin : public L64XXHelper {
40
 class L64XX_Marlin : public L64XXHelper {
43
 public:
41
 public:
44
-  static char index_to_axis[MAX_L6470][3];
42
+  static char index_to_axis[MAX_L64XX][3];
45
 
43
 
46
-  static uint8_t index_to_dir[MAX_L6470];
47
-  static uint8_t dir_commands[MAX_L6470];
44
+  static uint8_t index_to_dir[MAX_L64XX];
45
+  static uint8_t dir_commands[MAX_L64XX];
48
 
46
 
49
   // Flags to guarantee graceful switch if stepper interrupts L6470 SPI transfer
47
   // Flags to guarantee graceful switch if stepper interrupts L6470 SPI transfer
50
   static volatile uint8_t spi_abort;
48
   static volatile uint8_t spi_abort;

+ 1
- 1
Marlin/src/module/stepper.cpp View File

119
 
119
 
120
 #if HAS_L64XX
120
 #if HAS_L64XX
121
   #include "../libs/L64XX/L64XX_Marlin.h"
121
   #include "../libs/L64XX/L64XX_Marlin.h"
122
-  uint8_t L6470_buf[MAX_L6470 + 1];   // chip command sequence - element 0 not used
122
+  uint8_t L6470_buf[MAX_L64XX + 1];   // chip command sequence - element 0 not used
123
   bool L64XX_OK_to_power_up = false;  // flag to keep L64xx steppers powered down after a reset or power up
123
   bool L64XX_OK_to_power_up = false;  // flag to keep L64xx steppers powered down after a reset or power up
124
 #endif
124
 #endif
125
 
125
 

+ 78
- 78
Marlin/src/module/stepper/L64xx.h View File

44
 // X Stepper
44
 // X Stepper
45
 #if AXIS_IS_L64XX(X)
45
 #if AXIS_IS_L64XX(X)
46
   extern L64XX_CLASS(X)         stepperX;
46
   extern L64XX_CLASS(X)         stepperX;
47
-  #define X_ENABLE_INIT         NOOP
47
+  #define X_ENABLE_INIT()       NOOP
48
   #define X_ENABLE_WRITE(STATE) (STATE ? NOOP : stepperX.free())
48
   #define X_ENABLE_WRITE(STATE) (STATE ? NOOP : stepperX.free())
49
-  #define X_ENABLE_READ         (stepperX.getStatus() & STATUS_HIZ)
49
+  #define X_ENABLE_READ()       (stepperX.getStatus() & STATUS_HIZ)
50
   #if AXIS_DRIVER_TYPE_X(L6474)
50
   #if AXIS_DRIVER_TYPE_X(L6474)
51
-    #define X_DIR_INIT          SET_OUTPUT(X_DIR_PIN)
51
+    #define X_DIR_INIT()        SET_OUTPUT(X_DIR_PIN)
52
     #define X_DIR_WRITE(STATE)  L6474_DIR_WRITE(X, STATE)
52
     #define X_DIR_WRITE(STATE)  L6474_DIR_WRITE(X, STATE)
53
-    #define X_DIR_READ          READ(X_DIR_PIN)
53
+    #define X_DIR_READ()        READ(X_DIR_PIN)
54
   #else
54
   #else
55
-    #define X_DIR_INIT          NOOP
55
+    #define X_DIR_INIT()        NOOP
56
     #define X_DIR_WRITE(STATE)  L64XX_DIR_WRITE(X, STATE)
56
     #define X_DIR_WRITE(STATE)  L64XX_DIR_WRITE(X, STATE)
57
-    #define X_DIR_READ          (stepper##X.getStatus() & STATUS_DIR);
57
+    #define X_DIR_READ()        (stepper##X.getStatus() & STATUS_DIR);
58
   #endif
58
   #endif
59
 #endif
59
 #endif
60
 
60
 
61
 // Y Stepper
61
 // Y Stepper
62
 #if AXIS_IS_L64XX(Y)
62
 #if AXIS_IS_L64XX(Y)
63
   extern L64XX_CLASS(Y)         stepperY;
63
   extern L64XX_CLASS(Y)         stepperY;
64
-  #define Y_ENABLE_INIT         NOOP
64
+  #define Y_ENABLE_INIT()       NOOP
65
   #define Y_ENABLE_WRITE(STATE) (STATE ? NOOP : stepperY.free())
65
   #define Y_ENABLE_WRITE(STATE) (STATE ? NOOP : stepperY.free())
66
-  #define Y_ENABLE_READ         (stepperY.getStatus() & STATUS_HIZ)
66
+  #define Y_ENABLE_READ()       (stepperY.getStatus() & STATUS_HIZ)
67
   #if AXIS_DRIVER_TYPE_Y(L6474)
67
   #if AXIS_DRIVER_TYPE_Y(L6474)
68
-    #define Y_DIR_INIT          SET_OUTPUT(Y_DIR_PIN)
68
+    #define Y_DIR_INIT()        SET_OUTPUT(Y_DIR_PIN)
69
     #define Y_DIR_WRITE(STATE)  L6474_DIR_WRITE(Y, STATE)
69
     #define Y_DIR_WRITE(STATE)  L6474_DIR_WRITE(Y, STATE)
70
-    #define Y_DIR_READ          READ(Y_DIR_PIN)
70
+    #define Y_DIR_READ()        READ(Y_DIR_PIN)
71
   #else
71
   #else
72
-    #define Y_DIR_INIT          NOOP
72
+    #define Y_DIR_INIT()        NOOP
73
     #define Y_DIR_WRITE(STATE)  L64XX_DIR_WRITE(Y, STATE)
73
     #define Y_DIR_WRITE(STATE)  L64XX_DIR_WRITE(Y, STATE)
74
-    #define Y_DIR_READ          (stepper##Y.getStatus() & STATUS_DIR);
74
+    #define Y_DIR_READ()        (stepper##Y.getStatus() & STATUS_DIR);
75
   #endif
75
   #endif
76
 #endif
76
 #endif
77
 
77
 
78
 // Z Stepper
78
 // Z Stepper
79
 #if AXIS_IS_L64XX(Z)
79
 #if AXIS_IS_L64XX(Z)
80
   extern L64XX_CLASS(Z)         stepperZ;
80
   extern L64XX_CLASS(Z)         stepperZ;
81
-  #define Z_ENABLE_INIT         NOOP
81
+  #define Z_ENABLE_INIT()       NOOP
82
   #define Z_ENABLE_WRITE(STATE) (STATE ? NOOP : stepperZ.free())
82
   #define Z_ENABLE_WRITE(STATE) (STATE ? NOOP : stepperZ.free())
83
-  #define Z_ENABLE_READ         (stepperZ.getStatus() & STATUS_HIZ)
83
+  #define Z_ENABLE_READ()       (stepperZ.getStatus() & STATUS_HIZ)
84
   #if AXIS_DRIVER_TYPE_Z(L6474)
84
   #if AXIS_DRIVER_TYPE_Z(L6474)
85
-    #define Z_DIR_INIT          SET_OUTPUT(Z_DIR_PIN)
85
+    #define Z_DIR_INIT()        SET_OUTPUT(Z_DIR_PIN)
86
     #define Z_DIR_WRITE(STATE)  L6474_DIR_WRITE(Z, STATE)
86
     #define Z_DIR_WRITE(STATE)  L6474_DIR_WRITE(Z, STATE)
87
-    #define Z_DIR_READ          READ(Z_DIR_PIN)
87
+    #define Z_DIR_READ()        READ(Z_DIR_PIN)
88
   #else
88
   #else
89
-    #define Z_DIR_INIT          NOOP
89
+    #define Z_DIR_INIT()        NOOP
90
     #define Z_DIR_WRITE(STATE)  L64XX_DIR_WRITE(Z, STATE)
90
     #define Z_DIR_WRITE(STATE)  L64XX_DIR_WRITE(Z, STATE)
91
-    #define Z_DIR_READ          (stepper##Z.getStatus() & STATUS_DIR);
91
+    #define Z_DIR_READ()        (stepper##Z.getStatus() & STATUS_DIR);
92
   #endif
92
   #endif
93
 #endif
93
 #endif
94
 
94
 
95
 // X2 Stepper
95
 // X2 Stepper
96
 #if HAS_X2_ENABLE && AXIS_IS_L64XX(X2)
96
 #if HAS_X2_ENABLE && AXIS_IS_L64XX(X2)
97
   extern L64XX_CLASS(X2)         stepperX2;
97
   extern L64XX_CLASS(X2)         stepperX2;
98
-  #define X2_ENABLE_INIT         NOOP
98
+  #define X2_ENABLE_INIT()       NOOP
99
   #define X2_ENABLE_WRITE(STATE) (STATE ? NOOP : stepperX2.free())
99
   #define X2_ENABLE_WRITE(STATE) (STATE ? NOOP : stepperX2.free())
100
-  #define X2_ENABLE_READ         (stepperX2.getStatus() & STATUS_HIZ)
100
+  #define X2_ENABLE_READ()       (stepperX2.getStatus() & STATUS_HIZ)
101
   #if AXIS_DRIVER_TYPE_X2(L6474)
101
   #if AXIS_DRIVER_TYPE_X2(L6474)
102
-    #define X2_DIR_INIT          SET_OUTPUT(X2_DIR_PIN)
102
+    #define X2_DIR_INIT()        SET_OUTPUT(X2_DIR_PIN)
103
     #define X2_DIR_WRITE(STATE)  L6474_DIR_WRITE(X2, STATE)
103
     #define X2_DIR_WRITE(STATE)  L6474_DIR_WRITE(X2, STATE)
104
-    #define X2_DIR_READ          READ(X2_DIR_PIN)
104
+    #define X2_DIR_READ()        READ(X2_DIR_PIN)
105
   #else
105
   #else
106
-    #define X2_DIR_INIT          NOOP
106
+    #define X2_DIR_INIT()        NOOP
107
     #define X2_DIR_WRITE(STATE)  L64XX_DIR_WRITE(X2, STATE)
107
     #define X2_DIR_WRITE(STATE)  L64XX_DIR_WRITE(X2, STATE)
108
-    #define X2_DIR_READ          (stepper##X2.getStatus() & STATUS_DIR);
108
+    #define X2_DIR_READ()        (stepper##X2.getStatus() & STATUS_DIR);
109
   #endif
109
   #endif
110
 #endif
110
 #endif
111
 
111
 
112
 // Y2 Stepper
112
 // Y2 Stepper
113
 #if HAS_Y2_ENABLE && AXIS_IS_L64XX(Y2)
113
 #if HAS_Y2_ENABLE && AXIS_IS_L64XX(Y2)
114
   extern L64XX_CLASS(Y2)         stepperY2;
114
   extern L64XX_CLASS(Y2)         stepperY2;
115
-  #define Y2_ENABLE_INIT         NOOP
115
+  #define Y2_ENABLE_INIT()       NOOP
116
   #define Y2_ENABLE_WRITE(STATE) (STATE ? NOOP : stepperY2.free())
116
   #define Y2_ENABLE_WRITE(STATE) (STATE ? NOOP : stepperY2.free())
117
-  #define Y2_ENABLE_READ         (stepperY2.getStatus() & STATUS_HIZ)
117
+  #define Y2_ENABLE_READ()       (stepperY2.getStatus() & STATUS_HIZ)
118
   #if AXIS_DRIVER_TYPE_Y2(L6474)
118
   #if AXIS_DRIVER_TYPE_Y2(L6474)
119
-    #define Y2_DIR_INIT          SET_OUTPUT(Y2_DIR_PIN)
119
+    #define Y2_DIR_INIT()        SET_OUTPUT(Y2_DIR_PIN)
120
     #define Y2_DIR_WRITE(STATE)  L6474_DIR_WRITE(Y2, STATE)
120
     #define Y2_DIR_WRITE(STATE)  L6474_DIR_WRITE(Y2, STATE)
121
-    #define Y2_DIR_READ          READ(Y2_DIR_PIN)
121
+    #define Y2_DIR_READ()        READ(Y2_DIR_PIN)
122
   #else
122
   #else
123
-    #define Y2_DIR_INIT          NOOP
123
+    #define Y2_DIR_INIT()        NOOP
124
     #define Y2_DIR_WRITE(STATE)  L64XX_DIR_WRITE(Y2, STATE)
124
     #define Y2_DIR_WRITE(STATE)  L64XX_DIR_WRITE(Y2, STATE)
125
-    #define Y2_DIR_READ          (stepper##Y2.getStatus() & STATUS_DIR);
125
+    #define Y2_DIR_READ()        (stepper##Y2.getStatus() & STATUS_DIR);
126
   #endif
126
   #endif
127
 #endif
127
 #endif
128
 
128
 
129
 // Z2 Stepper
129
 // Z2 Stepper
130
 #if HAS_Z2_ENABLE && AXIS_IS_L64XX(Z2)
130
 #if HAS_Z2_ENABLE && AXIS_IS_L64XX(Z2)
131
   extern L64XX_CLASS(Z2)         stepperZ2;
131
   extern L64XX_CLASS(Z2)         stepperZ2;
132
-  #define Z2_ENABLE_INIT         NOOP
132
+  #define Z2_ENABLE_INIT()       NOOP
133
   #define Z2_ENABLE_WRITE(STATE) (STATE ? NOOP : stepperZ2.free())
133
   #define Z2_ENABLE_WRITE(STATE) (STATE ? NOOP : stepperZ2.free())
134
-  #define Z2_ENABLE_READ         (stepperZ2.getStatus() & STATUS_HIZ)
134
+  #define Z2_ENABLE_READ()       (stepperZ2.getStatus() & STATUS_HIZ)
135
   #if AXIS_DRIVER_TYPE_Z2(L6474)
135
   #if AXIS_DRIVER_TYPE_Z2(L6474)
136
-    #define Z2_DIR_INIT          SET_OUTPUT(Z2_DIR_PIN)
136
+    #define Z2_DIR_INIT()        SET_OUTPUT(Z2_DIR_PIN)
137
     #define Z2_DIR_WRITE(STATE)  L6474_DIR_WRITE(Z2, STATE)
137
     #define Z2_DIR_WRITE(STATE)  L6474_DIR_WRITE(Z2, STATE)
138
-    #define Z2_DIR_READ          READ(Z2_DIR_PIN)
138
+    #define Z2_DIR_READ()        READ(Z2_DIR_PIN)
139
   #else
139
   #else
140
-    #define Z2_DIR_INIT          NOOP
140
+    #define Z2_DIR_INIT()        NOOP
141
     #define Z2_DIR_WRITE(STATE)  L64XX_DIR_WRITE(Z2, STATE)
141
     #define Z2_DIR_WRITE(STATE)  L64XX_DIR_WRITE(Z2, STATE)
142
-    #define Z2_DIR_READ          (stepper##Z2.getStatus() & STATUS_DIR);
142
+    #define Z2_DIR_READ()        (stepper##Z2.getStatus() & STATUS_DIR);
143
   #endif
143
   #endif
144
 #endif
144
 #endif
145
 
145
 
146
 // Z3 Stepper
146
 // Z3 Stepper
147
 #if HAS_Z3_ENABLE && AXIS_IS_L64XX(Z3)
147
 #if HAS_Z3_ENABLE && AXIS_IS_L64XX(Z3)
148
   extern L64XX_CLASS(Z3)         stepperZ3;
148
   extern L64XX_CLASS(Z3)         stepperZ3;
149
-  #define Z3_ENABLE_INIT         NOOP
149
+  #define Z3_ENABLE_INIT()       NOOP
150
   #define Z3_ENABLE_WRITE(STATE) (STATE ? NOOP : stepperZ3.free())
150
   #define Z3_ENABLE_WRITE(STATE) (STATE ? NOOP : stepperZ3.free())
151
-  #define Z3_ENABLE_READ         (stepperZ3.getStatus() & STATUS_HIZ)
151
+  #define Z3_ENABLE_READ()       (stepperZ3.getStatus() & STATUS_HIZ)
152
   #if AXIS_DRIVER_TYPE_Z3(L6474)
152
   #if AXIS_DRIVER_TYPE_Z3(L6474)
153
-    #define Z3_DIR_INIT          SET_OUTPUT(Z3_DIR_PIN)
153
+    #define Z3_DIR_INIT()        SET_OUTPUT(Z3_DIR_PIN)
154
     #define Z3_DIR_WRITE(STATE)  L6474_DIR_WRITE(Z3, STATE)
154
     #define Z3_DIR_WRITE(STATE)  L6474_DIR_WRITE(Z3, STATE)
155
-    #define Z3_DIR_READ          READ(Z3_DIR_PIN)
155
+    #define Z3_DIR_READ()        READ(Z3_DIR_PIN)
156
   #else
156
   #else
157
-    #define Z3_DIR_INIT          NOOP
157
+    #define Z3_DIR_INIT()        NOOP
158
     #define Z3_DIR_WRITE(STATE)  L64XX_DIR_WRITE(Z3, STATE)
158
     #define Z3_DIR_WRITE(STATE)  L64XX_DIR_WRITE(Z3, STATE)
159
-    #define Z3_DIR_READ          (stepper##Z3.getStatus() & STATUS_DIR);
159
+    #define Z3_DIR_READ()        (stepper##Z3.getStatus() & STATUS_DIR);
160
   #endif
160
   #endif
161
 #endif
161
 #endif
162
 
162
 
163
 // E0 Stepper
163
 // E0 Stepper
164
 #if AXIS_IS_L64XX(E0)
164
 #if AXIS_IS_L64XX(E0)
165
   extern L64XX_CLASS(E0)         stepperE0;
165
   extern L64XX_CLASS(E0)         stepperE0;
166
-  #define E0_ENABLE_INIT         NOOP
166
+  #define E0_ENABLE_INIT()       NOOP
167
   #define E0_ENABLE_WRITE(STATE)  (STATE ? NOOP : stepperE0.free())
167
   #define E0_ENABLE_WRITE(STATE)  (STATE ? NOOP : stepperE0.free())
168
-  #define E0_ENABLE_READ         (stepperE0.getStatus() & STATUS_HIZ)
168
+  #define E0_ENABLE_READ()       (stepperE0.getStatus() & STATUS_HIZ)
169
   #if AXIS_DRIVER_TYPE_E0(L6474)
169
   #if AXIS_DRIVER_TYPE_E0(L6474)
170
-    #define E0_DIR_INIT          SET_OUTPUT(E0_DIR_PIN)
170
+    #define E0_DIR_INIT()        SET_OUTPUT(E0_DIR_PIN)
171
     #define E0_DIR_WRITE(STATE)  L6474_DIR_WRITE(E0, STATE)
171
     #define E0_DIR_WRITE(STATE)  L6474_DIR_WRITE(E0, STATE)
172
-    #define E0_DIR_READ          READ(E0_DIR_PIN)
172
+    #define E0_DIR_READ()        READ(E0_DIR_PIN)
173
   #else
173
   #else
174
-    #define E0_DIR_INIT          NOOP
174
+    #define E0_DIR_INIT()        NOOP
175
     #define E0_DIR_WRITE(STATE)  L64XX_DIR_WRITE(E0, STATE)
175
     #define E0_DIR_WRITE(STATE)  L64XX_DIR_WRITE(E0, STATE)
176
-    #define E0_DIR_READ          (stepper##E0.getStatus() & STATUS_DIR);
176
+    #define E0_DIR_READ()        (stepper##E0.getStatus() & STATUS_DIR);
177
   #endif
177
   #endif
178
 #endif
178
 #endif
179
 
179
 
180
 // E1 Stepper
180
 // E1 Stepper
181
 #if AXIS_IS_L64XX(E1)
181
 #if AXIS_IS_L64XX(E1)
182
   extern L64XX_CLASS(E1)         stepperE1;
182
   extern L64XX_CLASS(E1)         stepperE1;
183
-  #define E1_ENABLE_INIT         NOOP
183
+  #define E1_ENABLE_INIT()       NOOP
184
   #define E1_ENABLE_WRITE(STATE) (STATE ? NOOP : stepperE1.free())
184
   #define E1_ENABLE_WRITE(STATE) (STATE ? NOOP : stepperE1.free())
185
-  #define E1_ENABLE_READ         (stepperE1.getStatus() & STATUS_HIZ)
185
+  #define E1_ENABLE_READ()       (stepperE1.getStatus() & STATUS_HIZ)
186
   #if AXIS_DRIVER_TYPE_E1(L6474)
186
   #if AXIS_DRIVER_TYPE_E1(L6474)
187
-    #define E1_DIR_INIT          SET_OUTPUT(E1_DIR_PIN)
187
+    #define E1_DIR_INIT()        SET_OUTPUT(E1_DIR_PIN)
188
     #define E1_DIR_WRITE(STATE)  L6474_DIR_WRITE(E1, STATE)
188
     #define E1_DIR_WRITE(STATE)  L6474_DIR_WRITE(E1, STATE)
189
-    #define E1_DIR_READ          READ(E1_DIR_PIN)
189
+    #define E1_DIR_READ()        READ(E1_DIR_PIN)
190
   #else
190
   #else
191
-    #define E1_DIR_INIT          NOOP
191
+    #define E1_DIR_INIT()        NOOP
192
     #define E1_DIR_WRITE(STATE)  L64XX_DIR_WRITE(E1, STATE)
192
     #define E1_DIR_WRITE(STATE)  L64XX_DIR_WRITE(E1, STATE)
193
-    #define E1_DIR_READ          (stepper##E1.getStatus() & STATUS_DIR);
193
+    #define E1_DIR_READ()        (stepper##E1.getStatus() & STATUS_DIR);
194
   #endif
194
   #endif
195
 #endif
195
 #endif
196
 
196
 
197
 // E2 Stepper
197
 // E2 Stepper
198
 #if AXIS_IS_L64XX(E2)
198
 #if AXIS_IS_L64XX(E2)
199
   extern L64XX_CLASS(E2)         stepperE2;
199
   extern L64XX_CLASS(E2)         stepperE2;
200
-  #define E2_ENABLE_INIT         NOOP
200
+  #define E2_ENABLE_INIT()       NOOP
201
   #define E2_ENABLE_WRITE(STATE) (STATE ? NOOP : stepperE2.free())
201
   #define E2_ENABLE_WRITE(STATE) (STATE ? NOOP : stepperE2.free())
202
-  #define E2_ENABLE_READ         (stepperE2.getStatus() & STATUS_HIZ)
202
+  #define E2_ENABLE_READ()       (stepperE2.getStatus() & STATUS_HIZ)
203
   #if AXIS_DRIVER_TYPE_E2(L6474)
203
   #if AXIS_DRIVER_TYPE_E2(L6474)
204
-    #define E2_DIR_INIT          SET_OUTPUT(E2_DIR_PIN)
204
+    #define E2_DIR_INIT()        SET_OUTPUT(E2_DIR_PIN)
205
     #define E2_DIR_WRITE(STATE)  L6474_DIR_WRITE(E2, STATE)
205
     #define E2_DIR_WRITE(STATE)  L6474_DIR_WRITE(E2, STATE)
206
-    #define E2_DIR_READ          READ(E2_DIR_PIN)
206
+    #define E2_DIR_READ()        READ(E2_DIR_PIN)
207
   #else
207
   #else
208
-    #define E2_DIR_INIT          NOOP
208
+    #define E2_DIR_INIT()        NOOP
209
     #define E2_DIR_WRITE(STATE)  L64XX_DIR_WRITE(E2, STATE)
209
     #define E2_DIR_WRITE(STATE)  L64XX_DIR_WRITE(E2, STATE)
210
-    #define E2_DIR_READ          (stepper##E2.getStatus() & STATUS_DIR);
210
+    #define E2_DIR_READ()        (stepper##E2.getStatus() & STATUS_DIR);
211
   #endif
211
   #endif
212
 #endif
212
 #endif
213
 
213
 
214
 // E3 Stepper
214
 // E3 Stepper
215
 #if AXIS_IS_L64XX(E3)
215
 #if AXIS_IS_L64XX(E3)
216
   extern L64XX_CLASS(E3)         stepperE3;
216
   extern L64XX_CLASS(E3)         stepperE3;
217
-  #define E3_ENABLE_INIT         NOOP
217
+  #define E3_ENABLE_INIT()       NOOP
218
   #define E3_ENABLE_WRITE(STATE) (STATE ? NOOP : stepperE3.free())
218
   #define E3_ENABLE_WRITE(STATE) (STATE ? NOOP : stepperE3.free())
219
-  #define E3_ENABLE_READ         (stepperE3.getStatus() & STATUS_HIZ)
219
+  #define E3_ENABLE_READ()       (stepperE3.getStatus() & STATUS_HIZ)
220
   #if AXIS_DRIVER_TYPE_E3(L6474)
220
   #if AXIS_DRIVER_TYPE_E3(L6474)
221
-    #define E3_DIR_INIT          SET_OUTPUT(E3_DIR_PIN)
221
+    #define E3_DIR_INIT()        SET_OUTPUT(E3_DIR_PIN)
222
     #define E3_DIR_WRITE(STATE)  L6474_DIR_WRITE(E3, STATE)
222
     #define E3_DIR_WRITE(STATE)  L6474_DIR_WRITE(E3, STATE)
223
-    #define E3_DIR_READ          READ(E3_DIR_PIN)
223
+    #define E3_DIR_READ()        READ(E3_DIR_PIN)
224
   #else
224
   #else
225
-    #define E3_DIR_INIT          NOOP
225
+    #define E3_DIR_INIT()        NOOP
226
     #define E3_DIR_WRITE(STATE)  L64XX_DIR_WRITE(E3, STATE)
226
     #define E3_DIR_WRITE(STATE)  L64XX_DIR_WRITE(E3, STATE)
227
-    #define E3_DIR_READ          (stepper##E3.getStatus() & STATUS_DIR);
227
+    #define E3_DIR_READ()        (stepper##E3.getStatus() & STATUS_DIR);
228
   #endif
228
   #endif
229
 #endif
229
 #endif
230
 
230
 
231
 // E4 Stepper
231
 // E4 Stepper
232
 #if AXIS_IS_L64XX(E4)
232
 #if AXIS_IS_L64XX(E4)
233
   extern L64XX_CLASS(E4)         stepperE4;
233
   extern L64XX_CLASS(E4)         stepperE4;
234
-  #define E4_ENABLE_INIT         NOOP
234
+  #define E4_ENABLE_INIT()       NOOP
235
   #define E4_ENABLE_WRITE(STATE) (STATE ? NOOP : stepperE4.free())
235
   #define E4_ENABLE_WRITE(STATE) (STATE ? NOOP : stepperE4.free())
236
-  #define E4_ENABLE_READ         (stepperE4.getStatus() & STATUS_HIZ)
236
+  #define E4_ENABLE_READ()       (stepperE4.getStatus() & STATUS_HIZ)
237
   #if AXIS_DRIVER_TYPE_E4(L6474)
237
   #if AXIS_DRIVER_TYPE_E4(L6474)
238
-    #define E4_DIR_INIT          SET_OUTPUT(E4_DIR_PIN)
238
+    #define E4_DIR_INIT()        SET_OUTPUT(E4_DIR_PIN)
239
     #define E4_DIR_WRITE(STATE)  L6474_DIR_WRITE(E4, STATE)
239
     #define E4_DIR_WRITE(STATE)  L6474_DIR_WRITE(E4, STATE)
240
-    #define E4_DIR_READ          READ(E4_DIR_PIN)
240
+    #define E4_DIR_READ()        READ(E4_DIR_PIN)
241
   #else
241
   #else
242
-    #define E4_DIR_INIT          NOOP
242
+    #define E4_DIR_INIT()        NOOP
243
     #define E4_DIR_WRITE(STATE)  L64XX_DIR_WRITE(E4, STATE)
243
     #define E4_DIR_WRITE(STATE)  L64XX_DIR_WRITE(E4, STATE)
244
-    #define E4_DIR_READ          (stepper##E4.getStatus() & STATUS_DIR);
244
+    #define E4_DIR_READ()        (stepper##E4.getStatus() & STATUS_DIR);
245
   #endif
245
   #endif
246
 #endif
246
 #endif
247
 
247
 
248
 // E5 Stepper
248
 // E5 Stepper
249
 #if AXIS_IS_L64XX(E5)
249
 #if AXIS_IS_L64XX(E5)
250
   extern L64XX_CLASS(E5)         stepperE5;
250
   extern L64XX_CLASS(E5)         stepperE5;
251
-  #define E5_ENABLE_INIT         NOOP
251
+  #define E5_ENABLE_INIT()       NOOP
252
   #define E5_ENABLE_WRITE(STATE) (STATE ? NOOP : stepperE5.free())
252
   #define E5_ENABLE_WRITE(STATE) (STATE ? NOOP : stepperE5.free())
253
-  #define E5_ENABLE_READ         (stepperE5.getStatus() & STATUS_HIZ)
253
+  #define E5_ENABLE_READ()       (stepperE5.getStatus() & STATUS_HIZ)
254
   #if AXIS_DRIVER_TYPE_E5(L6474)
254
   #if AXIS_DRIVER_TYPE_E5(L6474)
255
-    #define E5_DIR_INIT          SET_OUTPUT(E5_DIR_PIN)
255
+    #define E5_DIR_INIT()        SET_OUTPUT(E5_DIR_PIN)
256
     #define E5_DIR_WRITE(STATE)  L6474_DIR_WRITE(E5, STATE)
256
     #define E5_DIR_WRITE(STATE)  L6474_DIR_WRITE(E5, STATE)
257
-    #define E5_DIR_READ          READ(E5_DIR_PIN)
257
+    #define E5_DIR_READ()        READ(E5_DIR_PIN)
258
   #else
258
   #else
259
-    #define E5_DIR_INIT          NOOP
259
+    #define E5_DIR_INIT()        NOOP
260
     #define E5_DIR_WRITE(STATE)  L64XX_DIR_WRITE(E5, STATE)
260
     #define E5_DIR_WRITE(STATE)  L64XX_DIR_WRITE(E5, STATE)
261
-    #define E5_DIR_READ          (stepper##E5.getStatus() & STATUS_DIR);
261
+    #define E5_DIR_READ()        (stepper##E5.getStatus() & STATUS_DIR);
262
   #endif
262
   #endif
263
 #endif
263
 #endif

+ 14
- 14
Marlin/src/module/stepper/TMC26X.h View File

42
 // X Stepper
42
 // X Stepper
43
 #if AXIS_DRIVER_TYPE_X(TMC26X)
43
 #if AXIS_DRIVER_TYPE_X(TMC26X)
44
   extern TMC26XStepper stepperX;
44
   extern TMC26XStepper stepperX;
45
-  #define X_ENABLE_INIT NOOP
45
+  #define X_ENABLE_INIT() NOOP
46
   #define X_ENABLE_WRITE(STATE) stepperX.setEnabled(STATE)
46
   #define X_ENABLE_WRITE(STATE) stepperX.setEnabled(STATE)
47
   #define X_ENABLE_READ() stepperX.isEnabled()
47
   #define X_ENABLE_READ() stepperX.isEnabled()
48
 #endif
48
 #endif
50
 // Y Stepper
50
 // Y Stepper
51
 #if AXIS_DRIVER_TYPE_Y(TMC26X)
51
 #if AXIS_DRIVER_TYPE_Y(TMC26X)
52
   extern TMC26XStepper stepperY;
52
   extern TMC26XStepper stepperY;
53
-  #define Y_ENABLE_INIT NOOP
53
+  #define Y_ENABLE_INIT() NOOP
54
   #define Y_ENABLE_WRITE(STATE) stepperY.setEnabled(STATE)
54
   #define Y_ENABLE_WRITE(STATE) stepperY.setEnabled(STATE)
55
   #define Y_ENABLE_READ() stepperY.isEnabled()
55
   #define Y_ENABLE_READ() stepperY.isEnabled()
56
 #endif
56
 #endif
58
 // Z Stepper
58
 // Z Stepper
59
 #if AXIS_DRIVER_TYPE_Z(TMC26X)
59
 #if AXIS_DRIVER_TYPE_Z(TMC26X)
60
   extern TMC26XStepper stepperZ;
60
   extern TMC26XStepper stepperZ;
61
-  #define Z_ENABLE_INIT NOOP
61
+  #define Z_ENABLE_INIT() NOOP
62
   #define Z_ENABLE_WRITE(STATE) stepperZ.setEnabled(STATE)
62
   #define Z_ENABLE_WRITE(STATE) stepperZ.setEnabled(STATE)
63
   #define Z_ENABLE_READ() stepperZ.isEnabled()
63
   #define Z_ENABLE_READ() stepperZ.isEnabled()
64
 #endif
64
 #endif
66
 // X2 Stepper
66
 // X2 Stepper
67
 #if HAS_X2_ENABLE && AXIS_DRIVER_TYPE_X2(TMC26X)
67
 #if HAS_X2_ENABLE && AXIS_DRIVER_TYPE_X2(TMC26X)
68
   extern TMC26XStepper stepperX2;
68
   extern TMC26XStepper stepperX2;
69
-  #define X2_ENABLE_INIT NOOP
69
+  #define X2_ENABLE_INIT() NOOP
70
   #define X2_ENABLE_WRITE(STATE) stepperX2.setEnabled(STATE)
70
   #define X2_ENABLE_WRITE(STATE) stepperX2.setEnabled(STATE)
71
   #define X2_ENABLE_READ() stepperX2.isEnabled()
71
   #define X2_ENABLE_READ() stepperX2.isEnabled()
72
 #endif
72
 #endif
74
 // Y2 Stepper
74
 // Y2 Stepper
75
 #if HAS_Y2_ENABLE && AXIS_DRIVER_TYPE_Y2(TMC26X)
75
 #if HAS_Y2_ENABLE && AXIS_DRIVER_TYPE_Y2(TMC26X)
76
   extern TMC26XStepper stepperY2;
76
   extern TMC26XStepper stepperY2;
77
-  #define Y2_ENABLE_INIT NOOP
77
+  #define Y2_ENABLE_INIT() NOOP
78
   #define Y2_ENABLE_WRITE(STATE) stepperY2.setEnabled(STATE)
78
   #define Y2_ENABLE_WRITE(STATE) stepperY2.setEnabled(STATE)
79
   #define Y2_ENABLE_READ() stepperY2.isEnabled()
79
   #define Y2_ENABLE_READ() stepperY2.isEnabled()
80
 #endif
80
 #endif
82
 // Z2 Stepper
82
 // Z2 Stepper
83
 #if HAS_Z2_ENABLE && AXIS_DRIVER_TYPE_Z2(TMC26X)
83
 #if HAS_Z2_ENABLE && AXIS_DRIVER_TYPE_Z2(TMC26X)
84
   extern TMC26XStepper stepperZ2;
84
   extern TMC26XStepper stepperZ2;
85
-  #define Z2_ENABLE_INIT NOOP
85
+  #define Z2_ENABLE_INIT() NOOP
86
   #define Z2_ENABLE_WRITE(STATE) stepperZ2.setEnabled(STATE)
86
   #define Z2_ENABLE_WRITE(STATE) stepperZ2.setEnabled(STATE)
87
   #define Z2_ENABLE_READ() stepperZ2.isEnabled()
87
   #define Z2_ENABLE_READ() stepperZ2.isEnabled()
88
 #endif
88
 #endif
89
 
89
 
90
 // Z3 Stepper
90
 // Z3 Stepper
91
-#if HAS_Z3_ENABLE && ENABLED(Z3_IS_TMC26X)
91
+#if HAS_Z3_ENABLE && AXIS_DRIVER_TYPE_Z3(TMC26X)
92
   extern TMC26XStepper stepperZ3;
92
   extern TMC26XStepper stepperZ3;
93
-  #define Z3_ENABLE_INIT NOOP
93
+  #define Z3_ENABLE_INIT() NOOP
94
   #define Z3_ENABLE_WRITE(STATE) stepperZ3.setEnabled(STATE)
94
   #define Z3_ENABLE_WRITE(STATE) stepperZ3.setEnabled(STATE)
95
   #define Z3_ENABLE_READ() stepperZ3.isEnabled()
95
   #define Z3_ENABLE_READ() stepperZ3.isEnabled()
96
 #endif
96
 #endif
98
 // E0 Stepper
98
 // E0 Stepper
99
 #if AXIS_DRIVER_TYPE_E0(TMC26X)
99
 #if AXIS_DRIVER_TYPE_E0(TMC26X)
100
   extern TMC26XStepper stepperE0;
100
   extern TMC26XStepper stepperE0;
101
-  #define E0_ENABLE_INIT NOOP
101
+  #define E0_ENABLE_INIT() NOOP
102
   #define E0_ENABLE_WRITE(STATE) stepperE0.setEnabled(STATE)
102
   #define E0_ENABLE_WRITE(STATE) stepperE0.setEnabled(STATE)
103
   #define E0_ENABLE_READ() stepperE0.isEnabled()
103
   #define E0_ENABLE_READ() stepperE0.isEnabled()
104
 #endif
104
 #endif
106
 // E1 Stepper
106
 // E1 Stepper
107
 #if AXIS_DRIVER_TYPE_E1(TMC26X)
107
 #if AXIS_DRIVER_TYPE_E1(TMC26X)
108
   extern TMC26XStepper stepperE1;
108
   extern TMC26XStepper stepperE1;
109
-  #define E1_ENABLE_INIT NOOP
109
+  #define E1_ENABLE_INIT() NOOP
110
   #define E1_ENABLE_WRITE(STATE) stepperE1.setEnabled(STATE)
110
   #define E1_ENABLE_WRITE(STATE) stepperE1.setEnabled(STATE)
111
   #define E1_ENABLE_READ() stepperE1.isEnabled()
111
   #define E1_ENABLE_READ() stepperE1.isEnabled()
112
 #endif
112
 #endif
114
 // E2 Stepper
114
 // E2 Stepper
115
 #if AXIS_DRIVER_TYPE_E2(TMC26X)
115
 #if AXIS_DRIVER_TYPE_E2(TMC26X)
116
   extern TMC26XStepper stepperE2;
116
   extern TMC26XStepper stepperE2;
117
-  #define E2_ENABLE_INIT NOOP
117
+  #define E2_ENABLE_INIT() NOOP
118
   #define E2_ENABLE_WRITE(STATE) stepperE2.setEnabled(STATE)
118
   #define E2_ENABLE_WRITE(STATE) stepperE2.setEnabled(STATE)
119
   #define E2_ENABLE_READ() stepperE2.isEnabled()
119
   #define E2_ENABLE_READ() stepperE2.isEnabled()
120
 #endif
120
 #endif
122
 // E3 Stepper
122
 // E3 Stepper
123
 #if AXIS_DRIVER_TYPE_E3(TMC26X)
123
 #if AXIS_DRIVER_TYPE_E3(TMC26X)
124
   extern TMC26XStepper stepperE3;
124
   extern TMC26XStepper stepperE3;
125
-  #define E3_ENABLE_INIT NOOP
125
+  #define E3_ENABLE_INIT() NOOP
126
   #define E3_ENABLE_WRITE(STATE) stepperE3.setEnabled(STATE)
126
   #define E3_ENABLE_WRITE(STATE) stepperE3.setEnabled(STATE)
127
   #define E3_ENABLE_READ() stepperE3.isEnabled()
127
   #define E3_ENABLE_READ() stepperE3.isEnabled()
128
 #endif
128
 #endif
130
 // E4 Stepper
130
 // E4 Stepper
131
 #if AXIS_DRIVER_TYPE_E4(TMC26X)
131
 #if AXIS_DRIVER_TYPE_E4(TMC26X)
132
   extern TMC26XStepper stepperE4;
132
   extern TMC26XStepper stepperE4;
133
-  #define E4_ENABLE_INIT NOOP
133
+  #define E4_ENABLE_INIT() NOOP
134
   #define E4_ENABLE_WRITE(STATE) stepperE4.setEnabled(STATE)
134
   #define E4_ENABLE_WRITE(STATE) stepperE4.setEnabled(STATE)
135
   #define E4_ENABLE_READ() stepperE4.isEnabled()
135
   #define E4_ENABLE_READ() stepperE4.isEnabled()
136
 #endif
136
 #endif
138
 // E5 Stepper
138
 // E5 Stepper
139
 #if AXIS_DRIVER_TYPE_E5(TMC26X)
139
 #if AXIS_DRIVER_TYPE_E5(TMC26X)
140
   extern TMC26XStepper stepperE5;
140
   extern TMC26XStepper stepperE5;
141
-  #define E5_ENABLE_INIT NOOP
141
+  #define E5_ENABLE_INIT() NOOP
142
   #define E5_ENABLE_WRITE(STATE) stepperE5.setEnabled(STATE)
142
   #define E5_ENABLE_WRITE(STATE) stepperE5.setEnabled(STATE)
143
   #define E5_ENABLE_READ() stepperE5.isEnabled()
143
   #define E5_ENABLE_READ() stepperE5.isEnabled()
144
 #endif
144
 #endif

+ 27
- 27
Marlin/src/module/stepper/indirection.h View File

49
 
49
 
50
 // X Stepper
50
 // X Stepper
51
 #ifndef X_ENABLE_INIT
51
 #ifndef X_ENABLE_INIT
52
-  #define X_ENABLE_INIT SET_OUTPUT(X_ENABLE_PIN)
52
+  #define X_ENABLE_INIT() SET_OUTPUT(X_ENABLE_PIN)
53
   #define X_ENABLE_WRITE(STATE) WRITE(X_ENABLE_PIN,STATE)
53
   #define X_ENABLE_WRITE(STATE) WRITE(X_ENABLE_PIN,STATE)
54
   #define X_ENABLE_READ() READ(X_ENABLE_PIN)
54
   #define X_ENABLE_READ() READ(X_ENABLE_PIN)
55
 #endif
55
 #endif
56
 #ifndef X_DIR_INIT
56
 #ifndef X_DIR_INIT
57
-  #define X_DIR_INIT SET_OUTPUT(X_DIR_PIN)
57
+  #define X_DIR_INIT() SET_OUTPUT(X_DIR_PIN)
58
   #define X_DIR_WRITE(STATE) WRITE(X_DIR_PIN,STATE)
58
   #define X_DIR_WRITE(STATE) WRITE(X_DIR_PIN,STATE)
59
   #define X_DIR_READ() READ(X_DIR_PIN)
59
   #define X_DIR_READ() READ(X_DIR_PIN)
60
 #endif
60
 #endif
66
 
66
 
67
 // Y Stepper
67
 // Y Stepper
68
 #ifndef Y_ENABLE_INIT
68
 #ifndef Y_ENABLE_INIT
69
-  #define Y_ENABLE_INIT SET_OUTPUT(Y_ENABLE_PIN)
69
+  #define Y_ENABLE_INIT() SET_OUTPUT(Y_ENABLE_PIN)
70
   #define Y_ENABLE_WRITE(STATE) WRITE(Y_ENABLE_PIN,STATE)
70
   #define Y_ENABLE_WRITE(STATE) WRITE(Y_ENABLE_PIN,STATE)
71
   #define Y_ENABLE_READ() READ(Y_ENABLE_PIN)
71
   #define Y_ENABLE_READ() READ(Y_ENABLE_PIN)
72
 #endif
72
 #endif
73
 #ifndef Y_DIR_INIT
73
 #ifndef Y_DIR_INIT
74
-  #define Y_DIR_INIT SET_OUTPUT(Y_DIR_PIN)
74
+  #define Y_DIR_INIT() SET_OUTPUT(Y_DIR_PIN)
75
   #define Y_DIR_WRITE(STATE) WRITE(Y_DIR_PIN,STATE)
75
   #define Y_DIR_WRITE(STATE) WRITE(Y_DIR_PIN,STATE)
76
   #define Y_DIR_READ() READ(Y_DIR_PIN)
76
   #define Y_DIR_READ() READ(Y_DIR_PIN)
77
 #endif
77
 #endif
83
 
83
 
84
 // Z Stepper
84
 // Z Stepper
85
 #ifndef Z_ENABLE_INIT
85
 #ifndef Z_ENABLE_INIT
86
-  #define Z_ENABLE_INIT SET_OUTPUT(Z_ENABLE_PIN)
86
+  #define Z_ENABLE_INIT() SET_OUTPUT(Z_ENABLE_PIN)
87
   #define Z_ENABLE_WRITE(STATE) WRITE(Z_ENABLE_PIN,STATE)
87
   #define Z_ENABLE_WRITE(STATE) WRITE(Z_ENABLE_PIN,STATE)
88
   #define Z_ENABLE_READ() READ(Z_ENABLE_PIN)
88
   #define Z_ENABLE_READ() READ(Z_ENABLE_PIN)
89
 #endif
89
 #endif
90
 #ifndef Z_DIR_INIT
90
 #ifndef Z_DIR_INIT
91
-  #define Z_DIR_INIT SET_OUTPUT(Z_DIR_PIN)
91
+  #define Z_DIR_INIT() SET_OUTPUT(Z_DIR_PIN)
92
   #define Z_DIR_WRITE(STATE) WRITE(Z_DIR_PIN,STATE)
92
   #define Z_DIR_WRITE(STATE) WRITE(Z_DIR_PIN,STATE)
93
   #define Z_DIR_READ() READ(Z_DIR_PIN)
93
   #define Z_DIR_READ() READ(Z_DIR_PIN)
94
 #endif
94
 #endif
101
 // X2 Stepper
101
 // X2 Stepper
102
 #if HAS_X2_ENABLE
102
 #if HAS_X2_ENABLE
103
   #ifndef X2_ENABLE_INIT
103
   #ifndef X2_ENABLE_INIT
104
-    #define X2_ENABLE_INIT SET_OUTPUT(X2_ENABLE_PIN)
104
+    #define X2_ENABLE_INIT() SET_OUTPUT(X2_ENABLE_PIN)
105
     #define X2_ENABLE_WRITE(STATE) WRITE(X2_ENABLE_PIN,STATE)
105
     #define X2_ENABLE_WRITE(STATE) WRITE(X2_ENABLE_PIN,STATE)
106
     #define X2_ENABLE_READ() READ(X2_ENABLE_PIN)
106
     #define X2_ENABLE_READ() READ(X2_ENABLE_PIN)
107
   #endif
107
   #endif
108
   #ifndef X2_DIR_INIT
108
   #ifndef X2_DIR_INIT
109
-    #define X2_DIR_INIT SET_OUTPUT(X2_DIR_PIN)
109
+    #define X2_DIR_INIT() SET_OUTPUT(X2_DIR_PIN)
110
     #define X2_DIR_WRITE(STATE) WRITE(X2_DIR_PIN,STATE)
110
     #define X2_DIR_WRITE(STATE) WRITE(X2_DIR_PIN,STATE)
111
     #define X2_DIR_READ() READ(X2_DIR_PIN)
111
     #define X2_DIR_READ() READ(X2_DIR_PIN)
112
   #endif
112
   #endif
120
 // Y2 Stepper
120
 // Y2 Stepper
121
 #if HAS_Y2_ENABLE
121
 #if HAS_Y2_ENABLE
122
   #ifndef Y2_ENABLE_INIT
122
   #ifndef Y2_ENABLE_INIT
123
-    #define Y2_ENABLE_INIT SET_OUTPUT(Y2_ENABLE_PIN)
123
+    #define Y2_ENABLE_INIT() SET_OUTPUT(Y2_ENABLE_PIN)
124
     #define Y2_ENABLE_WRITE(STATE) WRITE(Y2_ENABLE_PIN,STATE)
124
     #define Y2_ENABLE_WRITE(STATE) WRITE(Y2_ENABLE_PIN,STATE)
125
     #define Y2_ENABLE_READ() READ(Y2_ENABLE_PIN)
125
     #define Y2_ENABLE_READ() READ(Y2_ENABLE_PIN)
126
   #endif
126
   #endif
127
   #ifndef Y2_DIR_INIT
127
   #ifndef Y2_DIR_INIT
128
-    #define Y2_DIR_INIT SET_OUTPUT(Y2_DIR_PIN)
128
+    #define Y2_DIR_INIT() SET_OUTPUT(Y2_DIR_PIN)
129
     #define Y2_DIR_WRITE(STATE) WRITE(Y2_DIR_PIN,STATE)
129
     #define Y2_DIR_WRITE(STATE) WRITE(Y2_DIR_PIN,STATE)
130
     #define Y2_DIR_READ() READ(Y2_DIR_PIN)
130
     #define Y2_DIR_READ() READ(Y2_DIR_PIN)
131
   #endif
131
   #endif
141
 // Z2 Stepper
141
 // Z2 Stepper
142
 #if HAS_Z2_ENABLE
142
 #if HAS_Z2_ENABLE
143
   #ifndef Z2_ENABLE_INIT
143
   #ifndef Z2_ENABLE_INIT
144
-    #define Z2_ENABLE_INIT SET_OUTPUT(Z2_ENABLE_PIN)
144
+    #define Z2_ENABLE_INIT() SET_OUTPUT(Z2_ENABLE_PIN)
145
     #define Z2_ENABLE_WRITE(STATE) WRITE(Z2_ENABLE_PIN,STATE)
145
     #define Z2_ENABLE_WRITE(STATE) WRITE(Z2_ENABLE_PIN,STATE)
146
     #define Z2_ENABLE_READ() READ(Z2_ENABLE_PIN)
146
     #define Z2_ENABLE_READ() READ(Z2_ENABLE_PIN)
147
   #endif
147
   #endif
148
   #ifndef Z2_DIR_INIT
148
   #ifndef Z2_DIR_INIT
149
-    #define Z2_DIR_INIT SET_OUTPUT(Z2_DIR_PIN)
149
+    #define Z2_DIR_INIT() SET_OUTPUT(Z2_DIR_PIN)
150
     #define Z2_DIR_WRITE(STATE) WRITE(Z2_DIR_PIN,STATE)
150
     #define Z2_DIR_WRITE(STATE) WRITE(Z2_DIR_PIN,STATE)
151
     #define Z2_DIR_READ() READ(Z2_DIR_PIN)
151
     #define Z2_DIR_READ() READ(Z2_DIR_PIN)
152
   #endif
152
   #endif
162
 // Z3 Stepper
162
 // Z3 Stepper
163
 #if HAS_Z3_ENABLE
163
 #if HAS_Z3_ENABLE
164
   #ifndef Z3_ENABLE_INIT
164
   #ifndef Z3_ENABLE_INIT
165
-    #define Z3_ENABLE_INIT SET_OUTPUT(Z3_ENABLE_PIN)
165
+    #define Z3_ENABLE_INIT() SET_OUTPUT(Z3_ENABLE_PIN)
166
     #define Z3_ENABLE_WRITE(STATE) WRITE(Z3_ENABLE_PIN,STATE)
166
     #define Z3_ENABLE_WRITE(STATE) WRITE(Z3_ENABLE_PIN,STATE)
167
     #define Z3_ENABLE_READ() READ(Z3_ENABLE_PIN)
167
     #define Z3_ENABLE_READ() READ(Z3_ENABLE_PIN)
168
   #endif
168
   #endif
169
   #ifndef Z3_DIR_INIT
169
   #ifndef Z3_DIR_INIT
170
-    #define Z3_DIR_INIT SET_OUTPUT(Z3_DIR_PIN)
170
+    #define Z3_DIR_INIT() SET_OUTPUT(Z3_DIR_PIN)
171
     #define Z3_DIR_WRITE(STATE) WRITE(Z3_DIR_PIN,STATE)
171
     #define Z3_DIR_WRITE(STATE) WRITE(Z3_DIR_PIN,STATE)
172
     #define Z3_DIR_READ() READ(Z3_DIR_PIN)
172
     #define Z3_DIR_READ() READ(Z3_DIR_PIN)
173
   #endif
173
   #endif
182
 
182
 
183
 // E0 Stepper
183
 // E0 Stepper
184
 #ifndef E0_ENABLE_INIT
184
 #ifndef E0_ENABLE_INIT
185
-  #define E0_ENABLE_INIT SET_OUTPUT(E0_ENABLE_PIN)
185
+  #define E0_ENABLE_INIT() SET_OUTPUT(E0_ENABLE_PIN)
186
   #define E0_ENABLE_WRITE(STATE) WRITE(E0_ENABLE_PIN,STATE)
186
   #define E0_ENABLE_WRITE(STATE) WRITE(E0_ENABLE_PIN,STATE)
187
   #define E0_ENABLE_READ() READ(E0_ENABLE_PIN)
187
   #define E0_ENABLE_READ() READ(E0_ENABLE_PIN)
188
 #endif
188
 #endif
189
 #ifndef E0_DIR_INIT
189
 #ifndef E0_DIR_INIT
190
-  #define E0_DIR_INIT SET_OUTPUT(E0_DIR_PIN)
190
+  #define E0_DIR_INIT() SET_OUTPUT(E0_DIR_PIN)
191
   #define E0_DIR_WRITE(STATE) WRITE(E0_DIR_PIN,STATE)
191
   #define E0_DIR_WRITE(STATE) WRITE(E0_DIR_PIN,STATE)
192
   #define E0_DIR_READ() READ(E0_DIR_PIN)
192
   #define E0_DIR_READ() READ(E0_DIR_PIN)
193
 #endif
193
 #endif
199
 
199
 
200
 // E1 Stepper
200
 // E1 Stepper
201
 #ifndef E1_ENABLE_INIT
201
 #ifndef E1_ENABLE_INIT
202
-  #define E1_ENABLE_INIT SET_OUTPUT(E1_ENABLE_PIN)
202
+  #define E1_ENABLE_INIT() SET_OUTPUT(E1_ENABLE_PIN)
203
   #define E1_ENABLE_WRITE(STATE) WRITE(E1_ENABLE_PIN,STATE)
203
   #define E1_ENABLE_WRITE(STATE) WRITE(E1_ENABLE_PIN,STATE)
204
   #define E1_ENABLE_READ() READ(E1_ENABLE_PIN)
204
   #define E1_ENABLE_READ() READ(E1_ENABLE_PIN)
205
 #endif
205
 #endif
206
 #ifndef E1_DIR_INIT
206
 #ifndef E1_DIR_INIT
207
-  #define E1_DIR_INIT SET_OUTPUT(E1_DIR_PIN)
207
+  #define E1_DIR_INIT() SET_OUTPUT(E1_DIR_PIN)
208
   #define E1_DIR_WRITE(STATE) WRITE(E1_DIR_PIN,STATE)
208
   #define E1_DIR_WRITE(STATE) WRITE(E1_DIR_PIN,STATE)
209
   #define E1_DIR_READ() READ(E1_DIR_PIN)
209
   #define E1_DIR_READ() READ(E1_DIR_PIN)
210
 #endif
210
 #endif
216
 
216
 
217
 // E2 Stepper
217
 // E2 Stepper
218
 #ifndef E2_ENABLE_INIT
218
 #ifndef E2_ENABLE_INIT
219
-  #define E2_ENABLE_INIT SET_OUTPUT(E2_ENABLE_PIN)
219
+  #define E2_ENABLE_INIT() SET_OUTPUT(E2_ENABLE_PIN)
220
   #define E2_ENABLE_WRITE(STATE) WRITE(E2_ENABLE_PIN,STATE)
220
   #define E2_ENABLE_WRITE(STATE) WRITE(E2_ENABLE_PIN,STATE)
221
   #define E2_ENABLE_READ() READ(E2_ENABLE_PIN)
221
   #define E2_ENABLE_READ() READ(E2_ENABLE_PIN)
222
 #endif
222
 #endif
223
 #ifndef E2_DIR_INIT
223
 #ifndef E2_DIR_INIT
224
-  #define E2_DIR_INIT SET_OUTPUT(E2_DIR_PIN)
224
+  #define E2_DIR_INIT() SET_OUTPUT(E2_DIR_PIN)
225
   #define E2_DIR_WRITE(STATE) WRITE(E2_DIR_PIN,STATE)
225
   #define E2_DIR_WRITE(STATE) WRITE(E2_DIR_PIN,STATE)
226
   #define E2_DIR_READ() READ(E2_DIR_PIN)
226
   #define E2_DIR_READ() READ(E2_DIR_PIN)
227
 #endif
227
 #endif
233
 
233
 
234
 // E3 Stepper
234
 // E3 Stepper
235
 #ifndef E3_ENABLE_INIT
235
 #ifndef E3_ENABLE_INIT
236
-  #define E3_ENABLE_INIT SET_OUTPUT(E3_ENABLE_PIN)
236
+  #define E3_ENABLE_INIT() SET_OUTPUT(E3_ENABLE_PIN)
237
   #define E3_ENABLE_WRITE(STATE) WRITE(E3_ENABLE_PIN,STATE)
237
   #define E3_ENABLE_WRITE(STATE) WRITE(E3_ENABLE_PIN,STATE)
238
   #define E3_ENABLE_READ() READ(E3_ENABLE_PIN)
238
   #define E3_ENABLE_READ() READ(E3_ENABLE_PIN)
239
 #endif
239
 #endif
240
 #ifndef E3_DIR_INIT
240
 #ifndef E3_DIR_INIT
241
-  #define E3_DIR_INIT SET_OUTPUT(E3_DIR_PIN)
241
+  #define E3_DIR_INIT() SET_OUTPUT(E3_DIR_PIN)
242
   #define E3_DIR_WRITE(STATE) WRITE(E3_DIR_PIN,STATE)
242
   #define E3_DIR_WRITE(STATE) WRITE(E3_DIR_PIN,STATE)
243
   #define E3_DIR_READ() READ(E3_DIR_PIN)
243
   #define E3_DIR_READ() READ(E3_DIR_PIN)
244
 #endif
244
 #endif
250
 
250
 
251
 // E4 Stepper
251
 // E4 Stepper
252
 #ifndef E4_ENABLE_INIT
252
 #ifndef E4_ENABLE_INIT
253
-  #define E4_ENABLE_INIT SET_OUTPUT(E4_ENABLE_PIN)
253
+  #define E4_ENABLE_INIT() SET_OUTPUT(E4_ENABLE_PIN)
254
   #define E4_ENABLE_WRITE(STATE) WRITE(E4_ENABLE_PIN,STATE)
254
   #define E4_ENABLE_WRITE(STATE) WRITE(E4_ENABLE_PIN,STATE)
255
   #define E4_ENABLE_READ() READ(E4_ENABLE_PIN)
255
   #define E4_ENABLE_READ() READ(E4_ENABLE_PIN)
256
 #endif
256
 #endif
257
 #ifndef E4_DIR_INIT
257
 #ifndef E4_DIR_INIT
258
-  #define E4_DIR_INIT SET_OUTPUT(E4_DIR_PIN)
258
+  #define E4_DIR_INIT() SET_OUTPUT(E4_DIR_PIN)
259
   #define E4_DIR_WRITE(STATE) WRITE(E4_DIR_PIN,STATE)
259
   #define E4_DIR_WRITE(STATE) WRITE(E4_DIR_PIN,STATE)
260
   #define E4_DIR_READ() READ(E4_DIR_PIN)
260
   #define E4_DIR_READ() READ(E4_DIR_PIN)
261
 #endif
261
 #endif
267
 
267
 
268
 // E5 Stepper
268
 // E5 Stepper
269
 #ifndef E5_ENABLE_INIT
269
 #ifndef E5_ENABLE_INIT
270
-  #define E5_ENABLE_INIT SET_OUTPUT(E5_ENABLE_PIN)
270
+  #define E5_ENABLE_INIT() SET_OUTPUT(E5_ENABLE_PIN)
271
   #define E5_ENABLE_WRITE(STATE) WRITE(E5_ENABLE_PIN,STATE)
271
   #define E5_ENABLE_WRITE(STATE) WRITE(E5_ENABLE_PIN,STATE)
272
   #define E5_ENABLE_READ() READ(E5_ENABLE_PIN)
272
   #define E5_ENABLE_READ() READ(E5_ENABLE_PIN)
273
 #endif
273
 #endif
274
 #ifndef E5_DIR_INIT
274
 #ifndef E5_DIR_INIT
275
-  #define E5_DIR_INIT SET_OUTPUT(E5_DIR_PIN)
275
+  #define E5_DIR_INIT() SET_OUTPUT(E5_DIR_PIN)
276
   #define E5_DIR_WRITE(STATE) WRITE(E5_DIR_PIN,STATE)
276
   #define E5_DIR_WRITE(STATE) WRITE(E5_DIR_PIN,STATE)
277
   #define E5_DIR_READ() READ(E5_DIR_PIN)
277
   #define E5_DIR_READ() READ(E5_DIR_PIN)
278
 #endif
278
 #endif
491
   #define Z3_disable() NOOP
491
   #define Z3_disable() NOOP
492
 #endif
492
 #endif
493
 
493
 
494
-#define  enable_Z() do{ Z_enable(); Z2_enable(); Z3_enable(); }while(0)
494
+#define  enable_Z() do{ Z_enable();  Z2_enable();  Z3_enable();  }while(0)
495
 #define disable_Z() do{ Z_disable(); Z2_disable(); Z3_disable(); CBI(axis_known_position, Z_AXIS); }while(0)
495
 #define disable_Z() do{ Z_disable(); Z2_disable(); Z3_disable(); CBI(axis_known_position, Z_AXIS); }while(0)
496
 
496
 
497
 //
497
 //

+ 13
- 13
Marlin/src/module/stepper/trinamic.h View File

88
 #if AXIS_IS_TMC(X)
88
 #if AXIS_IS_TMC(X)
89
   extern TMC_CLASS(X, X) stepperX;
89
   extern TMC_CLASS(X, X) stepperX;
90
   #if ENABLED(SOFTWARE_DRIVER_ENABLE)
90
   #if ENABLED(SOFTWARE_DRIVER_ENABLE)
91
-    #define X_ENABLE_INIT NOOP
91
+    #define X_ENABLE_INIT() NOOP
92
     #define X_ENABLE_WRITE(STATE) stepperX.toff((STATE)==X_ENABLE_ON ? chopper_timing.toff : 0)
92
     #define X_ENABLE_WRITE(STATE) stepperX.toff((STATE)==X_ENABLE_ON ? chopper_timing.toff : 0)
93
     #define X_ENABLE_READ() stepperX.isEnabled()
93
     #define X_ENABLE_READ() stepperX.isEnabled()
94
   #endif
94
   #endif
101
 #if AXIS_IS_TMC(Y)
101
 #if AXIS_IS_TMC(Y)
102
   extern TMC_CLASS(Y, Y) stepperY;
102
   extern TMC_CLASS(Y, Y) stepperY;
103
   #if ENABLED(SOFTWARE_DRIVER_ENABLE)
103
   #if ENABLED(SOFTWARE_DRIVER_ENABLE)
104
-    #define Y_ENABLE_INIT NOOP
104
+    #define Y_ENABLE_INIT() NOOP
105
     #define Y_ENABLE_WRITE(STATE) stepperY.toff((STATE)==Y_ENABLE_ON ? chopper_timing.toff : 0)
105
     #define Y_ENABLE_WRITE(STATE) stepperY.toff((STATE)==Y_ENABLE_ON ? chopper_timing.toff : 0)
106
     #define Y_ENABLE_READ() stepperY.isEnabled()
106
     #define Y_ENABLE_READ() stepperY.isEnabled()
107
   #endif
107
   #endif
114
 #if AXIS_IS_TMC(Z)
114
 #if AXIS_IS_TMC(Z)
115
   extern TMC_CLASS(Z, Z) stepperZ;
115
   extern TMC_CLASS(Z, Z) stepperZ;
116
   #if ENABLED(SOFTWARE_DRIVER_ENABLE)
116
   #if ENABLED(SOFTWARE_DRIVER_ENABLE)
117
-    #define Z_ENABLE_INIT NOOP
117
+    #define Z_ENABLE_INIT() NOOP
118
     #define Z_ENABLE_WRITE(STATE) stepperZ.toff((STATE)==Z_ENABLE_ON ? chopper_timing.toff : 0)
118
     #define Z_ENABLE_WRITE(STATE) stepperZ.toff((STATE)==Z_ENABLE_ON ? chopper_timing.toff : 0)
119
     #define Z_ENABLE_READ() stepperZ.isEnabled()
119
     #define Z_ENABLE_READ() stepperZ.isEnabled()
120
   #endif
120
   #endif
127
 #if HAS_X2_ENABLE && AXIS_IS_TMC(X2)
127
 #if HAS_X2_ENABLE && AXIS_IS_TMC(X2)
128
   extern TMC_CLASS(X2, X) stepperX2;
128
   extern TMC_CLASS(X2, X) stepperX2;
129
   #if ENABLED(SOFTWARE_DRIVER_ENABLE)
129
   #if ENABLED(SOFTWARE_DRIVER_ENABLE)
130
-    #define X2_ENABLE_INIT NOOP
130
+    #define X2_ENABLE_INIT() NOOP
131
     #define X2_ENABLE_WRITE(STATE) stepperX2.toff((STATE)==X_ENABLE_ON ? chopper_timing.toff : 0)
131
     #define X2_ENABLE_WRITE(STATE) stepperX2.toff((STATE)==X_ENABLE_ON ? chopper_timing.toff : 0)
132
     #define X2_ENABLE_READ() stepperX2.isEnabled()
132
     #define X2_ENABLE_READ() stepperX2.isEnabled()
133
   #endif
133
   #endif
140
 #if HAS_Y2_ENABLE && AXIS_IS_TMC(Y2)
140
 #if HAS_Y2_ENABLE && AXIS_IS_TMC(Y2)
141
   extern TMC_CLASS(Y2, Y) stepperY2;
141
   extern TMC_CLASS(Y2, Y) stepperY2;
142
   #if ENABLED(SOFTWARE_DRIVER_ENABLE)
142
   #if ENABLED(SOFTWARE_DRIVER_ENABLE)
143
-    #define Y2_ENABLE_INIT NOOP
143
+    #define Y2_ENABLE_INIT() NOOP
144
     #define Y2_ENABLE_WRITE(STATE) stepperY2.toff((STATE)==Y_ENABLE_ON ? chopper_timing.toff : 0)
144
     #define Y2_ENABLE_WRITE(STATE) stepperY2.toff((STATE)==Y_ENABLE_ON ? chopper_timing.toff : 0)
145
     #define Y2_ENABLE_READ() stepperY2.isEnabled()
145
     #define Y2_ENABLE_READ() stepperY2.isEnabled()
146
   #endif
146
   #endif
153
 #if HAS_Z2_ENABLE && AXIS_IS_TMC(Z2)
153
 #if HAS_Z2_ENABLE && AXIS_IS_TMC(Z2)
154
   extern TMC_CLASS(Z2, Z) stepperZ2;
154
   extern TMC_CLASS(Z2, Z) stepperZ2;
155
   #if ENABLED(SOFTWARE_DRIVER_ENABLE) && AXIS_IS_TMC(Z2)
155
   #if ENABLED(SOFTWARE_DRIVER_ENABLE) && AXIS_IS_TMC(Z2)
156
-    #define Z2_ENABLE_INIT NOOP
156
+    #define Z2_ENABLE_INIT() NOOP
157
     #define Z2_ENABLE_WRITE(STATE) stepperZ2.toff((STATE)==Z_ENABLE_ON ? chopper_timing.toff : 0)
157
     #define Z2_ENABLE_WRITE(STATE) stepperZ2.toff((STATE)==Z_ENABLE_ON ? chopper_timing.toff : 0)
158
     #define Z2_ENABLE_READ() stepperZ2.isEnabled()
158
     #define Z2_ENABLE_READ() stepperZ2.isEnabled()
159
   #endif
159
   #endif
166
 #if HAS_Z3_ENABLE && AXIS_IS_TMC(Z3)
166
 #if HAS_Z3_ENABLE && AXIS_IS_TMC(Z3)
167
   extern TMC_CLASS(Z3, Z) stepperZ3;
167
   extern TMC_CLASS(Z3, Z) stepperZ3;
168
   #if ENABLED(SOFTWARE_DRIVER_ENABLE)
168
   #if ENABLED(SOFTWARE_DRIVER_ENABLE)
169
-    #define Z3_ENABLE_INIT NOOP
169
+    #define Z3_ENABLE_INIT() NOOP
170
     #define Z3_ENABLE_WRITE(STATE) stepperZ3.toff((STATE)==Z_ENABLE_ON ? chopper_timing.toff : 0)
170
     #define Z3_ENABLE_WRITE(STATE) stepperZ3.toff((STATE)==Z_ENABLE_ON ? chopper_timing.toff : 0)
171
     #define Z3_ENABLE_READ() stepperZ3.isEnabled()
171
     #define Z3_ENABLE_READ() stepperZ3.isEnabled()
172
   #endif
172
   #endif
179
 #if AXIS_IS_TMC(E0)
179
 #if AXIS_IS_TMC(E0)
180
   extern TMC_CLASS_E(0) stepperE0;
180
   extern TMC_CLASS_E(0) stepperE0;
181
   #if ENABLED(SOFTWARE_DRIVER_ENABLE) && AXIS_IS_TMC(E0)
181
   #if ENABLED(SOFTWARE_DRIVER_ENABLE) && AXIS_IS_TMC(E0)
182
-    #define E0_ENABLE_INIT NOOP
182
+    #define E0_ENABLE_INIT() NOOP
183
     #define E0_ENABLE_WRITE(STATE) stepperE0.toff((STATE)==E_ENABLE_ON ? chopper_timing.toff : 0)
183
     #define E0_ENABLE_WRITE(STATE) stepperE0.toff((STATE)==E_ENABLE_ON ? chopper_timing.toff : 0)
184
     #define E0_ENABLE_READ() stepperE0.isEnabled()
184
     #define E0_ENABLE_READ() stepperE0.isEnabled()
185
   #endif
185
   #endif
192
 #if AXIS_IS_TMC(E1)
192
 #if AXIS_IS_TMC(E1)
193
   extern TMC_CLASS_E(1) stepperE1;
193
   extern TMC_CLASS_E(1) stepperE1;
194
   #if ENABLED(SOFTWARE_DRIVER_ENABLE) && AXIS_IS_TMC(E1)
194
   #if ENABLED(SOFTWARE_DRIVER_ENABLE) && AXIS_IS_TMC(E1)
195
-    #define E1_ENABLE_INIT NOOP
195
+    #define E1_ENABLE_INIT() NOOP
196
     #define E1_ENABLE_WRITE(STATE) stepperE1.toff((STATE)==E_ENABLE_ON ? chopper_timing.toff : 0)
196
     #define E1_ENABLE_WRITE(STATE) stepperE1.toff((STATE)==E_ENABLE_ON ? chopper_timing.toff : 0)
197
     #define E1_ENABLE_READ() stepperE1.isEnabled()
197
     #define E1_ENABLE_READ() stepperE1.isEnabled()
198
   #endif
198
   #endif
205
 #if AXIS_IS_TMC(E2)
205
 #if AXIS_IS_TMC(E2)
206
   extern TMC_CLASS_E(2) stepperE2;
206
   extern TMC_CLASS_E(2) stepperE2;
207
   #if ENABLED(SOFTWARE_DRIVER_ENABLE) && AXIS_IS_TMC(E2)
207
   #if ENABLED(SOFTWARE_DRIVER_ENABLE) && AXIS_IS_TMC(E2)
208
-    #define E2_ENABLE_INIT NOOP
208
+    #define E2_ENABLE_INIT() NOOP
209
     #define E2_ENABLE_WRITE(STATE) stepperE2.toff((STATE)==E_ENABLE_ON ? chopper_timing.toff : 0)
209
     #define E2_ENABLE_WRITE(STATE) stepperE2.toff((STATE)==E_ENABLE_ON ? chopper_timing.toff : 0)
210
     #define E2_ENABLE_READ() stepperE2.isEnabled()
210
     #define E2_ENABLE_READ() stepperE2.isEnabled()
211
   #endif
211
   #endif
218
 #if AXIS_IS_TMC(E3)
218
 #if AXIS_IS_TMC(E3)
219
   extern TMC_CLASS_E(3) stepperE3;
219
   extern TMC_CLASS_E(3) stepperE3;
220
   #if ENABLED(SOFTWARE_DRIVER_ENABLE) && AXIS_IS_TMC(E3)
220
   #if ENABLED(SOFTWARE_DRIVER_ENABLE) && AXIS_IS_TMC(E3)
221
-    #define E3_ENABLE_INIT NOOP
221
+    #define E3_ENABLE_INIT() NOOP
222
     #define E3_ENABLE_WRITE(STATE) stepperE3.toff((STATE)==E_ENABLE_ON ? chopper_timing.toff : 0)
222
     #define E3_ENABLE_WRITE(STATE) stepperE3.toff((STATE)==E_ENABLE_ON ? chopper_timing.toff : 0)
223
     #define E3_ENABLE_READ() stepperE3.isEnabled()
223
     #define E3_ENABLE_READ() stepperE3.isEnabled()
224
   #endif
224
   #endif
231
 #if AXIS_IS_TMC(E4)
231
 #if AXIS_IS_TMC(E4)
232
   extern TMC_CLASS_E(4) stepperE4;
232
   extern TMC_CLASS_E(4) stepperE4;
233
   #if ENABLED(SOFTWARE_DRIVER_ENABLE) && AXIS_IS_TMC(E4)
233
   #if ENABLED(SOFTWARE_DRIVER_ENABLE) && AXIS_IS_TMC(E4)
234
-    #define E4_ENABLE_INIT NOOP
234
+    #define E4_ENABLE_INIT() NOOP
235
     #define E4_ENABLE_WRITE(STATE) stepperE4.toff((STATE)==E_ENABLE_ON ? chopper_timing.toff : 0)
235
     #define E4_ENABLE_WRITE(STATE) stepperE4.toff((STATE)==E_ENABLE_ON ? chopper_timing.toff : 0)
236
     #define E4_ENABLE_READ() stepperE4.isEnabled()
236
     #define E4_ENABLE_READ() stepperE4.isEnabled()
237
   #endif
237
   #endif
244
 #if AXIS_IS_TMC(E5)
244
 #if AXIS_IS_TMC(E5)
245
   extern TMC_CLASS_E(5) stepperE5;
245
   extern TMC_CLASS_E(5) stepperE5;
246
   #if ENABLED(SOFTWARE_DRIVER_ENABLE) && AXIS_IS_TMC(E5)
246
   #if ENABLED(SOFTWARE_DRIVER_ENABLE) && AXIS_IS_TMC(E5)
247
-    #define E5_ENABLE_INIT NOOP
247
+    #define E5_ENABLE_INIT() NOOP
248
     #define E5_ENABLE_WRITE(STATE) stepperE5.toff((STATE)==E_ENABLE_ON ? chopper_timing.toff : 0)
248
     #define E5_ENABLE_WRITE(STATE) stepperE5.toff((STATE)==E_ENABLE_ON ? chopper_timing.toff : 0)
249
     #define E5_ENABLE_READ() stepperE5.isEnabled()
249
     #define E5_ENABLE_READ() stepperE5.isEnabled()
250
   #endif
250
   #endif

Loading…
Cancel
Save