My Marlin configs for Fabrikator Mini and CTC i3 Pro B
Вы не можете выбрать более 25 тем Темы должны начинаться с буквы или цифры, могут содержать дефисы(-) и должны содержать не более 35 символов.

stepper_indirection.h 18KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544
  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. #define X2_STEP_INIT SET_OUTPUT(X2_STEP_PIN)
  53. #define X2_STEP_WRITE(STATE) WRITE(X2_STEP_PIN,STATE)
  54. #define X2_STEP_READ READ(X2_STEP_PIN)
  55. #define X2_DIR_INIT SET_OUTPUT(X2_DIR_PIN)
  56. #define X2_DIR_WRITE(STATE) WRITE(X2_DIR_PIN,STATE)
  57. #define X2_DIR_READ READ(X_DIR_PIN)
  58. #define X2_ENABLE_INIT SET_OUTPUT(X2_ENABLE_PIN)
  59. #define X2_ENABLE_WRITE(STATE) WRITE(X2_ENABLE_PIN,STATE)
  60. #define X2_ENABLE_READ READ(X_ENABLE_PIN)
  61. // Y motor
  62. #define Y_STEP_INIT SET_OUTPUT(Y_STEP_PIN)
  63. #define Y_STEP_WRITE(STATE) WRITE(Y_STEP_PIN,STATE)
  64. #define Y_STEP_READ READ(Y_STEP_PIN)
  65. #define Y_DIR_INIT SET_OUTPUT(Y_DIR_PIN)
  66. #define Y_DIR_WRITE(STATE) WRITE(Y_DIR_PIN,STATE)
  67. #define Y_DIR_READ READ(Y_DIR_PIN)
  68. #define Y_ENABLE_INIT SET_OUTPUT(Y_ENABLE_PIN)
  69. #define Y_ENABLE_WRITE(STATE) WRITE(Y_ENABLE_PIN,STATE)
  70. #define Y_ENABLE_READ READ(Y_ENABLE_PIN)
  71. // Y2 motor
  72. #define Y2_STEP_INIT SET_OUTPUT(Y2_STEP_PIN)
  73. #define Y2_STEP_WRITE(STATE) WRITE(Y2_STEP_PIN,STATE)
  74. #define Y2_STEP_READ READ(Y2_STEP_PIN)
  75. #define Y2_DIR_INIT SET_OUTPUT(Y2_DIR_PIN)
  76. #define Y2_DIR_WRITE(STATE) WRITE(Y2_DIR_PIN,STATE)
  77. #define Y2_DIR_READ READ(Y2_DIR_PIN)
  78. #define Y2_ENABLE_INIT SET_OUTPUT(Y2_ENABLE_PIN)
  79. #define Y2_ENABLE_WRITE(STATE) WRITE(Y2_ENABLE_PIN,STATE)
  80. #define Y2_ENABLE_READ READ(Y2_ENABLE_PIN)
  81. // Z motor
  82. #define Z_STEP_INIT SET_OUTPUT(Z_STEP_PIN)
  83. #define Z_STEP_WRITE(STATE) WRITE(Z_STEP_PIN,STATE)
  84. #define Z_STEP_READ READ(Z_STEP_PIN)
  85. #define Z_DIR_INIT SET_OUTPUT(Z_DIR_PIN)
  86. #define Z_DIR_WRITE(STATE) WRITE(Z_DIR_PIN,STATE)
  87. #define Z_DIR_READ READ(Z_DIR_PIN)
  88. #define Z_ENABLE_INIT SET_OUTPUT(Z_ENABLE_PIN)
  89. #define Z_ENABLE_WRITE(STATE) WRITE(Z_ENABLE_PIN,STATE)
  90. #define Z_ENABLE_READ READ(Z_ENABLE_PIN)
  91. // Z2 motor
  92. #define Z2_STEP_INIT SET_OUTPUT(Z2_STEP_PIN)
  93. #define Z2_STEP_WRITE(STATE) WRITE(Z2_STEP_PIN,STATE)
  94. #define Z2_STEP_READ READ(Z2_STEP_PIN)
  95. #define Z2_DIR_INIT SET_OUTPUT(Z2_DIR_PIN)
  96. #define Z2_DIR_WRITE(STATE) WRITE(Z2_DIR_PIN,STATE)
  97. #define Z2_DIR_READ READ(Z2_DIR_PIN)
  98. #define Z2_ENABLE_INIT SET_OUTPUT(Z2_ENABLE_PIN)
  99. #define Z2_ENABLE_WRITE(STATE) WRITE(Z2_ENABLE_PIN,STATE)
  100. #define Z2_ENABLE_READ READ(Z2_ENABLE_PIN)
  101. // E0 motor
  102. #define E0_STEP_INIT SET_OUTPUT(E0_STEP_PIN)
  103. #define E0_STEP_WRITE(STATE) WRITE(E0_STEP_PIN,STATE)
  104. #define E0_STEP_READ READ(E0_STEP_PIN)
  105. #define E0_DIR_INIT SET_OUTPUT(E0_DIR_PIN)
  106. #define E0_DIR_WRITE(STATE) WRITE(E0_DIR_PIN,STATE)
  107. #define E0_DIR_READ READ(E0_DIR_PIN)
  108. #define E0_ENABLE_INIT SET_OUTPUT(E0_ENABLE_PIN)
  109. #define E0_ENABLE_WRITE(STATE) WRITE(E0_ENABLE_PIN,STATE)
  110. #define E0_ENABLE_READ READ(E0_ENABLE_PIN)
  111. // E1 motor
  112. #define E1_STEP_INIT SET_OUTPUT(E1_STEP_PIN)
  113. #define E1_STEP_WRITE(STATE) WRITE(E1_STEP_PIN,STATE)
  114. #define E1_STEP_READ READ(E1_STEP_PIN)
  115. #define E1_DIR_INIT SET_OUTPUT(E1_DIR_PIN)
  116. #define E1_DIR_WRITE(STATE) WRITE(E1_DIR_PIN,STATE)
  117. #define E1_DIR_READ READ(E1_DIR_PIN)
  118. #define E1_ENABLE_INIT SET_OUTPUT(E1_ENABLE_PIN)
  119. #define E1_ENABLE_WRITE(STATE) WRITE(E1_ENABLE_PIN,STATE)
  120. #define E1_ENABLE_READ READ(E1_ENABLE_PIN)
  121. // E2 motor
  122. #define E2_STEP_INIT SET_OUTPUT(E2_STEP_PIN)
  123. #define E2_STEP_WRITE(STATE) WRITE(E2_STEP_PIN,STATE)
  124. #define E2_STEP_READ READ(E2_STEP_PIN)
  125. #define E2_DIR_INIT SET_OUTPUT(E2_DIR_PIN)
  126. #define E2_DIR_WRITE(STATE) WRITE(E2_DIR_PIN,STATE)
  127. #define E2_DIR_READ READ(E2_DIR_PIN)
  128. #define E2_ENABLE_INIT SET_OUTPUT(E2_ENABLE_PIN)
  129. #define E2_ENABLE_WRITE(STATE) WRITE(E2_ENABLE_PIN,STATE)
  130. #define E2_ENABLE_READ READ(E2_ENABLE_PIN)
  131. // E3 motor
  132. #define E3_STEP_INIT SET_OUTPUT(E3_STEP_PIN)
  133. #define E3_STEP_WRITE(STATE) WRITE(E3_STEP_PIN,STATE)
  134. #define E3_STEP_READ READ(E3_STEP_PIN)
  135. #define E3_DIR_INIT SET_OUTPUT(E3_DIR_PIN)
  136. #define E3_DIR_WRITE(STATE) WRITE(E3_DIR_PIN,STATE)
  137. #define E3_DIR_READ READ(E3_DIR_PIN)
  138. #define E3_ENABLE_INIT SET_OUTPUT(E3_ENABLE_PIN)
  139. #define E3_ENABLE_WRITE(STATE) WRITE(E3_ENABLE_PIN,STATE)
  140. #define E3_ENABLE_READ READ(E3_ENABLE_PIN)
  141. #if EXTRUDERS > 3
  142. #define E_STEP_WRITE(v) {switch(current_block->active_extruder){case 3:E3_STEP_WRITE(v);break;case 2:E2_STEP_WRITE(v);break;case 1:E1_STEP_WRITE(v);break;default:E0_STEP_WRITE(v);}}
  143. #define NORM_E_DIR() {switch(current_block->active_extruder){case 3:E3_DIR_WRITE(!INVERT_E3_DIR);break;case 2:E2_DIR_WRITE(!INVERT_E2_DIR);break;case 1:E1_DIR_WRITE(!INVERT_E1_DIR);break;default:E0_DIR_WRITE(!INVERT_E0_DIR);}}
  144. #define REV_E_DIR() {switch(current_block->active_extruder){case 3:E3_DIR_WRITE(INVERT_E3_DIR);break;case 2:E2_DIR_WRITE(INVERT_E2_DIR);break;case 1:E1_DIR_WRITE(INVERT_E1_DIR);break;default:E0_DIR_WRITE(INVERT_E0_DIR);}}
  145. #elif EXTRUDERS > 2
  146. #define E_STEP_WRITE(v) {switch(current_block->active_extruder){case 2:E2_STEP_WRITE(v);break;case 1:E1_STEP_WRITE(v);break;default:E0_STEP_WRITE(v);}}
  147. #define NORM_E_DIR() {switch(current_block->active_extruder){case 2:E2_DIR_WRITE(!INVERT_E2_DIR);break;case 1:E1_DIR_WRITE(!INVERT_E1_DIR);break;default:E0_DIR_WRITE(!INVERT_E0_DIR);}}
  148. #define REV_E_DIR() {switch(current_block->active_extruder){case 2:E2_DIR_WRITE(INVERT_E2_DIR);break;case 1:E1_DIR_WRITE(INVERT_E1_DIR);break;default:E0_DIR_WRITE(INVERT_E0_DIR);}}
  149. #elif EXTRUDERS > 1
  150. #define _E_STEP_WRITE(v) {if(current_block->active_extruder==1){E1_STEP_WRITE(v);}else{E0_STEP_WRITE(v);}}
  151. #define _NORM_E_DIR() {if(current_block->active_extruder==1){E1_DIR_WRITE(!INVERT_E1_DIR);}else{E0_DIR_WRITE(!INVERT_E0_DIR);}}
  152. #define _REV_E_DIR() {if(current_block->active_extruder==1){E1_DIR_WRITE(INVERT_E1_DIR);}else{E0_DIR_WRITE(INVERT_E0_DIR);}}
  153. #if DISABLED(DUAL_X_CARRIAGE)
  154. #define E_STEP_WRITE(v) _E_STEP_WRITE(v)
  155. #define NORM_E_DIR() _NORM_E_DIR()
  156. #define REV_E_DIR() _REV_E_DIR()
  157. #else
  158. extern bool extruder_duplication_enabled;
  159. #define E_STEP_WRITE(v) {if(extruder_duplication_enabled){E0_STEP_WRITE(v);E1_STEP_WRITE(v);}else _E_STEP_WRITE(v);}
  160. #define NORM_E_DIR() {if(extruder_duplication_enabled){E0_DIR_WRITE(!INVERT_E0_DIR);E1_DIR_WRITE(!INVERT_E1_DIR);}else _NORM_E_DIR();}
  161. #define REV_E_DIR() {if(extruder_duplication_enabled){E0_DIR_WRITE(INVERT_E0_DIR);E1_DIR_WRITE(INVERT_E1_DIR);}else _REV_E_DIR();}
  162. #endif
  163. #else
  164. #define E_STEP_WRITE(v) E0_STEP_WRITE(v)
  165. #define NORM_E_DIR() E0_DIR_WRITE(!INVERT_E0_DIR)
  166. #define REV_E_DIR() E0_DIR_WRITE(INVERT_E0_DIR)
  167. #endif
  168. //////////////////////////////////
  169. // Pin redefines for TMC drivers.
  170. // TMC26X drivers have step and dir on normal pins, but everything else via SPI
  171. //////////////////////////////////
  172. #if ENABLED(HAVE_TMCDRIVER)
  173. #include <SPI.h>
  174. #include <TMC26XStepper.h>
  175. void tmc_init();
  176. #if ENABLED(X_IS_TMC)
  177. extern TMC26XStepper stepperX;
  178. #undef X_ENABLE_INIT
  179. #define X_ENABLE_INIT ((void)0)
  180. #undef X_ENABLE_WRITE
  181. #define X_ENABLE_WRITE(STATE) stepperX.setEnabled(STATE)
  182. #undef X_ENABLE_READ
  183. #define X_ENABLE_READ stepperX.isEnabled()
  184. #endif
  185. #if ENABLED(X2_IS_TMC)
  186. extern TMC26XStepper stepperX2;
  187. #undef X2_ENABLE_INIT
  188. #define X2_ENABLE_INIT ((void)0)
  189. #undef X2_ENABLE_WRITE
  190. #define X2_ENABLE_WRITE(STATE) stepperX2.setEnabled(STATE)
  191. #undef X2_ENABLE_READ
  192. #define X2_ENABLE_READ stepperX2.isEnabled()
  193. #endif
  194. #if ENABLED(Y_IS_TMC)
  195. extern TMC26XStepper stepperY;
  196. #undef Y_ENABLE_INIT
  197. #define Y_ENABLE_INIT ((void)0)
  198. #undef Y_ENABLE_WRITE
  199. #define Y_ENABLE_WRITE(STATE) stepperY.setEnabled(STATE)
  200. #undef Y_ENABLE_READ
  201. #define Y_ENABLE_READ stepperY.isEnabled()
  202. #endif
  203. #if ENABLED(Y2_IS_TMC)
  204. extern TMC26XStepper stepperY2;
  205. #undef Y2_ENABLE_INIT
  206. #define Y2_ENABLE_INIT ((void)0)
  207. #undef Y2_ENABLE_WRITE
  208. #define Y2_ENABLE_WRITE(STATE) stepperY2.setEnabled(STATE)
  209. #undef Y2_ENABLE_READ
  210. #define Y2_ENABLE_READ stepperY2.isEnabled()
  211. #endif
  212. #if ENABLED(Z_IS_TMC)
  213. extern TMC26XStepper stepperZ;
  214. #undef Z_ENABLE_INIT
  215. #define Z_ENABLE_INIT ((void)0)
  216. #undef Z_ENABLE_WRITE
  217. #define Z_ENABLE_WRITE(STATE) stepperZ.setEnabled(STATE)
  218. #undef Z_ENABLE_READ
  219. #define Z_ENABLE_READ stepperZ.isEnabled()
  220. #endif
  221. #if ENABLED(Z2_IS_TMC)
  222. extern TMC26XStepper stepperZ2;
  223. #undef Z2_ENABLE_INIT
  224. #define Z2_ENABLE_INIT ((void)0)
  225. #undef Z2_ENABLE_WRITE
  226. #define Z2_ENABLE_WRITE(STATE) stepperZ2.setEnabled(STATE)
  227. #undef Z2_ENABLE_READ
  228. #define Z2_ENABLE_READ stepperZ2.isEnabled()
  229. #endif
  230. #if ENABLED(E0_IS_TMC)
  231. extern TMC26XStepper stepperE0;
  232. #undef E0_ENABLE_INIT
  233. #define E0_ENABLE_INIT ((void)0)
  234. #undef E0_ENABLE_WRITE
  235. #define E0_ENABLE_WRITE(STATE) stepperE0.setEnabled(STATE)
  236. #undef E0_ENABLE_READ
  237. #define E0_ENABLE_READ stepperE0.isEnabled()
  238. #endif
  239. #if ENABLED(E1_IS_TMC)
  240. extern TMC26XStepper stepperE1;
  241. #undef E1_ENABLE_INIT
  242. #define E1_ENABLE_INIT ((void)0)
  243. #undef E1_ENABLE_WRITE
  244. #define E1_ENABLE_WRITE(STATE) stepperE1.setEnabled(STATE)
  245. #undef E1_ENABLE_READ
  246. #define E1_ENABLE_READ stepperE1.isEnabled()
  247. #endif
  248. #if ENABLED(E2_IS_TMC)
  249. extern TMC26XStepper stepperE2;
  250. #undef E2_ENABLE_INIT
  251. #define E2_ENABLE_INIT ((void)0)
  252. #undef E2_ENABLE_WRITE
  253. #define E2_ENABLE_WRITE(STATE) stepperE2.setEnabled(STATE)
  254. #undef E2_ENABLE_READ
  255. #define E2_ENABLE_READ stepperE2.isEnabled()
  256. #endif
  257. #if ENABLED(E3_IS_TMC)
  258. extern TMC26XStepper stepperE3;
  259. #undef E3_ENABLE_INIT
  260. #define E3_ENABLE_INIT ((void)0)
  261. #undef E3_ENABLE_WRITE
  262. #define E3_ENABLE_WRITE(STATE) stepperE3.setEnabled(STATE)
  263. #undef E3_ENABLE_READ
  264. #define E3_ENABLE_READ stepperE3.isEnabled()
  265. #endif
  266. #endif // HAVE_TMCDRIVER
  267. //////////////////////////////////
  268. // Pin redefines for L6470 drivers.
  269. // L640 drivers have step on normal pins, but dir and everything else via SPI
  270. //////////////////////////////////
  271. #if ENABLED(HAVE_L6470DRIVER)
  272. #include <SPI.h>
  273. #include <L6470.h>
  274. void L6470_init();
  275. #if ENABLED(X_IS_L6470)
  276. extern L6470 stepperX;
  277. #undef X_ENABLE_INIT
  278. #define X_ENABLE_INIT ((void)0)
  279. #undef X_ENABLE_WRITE
  280. #define X_ENABLE_WRITE(STATE) {if(STATE) stepperX.Step_Clock(stepperX.getStatus() & STATUS_HIZ); else stepperX.softFree();}
  281. #undef X_ENABLE_READ
  282. #define X_ENABLE_READ (stepperX.getStatus() & STATUS_HIZ)
  283. #undef X_DIR_INIT
  284. #define X_DIR_INIT ((void)0)
  285. #undef X_DIR_WRITE
  286. #define X_DIR_WRITE(STATE) stepperX.Step_Clock(STATE)
  287. #undef X_DIR_READ
  288. #define X_DIR_READ (stepperX.getStatus() & STATUS_DIR)
  289. #endif
  290. #if ENABLED(X2_IS_L6470)
  291. extern L6470 stepperX2;
  292. #undef X2_ENABLE_INIT
  293. #define X2_ENABLE_INIT ((void)0)
  294. #undef X2_ENABLE_WRITE
  295. #define X2_ENABLE_WRITE(STATE) (if(STATE) stepperX2.Step_Clock(stepperX2.getStatus() & STATUS_HIZ); else stepperX2.softFree();)
  296. #undef X2_ENABLE_READ
  297. #define X2_ENABLE_READ (stepperX2.getStatus() & STATUS_HIZ)
  298. #undef X2_DIR_INIT
  299. #define X2_DIR_INIT ((void)0)
  300. #undef X2_DIR_WRITE
  301. #define X2_DIR_WRITE(STATE) stepperX2.Step_Clock(STATE)
  302. #undef X2_DIR_READ
  303. #define X2_DIR_READ (stepperX2.getStatus() & STATUS_DIR)
  304. #endif
  305. #if ENABLED(Y_IS_L6470)
  306. extern L6470 stepperY;
  307. #undef Y_ENABLE_INIT
  308. #define Y_ENABLE_INIT ((void)0)
  309. #undef Y_ENABLE_WRITE
  310. #define Y_ENABLE_WRITE(STATE) (if(STATE) stepperY.Step_Clock(stepperY.getStatus() & STATUS_HIZ); else stepperY.softFree();)
  311. #undef Y_ENABLE_READ
  312. #define Y_ENABLE_READ (stepperY.getStatus() & STATUS_HIZ)
  313. #undef Y_DIR_INIT
  314. #define Y_DIR_INIT ((void)0)
  315. #undef Y_DIR_WRITE
  316. #define Y_DIR_WRITE(STATE) stepperY.Step_Clock(STATE)
  317. #undef Y_DIR_READ
  318. #define Y_DIR_READ (stepperY.getStatus() & STATUS_DIR)
  319. #endif
  320. #if ENABLED(Y2_IS_L6470)
  321. extern L6470 stepperY2;
  322. #undef Y2_ENABLE_INIT
  323. #define Y2_ENABLE_INIT ((void)0)
  324. #undef Y2_ENABLE_WRITE
  325. #define Y2_ENABLE_WRITE(STATE) (if(STATE) stepperY2.Step_Clock(stepperY2.getStatus() & STATUS_HIZ); else stepperY2.softFree();)
  326. #undef Y2_ENABLE_READ
  327. #define Y2_ENABLE_READ (stepperY2.getStatus() & STATUS_HIZ)
  328. #undef Y2_DIR_INIT
  329. #define Y2_DIR_INIT ((void)0)
  330. #undef Y2_DIR_WRITE
  331. #define Y2_DIR_WRITE(STATE) stepperY2.Step_Clock(STATE)
  332. #undef Y2_DIR_READ
  333. #define Y2_DIR_READ (stepperY2.getStatus() & STATUS_DIR)
  334. #endif
  335. #if ENABLED(Z_IS_L6470)
  336. extern L6470 stepperZ;
  337. #undef Z_ENABLE_INIT
  338. #define Z_ENABLE_INIT ((void)0)
  339. #undef Z_ENABLE_WRITE
  340. #define Z_ENABLE_WRITE(STATE) (if(STATE) stepperZ.Step_Clock(stepperZ.getStatus() & STATUS_HIZ); else stepperZ.softFree();)
  341. #undef Z_ENABLE_READ
  342. #define Z_ENABLE_READ (stepperZ.getStatus() & STATUS_HIZ)
  343. #undef Z_DIR_INIT
  344. #define Z_DIR_INIT ((void)0)
  345. #undef Z_DIR_WRITE
  346. #define Z_DIR_WRITE(STATE) stepperZ.Step_Clock(STATE)
  347. #undef Y_DIR_READ
  348. #define Y_DIR_READ (stepperZ.getStatus() & STATUS_DIR)
  349. #endif
  350. #if ENABLED(Z2_IS_L6470)
  351. extern L6470 stepperZ2;
  352. #undef Z2_ENABLE_INIT
  353. #define Z2_ENABLE_INIT ((void)0)
  354. #undef Z2_ENABLE_WRITE
  355. #define Z2_ENABLE_WRITE(STATE) (if(STATE) stepperZ2.Step_Clock(stepperZ2.getStatus() & STATUS_HIZ); else stepperZ2.softFree();)
  356. #undef Z2_ENABLE_READ
  357. #define Z2_ENABLE_READ (stepperZ2.getStatus() & STATUS_HIZ)
  358. #undef Z2_DIR_INIT
  359. #define Z2_DIR_INIT ((void)0)
  360. #undef Z2_DIR_WRITE
  361. #define Z2_DIR_WRITE(STATE) stepperZ2.Step_Clock(STATE)
  362. #undef Y2_DIR_READ
  363. #define Y2_DIR_READ (stepperZ2.getStatus() & STATUS_DIR)
  364. #endif
  365. #if ENABLED(E0_IS_L6470)
  366. extern L6470 stepperE0;
  367. #undef E0_ENABLE_INIT
  368. #define E0_ENABLE_INIT ((void)0)
  369. #undef E0_ENABLE_WRITE
  370. #define E0_ENABLE_WRITE(STATE) (if(STATE) stepperE0.Step_Clock(stepperE0.getStatus() & STATUS_HIZ); else stepperE0.softFree();)
  371. #undef E0_ENABLE_READ
  372. #define E0_ENABLE_READ (stepperE0.getStatus() & STATUS_HIZ)
  373. #undef E0_DIR_INIT
  374. #define E0_DIR_INIT ((void)0)
  375. #undef E0_DIR_WRITE
  376. #define E0_DIR_WRITE(STATE) stepperE0.Step_Clock(STATE)
  377. #undef E0_DIR_READ
  378. #define E0_DIR_READ (stepperE0.getStatus() & STATUS_DIR)
  379. #endif
  380. #if ENABLED(E1_IS_L6470)
  381. extern L6470 stepperE1;
  382. #undef E1_ENABLE_INIT
  383. #define E1_ENABLE_INIT ((void)0)
  384. #undef E1_ENABLE_WRITE
  385. #define E1_ENABLE_WRITE(STATE) (if(STATE) stepperE1.Step_Clock(stepperE1.getStatus() & STATUS_HIZ); else stepperE1.softFree();)
  386. #undef E1_ENABLE_READ
  387. #define E1_ENABLE_READ (stepperE1.getStatus() & STATUS_HIZ)
  388. #undef E1_DIR_INIT
  389. #define E1_DIR_INIT ((void)0)
  390. #undef E1_DIR_WRITE
  391. #define E1_DIR_WRITE(STATE) stepperE1.Step_Clock(STATE)
  392. #undef E1_DIR_READ
  393. #define E1_DIR_READ (stepperE1.getStatus() & STATUS_DIR)
  394. #endif
  395. #if ENABLED(E2_IS_L6470)
  396. extern L6470 stepperE2;
  397. #undef E2_ENABLE_INIT
  398. #define E2_ENABLE_INIT ((void)0)
  399. #undef E2_ENABLE_WRITE
  400. #define E2_ENABLE_WRITE(STATE) (if(STATE) stepperE2.Step_Clock(stepperE2.getStatus() & STATUS_HIZ); else stepperE2.softFree();)
  401. #undef E2_ENABLE_READ
  402. #define E2_ENABLE_READ (stepperE2.getStatus() & STATUS_HIZ)
  403. #undef E2_DIR_INIT
  404. #define E2_DIR_INIT ((void)0)
  405. #undef E2_DIR_WRITE
  406. #define E2_DIR_WRITE(STATE) stepperE2.Step_Clock(STATE)
  407. #undef E2_DIR_READ
  408. #define E2_DIR_READ (stepperE2.getStatus() & STATUS_DIR)
  409. #endif
  410. #if ENABLED(E3_IS_L6470)
  411. extern L6470 stepperE3;
  412. #undef E3_ENABLE_INIT
  413. #define E3_ENABLE_INIT ((void)0)
  414. #undef E3_ENABLE_WRITE
  415. #define E3_ENABLE_WRITE(STATE) (if(STATE) stepperE3.Step_Clock(stepperE3.getStatus() & STATUS_HIZ); else stepperE3.softFree();)
  416. #undef E3_ENABLE_READ
  417. #define E3_ENABLE_READ (stepperE3.getStatus() & STATUS_HIZ)
  418. #undef E3_DIR_INIT
  419. #define E3_DIR_INIT ((void)0)
  420. #undef E3_DIR_WRITE
  421. #define E3_DIR_WRITE(STATE) stepperE3.Step_Clock(STATE)
  422. #undef E3_DIR_READ
  423. #define E3_DIR_READ (stepperE3.getStatus() & STATUS_DIR)
  424. #endif
  425. #endif //HAVE_L6470DRIVER
  426. #endif // STEPPER_INDIRECTION_H