My Marlin configs for Fabrikator Mini and CTC i3 Pro B
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

TMC26X.h 4.8KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164
  1. /**
  2. * Marlin 3D Printer Firmware
  3. * Copyright (c) 2020 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
  4. *
  5. * Based on Sprinter and grbl.
  6. * Copyright (c) 2011 Camiel Gubbels / Erik van der Zalm
  7. *
  8. * This program is free software: you can redistribute it and/or modify
  9. * it under the terms of the GNU General Public License as published by
  10. * the Free Software Foundation, either version 3 of the License, or
  11. * (at your option) any later version.
  12. *
  13. * This program is distributed in the hope that it will be useful,
  14. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  15. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  16. * GNU General Public License for more details.
  17. *
  18. * You should have received a copy of the GNU General Public License
  19. * along with this program. If not, see <https://www.gnu.org/licenses/>.
  20. *
  21. */
  22. #pragma once
  23. /**
  24. * stepper/TMC26X.h
  25. * Stepper driver indirection for TMC26X drivers
  26. */
  27. #include "../../inc/MarlinConfig.h"
  28. // TMC26X drivers have STEP/DIR on normal pins, but ENABLE via SPI
  29. #include <SPI.h>
  30. #include <TMC26XStepper.h>
  31. void tmc26x_init_to_defaults();
  32. // X Stepper
  33. #if AXIS_DRIVER_TYPE_X(TMC26X)
  34. extern TMC26XStepper stepperX;
  35. #define X_ENABLE_INIT() NOOP
  36. #define X_ENABLE_WRITE(STATE) stepperX.setEnabled(STATE)
  37. #define X_ENABLE_READ() stepperX.isEnabled()
  38. #endif
  39. // Y Stepper
  40. #if AXIS_DRIVER_TYPE_Y(TMC26X)
  41. extern TMC26XStepper stepperY;
  42. #define Y_ENABLE_INIT() NOOP
  43. #define Y_ENABLE_WRITE(STATE) stepperY.setEnabled(STATE)
  44. #define Y_ENABLE_READ() stepperY.isEnabled()
  45. #endif
  46. // Z Stepper
  47. #if AXIS_DRIVER_TYPE_Z(TMC26X)
  48. extern TMC26XStepper stepperZ;
  49. #define Z_ENABLE_INIT() NOOP
  50. #define Z_ENABLE_WRITE(STATE) stepperZ.setEnabled(STATE)
  51. #define Z_ENABLE_READ() stepperZ.isEnabled()
  52. #endif
  53. // X2 Stepper
  54. #if HAS_X2_ENABLE && AXIS_DRIVER_TYPE_X2(TMC26X)
  55. extern TMC26XStepper stepperX2;
  56. #define X2_ENABLE_INIT() NOOP
  57. #define X2_ENABLE_WRITE(STATE) stepperX2.setEnabled(STATE)
  58. #define X2_ENABLE_READ() stepperX2.isEnabled()
  59. #endif
  60. // Y2 Stepper
  61. #if HAS_Y2_ENABLE && AXIS_DRIVER_TYPE_Y2(TMC26X)
  62. extern TMC26XStepper stepperY2;
  63. #define Y2_ENABLE_INIT() NOOP
  64. #define Y2_ENABLE_WRITE(STATE) stepperY2.setEnabled(STATE)
  65. #define Y2_ENABLE_READ() stepperY2.isEnabled()
  66. #endif
  67. // Z2 Stepper
  68. #if HAS_Z2_ENABLE && AXIS_DRIVER_TYPE_Z2(TMC26X)
  69. extern TMC26XStepper stepperZ2;
  70. #define Z2_ENABLE_INIT() NOOP
  71. #define Z2_ENABLE_WRITE(STATE) stepperZ2.setEnabled(STATE)
  72. #define Z2_ENABLE_READ() stepperZ2.isEnabled()
  73. #endif
  74. // Z3 Stepper
  75. #if HAS_Z3_ENABLE && AXIS_DRIVER_TYPE_Z3(TMC26X)
  76. extern TMC26XStepper stepperZ3;
  77. #define Z3_ENABLE_INIT() NOOP
  78. #define Z3_ENABLE_WRITE(STATE) stepperZ3.setEnabled(STATE)
  79. #define Z3_ENABLE_READ() stepperZ3.isEnabled()
  80. #endif
  81. // Z4 Stepper
  82. #if HAS_Z4_ENABLE && AXIS_DRIVER_TYPE_Z4(TMC26X)
  83. extern TMC26XStepper stepperZ4;
  84. #define Z4_ENABLE_INIT() NOOP
  85. #define Z4_ENABLE_WRITE(STATE) stepperZ4.setEnabled(STATE)
  86. #define Z4_ENABLE_READ() stepperZ4.isEnabled()
  87. #endif
  88. // E0 Stepper
  89. #if AXIS_DRIVER_TYPE_E0(TMC26X)
  90. extern TMC26XStepper stepperE0;
  91. #define E0_ENABLE_INIT() NOOP
  92. #define E0_ENABLE_WRITE(STATE) stepperE0.setEnabled(STATE)
  93. #define E0_ENABLE_READ() stepperE0.isEnabled()
  94. #endif
  95. // E1 Stepper
  96. #if AXIS_DRIVER_TYPE_E1(TMC26X)
  97. extern TMC26XStepper stepperE1;
  98. #define E1_ENABLE_INIT() NOOP
  99. #define E1_ENABLE_WRITE(STATE) stepperE1.setEnabled(STATE)
  100. #define E1_ENABLE_READ() stepperE1.isEnabled()
  101. #endif
  102. // E2 Stepper
  103. #if AXIS_DRIVER_TYPE_E2(TMC26X)
  104. extern TMC26XStepper stepperE2;
  105. #define E2_ENABLE_INIT() NOOP
  106. #define E2_ENABLE_WRITE(STATE) stepperE2.setEnabled(STATE)
  107. #define E2_ENABLE_READ() stepperE2.isEnabled()
  108. #endif
  109. // E3 Stepper
  110. #if AXIS_DRIVER_TYPE_E3(TMC26X)
  111. extern TMC26XStepper stepperE3;
  112. #define E3_ENABLE_INIT() NOOP
  113. #define E3_ENABLE_WRITE(STATE) stepperE3.setEnabled(STATE)
  114. #define E3_ENABLE_READ() stepperE3.isEnabled()
  115. #endif
  116. // E4 Stepper
  117. #if AXIS_DRIVER_TYPE_E4(TMC26X)
  118. extern TMC26XStepper stepperE4;
  119. #define E4_ENABLE_INIT() NOOP
  120. #define E4_ENABLE_WRITE(STATE) stepperE4.setEnabled(STATE)
  121. #define E4_ENABLE_READ() stepperE4.isEnabled()
  122. #endif
  123. // E5 Stepper
  124. #if AXIS_DRIVER_TYPE_E5(TMC26X)
  125. extern TMC26XStepper stepperE5;
  126. #define E5_ENABLE_INIT() NOOP
  127. #define E5_ENABLE_WRITE(STATE) stepperE5.setEnabled(STATE)
  128. #define E5_ENABLE_READ() stepperE5.isEnabled()
  129. #endif
  130. // E6 Stepper
  131. #if AXIS_DRIVER_TYPE_E6(TMC26X)
  132. extern TMC26XStepper stepperE6;
  133. #define E6_ENABLE_INIT() NOOP
  134. #define E6_ENABLE_WRITE(STATE) stepperE6.setEnabled(STATE)
  135. #define E6_ENABLE_READ() stepperE6.isEnabled()
  136. #endif
  137. // E7 Stepper
  138. #if AXIS_DRIVER_TYPE_E7(TMC26X)
  139. extern TMC26XStepper stepperE7;
  140. #define E7_ENABLE_INIT() NOOP
  141. #define E7_ENABLE_WRITE(STATE) stepperE7.setEnabled(STATE)
  142. #define E7_ENABLE_READ() stepperE7.isEnabled()
  143. #endif