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.

sensitive_pins.h 21KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016
  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. // Prepare a list of protected pins for M42/M43
  25. //
  26. #if PIN_EXISTS(X_MIN)
  27. #define _X_MIN X_MIN_PIN,
  28. #else
  29. #define _X_MIN
  30. #endif
  31. #if PIN_EXISTS(X_MAX)
  32. #define _X_MAX X_MAX_PIN,
  33. #else
  34. #define _X_MAX
  35. #endif
  36. #if PIN_EXISTS(X_CS) && AXIS_HAS_SPI(X)
  37. #define _X_CS X_CS_PIN,
  38. #else
  39. #define _X_CS
  40. #endif
  41. #if PIN_EXISTS(X_MS1)
  42. #define _X_MS1 X_MS1_PIN,
  43. #else
  44. #define _X_MS1
  45. #endif
  46. #if PIN_EXISTS(X_MS2)
  47. #define _X_MS2 X_MS2_PIN,
  48. #else
  49. #define _X_MS2
  50. #endif
  51. #if PIN_EXISTS(X_MS3)
  52. #define _X_MS3 X_MS3_PIN,
  53. #else
  54. #define _X_MS3
  55. #endif
  56. #if PIN_EXISTS(X_ENABLE)
  57. #define _X_ENABLE_PIN X_ENABLE_PIN,
  58. #else
  59. #define _X_ENABLE_PIN
  60. #endif
  61. #define _X_PINS X_STEP_PIN, X_DIR_PIN, _X_ENABLE_PIN _X_MIN _X_MAX _X_MS1 _X_MS2 _X_MS3 _X_CS
  62. #if HAS_Y_AXIS
  63. #if PIN_EXISTS(Y_MIN)
  64. #define _Y_MIN Y_MIN_PIN,
  65. #else
  66. #define _Y_MIN
  67. #endif
  68. #if PIN_EXISTS(Y_MAX)
  69. #define _Y_MAX Y_MAX_PIN,
  70. #else
  71. #define _Y_MAX
  72. #endif
  73. #if PIN_EXISTS(Y_CS) && AXIS_HAS_SPI(Y)
  74. #define _Y_CS Y_CS_PIN,
  75. #else
  76. #define _Y_CS
  77. #endif
  78. #if PIN_EXISTS(Y_MS1)
  79. #define _Y_MS1 Y_MS1_PIN,
  80. #else
  81. #define _Y_MS1
  82. #endif
  83. #if PIN_EXISTS(Y_MS2)
  84. #define _Y_MS2 Y_MS2_PIN,
  85. #else
  86. #define _Y_MS2
  87. #endif
  88. #if PIN_EXISTS(Y_MS3)
  89. #define _Y_MS3 Y_MS3_PIN,
  90. #else
  91. #define _Y_MS3
  92. #endif
  93. #if PIN_EXISTS(Y_ENABLE)
  94. #define _Y_ENABLE_PIN Y_ENABLE_PIN,
  95. #else
  96. #define _Y_ENABLE_PIN
  97. #endif
  98. #define _Y_PINS Y_STEP_PIN, Y_DIR_PIN, _Y_ENABLE_PIN _Y_MIN _Y_MAX _Y_MS1 _Y_MS2 _Y_MS3 _Y_CS
  99. #else
  100. #define _Y_PINS
  101. #endif
  102. #if HAS_Z_AXIS
  103. #if PIN_EXISTS(Z_MIN)
  104. #define _Z_MIN Z_MIN_PIN,
  105. #else
  106. #define _Z_MIN
  107. #endif
  108. #if PIN_EXISTS(Z_MAX)
  109. #define _Z_MAX Z_MAX_PIN,
  110. #else
  111. #define _Z_MAX
  112. #endif
  113. #if PIN_EXISTS(Z_CS) && AXIS_HAS_SPI(Z)
  114. #define _Z_CS Z_CS_PIN,
  115. #else
  116. #define _Z_CS
  117. #endif
  118. #if PIN_EXISTS(Z_MS1)
  119. #define _Z_MS1 Z_MS1_PIN,
  120. #else
  121. #define _Z_MS1
  122. #endif
  123. #if PIN_EXISTS(Z_MS2)
  124. #define _Z_MS2 Z_MS2_PIN,
  125. #else
  126. #define _Z_MS2
  127. #endif
  128. #if PIN_EXISTS(Z_MS3)
  129. #define _Z_MS3 Z_MS3_PIN,
  130. #else
  131. #define _Z_MS3
  132. #endif
  133. #if PIN_EXISTS(Z_ENABLE)
  134. #define _Z_ENABLE_PIN Z_ENABLE_PIN,
  135. #else
  136. #define _Z_ENABLE_PIN
  137. #endif
  138. #define _Z_PINS Z_STEP_PIN, Z_DIR_PIN, _Z_ENABLE_PIN _Z_MIN _Z_MAX _Z_MS1 _Z_MS2 _Z_MS3 _Z_CS
  139. #else
  140. #define _Z_PINS
  141. #endif
  142. #if HAS_I_AXIS
  143. #if PIN_EXISTS(I_MIN)
  144. #define _I_MIN I_MIN_PIN,
  145. #else
  146. #define _I_MIN
  147. #endif
  148. #if PIN_EXISTS(I_MAX)
  149. #define _I_MAX I_MAX_PIN,
  150. #else
  151. #define _I_MAX
  152. #endif
  153. #if PIN_EXISTS(I_CS) && AXIS_HAS_SPI(I)
  154. #define _I_CS I_CS_PIN,
  155. #else
  156. #define _I_CS
  157. #endif
  158. #if PIN_EXISTS(I_MS1)
  159. #define _I_MS1 I_MS1_PIN,
  160. #else
  161. #define _I_MS1
  162. #endif
  163. #if PIN_EXISTS(I_MS2)
  164. #define _I_MS2 I_MS2_PIN,
  165. #else
  166. #define _I_MS2
  167. #endif
  168. #if PIN_EXISTS(I_MS3)
  169. #define _I_MS3 I_MS3_PIN,
  170. #else
  171. #define _I_MS3
  172. #endif
  173. #if PIN_EXISTS(I_ENABLE)
  174. #define _I_ENABLE_PIN I_ENABLE_PIN,
  175. #else
  176. #define _I_ENABLE_PIN
  177. #endif
  178. #define _I_PINS I_STEP_PIN, I_DIR_PIN, _I_ENABLE_PIN _I_MIN _I_MAX _I_MS1 _I_MS2 _I_MS3 _I_CS
  179. #else
  180. #define _I_PINS
  181. #endif
  182. #if HAS_J_AXIS
  183. #if PIN_EXISTS(J_MIN)
  184. #define _J_MIN J_MIN_PIN,
  185. #else
  186. #define _J_MIN
  187. #endif
  188. #if PIN_EXISTS(J_MAX)
  189. #define _J_MAX J_MAX_PIN,
  190. #else
  191. #define _J_MAX
  192. #endif
  193. #if PIN_EXISTS(J_CS) && AXIS_HAS_SPI(J)
  194. #define _J_CS J_CS_PIN,
  195. #else
  196. #define _J_CS
  197. #endif
  198. #if PIN_EXISTS(J_MS1)
  199. #define _J_MS1 J_MS1_PIN,
  200. #else
  201. #define _J_MS1
  202. #endif
  203. #if PIN_EXISTS(J_MS2)
  204. #define _J_MS2 J_MS2_PIN,
  205. #else
  206. #define _J_MS2
  207. #endif
  208. #if PIN_EXISTS(J_MS3)
  209. #define _J_MS3 J_MS3_PIN,
  210. #else
  211. #define _J_MS3
  212. #endif
  213. #if PIN_EXISTS(J_ENABLE)
  214. #define _J_ENABLE_PIN J_ENABLE_PIN,
  215. #else
  216. #define _J_ENABLE_PIN
  217. #endif
  218. #define _J_PINS J_STEP_PIN, J_DIR_PIN, _J_ENABLE_PIN _J_MIN _J_MAX _J_MS1 _J_MS2 _J_MS3 _J_CS
  219. #else
  220. #define _J_PINS
  221. #endif
  222. #if HAS_K_AXIS
  223. #if PIN_EXISTS(K_MIN)
  224. #define _K_MIN K_MIN_PIN,
  225. #else
  226. #define _K_MIN
  227. #endif
  228. #if PIN_EXISTS(K_MAX)
  229. #define _K_MAX K_MAX_PIN,
  230. #else
  231. #define _K_MAX
  232. #endif
  233. #if PIN_EXISTS(K_CS) && AXIS_HAS_SPI(K)
  234. #define _K_CS K_CS_PIN,
  235. #else
  236. #define _K_CS
  237. #endif
  238. #if PIN_EXISTS(K_MS1)
  239. #define _K_MS1 K_MS1_PIN,
  240. #else
  241. #define _K_MS1
  242. #endif
  243. #if PIN_EXISTS(K_MS2)
  244. #define _K_MS2 K_MS2_PIN,
  245. #else
  246. #define _K_MS2
  247. #endif
  248. #if PIN_EXISTS(K_MS3)
  249. #define _K_MS3 K_MS3_PIN,
  250. #else
  251. #define _K_MS3
  252. #endif
  253. #if PIN_EXISTS(K_ENABLE)
  254. #define _K_ENABLE_PIN K_ENABLE_PIN,
  255. #else
  256. #define _K_ENABLE_PIN
  257. #endif
  258. #define _K_PINS K_STEP_PIN, K_DIR_PIN, _K_ENABLE_PIN _K_MIN _K_MAX _K_MS1 _K_MS2 _K_MS3 _K_CS
  259. #else
  260. #define _K_PINS
  261. #endif
  262. #if HAS_U_AXIS
  263. #if PIN_EXISTS(U_MIN)
  264. #define _U_MIN U_MIN_PIN,
  265. #else
  266. #define _U_MIN
  267. #endif
  268. #if PIN_EXISTS(U_MAX)
  269. #define _U_MAX U_MAX_PIN,
  270. #else
  271. #define _U_MAX
  272. #endif
  273. #if PIN_EXISTS(U_CS) && AXIS_HAS_SPI(U)
  274. #define _U_CS U_CS_PIN,
  275. #else
  276. #define _U_CS
  277. #endif
  278. #if PIN_EXISTS(U_MS1)
  279. #define _U_MS1 U_MS1_PIN,
  280. #else
  281. #define _U_MS1
  282. #endif
  283. #if PIN_EXISTS(U_MS2)
  284. #define _U_MS2 U_MS2_PIN,
  285. #else
  286. #define _U_MS2
  287. #endif
  288. #if PIN_EXISTS(U_MS3)
  289. #define _U_MS3 U_MS3_PIN,
  290. #else
  291. #define _U_MS3
  292. #endif
  293. #define _U_PINS U_STEP_PIN, U_DIR_PIN, U_ENABLE_PIN, _U_MIN _U_MAX _U_MS1 _U_MS2 _U_MS3 _U_CS
  294. #else
  295. #define _U_PINS
  296. #endif
  297. #if HAS_V_AXIS
  298. #if PIN_EXISTS(V_MIN)
  299. #define _V_MIN V_MIN_PIN,
  300. #else
  301. #define _V_MIN
  302. #endif
  303. #if PIN_EXISTS(V_MAX)
  304. #define _V_MAX V_MAX_PIN,
  305. #else
  306. #define _V_MAX
  307. #endif
  308. #if PIN_EXISTS(V_CS) && AXIS_HAS_SPI(V)
  309. #define _V_CS V_CS_PIN,
  310. #else
  311. #define _V_CS
  312. #endif
  313. #if PIN_EXISTS(V_MS1)
  314. #define _V_MS1 V_MS1_PIN,
  315. #else
  316. #define _V_MS1
  317. #endif
  318. #if PIN_EXISTS(V_MS2)
  319. #define _V_MS2 V_MS2_PIN,
  320. #else
  321. #define _V_MS2
  322. #endif
  323. #if PIN_EXISTS(V_MS3)
  324. #define _V_MS3 V_MS3_PIN,
  325. #else
  326. #define _V_MS3
  327. #endif
  328. #define _V_PINS V_STEP_PIN, V_DIR_PIN, V_ENABLE_PIN, _V_MIN _V_MAX _V_MS1 _V_MS2 _V_MS3 _V_CS
  329. #else
  330. #define _V_PINS
  331. #endif
  332. #if HAS_W_AXIS
  333. #if PIN_EXISTS(W_MIN)
  334. #define _W_MIN W_MIN_PIN,
  335. #else
  336. #define _W_MIN
  337. #endif
  338. #if PIN_EXISTS(W_MAX)
  339. #define _W_MAX W_MAX_PIN,
  340. #else
  341. #define _W_MAX
  342. #endif
  343. #if PIN_EXISTS(W_CS) && AXIS_HAS_SPI(W)
  344. #define _W_CS W_CS_PIN,
  345. #else
  346. #define _W_CS
  347. #endif
  348. #if PIN_EXISTS(W_MS1)
  349. #define _W_MS1 W_MS1_PIN,
  350. #else
  351. #define _W_MS1
  352. #endif
  353. #if PIN_EXISTS(W_MS2)
  354. #define _W_MS2 W_MS2_PIN,
  355. #else
  356. #define _W_MS2
  357. #endif
  358. #if PIN_EXISTS(W_MS3)
  359. #define _W_MS3 W_MS3_PIN,
  360. #else
  361. #define _W_MS3
  362. #endif
  363. #define _W_PINS W_STEP_PIN, W_DIR_PIN, W_ENABLE_PIN, _W_MIN _W_MAX _W_MS1 _W_MS2 _W_MS3 _W_CS
  364. #else
  365. #define _W_PINS
  366. #endif
  367. //
  368. // Extruder Chip Select, Digital Micro-steps
  369. //
  370. // Mixing stepper, Switching stepper, or regular stepper
  371. #define E_NEEDED(N) (ENABLED(MIXING_EXTRUDER) && MIXING_STEPPERS > N) \
  372. || (ENABLED(SWITCHING_EXTRUDER) && E_STEPPERS > N) \
  373. || (NONE(SWITCHING_EXTRUDER, MIXING_EXTRUDER) && EXTRUDERS > N)
  374. #define _E0_CS
  375. #define _E0_MS1
  376. #define _E0_MS2
  377. #define _E0_MS3
  378. #if E_NEEDED(0)
  379. #if PIN_EXISTS(E0_CS) && AXIS_HAS_SPI(E0)
  380. #undef _E0_CS
  381. #define _E0_CS E0_CS_PIN,
  382. #endif
  383. #if PIN_EXISTS(E0_MS1)
  384. #undef _E0_MS1
  385. #define _E0_MS1 E0_MS1_PIN,
  386. #endif
  387. #if PIN_EXISTS(E0_MS2)
  388. #undef _E0_MS2
  389. #define _E0_MS2 E0_MS2_PIN,
  390. #endif
  391. #if PIN_EXISTS(E0_MS3)
  392. #undef _E0_MS3
  393. #define _E0_MS3 E0_MS3_PIN,
  394. #endif
  395. #endif
  396. #define _E1_CS
  397. #define _E1_MS1
  398. #define _E1_MS2
  399. #define _E1_MS3
  400. #if E_NEEDED(1)
  401. #if PIN_EXISTS(E1_CS) && AXIS_HAS_SPI(E1)
  402. #undef _E1_CS
  403. #define _E1_CS E1_CS_PIN,
  404. #endif
  405. #if PIN_EXISTS(E1_MS1)
  406. #undef _E1_MS1
  407. #define _E1_MS1 E1_MS1_PIN,
  408. #endif
  409. #if PIN_EXISTS(E1_MS2)
  410. #undef _E1_MS2
  411. #define _E1_MS2 E1_MS2_PIN,
  412. #endif
  413. #if PIN_EXISTS(E1_MS3)
  414. #undef _E1_MS3
  415. #define _E1_MS3 E1_MS3_PIN,
  416. #endif
  417. #endif
  418. #define _E2_CS
  419. #define _E2_MS1
  420. #define _E2_MS2
  421. #define _E2_MS3
  422. #if E_NEEDED(2)
  423. #if PIN_EXISTS(E2_CS) && AXIS_HAS_SPI(E2)
  424. #undef _E2_CS
  425. #define _E2_CS E2_CS_PIN,
  426. #endif
  427. #if PIN_EXISTS(E2_MS1)
  428. #undef _E2_MS1
  429. #define _E2_MS1 E2_MS1_PIN,
  430. #endif
  431. #if PIN_EXISTS(E2_MS2)
  432. #undef _E2_MS2
  433. #define _E2_MS2 E2_MS2_PIN,
  434. #endif
  435. #if PIN_EXISTS(E2_MS3)
  436. #undef _E2_MS3
  437. #define _E2_MS3 E2_MS3_PIN,
  438. #endif
  439. #endif
  440. #define _E3_CS
  441. #define _E3_MS1
  442. #define _E3_MS2
  443. #define _E3_MS3
  444. #if E_NEEDED(3)
  445. #if PIN_EXISTS(E3_CS) && AXIS_HAS_SPI(E3)
  446. #undef _E3_CS
  447. #define _E3_CS E3_CS_PIN,
  448. #endif
  449. #if PIN_EXISTS(E3_MS1)
  450. #undef _E3_MS1
  451. #define _E3_MS1 E3_MS1_PIN,
  452. #endif
  453. #if PIN_EXISTS(E3_MS2)
  454. #undef _E3_MS2
  455. #define _E3_MS2 E3_MS2_PIN,
  456. #endif
  457. #if PIN_EXISTS(E3_MS3)
  458. #undef _E3_MS3
  459. #define _E3_MS3 E3_MS3_PIN,
  460. #endif
  461. #endif
  462. #define _E4_CS
  463. #define _E4_MS1
  464. #define _E4_MS2
  465. #define _E4_MS3
  466. #if E_NEEDED(4)
  467. #if PIN_EXISTS(E4_CS) && AXIS_HAS_SPI(E4)
  468. #undef _E4_CS
  469. #define _E4_CS E4_CS_PIN,
  470. #endif
  471. #if PIN_EXISTS(E4_MS1)
  472. #undef _E4_MS1
  473. #define _E4_MS1 E4_MS1_PIN,
  474. #endif
  475. #if PIN_EXISTS(E4_MS2)
  476. #undef _E4_MS2
  477. #define _E4_MS2 E4_MS2_PIN,
  478. #endif
  479. #if PIN_EXISTS(E4_MS3)
  480. #undef _E4_MS3
  481. #define _E4_MS3 E4_MS3_PIN,
  482. #endif
  483. #endif
  484. #define _E5_CS
  485. #define _E5_MS1
  486. #define _E5_MS2
  487. #define _E5_MS3
  488. #if E_NEEDED(5)
  489. #if PIN_EXISTS(E5_CS) && AXIS_HAS_SPI(E5)
  490. #undef _E5_CS
  491. #define _E5_CS E5_CS_PIN,
  492. #endif
  493. #if PIN_EXISTS(E5_MS1)
  494. #undef _E5_MS1
  495. #define _E5_MS1 E5_MS1_PIN,
  496. #endif
  497. #if PIN_EXISTS(E5_MS2)
  498. #undef _E5_MS2
  499. #define _E5_MS2 E5_MS2_PIN,
  500. #endif
  501. #if PIN_EXISTS(E5_MS3)
  502. #undef _E5_MS3
  503. #define _E5_MS3 E5_MS3_PIN,
  504. #endif
  505. #endif
  506. #define _E6_CS
  507. #define _E6_MS1
  508. #define _E6_MS2
  509. #define _E6_MS3
  510. #if E_NEEDED(6)
  511. #if PIN_EXISTS(E6_CS) && AXIS_HAS_SPI(E6)
  512. #undef _E6_CS
  513. #define _E6_CS E6_CS_PIN,
  514. #endif
  515. #if PIN_EXISTS(E6_MS2)
  516. #undef _E6_MS2
  517. #define _E6_MS2 E6_MS2_PIN,
  518. #endif
  519. #if PIN_EXISTS(E6_MS3)
  520. #undef _E6_MS3
  521. #define _E6_MS3 E6_MS3_PIN,
  522. #endif
  523. #if PIN_EXISTS(E6_MS4)
  524. #undef _E6_MS4
  525. #define _E6_MS4 E6_MS4_PIN,
  526. #endif
  527. #endif
  528. #define _E7_CS
  529. #define _E7_MS1
  530. #define _E7_MS2
  531. #define _E7_MS3
  532. #if E_NEEDED(7)
  533. #if PIN_EXISTS(E7_CS) && AXIS_HAS_SPI(E7)
  534. #undef _E7_CS
  535. #define _E7_CS E7_CS_PIN,
  536. #endif
  537. #if PIN_EXISTS(E7_MS3)
  538. #undef _E7_MS3
  539. #define _E7_MS3 E7_MS3_PIN,
  540. #endif
  541. #if PIN_EXISTS(E7_MS4)
  542. #undef _E7_MS4
  543. #define _E7_MS4 E7_MS4_PIN,
  544. #endif
  545. #if PIN_EXISTS(E7_MS5)
  546. #undef _E7_MS5
  547. #define _E7_MS5 E7_MS5_PIN,
  548. #endif
  549. #endif
  550. //
  551. // E Steppers
  552. //
  553. #define _E0_PINS
  554. #define _E1_PINS
  555. #define _E2_PINS
  556. #define _E3_PINS
  557. #define _E4_PINS
  558. #define _E5_PINS
  559. #define _E6_PINS
  560. #define _E7_PINS
  561. #if HAS_EXTRUDERS
  562. #undef _E0_PINS
  563. #define _E0_PINS E0_STEP_PIN, E0_DIR_PIN, E0_ENABLE_PIN, _E0_CS _E0_MS1 _E0_MS2 _E0_MS3
  564. #endif
  565. #if ENABLED(SWITCHING_EXTRUDER)
  566. // Tools 0 and 1 use E0
  567. #if EXTRUDERS > 2 // Tools 2 and 3 use E1
  568. #undef _E1_PINS
  569. #define _E1_PINS E1_STEP_PIN, E1_DIR_PIN, E1_ENABLE_PIN, _E1_CS _E1_MS1 _E1_MS2 _E1_MS3
  570. #if EXTRUDERS > 4 // Tools 4 and 5 use E2
  571. #undef _E2_PINS
  572. #define _E2_PINS E2_STEP_PIN, E2_DIR_PIN, E2_ENABLE_PIN, _E2_CS _E2_MS1 _E2_MS2 _E2_MS3
  573. #endif
  574. #endif
  575. #elif EITHER(HAS_MULTI_EXTRUDER, MIXING_EXTRUDER)
  576. #undef _E1_PINS
  577. #define _E1_PINS E1_STEP_PIN, E1_DIR_PIN, E1_ENABLE_PIN, _E1_CS _E1_MS1 _E1_MS2 _E1_MS3
  578. #if EXTRUDERS > 2 || (ENABLED(MIXING_EXTRUDER) && MIXING_STEPPERS > 2)
  579. #undef _E2_PINS
  580. #define _E2_PINS E2_STEP_PIN, E2_DIR_PIN, E2_ENABLE_PIN, _E2_CS _E2_MS1 _E2_MS2 _E2_MS3
  581. #if EXTRUDERS > 3 || (ENABLED(MIXING_EXTRUDER) && MIXING_STEPPERS > 3)
  582. #undef _E3_PINS
  583. #define _E3_PINS E3_STEP_PIN, E3_DIR_PIN, E3_ENABLE_PIN, _E3_CS _E3_MS1 _E3_MS2 _E3_MS3
  584. #if EXTRUDERS > 4 || (ENABLED(MIXING_EXTRUDER) && MIXING_STEPPERS > 4)
  585. #undef _E4_PINS
  586. #define _E4_PINS E4_STEP_PIN, E4_DIR_PIN, E4_ENABLE_PIN, _E4_CS _E4_MS1 _E4_MS2 _E4_MS3
  587. #if EXTRUDERS > 5 || (ENABLED(MIXING_EXTRUDER) && MIXING_STEPPERS > 5)
  588. #undef _E5_PINS
  589. #define _E5_PINS E5_STEP_PIN, E5_DIR_PIN, E5_ENABLE_PIN, _E5_CS _E5_MS1 _E5_MS2 _E5_MS3
  590. #if EXTRUDERS > 6 || (ENABLED(MIXING_EXTRUDER) && MIXING_STEPPERS > 6)
  591. #undef _E6_PINS
  592. #define _E6_PINS E6_STEP_PIN, E6_DIR_PIN, E6_ENABLE_PIN, _E6_CS _E6_MS1 _E6_MS2 _E6_MS3
  593. #if EXTRUDERS > 7 || (ENABLED(MIXING_EXTRUDER) && MIXING_STEPPERS > 7)
  594. #undef _E7_PINS
  595. #define _E7_PINS E7_STEP_PIN, E7_DIR_PIN, E7_ENABLE_PIN, _E7_CS _E7_MS1 _E7_MS2 _E7_MS3
  596. #endif // EXTRUDERS > 7 || MIXING_EXTRUDER > 7
  597. #endif // EXTRUDERS > 6 || MIXING_EXTRUDER > 6
  598. #endif // EXTRUDERS > 5 || MIXING_EXTRUDER > 5
  599. #endif // EXTRUDERS > 4 || MIXING_EXTRUDER > 4
  600. #endif // EXTRUDERS > 3 || MIXING_EXTRUDER > 3
  601. #endif // EXTRUDERS > 2 || MIXING_EXTRUDER > 2
  602. #endif // HAS_MULTI_EXTRUDER || MIXING_EXTRUDER
  603. //
  604. // Heaters, Fans, Temp Sensors
  605. //
  606. #ifndef E0_AUTO_FAN_PIN
  607. #define E0_AUTO_FAN_PIN -1
  608. #endif
  609. #ifndef E1_AUTO_FAN_PIN
  610. #define E1_AUTO_FAN_PIN -1
  611. #endif
  612. #ifndef E2_AUTO_FAN_PIN
  613. #define E2_AUTO_FAN_PIN -1
  614. #endif
  615. #ifndef E3_AUTO_FAN_PIN
  616. #define E3_AUTO_FAN_PIN -1
  617. #endif
  618. #ifndef E4_AUTO_FAN_PIN
  619. #define E4_AUTO_FAN_PIN -1
  620. #endif
  621. #ifndef E5_AUTO_FAN_PIN
  622. #define E5_AUTO_FAN_PIN -1
  623. #endif
  624. #ifndef E6_AUTO_FAN_PIN
  625. #define E6_AUTO_FAN_PIN -1
  626. #endif
  627. #ifndef E7_AUTO_FAN_PIN
  628. #define E7_AUTO_FAN_PIN -1
  629. #endif
  630. #define _H0_PINS
  631. #define _H1_PINS
  632. #define _H2_PINS
  633. #define _H3_PINS
  634. #define _H4_PINS
  635. #define _H5_PINS
  636. #define _H6_PINS
  637. #define _H7_PINS
  638. #define DIO_PIN(P) TERN(TARGET_LPC1768, P, analogInputToDigitalPin(P))
  639. #if HAS_HOTEND
  640. #undef _H0_PINS
  641. #define _H0_PINS HEATER_0_PIN, E0_AUTO_FAN_PIN, DIO_PIN(TEMP_0_PIN),
  642. #if HAS_MULTI_HOTEND
  643. #undef _H1_PINS
  644. #define _H1_PINS HEATER_1_PIN, E1_AUTO_FAN_PIN, DIO_PIN(TEMP_1_PIN),
  645. #if HOTENDS > 2
  646. #undef _H2_PINS
  647. #define _H2_PINS HEATER_2_PIN, E2_AUTO_FAN_PIN, DIO_PIN(TEMP_2_PIN),
  648. #if HOTENDS > 3
  649. #undef _H3_PINS
  650. #define _H3_PINS HEATER_3_PIN, E3_AUTO_FAN_PIN, DIO_PIN(TEMP_3_PIN),
  651. #if HOTENDS > 4
  652. #undef _H4_PINS
  653. #define _H4_PINS HEATER_4_PIN, E4_AUTO_FAN_PIN, DIO_PIN(TEMP_4_PIN),
  654. #if HOTENDS > 5
  655. #undef _H5_PINS
  656. #define _H5_PINS HEATER_5_PIN, E5_AUTO_FAN_PIN, DIO_PIN(TEMP_5_PIN),
  657. #if HOTENDS > 6
  658. #undef _H6_PINS
  659. #define _H6_PINS HEATER_6_PIN, E6_AUTO_FAN_PIN, DIO_PIN(TEMP_6_PIN),
  660. #if HOTENDS > 7
  661. #undef _H7_PINS
  662. #define _H7_PINS HEATER_7_PIN, E7_AUTO_FAN_PIN, DIO_PIN(TEMP_7_PIN),
  663. #endif // HOTENDS > 7
  664. #endif // HOTENDS > 6
  665. #endif // HOTENDS > 5
  666. #endif // HOTENDS > 4
  667. #endif // HOTENDS > 3
  668. #endif // HOTENDS > 2
  669. #endif // HAS_MULTI_HOTEND
  670. #endif // HOTENDS
  671. //
  672. // Dual X, Dual Y, Multi-Z
  673. // Chip Select and Digital Micro-stepping
  674. //
  675. #if HAS_X2_STEPPER
  676. #if PIN_EXISTS(X2_CS) && AXIS_HAS_SPI(X2)
  677. #define _X2_CS X2_CS_PIN,
  678. #else
  679. #define _X2_CS
  680. #endif
  681. #if PIN_EXISTS(X2_MS1)
  682. #define _X2_MS1 X2_MS1_PIN,
  683. #else
  684. #define _X2_MS1
  685. #endif
  686. #if PIN_EXISTS(X2_MS2)
  687. #define _X2_MS2 X2_MS2_PIN,
  688. #else
  689. #define _X2_MS2
  690. #endif
  691. #if PIN_EXISTS(X2_MS3)
  692. #define _X2_MS3 X2_MS3_PIN,
  693. #else
  694. #define _X2_MS3
  695. #endif
  696. #define _X2_PINS X2_STEP_PIN, X2_DIR_PIN, X2_ENABLE_PIN, _X2_CS _X2_MS1 _X2_MS2 _X2_MS3
  697. #else
  698. #define _X2_PINS
  699. #endif
  700. #if HAS_DUAL_Y_STEPPERS
  701. #if PIN_EXISTS(Y2_CS) && AXIS_HAS_SPI(Y2)
  702. #define _Y2_CS Y2_CS_PIN,
  703. #else
  704. #define _Y2_CS
  705. #endif
  706. #if PIN_EXISTS(Y2_MS1)
  707. #define _Y2_MS1 Y2_MS1_PIN,
  708. #else
  709. #define _Y2_MS1
  710. #endif
  711. #if PIN_EXISTS(Y2_MS2)
  712. #define _Y2_MS2 Y2_MS2_PIN,
  713. #else
  714. #define _Y2_MS2
  715. #endif
  716. #if PIN_EXISTS(Y2_MS3)
  717. #define _Y2_MS3 Y2_MS3_PIN,
  718. #else
  719. #define _Y2_MS3
  720. #endif
  721. #define _Y2_PINS Y2_STEP_PIN, Y2_DIR_PIN, Y2_ENABLE_PIN, _Y2_CS _Y2_MS1 _Y2_MS2 _Y2_MS3
  722. #else
  723. #define _Y2_PINS
  724. #endif
  725. #if NUM_Z_STEPPERS >= 2
  726. #if PIN_EXISTS(Z2_CS) && AXIS_HAS_SPI(Z2)
  727. #define _Z2_CS Z2_CS_PIN,
  728. #else
  729. #define _Z2_CS
  730. #endif
  731. #if PIN_EXISTS(Z2_MS1)
  732. #define _Z2_MS1 Z2_MS1_PIN,
  733. #else
  734. #define _Z2_MS1
  735. #endif
  736. #if PIN_EXISTS(Z2_MS2)
  737. #define _Z2_MS2 Z2_MS2_PIN,
  738. #else
  739. #define _Z2_MS2
  740. #endif
  741. #if PIN_EXISTS(Z2_MS3)
  742. #define _Z2_MS3 Z2_MS3_PIN,
  743. #else
  744. #define _Z2_MS3
  745. #endif
  746. #define _Z2_PINS Z2_STEP_PIN, Z2_DIR_PIN, Z2_ENABLE_PIN, _Z2_CS _Z2_MS1 _Z2_MS2 _Z2_MS3
  747. #else
  748. #define _Z2_PINS
  749. #endif
  750. #if NUM_Z_STEPPERS >= 3
  751. #if PIN_EXISTS(Z3_CS) && AXIS_HAS_SPI(Z3)
  752. #define _Z3_CS Z3_CS_PIN,
  753. #else
  754. #define _Z3_CS
  755. #endif
  756. #if PIN_EXISTS(Z3_MS1)
  757. #define _Z3_MS1 Z3_MS1_PIN,
  758. #else
  759. #define _Z3_MS1
  760. #endif
  761. #if PIN_EXISTS(Z3_MS2)
  762. #define _Z3_MS2 Z3_MS2_PIN,
  763. #else
  764. #define _Z3_MS2
  765. #endif
  766. #if PIN_EXISTS(Z3_MS3)
  767. #define _Z3_MS3 Z3_MS3_PIN,
  768. #else
  769. #define _Z3_MS3
  770. #endif
  771. #define _Z3_PINS Z3_STEP_PIN, Z3_DIR_PIN, Z3_ENABLE_PIN, _Z3_CS _Z3_MS1 _Z3_MS2 _Z3_MS3
  772. #else
  773. #define _Z3_PINS
  774. #endif
  775. #if NUM_Z_STEPPERS >= 4
  776. #if PIN_EXISTS(Z4_CS) && AXIS_HAS_SPI(Z4)
  777. #define _Z4_CS Z4_CS_PIN,
  778. #else
  779. #define _Z4_CS
  780. #endif
  781. #if PIN_EXISTS(Z4_MS1)
  782. #define _Z4_MS1 Z4_MS1_PIN,
  783. #else
  784. #define _Z4_MS1
  785. #endif
  786. #if PIN_EXISTS(Z4_MS2)
  787. #define _Z4_MS2 Z4_MS2_PIN,
  788. #else
  789. #define _Z4_MS2
  790. #endif
  791. #if PIN_EXISTS(Z4_MS3)
  792. #define _Z4_MS3 Z4_MS3_PIN,
  793. #else
  794. #define _Z4_MS3
  795. #endif
  796. #define _Z4_PINS Z4_STEP_PIN, Z4_DIR_PIN, Z4_ENABLE_PIN, _Z4_CS _Z4_MS1 _Z4_MS2 _Z4_MS3
  797. #else
  798. #define _Z4_PINS
  799. #endif
  800. //
  801. // Generate the final Sensitive Pins array,
  802. // keeping the array as small as possible.
  803. //
  804. #if PIN_EXISTS(PS_ON)
  805. #define _PS_ON PS_ON_PIN,
  806. #else
  807. #define _PS_ON
  808. #endif
  809. #if HAS_BED_PROBE && PIN_EXISTS(Z_MIN_PROBE)
  810. #define _Z_PROBE Z_MIN_PROBE_PIN,
  811. #else
  812. #define _Z_PROBE
  813. #endif
  814. #if PIN_EXISTS(FAN)
  815. #define _FAN0 FAN_PIN,
  816. #else
  817. #define _FAN0
  818. #endif
  819. #if PIN_EXISTS(FAN1)
  820. #define _FAN1 FAN1_PIN,
  821. #else
  822. #define _FAN1
  823. #endif
  824. #if PIN_EXISTS(FAN2)
  825. #define _FAN2 FAN2_PIN,
  826. #else
  827. #define _FAN2
  828. #endif
  829. #if PIN_EXISTS(FAN3)
  830. #define _FAN3 FAN3_PIN,
  831. #else
  832. #define _FAN3
  833. #endif
  834. #if PIN_EXISTS(FAN4)
  835. #define _FAN4 FAN4_PIN,
  836. #else
  837. #define _FAN4
  838. #endif
  839. #if PIN_EXISTS(FAN5)
  840. #define _FAN5 FAN5_PIN,
  841. #else
  842. #define _FAN5
  843. #endif
  844. #if PIN_EXISTS(FAN6)
  845. #define _FAN6 FAN6_PIN,
  846. #else
  847. #define _FAN6
  848. #endif
  849. #if PIN_EXISTS(FAN7)
  850. #define _FAN7 FAN7_PIN,
  851. #else
  852. #define _FAN7
  853. #endif
  854. #if PIN_EXISTS(CONTROLLER_FAN)
  855. #define _FANC CONTROLLER_FAN_PIN,
  856. #else
  857. #define _FANC
  858. #endif
  859. #if TEMP_SENSOR_BED && PINS_EXIST(TEMP_BED, HEATER_BED)
  860. #define _BED_PINS HEATER_BED_PIN, DIO_PIN(TEMP_BED_PIN),
  861. #else
  862. #define _BED_PINS
  863. #endif
  864. #if TEMP_SENSOR_CHAMBER && PIN_EXISTS(TEMP_CHAMBER)
  865. #define _CHAMBER_TEMP DIO_PIN(TEMP_CHAMBER_PIN),
  866. #else
  867. #define _CHAMBER_TEMP
  868. #endif
  869. #if TEMP_SENSOR_CHAMBER && PINS_EXIST(TEMP_CHAMBER, HEATER_CHAMBER)
  870. #define _CHAMBER_HEATER HEATER_CHAMBER_PIN,
  871. #else
  872. #define _CHAMBER_HEATER
  873. #endif
  874. #if TEMP_SENSOR_CHAMBER && PINS_EXIST(TEMP_CHAMBER, CHAMBER_AUTO_FAN)
  875. #define _CHAMBER_FAN CHAMBER_AUTO_FAN_PIN,
  876. #else
  877. #define _CHAMBER_FAN
  878. #endif
  879. #if TEMP_SENSOR_COOLER && PIN_EXISTS(TEMP_COOLER)
  880. #define _COOLER_TEMP DIO_PIN(TEMP_COOLER_PIN),
  881. #else
  882. #define _COOLER_TEMP
  883. #endif
  884. #if TEMP_SENSOR_COOLER && PIN_EXISTS(COOLER)
  885. #define _COOLER COOLER_PIN,
  886. #else
  887. #define _COOLER
  888. #endif
  889. #if TEMP_SENSOR_COOLER && PINS_EXIST(TEMP_COOLER, COOLER_AUTO_FAN)
  890. #define _COOLER_FAN COOLER_AUTO_FAN_PIN,
  891. #else
  892. #define _COOLER_FAN
  893. #endif
  894. #ifndef HAL_SENSITIVE_PINS
  895. #define HAL_SENSITIVE_PINS
  896. #endif
  897. #ifdef RUNTIME_ONLY_ANALOG_TO_DIGITAL
  898. #define _SP_END
  899. #else
  900. #define _SP_END -2
  901. // Move a regular pin in front to the end
  902. template<pin_t F, pin_t ...D>
  903. struct OnlyPins : OnlyPins<D..., F> { };
  904. // Remove a -1 from the front
  905. template<pin_t ...D>
  906. struct OnlyPins<-1, D...> : OnlyPins<D...> { };
  907. // Remove -2 from the front, emit the rest, cease propagation
  908. template<pin_t ...D>
  909. struct OnlyPins<_SP_END, D...> { static constexpr size_t size = sizeof...(D); static constexpr pin_t table[sizeof...(D)] PROGMEM = { D... }; };
  910. #endif
  911. #define SENSITIVE_PINS \
  912. _X_PINS _Y_PINS _Z_PINS _I_PINS _J_PINS _K_PINS _U_PINS _V_PINS _W_PINS \
  913. _X2_PINS _Y2_PINS _Z2_PINS _Z3_PINS _Z4_PINS _Z_PROBE \
  914. _E0_PINS _E1_PINS _E2_PINS _E3_PINS _E4_PINS _E5_PINS _E6_PINS _E7_PINS \
  915. _H0_PINS _H1_PINS _H2_PINS _H3_PINS _H4_PINS _H5_PINS _H6_PINS _H7_PINS \
  916. _PS_ON _FAN0 _FAN1 _FAN2 _FAN3 _FAN4 _FAN5 _FAN6 _FAN7 _FANC \
  917. _BED_PINS _CHAMBER_TEMP _CHAMBER_HEATER _CHAMBER_FAN \
  918. _COOLER_TEMP _COOLER _COOLER_FAN HAL_SENSITIVE_PINS \
  919. _SP_END