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

stepper_indirection.h 17KB

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