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.

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465
  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/trinamic.h
  25. * Stepper driver indirection for Trinamic
  26. */
  27. #include <TMCStepper.h>
  28. #if TMCSTEPPER_VERSION < 0x000500
  29. #error "Update TMCStepper library to 0.5.0 or newer."
  30. #endif
  31. #include "../../inc/MarlinConfig.h"
  32. #include "../../feature/tmc_util.h"
  33. #define CLASS_TMC2130 TMC2130Stepper
  34. #define CLASS_TMC2160 TMC2160Stepper
  35. #define CLASS_TMC2208 TMC2208Stepper
  36. #define CLASS_TMC2209 TMC2209Stepper
  37. #define CLASS_TMC2660 TMC2660Stepper
  38. #define CLASS_TMC5130 TMC5130Stepper
  39. #define CLASS_TMC5160 TMC5160Stepper
  40. #define TMC_X_LABEL 'X', '0'
  41. #define TMC_Y_LABEL 'Y', '0'
  42. #define TMC_Z_LABEL 'Z', '0'
  43. #define TMC_I_LABEL 'I', '0'
  44. #define TMC_J_LABEL 'J', '0'
  45. #define TMC_K_LABEL 'K', '0'
  46. #define TMC_U_LABEL 'U', '0'
  47. #define TMC_V_LABEL 'V', '0'
  48. #define TMC_W_LABEL 'W', '0'
  49. #define TMC_X2_LABEL 'X', '2'
  50. #define TMC_Y2_LABEL 'Y', '2'
  51. #define TMC_Z2_LABEL 'Z', '2'
  52. #define TMC_Z3_LABEL 'Z', '3'
  53. #define TMC_Z4_LABEL 'Z', '4'
  54. #define TMC_E0_LABEL 'E', '0'
  55. #define TMC_E1_LABEL 'E', '1'
  56. #define TMC_E2_LABEL 'E', '2'
  57. #define TMC_E3_LABEL 'E', '3'
  58. #define TMC_E4_LABEL 'E', '4'
  59. #define TMC_E5_LABEL 'E', '5'
  60. #define TMC_E6_LABEL 'E', '6'
  61. #define TMC_E7_LABEL 'E', '7'
  62. #define __TMC_CLASS(TYPE, L, I, A) TMCMarlin<CLASS_##TYPE, L, I, A>
  63. #define _TMC_CLASS(TYPE, LandI, A) __TMC_CLASS(TYPE, LandI, A)
  64. #define TMC_CLASS(ST, A) _TMC_CLASS(ST##_DRIVER_TYPE, TMC_##ST##_LABEL, A##_AXIS)
  65. #if ENABLED(DISTINCT_E_FACTORS)
  66. #define TMC_CLASS_E(N) TMC_CLASS(E##N, E##N)
  67. #else
  68. #define TMC_CLASS_E(N) TMC_CLASS(E##N, E)
  69. #endif
  70. #ifndef CHOPPER_TIMING_X
  71. #define CHOPPER_TIMING_X CHOPPER_TIMING
  72. #endif
  73. #if HAS_Y_AXIS && !defined(CHOPPER_TIMING_Y)
  74. #define CHOPPER_TIMING_Y CHOPPER_TIMING
  75. #endif
  76. #if HAS_Z_AXIS && !defined(CHOPPER_TIMING_Z)
  77. #define CHOPPER_TIMING_Z CHOPPER_TIMING
  78. #endif
  79. #if HAS_I_AXIS && !defined(CHOPPER_TIMING_I)
  80. #define CHOPPER_TIMING_I CHOPPER_TIMING
  81. #endif
  82. #if HAS_J_AXIS && !defined(CHOPPER_TIMING_J)
  83. #define CHOPPER_TIMING_J CHOPPER_TIMING
  84. #endif
  85. #if HAS_K_AXIS && !defined(CHOPPER_TIMING_K)
  86. #define CHOPPER_TIMING_K CHOPPER_TIMING
  87. #endif
  88. #if HAS_U_AXIS && !defined(CHOPPER_TIMING_U)
  89. #define CHOPPER_TIMING_U CHOPPER_TIMING
  90. #endif
  91. #if HAS_V_AXIS && !defined(CHOPPER_TIMING_V)
  92. #define CHOPPER_TIMING_V CHOPPER_TIMING
  93. #endif
  94. #if HAS_W_AXIS && !defined(CHOPPER_TIMING_W)
  95. #define CHOPPER_TIMING_W CHOPPER_TIMING
  96. #endif
  97. #if HAS_EXTRUDERS && !defined(CHOPPER_TIMING_E)
  98. #define CHOPPER_TIMING_E CHOPPER_TIMING
  99. #endif
  100. #if HAS_TMC220x
  101. void tmc_serial_begin();
  102. #endif
  103. void restore_trinamic_drivers();
  104. void reset_trinamic_drivers();
  105. #define AXIS_HAS_SQUARE_WAVE(A) (AXIS_IS_TMC(A) && ENABLED(SQUARE_WAVE_STEPPING))
  106. // X Stepper
  107. #if AXIS_IS_TMC(X)
  108. extern TMC_CLASS(X, X) stepperX;
  109. static constexpr chopper_timing_t chopper_timing_X = CHOPPER_TIMING_X;
  110. #if ENABLED(SOFTWARE_DRIVER_ENABLE)
  111. #define X_ENABLE_INIT() NOOP
  112. #define X_ENABLE_WRITE(STATE) stepperX.toff((STATE)==X_ENABLE_ON ? chopper_timing_X.toff : 0)
  113. #define X_ENABLE_READ() stepperX.isEnabled()
  114. #endif
  115. #if AXIS_HAS_SQUARE_WAVE(X)
  116. #define X_STEP_WRITE(STATE) do{ if (STATE) TOGGLE(X_STEP_PIN); }while(0)
  117. #endif
  118. #endif
  119. // Y Stepper
  120. #if AXIS_IS_TMC(Y)
  121. extern TMC_CLASS(Y, Y) stepperY;
  122. static constexpr chopper_timing_t chopper_timing_Y = CHOPPER_TIMING_Y;
  123. #if ENABLED(SOFTWARE_DRIVER_ENABLE)
  124. #define Y_ENABLE_INIT() NOOP
  125. #define Y_ENABLE_WRITE(STATE) stepperY.toff((STATE)==Y_ENABLE_ON ? chopper_timing_Y.toff : 0)
  126. #define Y_ENABLE_READ() stepperY.isEnabled()
  127. #endif
  128. #if AXIS_HAS_SQUARE_WAVE(Y)
  129. #define Y_STEP_WRITE(STATE) do{ if (STATE) TOGGLE(Y_STEP_PIN); }while(0)
  130. #endif
  131. #endif
  132. // Z Stepper
  133. #if AXIS_IS_TMC(Z)
  134. extern TMC_CLASS(Z, Z) stepperZ;
  135. static constexpr chopper_timing_t chopper_timing_Z = CHOPPER_TIMING_Z;
  136. #if ENABLED(SOFTWARE_DRIVER_ENABLE)
  137. #define Z_ENABLE_INIT() NOOP
  138. #define Z_ENABLE_WRITE(STATE) stepperZ.toff((STATE)==Z_ENABLE_ON ? chopper_timing_Z.toff : 0)
  139. #define Z_ENABLE_READ() stepperZ.isEnabled()
  140. #endif
  141. #if AXIS_HAS_SQUARE_WAVE(Z)
  142. #define Z_STEP_WRITE(STATE) do{ if (STATE) TOGGLE(Z_STEP_PIN); }while(0)
  143. #endif
  144. #endif
  145. // X2 Stepper
  146. #if HAS_X2_ENABLE && AXIS_IS_TMC(X2)
  147. extern TMC_CLASS(X2, X) stepperX2;
  148. #ifndef CHOPPER_TIMING_X2
  149. #define CHOPPER_TIMING_X2 CHOPPER_TIMING_X
  150. #endif
  151. static constexpr chopper_timing_t chopper_timing_X2 = CHOPPER_TIMING_X2;
  152. #if ENABLED(SOFTWARE_DRIVER_ENABLE)
  153. #define X2_ENABLE_INIT() NOOP
  154. #define X2_ENABLE_WRITE(STATE) stepperX2.toff((STATE)==X_ENABLE_ON ? chopper_timing_X2.toff : 0)
  155. #define X2_ENABLE_READ() stepperX2.isEnabled()
  156. #endif
  157. #if AXIS_HAS_SQUARE_WAVE(X2)
  158. #define X2_STEP_WRITE(STATE) do{ if (STATE) TOGGLE(X2_STEP_PIN); }while(0)
  159. #endif
  160. #endif
  161. // Y2 Stepper
  162. #if HAS_Y2_ENABLE && AXIS_IS_TMC(Y2)
  163. extern TMC_CLASS(Y2, Y) stepperY2;
  164. #ifndef CHOPPER_TIMING_Y2
  165. #define CHOPPER_TIMING_Y2 CHOPPER_TIMING_Y
  166. #endif
  167. static constexpr chopper_timing_t chopper_timing_Y2 = CHOPPER_TIMING_Y2;
  168. #if ENABLED(SOFTWARE_DRIVER_ENABLE)
  169. #define Y2_ENABLE_INIT() NOOP
  170. #define Y2_ENABLE_WRITE(STATE) stepperY2.toff((STATE)==Y_ENABLE_ON ? chopper_timing_Y2.toff : 0)
  171. #define Y2_ENABLE_READ() stepperY2.isEnabled()
  172. #endif
  173. #if AXIS_HAS_SQUARE_WAVE(Y2)
  174. #define Y2_STEP_WRITE(STATE) do{ if (STATE) TOGGLE(Y2_STEP_PIN); }while(0)
  175. #endif
  176. #endif
  177. // Z2 Stepper
  178. #if HAS_Z2_ENABLE && AXIS_IS_TMC(Z2)
  179. extern TMC_CLASS(Z2, Z) stepperZ2;
  180. #ifndef CHOPPER_TIMING_Z2
  181. #define CHOPPER_TIMING_Z2 CHOPPER_TIMING_Z
  182. #endif
  183. static constexpr chopper_timing_t chopper_timing_Z2 = CHOPPER_TIMING_Z2;
  184. #if ENABLED(SOFTWARE_DRIVER_ENABLE)
  185. #define Z2_ENABLE_INIT() NOOP
  186. #define Z2_ENABLE_WRITE(STATE) stepperZ2.toff((STATE)==Z_ENABLE_ON ? chopper_timing_Z2.toff : 0)
  187. #define Z2_ENABLE_READ() stepperZ2.isEnabled()
  188. #endif
  189. #if AXIS_HAS_SQUARE_WAVE(Z2)
  190. #define Z2_STEP_WRITE(STATE) do{ if (STATE) TOGGLE(Z2_STEP_PIN); }while(0)
  191. #endif
  192. #endif
  193. // Z3 Stepper
  194. #if HAS_Z3_ENABLE && AXIS_IS_TMC(Z3)
  195. extern TMC_CLASS(Z3, Z) stepperZ3;
  196. #ifndef CHOPPER_TIMING_Z3
  197. #define CHOPPER_TIMING_Z3 CHOPPER_TIMING_Z
  198. #endif
  199. static constexpr chopper_timing_t chopper_timing_Z3 = CHOPPER_TIMING_Z3;
  200. #if ENABLED(SOFTWARE_DRIVER_ENABLE)
  201. #define Z3_ENABLE_INIT() NOOP
  202. #define Z3_ENABLE_WRITE(STATE) stepperZ3.toff((STATE)==Z_ENABLE_ON ? chopper_timing_Z3.toff : 0)
  203. #define Z3_ENABLE_READ() stepperZ3.isEnabled()
  204. #endif
  205. #if AXIS_HAS_SQUARE_WAVE(Z3)
  206. #define Z3_STEP_WRITE(STATE) do{ if (STATE) TOGGLE(Z3_STEP_PIN); }while(0)
  207. #endif
  208. #endif
  209. // Z4 Stepper
  210. #if HAS_Z4_ENABLE && AXIS_IS_TMC(Z4)
  211. extern TMC_CLASS(Z4, Z) stepperZ4;
  212. #ifndef CHOPPER_TIMING_Z4
  213. #define CHOPPER_TIMING_Z4 CHOPPER_TIMING_Z
  214. #endif
  215. static constexpr chopper_timing_t chopper_timing_Z4 = CHOPPER_TIMING_Z4;
  216. #if ENABLED(SOFTWARE_DRIVER_ENABLE)
  217. #define Z4_ENABLE_INIT() NOOP
  218. #define Z4_ENABLE_WRITE(STATE) stepperZ4.toff((STATE)==Z_ENABLE_ON ? chopper_timing_Z4.toff : 0)
  219. #define Z4_ENABLE_READ() stepperZ4.isEnabled()
  220. #endif
  221. #if AXIS_HAS_SQUARE_WAVE(Z4)
  222. #define Z4_STEP_WRITE(STATE) do{ if (STATE) TOGGLE(Z4_STEP_PIN); }while(0)
  223. #endif
  224. #endif
  225. // I Stepper
  226. #if AXIS_IS_TMC(I)
  227. extern TMC_CLASS(I, I) stepperI;
  228. static constexpr chopper_timing_t chopper_timing_I = CHOPPER_TIMING_I;
  229. #if ENABLED(SOFTWARE_DRIVER_ENABLE)
  230. #define I_ENABLE_INIT() NOOP
  231. #define I_ENABLE_WRITE(STATE) stepperI.toff((STATE)==I_ENABLE_ON ? chopper_timing.toff : 0)
  232. #define I_ENABLE_READ() stepperI.isEnabled()
  233. #endif
  234. #if AXIS_HAS_SQUARE_WAVE(I)
  235. #define I_STEP_WRITE(STATE) do{ if (STATE) TOGGLE(I_STEP_PIN); }while(0)
  236. #endif
  237. #endif
  238. // J Stepper
  239. #if AXIS_IS_TMC(J)
  240. extern TMC_CLASS(J, J) stepperJ;
  241. static constexpr chopper_timing_t chopper_timing_J = CHOPPER_TIMING_J;
  242. #if ENABLED(SOFTWARE_DRIVER_ENABLE)
  243. #define J_ENABLE_INIT() NOOP
  244. #define J_ENABLE_WRITE(STATE) stepperJ.toff((STATE)==J_ENABLE_ON ? chopper_timing.toff : 0)
  245. #define J_ENABLE_READ() stepperJ.isEnabled()
  246. #endif
  247. #if AXIS_HAS_SQUARE_WAVE(J)
  248. #define J_STEP_WRITE(STATE) do{ if (STATE) TOGGLE(J_STEP_PIN); }while(0)
  249. #endif
  250. #endif
  251. // K Stepper
  252. #if AXIS_IS_TMC(K)
  253. extern TMC_CLASS(K, K) stepperK;
  254. static constexpr chopper_timing_t chopper_timing_K = CHOPPER_TIMING_K;
  255. #if ENABLED(SOFTWARE_DRIVER_ENABLE)
  256. #define K_ENABLE_INIT() NOOP
  257. #define K_ENABLE_WRITE(STATE) stepperK.toff((STATE)==K_ENABLE_ON ? chopper_timing.toff : 0)
  258. #define K_ENABLE_READ() stepperK.isEnabled()
  259. #endif
  260. #if AXIS_HAS_SQUARE_WAVE(K)
  261. #define K_STEP_WRITE(STATE) do{ if (STATE) TOGGLE(K_STEP_PIN); }while(0)
  262. #endif
  263. #endif
  264. // U Stepper
  265. #if AXIS_IS_TMC(U)
  266. extern TMC_CLASS(U, U) stepperU;
  267. static constexpr chopper_timing_t chopper_timing_U = CHOPPER_TIMING_U;
  268. #if ENABLED(SOFTWARE_DRIVER_ENABLE)
  269. #define U_ENABLE_INIT() NOOP
  270. #define U_ENABLE_WRITE(STATE) stepperU.toff((STATE)==U_ENABLE_ON ? chopper_timing_U.toff : 0)
  271. #define U_ENABLE_READ() stepperU.isEnabled()
  272. #endif
  273. #if AXIS_HAS_SQUARE_WAVE(U)
  274. #define U_STEP_WRITE(STATE) do{ if(STATE) TOGGLE(U_STEP_PIN); }while(0)
  275. #endif
  276. #endif
  277. // V Stepper
  278. #if AXIS_IS_TMC(V)
  279. extern TMC_CLASS(V, V) stepperV;
  280. static constexpr chopper_timing_t chopper_timing_V = CHOPPER_TIMING_V;
  281. #if ENABLED(SOFTWARE_DRIVER_ENABLE)
  282. #define V_ENABLE_INIT() NOOP
  283. #define V_ENABLE_WRITE(STATE) stepperV.toff((STATE)==V_ENABLE_ON ? chopper_timing_V.toff : 0)
  284. #define V_ENABLE_READ() stepperV.isEnabled()
  285. #endif
  286. #if AXIS_HAS_SQUARE_WAVE(V)
  287. #define V_STEP_WRITE(STATE) do{ if(STATE) TOGGLE(V_STEP_PIN); }while(0)
  288. #endif
  289. #endif
  290. // W Stepper
  291. #if AXIS_IS_TMC(W)
  292. extern TMC_CLASS(W, W) stepperW;
  293. static constexpr chopper_timing_t chopper_timing_W = CHOPPER_TIMING_W;
  294. #if ENABLED(SOFTWARE_DRIVER_ENABLE)
  295. #define W_ENABLE_INIT() NOOP
  296. #define W_ENABLE_WRITE(STATE) stepperW.toff((STATE)==W_ENABLE_ON ? chopper_timing_W.toff : 0)
  297. #define W_ENABLE_READ() stepperW.isEnabled()
  298. #endif
  299. #if AXIS_HAS_SQUARE_WAVE(W)
  300. #define W_STEP_WRITE(STATE) do{ if(STATE) TOGGLE(W_STEP_PIN); }while(0)
  301. #endif
  302. #endif
  303. // E0 Stepper
  304. #if AXIS_IS_TMC(E0)
  305. extern TMC_CLASS_E(0) stepperE0;
  306. #ifndef CHOPPER_TIMING_E0
  307. #define CHOPPER_TIMING_E0 CHOPPER_TIMING_E
  308. #endif
  309. static constexpr chopper_timing_t chopper_timing_E0 = CHOPPER_TIMING_E0;
  310. #if ENABLED(SOFTWARE_DRIVER_ENABLE)
  311. #define E0_ENABLE_INIT() NOOP
  312. #define E0_ENABLE_WRITE(STATE) stepperE0.toff((STATE)==E_ENABLE_ON ? chopper_timing_E0.toff : 0)
  313. #define E0_ENABLE_READ() stepperE0.isEnabled()
  314. #endif
  315. #if AXIS_HAS_SQUARE_WAVE(E0)
  316. #define E0_STEP_WRITE(STATE) do{ if (STATE) TOGGLE(E0_STEP_PIN); }while(0)
  317. #endif
  318. #endif
  319. // E1 Stepper
  320. #if AXIS_IS_TMC(E1)
  321. extern TMC_CLASS_E(1) stepperE1;
  322. #ifndef CHOPPER_TIMING_E1
  323. #define CHOPPER_TIMING_E1 CHOPPER_TIMING_E
  324. #endif
  325. static constexpr chopper_timing_t chopper_timing_E1 = CHOPPER_TIMING_E1;
  326. #if ENABLED(SOFTWARE_DRIVER_ENABLE)
  327. #define E1_ENABLE_INIT() NOOP
  328. #define E1_ENABLE_WRITE(STATE) stepperE1.toff((STATE)==E_ENABLE_ON ? chopper_timing_E1.toff : 0)
  329. #define E1_ENABLE_READ() stepperE1.isEnabled()
  330. #endif
  331. #if AXIS_HAS_SQUARE_WAVE(E1)
  332. #define E1_STEP_WRITE(STATE) do{ if (STATE) TOGGLE(E1_STEP_PIN); }while(0)
  333. #endif
  334. #endif
  335. // E2 Stepper
  336. #if AXIS_IS_TMC(E2)
  337. extern TMC_CLASS_E(2) stepperE2;
  338. #ifndef CHOPPER_TIMING_E2
  339. #define CHOPPER_TIMING_E2 CHOPPER_TIMING_E
  340. #endif
  341. static constexpr chopper_timing_t chopper_timing_E2 = CHOPPER_TIMING_E2;
  342. #if ENABLED(SOFTWARE_DRIVER_ENABLE)
  343. #define E2_ENABLE_INIT() NOOP
  344. #define E2_ENABLE_WRITE(STATE) stepperE2.toff((STATE)==E_ENABLE_ON ? chopper_timing_E2.toff : 0)
  345. #define E2_ENABLE_READ() stepperE2.isEnabled()
  346. #endif
  347. #if AXIS_HAS_SQUARE_WAVE(E2)
  348. #define E2_STEP_WRITE(STATE) do{ if (STATE) TOGGLE(E2_STEP_PIN); }while(0)
  349. #endif
  350. #endif
  351. // E3 Stepper
  352. #if AXIS_IS_TMC(E3)
  353. extern TMC_CLASS_E(3) stepperE3;
  354. #ifndef CHOPPER_TIMING_E3
  355. #define CHOPPER_TIMING_E3 CHOPPER_TIMING_E
  356. #endif
  357. static constexpr chopper_timing_t chopper_timing_E3 = CHOPPER_TIMING_E3;
  358. #if ENABLED(SOFTWARE_DRIVER_ENABLE)
  359. #define E3_ENABLE_INIT() NOOP
  360. #define E3_ENABLE_WRITE(STATE) stepperE3.toff((STATE)==E_ENABLE_ON ? chopper_timing_E3.toff : 0)
  361. #define E3_ENABLE_READ() stepperE3.isEnabled()
  362. #endif
  363. #if AXIS_HAS_SQUARE_WAVE(E3)
  364. #define E3_STEP_WRITE(STATE) do{ if (STATE) TOGGLE(E3_STEP_PIN); }while(0)
  365. #endif
  366. #endif
  367. // E4 Stepper
  368. #if AXIS_IS_TMC(E4)
  369. extern TMC_CLASS_E(4) stepperE4;
  370. #ifndef CHOPPER_TIMING_E4
  371. #define CHOPPER_TIMING_E4 CHOPPER_TIMING_E
  372. #endif
  373. static constexpr chopper_timing_t chopper_timing_E4 = CHOPPER_TIMING_E4;
  374. #if ENABLED(SOFTWARE_DRIVER_ENABLE)
  375. #define E4_ENABLE_INIT() NOOP
  376. #define E4_ENABLE_WRITE(STATE) stepperE4.toff((STATE)==E_ENABLE_ON ? chopper_timing_E4.toff : 0)
  377. #define E4_ENABLE_READ() stepperE4.isEnabled()
  378. #endif
  379. #if AXIS_HAS_SQUARE_WAVE(E4)
  380. #define E4_STEP_WRITE(STATE) do{ if (STATE) TOGGLE(E4_STEP_PIN); }while(0)
  381. #endif
  382. #endif
  383. // E5 Stepper
  384. #if AXIS_IS_TMC(E5)
  385. extern TMC_CLASS_E(5) stepperE5;
  386. #ifndef CHOPPER_TIMING_E5
  387. #define CHOPPER_TIMING_E5 CHOPPER_TIMING_E
  388. #endif
  389. static constexpr chopper_timing_t chopper_timing_E5 = CHOPPER_TIMING_E5;
  390. #if ENABLED(SOFTWARE_DRIVER_ENABLE)
  391. #define E5_ENABLE_INIT() NOOP
  392. #define E5_ENABLE_WRITE(STATE) stepperE5.toff((STATE)==E_ENABLE_ON ? chopper_timing_E5.toff : 0)
  393. #define E5_ENABLE_READ() stepperE5.isEnabled()
  394. #endif
  395. #if AXIS_HAS_SQUARE_WAVE(E5)
  396. #define E5_STEP_WRITE(STATE) do{ if (STATE) TOGGLE(E5_STEP_PIN); }while(0)
  397. #endif
  398. #endif
  399. // E6 Stepper
  400. #if AXIS_IS_TMC(E6)
  401. extern TMC_CLASS_E(6) stepperE6;
  402. #ifndef CHOPPER_TIMING_E6
  403. #define CHOPPER_TIMING_E6 CHOPPER_TIMING_E
  404. #endif
  405. static constexpr chopper_timing_t chopper_timing_E6 = CHOPPER_TIMING_E6;
  406. #if ENABLED(SOFTWARE_DRIVER_ENABLE)
  407. #define E6_ENABLE_INIT() NOOP
  408. #define E6_ENABLE_WRITE(STATE) stepperE6.toff((STATE)==E_ENABLE_ON ? chopper_timing_E6.toff : 0)
  409. #define E6_ENABLE_READ() stepperE6.isEnabled()
  410. #endif
  411. #if AXIS_HAS_SQUARE_WAVE(E6)
  412. #define E6_STEP_WRITE(STATE) do{ if (STATE) TOGGLE(E6_STEP_PIN); }while(0)
  413. #endif
  414. #endif
  415. // E7 Stepper
  416. #if AXIS_IS_TMC(E7)
  417. extern TMC_CLASS_E(7) stepperE7;
  418. #ifndef CHOPPER_TIMING_E7
  419. #define CHOPPER_TIMING_E7 CHOPPER_TIMING_E
  420. #endif
  421. static constexpr chopper_timing_t chopper_timing_E7 = CHOPPER_TIMING_E7;
  422. #if ENABLED(SOFTWARE_DRIVER_ENABLE)
  423. #define E7_ENABLE_INIT() NOOP
  424. #define E7_ENABLE_WRITE(STATE) stepperE7.toff((STATE)==E_ENABLE_ON ? chopper_timing_E7.toff : 0)
  425. #define E7_ENABLE_READ() stepperE7.isEnabled()
  426. #endif
  427. #if AXIS_HAS_SQUARE_WAVE(E7)
  428. #define E7_STEP_WRITE(STATE) do{ if (STATE) TOGGLE(E7_STEP_PIN); }while(0)
  429. #endif
  430. #endif