My Marlin configs for Fabrikator Mini and CTC i3 Pro B
Vous ne pouvez pas sélectionner plus de 25 sujets Les noms de sujets doivent commencer par une lettre ou un nombre, peuvent contenir des tirets ('-') et peuvent comporter jusqu'à 35 caractères.

stepper_indirection.h 20KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565
  1. /**
  2. * Marlin 3D Printer Firmware
  3. * Copyright (C) 2016 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 <http://www.gnu.org/licenses/>.
  20. *
  21. */
  22. /**
  23. stepper_indirection.h - stepper motor driver indirection macros
  24. to allow some stepper functions to be done via SPI/I2c instead of direct pin manipulation
  25. Part of Marlin
  26. Copyright (c) 2015 Dominik Wenger
  27. Marlin is free software: you can redistribute it and/or modify
  28. it under the terms of the GNU General Public License as published by
  29. the Free Software Foundation, either version 3 of the License, or
  30. (at your option) any later version.
  31. Marlin is distributed in the hope that it will be useful,
  32. but WITHOUT ANY WARRANTY; without even the implied warranty of
  33. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  34. GNU General Public License for more details.
  35. You should have received a copy of the GNU General Public License
  36. along with Marlin. If not, see <http://www.gnu.org/licenses/>.
  37. */
  38. #ifndef STEPPER_INDIRECTION_H
  39. #define STEPPER_INDIRECTION_H
  40. #include "macros.h"
  41. // X motor
  42. #define X_STEP_INIT SET_OUTPUT(X_STEP_PIN)
  43. #define X_STEP_WRITE(STATE) WRITE(X_STEP_PIN,STATE)
  44. #define X_STEP_READ READ(X_STEP_PIN)
  45. #define X_DIR_INIT SET_OUTPUT(X_DIR_PIN)
  46. #define X_DIR_WRITE(STATE) WRITE(X_DIR_PIN,STATE)
  47. #define X_DIR_READ READ(X_DIR_PIN)
  48. #define X_ENABLE_INIT SET_OUTPUT(X_ENABLE_PIN)
  49. #define X_ENABLE_WRITE(STATE) WRITE(X_ENABLE_PIN,STATE)
  50. #define X_ENABLE_READ READ(X_ENABLE_PIN)
  51. // X2 motor
  52. #if HAS_X2_ENABLE
  53. #define X2_STEP_INIT SET_OUTPUT(X2_STEP_PIN)
  54. #define X2_STEP_WRITE(STATE) WRITE(X2_STEP_PIN,STATE)
  55. #define X2_STEP_READ READ(X2_STEP_PIN)
  56. #define X2_DIR_INIT SET_OUTPUT(X2_DIR_PIN)
  57. #define X2_DIR_WRITE(STATE) WRITE(X2_DIR_PIN,STATE)
  58. #define X2_DIR_READ READ(X_DIR_PIN)
  59. #define X2_ENABLE_INIT SET_OUTPUT(X2_ENABLE_PIN)
  60. #define X2_ENABLE_WRITE(STATE) WRITE(X2_ENABLE_PIN,STATE)
  61. #define X2_ENABLE_READ READ(X_ENABLE_PIN)
  62. #endif // DUAL_X_CARRIAGE
  63. // Y motor
  64. #define Y_STEP_INIT SET_OUTPUT(Y_STEP_PIN)
  65. #define Y_STEP_WRITE(STATE) WRITE(Y_STEP_PIN,STATE)
  66. #define Y_STEP_READ READ(Y_STEP_PIN)
  67. #define Y_DIR_INIT SET_OUTPUT(Y_DIR_PIN)
  68. #define Y_DIR_WRITE(STATE) WRITE(Y_DIR_PIN,STATE)
  69. #define Y_DIR_READ READ(Y_DIR_PIN)
  70. #define Y_ENABLE_INIT SET_OUTPUT(Y_ENABLE_PIN)
  71. #define Y_ENABLE_WRITE(STATE) WRITE(Y_ENABLE_PIN,STATE)
  72. #define Y_ENABLE_READ READ(Y_ENABLE_PIN)
  73. // Y2 motor
  74. #if HAS_Y2_ENABLE
  75. #define Y2_STEP_INIT SET_OUTPUT(Y2_STEP_PIN)
  76. #define Y2_STEP_WRITE(STATE) WRITE(Y2_STEP_PIN,STATE)
  77. #define Y2_STEP_READ READ(Y2_STEP_PIN)
  78. #define Y2_DIR_INIT SET_OUTPUT(Y2_DIR_PIN)
  79. #define Y2_DIR_WRITE(STATE) WRITE(Y2_DIR_PIN,STATE)
  80. #define Y2_DIR_READ READ(Y2_DIR_PIN)
  81. #define Y2_ENABLE_INIT SET_OUTPUT(Y2_ENABLE_PIN)
  82. #define Y2_ENABLE_WRITE(STATE) WRITE(Y2_ENABLE_PIN,STATE)
  83. #define Y2_ENABLE_READ READ(Y2_ENABLE_PIN)
  84. #endif // Y_DUAL_STEPPER_DRIVERS
  85. // Z motor
  86. #define Z_STEP_INIT SET_OUTPUT(Z_STEP_PIN)
  87. #define Z_STEP_WRITE(STATE) WRITE(Z_STEP_PIN,STATE)
  88. #define Z_STEP_READ READ(Z_STEP_PIN)
  89. #define Z_DIR_INIT SET_OUTPUT(Z_DIR_PIN)
  90. #define Z_DIR_WRITE(STATE) WRITE(Z_DIR_PIN,STATE)
  91. #define Z_DIR_READ READ(Z_DIR_PIN)
  92. #define Z_ENABLE_INIT SET_OUTPUT(Z_ENABLE_PIN)
  93. #define Z_ENABLE_WRITE(STATE) WRITE(Z_ENABLE_PIN,STATE)
  94. #define Z_ENABLE_READ READ(Z_ENABLE_PIN)
  95. // Z2 motor
  96. #if HAS_Z2_ENABLE
  97. #define Z2_STEP_INIT SET_OUTPUT(Z2_STEP_PIN)
  98. #define Z2_STEP_WRITE(STATE) WRITE(Z2_STEP_PIN,STATE)
  99. #define Z2_STEP_READ READ(Z2_STEP_PIN)
  100. #define Z2_DIR_INIT SET_OUTPUT(Z2_DIR_PIN)
  101. #define Z2_DIR_WRITE(STATE) WRITE(Z2_DIR_PIN,STATE)
  102. #define Z2_DIR_READ READ(Z2_DIR_PIN)
  103. #define Z2_ENABLE_INIT SET_OUTPUT(Z2_ENABLE_PIN)
  104. #define Z2_ENABLE_WRITE(STATE) WRITE(Z2_ENABLE_PIN,STATE)
  105. #define Z2_ENABLE_READ READ(Z2_ENABLE_PIN)
  106. #endif // Z_DUAL_STEPPER_DRIVERS
  107. // E0 motor
  108. #define E0_STEP_INIT SET_OUTPUT(E0_STEP_PIN)
  109. #define E0_STEP_WRITE(STATE) WRITE(E0_STEP_PIN,STATE)
  110. #define E0_STEP_READ READ(E0_STEP_PIN)
  111. #define E0_DIR_INIT SET_OUTPUT(E0_DIR_PIN)
  112. #define E0_DIR_WRITE(STATE) WRITE(E0_DIR_PIN,STATE)
  113. #define E0_DIR_READ READ(E0_DIR_PIN)
  114. #define E0_ENABLE_INIT SET_OUTPUT(E0_ENABLE_PIN)
  115. #define E0_ENABLE_WRITE(STATE) WRITE(E0_ENABLE_PIN,STATE)
  116. #define E0_ENABLE_READ READ(E0_ENABLE_PIN)
  117. // E1 motor
  118. #define E1_STEP_INIT SET_OUTPUT(E1_STEP_PIN)
  119. #define E1_STEP_WRITE(STATE) WRITE(E1_STEP_PIN,STATE)
  120. #define E1_STEP_READ READ(E1_STEP_PIN)
  121. #define E1_DIR_INIT SET_OUTPUT(E1_DIR_PIN)
  122. #define E1_DIR_WRITE(STATE) WRITE(E1_DIR_PIN,STATE)
  123. #define E1_DIR_READ READ(E1_DIR_PIN)
  124. #define E1_ENABLE_INIT SET_OUTPUT(E1_ENABLE_PIN)
  125. #define E1_ENABLE_WRITE(STATE) WRITE(E1_ENABLE_PIN,STATE)
  126. #define E1_ENABLE_READ READ(E1_ENABLE_PIN)
  127. // E2 motor
  128. #define E2_STEP_INIT SET_OUTPUT(E2_STEP_PIN)
  129. #define E2_STEP_WRITE(STATE) WRITE(E2_STEP_PIN,STATE)
  130. #define E2_STEP_READ READ(E2_STEP_PIN)
  131. #define E2_DIR_INIT SET_OUTPUT(E2_DIR_PIN)
  132. #define E2_DIR_WRITE(STATE) WRITE(E2_DIR_PIN,STATE)
  133. #define E2_DIR_READ READ(E2_DIR_PIN)
  134. #define E2_ENABLE_INIT SET_OUTPUT(E2_ENABLE_PIN)
  135. #define E2_ENABLE_WRITE(STATE) WRITE(E2_ENABLE_PIN,STATE)
  136. #define E2_ENABLE_READ READ(E2_ENABLE_PIN)
  137. // E3 motor
  138. #define E3_STEP_INIT SET_OUTPUT(E3_STEP_PIN)
  139. #define E3_STEP_WRITE(STATE) WRITE(E3_STEP_PIN,STATE)
  140. #define E3_STEP_READ READ(E3_STEP_PIN)
  141. #define E3_DIR_INIT SET_OUTPUT(E3_DIR_PIN)
  142. #define E3_DIR_WRITE(STATE) WRITE(E3_DIR_PIN,STATE)
  143. #define E3_DIR_READ READ(E3_DIR_PIN)
  144. #define E3_ENABLE_INIT SET_OUTPUT(E3_ENABLE_PIN)
  145. #define E3_ENABLE_WRITE(STATE) WRITE(E3_ENABLE_PIN,STATE)
  146. #define E3_ENABLE_READ READ(E3_ENABLE_PIN)
  147. #if ENABLED(SWITCHING_EXTRUDER)
  148. #define E_STEP_WRITE(v) E0_STEP_WRITE(v)
  149. #define NORM_E_DIR() E0_DIR_WRITE(current_block->active_extruder ? INVERT_E0_DIR : !INVERT_E0_DIR)
  150. #define REV_E_DIR() E0_DIR_WRITE(current_block->active_extruder ? !INVERT_E0_DIR : INVERT_E0_DIR)
  151. #elif EXTRUDERS > 3
  152. #define E_STEP_WRITE(v) { switch (current_block->active_extruder) { case 0: E0_STEP_WRITE(v); break; case 1: E1_STEP_WRITE(v); break; case 2: E2_STEP_WRITE(v); break; case 3: E3_STEP_WRITE(v); } }
  153. #define NORM_E_DIR() { switch (current_block->active_extruder) { case 0: E0_DIR_WRITE(!INVERT_E0_DIR); break; case 1: E1_DIR_WRITE(!INVERT_E1_DIR); break; case 2: E2_DIR_WRITE(!INVERT_E2_DIR); break; case 3: E3_DIR_WRITE(!INVERT_E3_DIR); } }
  154. #define REV_E_DIR() { switch (current_block->active_extruder) { case 0: E0_DIR_WRITE(INVERT_E0_DIR); break; case 1: E1_DIR_WRITE(INVERT_E1_DIR); break; case 2: E2_DIR_WRITE(INVERT_E2_DIR); break; case 3: E3_DIR_WRITE(INVERT_E3_DIR); } }
  155. #elif EXTRUDERS > 2
  156. #define E_STEP_WRITE(v) { switch (current_block->active_extruder) { case 0: E0_STEP_WRITE(v); break; case 1: E1_STEP_WRITE(v); break; case 2: E2_STEP_WRITE(v); } }
  157. #define NORM_E_DIR() { switch (current_block->active_extruder) { case 0: E0_DIR_WRITE(!INVERT_E0_DIR); break; case 1: E1_DIR_WRITE(!INVERT_E1_DIR); break; case 2: E2_DIR_WRITE(!INVERT_E2_DIR); } }
  158. #define REV_E_DIR() { switch (current_block->active_extruder) { case 0: E0_DIR_WRITE(INVERT_E0_DIR); break; case 1: E1_DIR_WRITE(INVERT_E1_DIR); break; case 2: E2_DIR_WRITE(INVERT_E2_DIR); } }
  159. #elif EXTRUDERS > 1
  160. #if DISABLED(DUAL_X_CARRIAGE)
  161. #define E_STEP_WRITE(v) { if (current_block->active_extruder == 0) { E0_STEP_WRITE(v); } else { E1_STEP_WRITE(v); } }
  162. #define NORM_E_DIR() { if (current_block->active_extruder == 0) { E0_DIR_WRITE(!INVERT_E0_DIR); } else { E1_DIR_WRITE(!INVERT_E1_DIR); } }
  163. #define REV_E_DIR() { if (current_block->active_extruder == 0) { E0_DIR_WRITE(INVERT_E0_DIR); } else { E1_DIR_WRITE(INVERT_E1_DIR); } }
  164. #else
  165. #define E_STEP_WRITE(v) { if (extruder_duplication_enabled) { E0_STEP_WRITE(v); E1_STEP_WRITE(v); } else if (current_block->active_extruder == 0) { E0_STEP_WRITE(v); } else { E1_STEP_WRITE(v); } }
  166. #define NORM_E_DIR() { if (extruder_duplication_enabled) { E0_DIR_WRITE(!INVERT_E0_DIR); E1_DIR_WRITE(!INVERT_E1_DIR); } else if (current_block->active_extruder == 0) { E0_DIR_WRITE(!INVERT_E0_DIR); } else { E1_DIR_WRITE(!INVERT_E1_DIR); } }
  167. #define REV_E_DIR() { if (extruder_duplication_enabled) { E0_DIR_WRITE(INVERT_E0_DIR); E1_DIR_WRITE(INVERT_E1_DIR); } else if (current_block->active_extruder == 0) { E0_DIR_WRITE(INVERT_E0_DIR); } else { E1_DIR_WRITE(INVERT_E1_DIR); } }
  168. #endif
  169. #elif ENABLED(MIXING_EXTRUDER)
  170. #define E_STEP_WRITE(v) NOOP /* not used for mixing extruders! */
  171. #if MIXING_STEPPERS > 3
  172. #define En_STEP_WRITE(n,v) { switch (n) { case 0: E0_STEP_WRITE(v); break; case 1: E1_STEP_WRITE(v); break; case 2: E2_STEP_WRITE(v); break; case 3: E3_STEP_WRITE(v); } }
  173. #define NORM_E_DIR() { E0_DIR_WRITE(!INVERT_E0_DIR); E1_DIR_WRITE(!INVERT_E1_DIR); E2_DIR_WRITE(!INVERT_E2_DIR); E3_DIR_WRITE(!INVERT_E3_DIR); }
  174. #define REV_E_DIR() { E0_DIR_WRITE( INVERT_E0_DIR); E1_DIR_WRITE( INVERT_E1_DIR); E2_DIR_WRITE( INVERT_E2_DIR); E3_DIR_WRITE( INVERT_E3_DIR); }
  175. #elif MIXING_STEPPERS > 2
  176. #define En_STEP_WRITE(n,v) { switch (n) { case 0: E0_STEP_WRITE(v); break; case 1: E1_STEP_WRITE(v); break; case 2: E2_STEP_WRITE(v); } }
  177. #define NORM_E_DIR() { E0_DIR_WRITE(!INVERT_E0_DIR); E1_DIR_WRITE(!INVERT_E1_DIR); E2_DIR_WRITE(!INVERT_E2_DIR); }
  178. #define REV_E_DIR() { E0_DIR_WRITE( INVERT_E0_DIR); E1_DIR_WRITE( INVERT_E1_DIR); E2_DIR_WRITE( INVERT_E2_DIR); }
  179. #else
  180. #define En_STEP_WRITE(n,v) { switch (n) { case 0: E0_STEP_WRITE(v); break; case 1: E1_STEP_WRITE(v); } }
  181. #define NORM_E_DIR() { E0_DIR_WRITE(!INVERT_E0_DIR); E1_DIR_WRITE(!INVERT_E1_DIR); }
  182. #define REV_E_DIR() { E0_DIR_WRITE( INVERT_E0_DIR); E1_DIR_WRITE( INVERT_E1_DIR); }
  183. #endif
  184. #else
  185. #define E_STEP_WRITE(v) E0_STEP_WRITE(v)
  186. #define NORM_E_DIR() E0_DIR_WRITE(!INVERT_E0_DIR)
  187. #define REV_E_DIR() E0_DIR_WRITE(INVERT_E0_DIR)
  188. #endif
  189. //////////////////////////////////
  190. // Pin redefines for TMC drivers.
  191. // TMC26X drivers have step and dir on normal pins, but everything else via SPI
  192. //////////////////////////////////
  193. #if ENABLED(HAVE_TMCDRIVER)
  194. #include <SPI.h>
  195. #include <TMC26XStepper.h>
  196. void tmc_init();
  197. #if ENABLED(X_IS_TMC)
  198. extern TMC26XStepper stepperX;
  199. #undef X_ENABLE_INIT
  200. #define X_ENABLE_INIT ((void)0)
  201. #undef X_ENABLE_WRITE
  202. #define X_ENABLE_WRITE(STATE) stepperX.setEnabled(STATE)
  203. #undef X_ENABLE_READ
  204. #define X_ENABLE_READ stepperX.isEnabled()
  205. #endif
  206. #if ENABLED(X2_IS_TMC)
  207. extern TMC26XStepper stepperX2;
  208. #undef X2_ENABLE_INIT
  209. #define X2_ENABLE_INIT ((void)0)
  210. #undef X2_ENABLE_WRITE
  211. #define X2_ENABLE_WRITE(STATE) stepperX2.setEnabled(STATE)
  212. #undef X2_ENABLE_READ
  213. #define X2_ENABLE_READ stepperX2.isEnabled()
  214. #endif
  215. #if ENABLED(Y_IS_TMC)
  216. extern TMC26XStepper stepperY;
  217. #undef Y_ENABLE_INIT
  218. #define Y_ENABLE_INIT ((void)0)
  219. #undef Y_ENABLE_WRITE
  220. #define Y_ENABLE_WRITE(STATE) stepperY.setEnabled(STATE)
  221. #undef Y_ENABLE_READ
  222. #define Y_ENABLE_READ stepperY.isEnabled()
  223. #endif
  224. #if ENABLED(Y2_IS_TMC)
  225. extern TMC26XStepper stepperY2;
  226. #undef Y2_ENABLE_INIT
  227. #define Y2_ENABLE_INIT ((void)0)
  228. #undef Y2_ENABLE_WRITE
  229. #define Y2_ENABLE_WRITE(STATE) stepperY2.setEnabled(STATE)
  230. #undef Y2_ENABLE_READ
  231. #define Y2_ENABLE_READ stepperY2.isEnabled()
  232. #endif
  233. #if ENABLED(Z_IS_TMC)
  234. extern TMC26XStepper stepperZ;
  235. #undef Z_ENABLE_INIT
  236. #define Z_ENABLE_INIT ((void)0)
  237. #undef Z_ENABLE_WRITE
  238. #define Z_ENABLE_WRITE(STATE) stepperZ.setEnabled(STATE)
  239. #undef Z_ENABLE_READ
  240. #define Z_ENABLE_READ stepperZ.isEnabled()
  241. #endif
  242. #if ENABLED(Z2_IS_TMC)
  243. extern TMC26XStepper stepperZ2;
  244. #undef Z2_ENABLE_INIT
  245. #define Z2_ENABLE_INIT ((void)0)
  246. #undef Z2_ENABLE_WRITE
  247. #define Z2_ENABLE_WRITE(STATE) stepperZ2.setEnabled(STATE)
  248. #undef Z2_ENABLE_READ
  249. #define Z2_ENABLE_READ stepperZ2.isEnabled()
  250. #endif
  251. #if ENABLED(E0_IS_TMC)
  252. extern TMC26XStepper stepperE0;
  253. #undef E0_ENABLE_INIT
  254. #define E0_ENABLE_INIT ((void)0)
  255. #undef E0_ENABLE_WRITE
  256. #define E0_ENABLE_WRITE(STATE) stepperE0.setEnabled(STATE)
  257. #undef E0_ENABLE_READ
  258. #define E0_ENABLE_READ stepperE0.isEnabled()
  259. #endif
  260. #if ENABLED(E1_IS_TMC)
  261. extern TMC26XStepper stepperE1;
  262. #undef E1_ENABLE_INIT
  263. #define E1_ENABLE_INIT ((void)0)
  264. #undef E1_ENABLE_WRITE
  265. #define E1_ENABLE_WRITE(STATE) stepperE1.setEnabled(STATE)
  266. #undef E1_ENABLE_READ
  267. #define E1_ENABLE_READ stepperE1.isEnabled()
  268. #endif
  269. #if ENABLED(E2_IS_TMC)
  270. extern TMC26XStepper stepperE2;
  271. #undef E2_ENABLE_INIT
  272. #define E2_ENABLE_INIT ((void)0)
  273. #undef E2_ENABLE_WRITE
  274. #define E2_ENABLE_WRITE(STATE) stepperE2.setEnabled(STATE)
  275. #undef E2_ENABLE_READ
  276. #define E2_ENABLE_READ stepperE2.isEnabled()
  277. #endif
  278. #if ENABLED(E3_IS_TMC)
  279. extern TMC26XStepper stepperE3;
  280. #undef E3_ENABLE_INIT
  281. #define E3_ENABLE_INIT ((void)0)
  282. #undef E3_ENABLE_WRITE
  283. #define E3_ENABLE_WRITE(STATE) stepperE3.setEnabled(STATE)
  284. #undef E3_ENABLE_READ
  285. #define E3_ENABLE_READ stepperE3.isEnabled()
  286. #endif
  287. #endif // HAVE_TMCDRIVER
  288. //////////////////////////////////
  289. // Pin redefines for L6470 drivers.
  290. // L640 drivers have step on normal pins, but dir and everything else via SPI
  291. //////////////////////////////////
  292. #if ENABLED(HAVE_L6470DRIVER)
  293. #include <SPI.h>
  294. #include <L6470.h>
  295. void L6470_init();
  296. #if ENABLED(X_IS_L6470)
  297. extern L6470 stepperX;
  298. #undef X_ENABLE_INIT
  299. #define X_ENABLE_INIT ((void)0)
  300. #undef X_ENABLE_WRITE
  301. #define X_ENABLE_WRITE(STATE) {if(STATE) stepperX.Step_Clock(stepperX.getStatus() & STATUS_HIZ); else stepperX.softFree();}
  302. #undef X_ENABLE_READ
  303. #define X_ENABLE_READ (stepperX.getStatus() & STATUS_HIZ)
  304. #undef X_DIR_INIT
  305. #define X_DIR_INIT ((void)0)
  306. #undef X_DIR_WRITE
  307. #define X_DIR_WRITE(STATE) stepperX.Step_Clock(STATE)
  308. #undef X_DIR_READ
  309. #define X_DIR_READ (stepperX.getStatus() & STATUS_DIR)
  310. #endif
  311. #if ENABLED(X2_IS_L6470)
  312. extern L6470 stepperX2;
  313. #undef X2_ENABLE_INIT
  314. #define X2_ENABLE_INIT ((void)0)
  315. #undef X2_ENABLE_WRITE
  316. #define X2_ENABLE_WRITE(STATE) (if(STATE) stepperX2.Step_Clock(stepperX2.getStatus() & STATUS_HIZ); else stepperX2.softFree();)
  317. #undef X2_ENABLE_READ
  318. #define X2_ENABLE_READ (stepperX2.getStatus() & STATUS_HIZ)
  319. #undef X2_DIR_INIT
  320. #define X2_DIR_INIT ((void)0)
  321. #undef X2_DIR_WRITE
  322. #define X2_DIR_WRITE(STATE) stepperX2.Step_Clock(STATE)
  323. #undef X2_DIR_READ
  324. #define X2_DIR_READ (stepperX2.getStatus() & STATUS_DIR)
  325. #endif
  326. #if ENABLED(Y_IS_L6470)
  327. extern L6470 stepperY;
  328. #undef Y_ENABLE_INIT
  329. #define Y_ENABLE_INIT ((void)0)
  330. #undef Y_ENABLE_WRITE
  331. #define Y_ENABLE_WRITE(STATE) (if(STATE) stepperY.Step_Clock(stepperY.getStatus() & STATUS_HIZ); else stepperY.softFree();)
  332. #undef Y_ENABLE_READ
  333. #define Y_ENABLE_READ (stepperY.getStatus() & STATUS_HIZ)
  334. #undef Y_DIR_INIT
  335. #define Y_DIR_INIT ((void)0)
  336. #undef Y_DIR_WRITE
  337. #define Y_DIR_WRITE(STATE) stepperY.Step_Clock(STATE)
  338. #undef Y_DIR_READ
  339. #define Y_DIR_READ (stepperY.getStatus() & STATUS_DIR)
  340. #endif
  341. #if ENABLED(Y2_IS_L6470)
  342. extern L6470 stepperY2;
  343. #undef Y2_ENABLE_INIT
  344. #define Y2_ENABLE_INIT ((void)0)
  345. #undef Y2_ENABLE_WRITE
  346. #define Y2_ENABLE_WRITE(STATE) (if(STATE) stepperY2.Step_Clock(stepperY2.getStatus() & STATUS_HIZ); else stepperY2.softFree();)
  347. #undef Y2_ENABLE_READ
  348. #define Y2_ENABLE_READ (stepperY2.getStatus() & STATUS_HIZ)
  349. #undef Y2_DIR_INIT
  350. #define Y2_DIR_INIT ((void)0)
  351. #undef Y2_DIR_WRITE
  352. #define Y2_DIR_WRITE(STATE) stepperY2.Step_Clock(STATE)
  353. #undef Y2_DIR_READ
  354. #define Y2_DIR_READ (stepperY2.getStatus() & STATUS_DIR)
  355. #endif
  356. #if ENABLED(Z_IS_L6470)
  357. extern L6470 stepperZ;
  358. #undef Z_ENABLE_INIT
  359. #define Z_ENABLE_INIT ((void)0)
  360. #undef Z_ENABLE_WRITE
  361. #define Z_ENABLE_WRITE(STATE) (if(STATE) stepperZ.Step_Clock(stepperZ.getStatus() & STATUS_HIZ); else stepperZ.softFree();)
  362. #undef Z_ENABLE_READ
  363. #define Z_ENABLE_READ (stepperZ.getStatus() & STATUS_HIZ)
  364. #undef Z_DIR_INIT
  365. #define Z_DIR_INIT ((void)0)
  366. #undef Z_DIR_WRITE
  367. #define Z_DIR_WRITE(STATE) stepperZ.Step_Clock(STATE)
  368. #undef Y_DIR_READ
  369. #define Y_DIR_READ (stepperZ.getStatus() & STATUS_DIR)
  370. #endif
  371. #if ENABLED(Z2_IS_L6470)
  372. extern L6470 stepperZ2;
  373. #undef Z2_ENABLE_INIT
  374. #define Z2_ENABLE_INIT ((void)0)
  375. #undef Z2_ENABLE_WRITE
  376. #define Z2_ENABLE_WRITE(STATE) (if(STATE) stepperZ2.Step_Clock(stepperZ2.getStatus() & STATUS_HIZ); else stepperZ2.softFree();)
  377. #undef Z2_ENABLE_READ
  378. #define Z2_ENABLE_READ (stepperZ2.getStatus() & STATUS_HIZ)
  379. #undef Z2_DIR_INIT
  380. #define Z2_DIR_INIT ((void)0)
  381. #undef Z2_DIR_WRITE
  382. #define Z2_DIR_WRITE(STATE) stepperZ2.Step_Clock(STATE)
  383. #undef Y2_DIR_READ
  384. #define Y2_DIR_READ (stepperZ2.getStatus() & STATUS_DIR)
  385. #endif
  386. #if ENABLED(E0_IS_L6470)
  387. extern L6470 stepperE0;
  388. #undef E0_ENABLE_INIT
  389. #define E0_ENABLE_INIT ((void)0)
  390. #undef E0_ENABLE_WRITE
  391. #define E0_ENABLE_WRITE(STATE) (if(STATE) stepperE0.Step_Clock(stepperE0.getStatus() & STATUS_HIZ); else stepperE0.softFree();)
  392. #undef E0_ENABLE_READ
  393. #define E0_ENABLE_READ (stepperE0.getStatus() & STATUS_HIZ)
  394. #undef E0_DIR_INIT
  395. #define E0_DIR_INIT ((void)0)
  396. #undef E0_DIR_WRITE
  397. #define E0_DIR_WRITE(STATE) stepperE0.Step_Clock(STATE)
  398. #undef E0_DIR_READ
  399. #define E0_DIR_READ (stepperE0.getStatus() & STATUS_DIR)
  400. #endif
  401. #if ENABLED(E1_IS_L6470)
  402. extern L6470 stepperE1;
  403. #undef E1_ENABLE_INIT
  404. #define E1_ENABLE_INIT ((void)0)
  405. #undef E1_ENABLE_WRITE
  406. #define E1_ENABLE_WRITE(STATE) (if(STATE) stepperE1.Step_Clock(stepperE1.getStatus() & STATUS_HIZ); else stepperE1.softFree();)
  407. #undef E1_ENABLE_READ
  408. #define E1_ENABLE_READ (stepperE1.getStatus() & STATUS_HIZ)
  409. #undef E1_DIR_INIT
  410. #define E1_DIR_INIT ((void)0)
  411. #undef E1_DIR_WRITE
  412. #define E1_DIR_WRITE(STATE) stepperE1.Step_Clock(STATE)
  413. #undef E1_DIR_READ
  414. #define E1_DIR_READ (stepperE1.getStatus() & STATUS_DIR)
  415. #endif
  416. #if ENABLED(E2_IS_L6470)
  417. extern L6470 stepperE2;
  418. #undef E2_ENABLE_INIT
  419. #define E2_ENABLE_INIT ((void)0)
  420. #undef E2_ENABLE_WRITE
  421. #define E2_ENABLE_WRITE(STATE) (if(STATE) stepperE2.Step_Clock(stepperE2.getStatus() & STATUS_HIZ); else stepperE2.softFree();)
  422. #undef E2_ENABLE_READ
  423. #define E2_ENABLE_READ (stepperE2.getStatus() & STATUS_HIZ)
  424. #undef E2_DIR_INIT
  425. #define E2_DIR_INIT ((void)0)
  426. #undef E2_DIR_WRITE
  427. #define E2_DIR_WRITE(STATE) stepperE2.Step_Clock(STATE)
  428. #undef E2_DIR_READ
  429. #define E2_DIR_READ (stepperE2.getStatus() & STATUS_DIR)
  430. #endif
  431. #if ENABLED(E3_IS_L6470)
  432. extern L6470 stepperE3;
  433. #undef E3_ENABLE_INIT
  434. #define E3_ENABLE_INIT ((void)0)
  435. #undef E3_ENABLE_WRITE
  436. #define E3_ENABLE_WRITE(STATE) (if(STATE) stepperE3.Step_Clock(stepperE3.getStatus() & STATUS_HIZ); else stepperE3.softFree();)
  437. #undef E3_ENABLE_READ
  438. #define E3_ENABLE_READ (stepperE3.getStatus() & STATUS_HIZ)
  439. #undef E3_DIR_INIT
  440. #define E3_DIR_INIT ((void)0)
  441. #undef E3_DIR_WRITE
  442. #define E3_DIR_WRITE(STATE) stepperE3.Step_Clock(STATE)
  443. #undef E3_DIR_READ
  444. #define E3_DIR_READ (stepperE3.getStatus() & STATUS_DIR)
  445. #endif
  446. #endif //HAVE_L6470DRIVER
  447. #endif // STEPPER_INDIRECTION_H