pins.h 29 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882
  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. * Include pins definitions
  24. *
  25. * Pins numbering schemes:
  26. *
  27. * - Digital I/O pin number if used by READ/WRITE macros. (e.g., X_STEP_DIR)
  28. * The FastIO headers map digital pins to their ports and functions.
  29. *
  30. * - Analog Input number if used by analogRead or DAC. (e.g., TEMP_n_PIN)
  31. * These numbers are the same in any pin mapping.
  32. */
  33. #ifndef __PINS_H__
  34. #define __PINS_H__
  35. #if MB(RAMPS_13_EFB) || MB(RAMPS_14_EFB) || MB(RAMPS_PLUS_EFB)
  36. #define IS_RAMPS_EFB
  37. #elif MB(RAMPS_13_EEB) || MB(RAMPS_14_EEB) || MB(RAMPS_PLUS_EEB)
  38. #define IS_RAMPS_EEB
  39. #elif MB(RAMPS_13_EFF) || MB(RAMPS_14_EFF) || MB(RAMPS_PLUS_EFF)
  40. #define IS_RAMPS_EFF
  41. #elif MB(RAMPS_13_EEF) || MB(RAMPS_14_EEF) || MB(RAMPS_PLUS_EEF)
  42. #define IS_RAMPS_EEF
  43. #elif MB(RAMPS_13_SF) || MB(RAMPS_14_SF) || MB(RAMPS_PLUS_SF)
  44. #define IS_RAMPS_SF
  45. #endif
  46. //
  47. // RAMPS 1.3 / 1.4 - ATmega1280, ATmega2560
  48. //
  49. #if MB(RAMPS_OLD)
  50. #include "pins_RAMPS_OLD.h" // ATmega1280, ATmega2560 env:megaatmega1280 env:megaatmega2560
  51. #elif MB(RAMPS_13_EFB)
  52. #include "pins_RAMPS_13.h" // ATmega1280, ATmega2560 env:megaatmega1280 env:megaatmega2560
  53. #elif MB(RAMPS_13_EEB)
  54. #include "pins_RAMPS_13.h" // ATmega1280, ATmega2560 env:megaatmega1280 env:megaatmega2560
  55. #elif MB(RAMPS_13_EFF)
  56. #include "pins_RAMPS_13.h" // ATmega1280, ATmega2560 env:megaatmega1280 env:megaatmega2560
  57. #elif MB(RAMPS_13_EEF)
  58. #include "pins_RAMPS_13.h" // ATmega1280, ATmega2560 env:megaatmega1280 env:megaatmega2560
  59. #elif MB(RAMPS_13_SF)
  60. #include "pins_RAMPS_13.h" // ATmega1280, ATmega2560 env:megaatmega1280 env:megaatmega2560
  61. #elif MB(RAMPS_14_EFB)
  62. #include "pins_RAMPS.h" // ATmega1280, ATmega2560 env:megaatmega1280 env:megaatmega2560
  63. #elif MB(RAMPS_14_EEB)
  64. #include "pins_RAMPS.h" // ATmega1280, ATmega2560 env:megaatmega1280 env:megaatmega2560
  65. #elif MB(RAMPS_14_EFF)
  66. #include "pins_RAMPS.h" // ATmega1280, ATmega2560 env:megaatmega1280 env:megaatmega2560
  67. #elif MB(RAMPS_14_EEF)
  68. #include "pins_RAMPS.h" // ATmega1280, ATmega2560 env:megaatmega1280 env:megaatmega2560
  69. #elif MB(RAMPS_14_SF)
  70. #include "pins_RAMPS.h" // ATmega1280, ATmega2560 env:megaatmega1280 env:megaatmega2560
  71. #elif MB(RAMPS_PLUS_EFB)
  72. #include "pins_RAMPS_PLUS.h" // ATmega1280, ATmega2560 env:megaatmega1280 env:megaatmega2560
  73. #elif MB(RAMPS_PLUS_EEB)
  74. #include "pins_RAMPS_PLUS.h" // ATmega1280, ATmega2560 env:megaatmega1280 env:megaatmega2560
  75. #elif MB(RAMPS_PLUS_EFF)
  76. #include "pins_RAMPS_PLUS.h" // ATmega1280, ATmega2560 env:megaatmega1280 env:megaatmega2560
  77. #elif MB(RAMPS_PLUS_EEF)
  78. #include "pins_RAMPS_PLUS.h" // ATmega1280, ATmega2560 env:megaatmega1280 env:megaatmega2560
  79. #elif MB(RAMPS_PLUS_SF)
  80. #include "pins_RAMPS_PLUS.h" // ATmega1280, ATmega2560 env:megaatmega1280 env:megaatmega2560
  81. //
  82. // RAMPS Derivatives - ATmega1280, ATmega2560
  83. //
  84. #elif MB(3DRAG)
  85. #include "pins_3DRAG.h" // ATmega1280, ATmega2560 env:megaatmega1280 env:megaatmega2560
  86. #elif MB(K8200)
  87. #include "pins_K8200.h" // ATmega1280, ATmega2560 env:megaatmega1280 env:megaatmega2560 (3DRAG)
  88. #elif MB(K8400)
  89. #include "pins_K8400.h" // ATmega1280, ATmega2560 env:megaatmega1280 env:megaatmega2560 (3DRAG)
  90. #elif MB(BAM_DICE)
  91. #include "pins_RAMPS.h" // ATmega1280, ATmega2560 env:megaatmega1280 env:megaatmega2560
  92. #elif MB(BAM_DICE_DUE)
  93. #include "pins_BAM_DICE_DUE.h" // ATmega1280, ATmega2560 env:megaatmega1280 env:megaatmega2560
  94. #elif MB(MKS_BASE)
  95. #include "pins_MKS_BASE.h" // ATmega1280, ATmega2560 env:megaatmega1280 env:megaatmega2560
  96. #elif MB(MKS_BASE_15)
  97. #include "pins_MKS_BASE_15.h" // ATmega1280, ATmega2560 env:megaatmega1280 env:megaatmega2560
  98. #elif MB(MKS_BASE_HEROIC)
  99. #include "pins_MKS_BASE_HEROIC.h" // ATmega1280, ATmega2560 env:megaatmega1280 env:megaatmega2560
  100. #elif MB(MKS_GEN_13)
  101. #include "pins_MKS_GEN_13.h" // ATmega1280, ATmega2560 env:megaatmega1280 env:megaatmega2560
  102. #elif MB(MKS_GEN_L)
  103. #include "pins_MKS_GEN_L.h" // ATmega1280, ATmega2560 env:megaatmega1280 env:megaatmega2560
  104. #elif MB(ZRIB_V20)
  105. #include "pins_ZRIB_V20.h" // ATmega1280, ATmega2560 env:megaatmega1280 env:megaatmega2560 (MKS_GEN_13)
  106. #elif MB(FELIX2)
  107. #include "pins_FELIX2.h" // ATmega1280, ATmega2560 env:megaatmega1280 env:megaatmega2560
  108. #elif MB(RIGIDBOARD)
  109. #include "pins_RIGIDBOARD.h" // ATmega1280, ATmega2560 env:megaatmega1280 env:megaatmega2560
  110. #elif MB(RIGIDBOARD_V2)
  111. #include "pins_RIGIDBOARD_V2.h" // ATmega1280, ATmega2560 env:megaatmega1280 env:megaatmega2560
  112. #elif MB(SAINSMART_2IN1)
  113. #include "pins_SAINSMART_2IN1.h" // ATmega1280, ATmega2560 env:megaatmega1280 env:megaatmega2560
  114. #elif MB(ULTIMAKER)
  115. #include "pins_ULTIMAKER.h" // ATmega1280, ATmega2560 env:megaatmega1280 env:megaatmega2560
  116. #elif MB(ULTIMAKER_OLD)
  117. #include "pins_ULTIMAKER_OLD.h" // ATmega1280, ATmega2560 env:megaatmega1280 env:megaatmega2560
  118. #elif MB(AZTEEG_X3)
  119. #include "pins_AZTEEG_X3.h" // ATmega2560 env:megaatmega2560
  120. #elif MB(AZTEEG_X3_PRO)
  121. #include "pins_AZTEEG_X3_PRO.h" // ATmega2560 env:megaatmega2560
  122. #elif MB(ULTIMAIN_2)
  123. #include "pins_ULTIMAIN_2.h" // ATmega2560 env:megaatmega2560
  124. #elif MB(RUMBA)
  125. #include "pins_RUMBA.h" // ATmega2560 env:megaatmega2560
  126. #elif MB(BQ_ZUM_MEGA_3D)
  127. #include "pins_BQ_ZUM_MEGA_3D.h" // ATmega2560 env:megaatmega2560
  128. #elif MB(MAKEBOARD_MINI)
  129. #include "pins_MAKEBOARD_MINI.h" // ATmega2560 env:megaatmega2560
  130. #elif MB(TRIGORILLA_13)
  131. #include "pins_TRIGORILLA_13.h" // ATmega2560 env:megaatmega2560
  132. #elif MB(TRIGORILLA_14)
  133. #include "pins_TRIGORILLA_14.h" // ATmega2560 env:megaatmega2560
  134. #elif MB(RAMPS_ENDER_4)
  135. #include "pins_RAMPS_ENDER_4.h" // ATmega2560 env:megaatmega2560
  136. //
  137. // Other ATmega1280, ATmega2560
  138. //
  139. #elif MB(CNCONTROLS_11)
  140. #include "pins_CNCONTROLS_11.h" // ATmega1280, ATmega2560 env:megaatmega1280 env:megaatmega2560
  141. #elif MB(CNCONTROLS_12)
  142. #include "pins_CNCONTROLS_12.h" // ATmega1280, ATmega2560 env:megaatmega1280 env:megaatmega2560
  143. #elif MB(MIGHTYBOARD_REVE)
  144. #include "pins_MIGHTYBOARD_REVE.h" // ATmega1280, ATmega2560 env:megaatmega1280 env:megaatmega2560
  145. #elif MB(CHEAPTRONIC)
  146. #include "pins_CHEAPTRONIC.h" // ATmega2560 env:megaatmega2560
  147. #elif MB(CHEAPTRONIC_V2)
  148. #include "pins_CHEAPTRONICv2.h" // ATmega2560 env:megaatmega2560
  149. #elif MB(MEGATRONICS)
  150. #include "pins_MEGATRONICS.h" // ATmega2560 env:megaatmega2560
  151. #elif MB(MEGATRONICS_2)
  152. #include "pins_MEGATRONICS_2.h" // ATmega2560 env:megaatmega2560
  153. #elif MB(MEGATRONICS_3) || MB(MEGATRONICS_31)
  154. #include "pins_MEGATRONICS_3.h" // ATmega2560 env:megaatmega2560
  155. #elif MB(RAMBO)
  156. #include "pins_RAMBO.h" // ATmega2560 env:rambo
  157. #elif MB(MINIRAMBO) || MB(MINIRAMBO_10A)
  158. #include "pins_MINIRAMBO.h" // ATmega2560 env:rambo
  159. #elif MB(EINSY_RAMBO)
  160. #include "pins_EINSY_RAMBO.h" // ATmega2560 env:rambo
  161. #elif MB(EINSY_RETRO)
  162. #include "pins_EINSY_RETRO.h" // ATmega2560 env:rambo
  163. #elif MB(ELEFU_3)
  164. #include "pins_ELEFU_3.h" // ATmega2560 env:megaatmega2560
  165. #elif MB(LEAPFROG)
  166. #include "pins_LEAPFROG.h" // ATmega1280, ATmega2560 env:megaatmega1280 env:megaatmega2560
  167. #elif MB(MEGACONTROLLER)
  168. #include "pins_MEGACONTROLLER.h" // ATmega2560 env:megaatmega2560
  169. #elif MB(SCOOVO_X9H)
  170. #include "pins_SCOOVO_X9H.h" // ATmega2560 env:rambo
  171. #elif MB(GT2560_REV_A)
  172. #include "pins_GT2560_REV_A.h" // ATmega1280, ATmega2560 env:megaatmega1280 env:megaatmega2560
  173. #elif MB(GT2560_REV_A_PLUS)
  174. #include "pins_GT2560_REV_A_PLUS.h" // ATmega1280, ATmega2560 env:megaatmega1280 env:megaatmega2560
  175. //
  176. // ATmega1281, ATmega2561
  177. //
  178. #elif MB(MINITRONICS)
  179. #include "pins_MINITRONICS.h" // ATmega1281 env:megaatmega1280
  180. #elif MB(SILVER_GATE)
  181. #include "pins_SILVER_GATE.h" // ATmega2561 env:megaatmega2560
  182. //
  183. // Sanguinololu and Derivatives - ATmega644P, ATmega1284P
  184. //
  185. #elif MB(SANGUINOLOLU_11)
  186. #include "pins_SANGUINOLOLU_11.h" // ATmega644P, ATmega1284P env:sanguino_atmega644p env:sanguino_atmega1284p
  187. #elif MB(SANGUINOLOLU_12)
  188. #include "pins_SANGUINOLOLU_12.h" // ATmega644P, ATmega1284P env:sanguino_atmega644p env:sanguino_atmega1284p
  189. #elif MB(MELZI)
  190. #include "pins_MELZI.h" // ATmega644P, ATmega1284P env:sanguino_atmega644p env:sanguino_atmega1284p
  191. #elif MB(MELZI_MAKR3D)
  192. #include "pins_MELZI_MAKR3D.h" // ATmega644P, ATmega1284P env:sanguino_atmega644p env:sanguino_atmega1284p
  193. #elif MB(MELZI_CREALITY)
  194. #include "pins_MELZI_CREALITY.h" // ATmega644P, ATmega1284P env:sanguino_atmega644p env:sanguino_atmega1284p
  195. #elif MB(MELZI_MALYAN)
  196. #include "pins_MELZI_MALYAN.h" // ATmega644P, ATmega1284P env:sanguino_atmega644p env:sanguino_atmega1284p
  197. #elif MB(MELZI_TRONXY)
  198. #include "pins_MELZI_TRONXY.h" // ATmega644P, ATmega1284P env:sanguino_atmega644p env:sanguino_atmega1284p
  199. #elif MB(STB_11)
  200. #include "pins_STB_11.h" // ATmega644P, ATmega1284P env:sanguino_atmega644p env:sanguino_atmega1284p
  201. #elif MB(AZTEEG_X1)
  202. #include "pins_AZTEEG_X1.h" // ATmega644P, ATmega1284P env:sanguino_atmega644p env:sanguino_atmega1284p
  203. //
  204. // Other ATmega644P, ATmega644, ATmega1284P
  205. //
  206. #elif MB(GEN3_MONOLITHIC)
  207. #include "pins_GEN3_MONOLITHIC.h" // ATmega644P env:sanguino_atmega644p
  208. #elif MB(GEN3_PLUS)
  209. #include "pins_GEN3_PLUS.h" // ATmega644P, ATmega1284P env:sanguino_atmega644p env:sanguino_atmega1284p
  210. #elif MB(GEN6)
  211. #include "pins_GEN6.h" // ATmega644P, ATmega1284P env:sanguino_atmega644p env:sanguino_atmega1284p
  212. #elif MB(GEN6_DELUXE)
  213. #include "pins_GEN6_DELUXE.h" // ATmega644P, ATmega1284P env:sanguino_atmega644p env:sanguino_atmega1284p
  214. #elif MB(GEN7_CUSTOM)
  215. #include "pins_GEN7_CUSTOM.h" // ATmega644P, ATmega644, ATmega1284P env:sanguino_atmega644p env:sanguino_atmega1284p
  216. #elif MB(GEN7_12)
  217. #include "pins_GEN7_12.h" // ATmega644P, ATmega644, ATmega1284P env:sanguino_atmega644p env:sanguino_atmega1284p
  218. #elif MB(GEN7_13)
  219. #include "pins_GEN7_13.h" // ATmega644P, ATmega644, ATmega1284P env:sanguino_atmega644p env:sanguino_atmega1284p
  220. #elif MB(GEN7_14)
  221. #include "pins_GEN7_14.h" // ATmega644P, ATmega644, ATmega1284P env:sanguino_atmega644p env:sanguino_atmega1284p
  222. #elif MB(OMCA_A)
  223. #include "pins_OMCA_A.h" // ATmega644 env:sanguino_atmega644p
  224. #elif MB(OMCA)
  225. #include "pins_OMCA.h" // ATmega644P, ATmega644 env:sanguino_atmega644p
  226. #elif MB(ANET_10)
  227. #include "pins_ANET_10.h" // ATmega1284P env:sanguino_atmega1284p
  228. #elif MB(SETHI)
  229. #include "pins_SETHI.h" // ATmega644P, ATmega644, ATmega1284P env:sanguino_atmega644p env:sanguino_atmega1284p
  230. //
  231. // Teensyduino - AT90USB1286, AT90USB1286P
  232. //
  233. #elif MB(TEENSYLU)
  234. #include "pins_TEENSYLU.h" // AT90USB1286, AT90USB1286P env:at90USB1286_CDC
  235. #elif MB(PRINTRBOARD)
  236. #include "pins_PRINTRBOARD.h" // AT90USB1286 env:at90USB1286_DFU
  237. #elif MB(PRINTRBOARD_REVF)
  238. #include "pins_PRINTRBOARD_REVF.h" // AT90USB1286 env:at90USB1286_DFU
  239. #elif MB(BRAINWAVE)
  240. #include "pins_BRAINWAVE.h" // AT90USB646 env:at90USB1286_CDC
  241. #elif MB(BRAINWAVE_PRO)
  242. #include "pins_BRAINWAVE_PRO.h" // AT90USB1286 env:at90USB1286_CDC
  243. #elif MB(SAV_MKI)
  244. #include "pins_SAV_MKI.h" // AT90USB1286 env:at90USB1286_CDC
  245. #elif MB(TEENSY2)
  246. #include "pins_TEENSY2.h" // AT90USB1286 env:teensy20
  247. #elif MB(5DPRINT)
  248. #include "pins_5DPRINT.h" // AT90USB1286 ?env:at90USB1286_DFU
  249. #else
  250. #error "Unknown MOTHERBOARD value set in Configuration.h"
  251. #endif
  252. // Define certain undefined pins
  253. #ifndef X_MS1_PIN
  254. #define X_MS1_PIN -1
  255. #endif
  256. #ifndef X_MS2_PIN
  257. #define X_MS2_PIN -1
  258. #endif
  259. #ifndef Y_MS1_PIN
  260. #define Y_MS1_PIN -1
  261. #endif
  262. #ifndef Y_MS2_PIN
  263. #define Y_MS2_PIN -1
  264. #endif
  265. #ifndef Z_MS1_PIN
  266. #define Z_MS1_PIN -1
  267. #endif
  268. #ifndef Z_MS2_PIN
  269. #define Z_MS2_PIN -1
  270. #endif
  271. #ifndef Z_MS3_PIN
  272. #define Z_MS3_PIN -1
  273. #endif
  274. #ifndef E0_MS1_PIN
  275. #define E0_MS1_PIN -1
  276. #endif
  277. #ifndef E0_MS2_PIN
  278. #define E0_MS2_PIN -1
  279. #endif
  280. #ifndef E1_MS1_PIN
  281. #define E1_MS1_PIN -1
  282. #endif
  283. #ifndef E1_MS2_PIN
  284. #define E1_MS2_PIN -1
  285. #endif
  286. #ifndef E2_MS1_PIN
  287. #define E2_MS1_PIN -1
  288. #endif
  289. #ifndef E2_MS2_PIN
  290. #define E2_MS2_PIN -1
  291. #endif
  292. #ifndef E3_MS1_PIN
  293. #define E3_MS1_PIN -1
  294. #endif
  295. #ifndef E3_MS2_PIN
  296. #define E3_MS2_PIN -1
  297. #endif
  298. #ifndef E3_MS3_PIN
  299. #define E3_MS3_PIN -1
  300. #endif
  301. #ifndef E4_MS1_PIN
  302. #define E4_MS1_PIN -1
  303. #endif
  304. #ifndef E4_MS2_PIN
  305. #define E4_MS2_PIN -1
  306. #endif
  307. #ifndef E4_MS3_PIN
  308. #define E4_MS3_PIN -1
  309. #endif
  310. #ifndef E0_STEP_PIN
  311. #define E0_STEP_PIN -1
  312. #endif
  313. #ifndef E0_DIR_PIN
  314. #define E0_DIR_PIN -1
  315. #endif
  316. #ifndef E0_ENABLE_PIN
  317. #define E0_ENABLE_PIN -1
  318. #endif
  319. #ifndef E1_STEP_PIN
  320. #define E1_STEP_PIN -1
  321. #endif
  322. #ifndef E1_DIR_PIN
  323. #define E1_DIR_PIN -1
  324. #endif
  325. #ifndef E1_ENABLE_PIN
  326. #define E1_ENABLE_PIN -1
  327. #endif
  328. #ifndef E2_STEP_PIN
  329. #define E2_STEP_PIN -1
  330. #endif
  331. #ifndef E2_DIR_PIN
  332. #define E2_DIR_PIN -1
  333. #endif
  334. #ifndef E2_ENABLE_PIN
  335. #define E2_ENABLE_PIN -1
  336. #endif
  337. #ifndef E3_STEP_PIN
  338. #define E3_STEP_PIN -1
  339. #endif
  340. #ifndef E3_DIR_PIN
  341. #define E3_DIR_PIN -1
  342. #endif
  343. #ifndef E3_ENABLE_PIN
  344. #define E3_ENABLE_PIN -1
  345. #endif
  346. #ifndef E4_STEP_PIN
  347. #define E4_STEP_PIN -1
  348. #endif
  349. #ifndef E4_DIR_PIN
  350. #define E4_DIR_PIN -1
  351. #endif
  352. #ifndef E4_ENABLE_PIN
  353. #define E4_ENABLE_PIN -1
  354. #endif
  355. #ifndef X_CS_PIN
  356. #define X_CS_PIN -1
  357. #endif
  358. #ifndef Y_CS_PIN
  359. #define Y_CS_PIN -1
  360. #endif
  361. #ifndef Z_CS_PIN
  362. #define Z_CS_PIN -1
  363. #endif
  364. #ifndef E0_CS_PIN
  365. #define E0_CS_PIN -1
  366. #endif
  367. #ifndef E1_CS_PIN
  368. #define E1_CS_PIN -1
  369. #endif
  370. #ifndef E2_CS_PIN
  371. #define E2_CS_PIN -1
  372. #endif
  373. #ifndef E3_CS_PIN
  374. #define E3_CS_PIN -1
  375. #endif
  376. #ifndef E4_CS_PIN
  377. #define E4_CS_PIN -1
  378. #endif
  379. #ifndef FAN_PIN
  380. #define FAN_PIN -1
  381. #endif
  382. #ifndef FAN1_PIN
  383. #define FAN1_PIN -1
  384. #endif
  385. #ifndef FAN2_PIN
  386. #define FAN2_PIN -1
  387. #endif
  388. #ifndef CONTROLLER_FAN_PIN
  389. #define CONTROLLER_FAN_PIN -1
  390. #endif
  391. #ifndef FANMUX0_PIN
  392. #define FANMUX0_PIN -1
  393. #endif
  394. #ifndef FANMUX1_PIN
  395. #define FANMUX1_PIN -1
  396. #endif
  397. #ifndef FANMUX2_PIN
  398. #define FANMUX2_PIN -1
  399. #endif
  400. #ifndef HEATER_0_PIN
  401. #define HEATER_0_PIN -1
  402. #endif
  403. #ifndef HEATER_1_PIN
  404. #define HEATER_1_PIN -1
  405. #endif
  406. #ifndef HEATER_2_PIN
  407. #define HEATER_2_PIN -1
  408. #endif
  409. #ifndef HEATER_3_PIN
  410. #define HEATER_3_PIN -1
  411. #endif
  412. #ifndef HEATER_4_PIN
  413. #define HEATER_4_PIN -1
  414. #endif
  415. #ifndef HEATER_BED_PIN
  416. #define HEATER_BED_PIN -1
  417. #endif
  418. #ifndef TEMP_0_PIN
  419. #define TEMP_0_PIN -1
  420. #endif
  421. #ifndef TEMP_1_PIN
  422. #define TEMP_1_PIN -1
  423. #endif
  424. #ifndef TEMP_2_PIN
  425. #define TEMP_2_PIN -1
  426. #endif
  427. #ifndef TEMP_3_PIN
  428. #define TEMP_3_PIN -1
  429. #endif
  430. #ifndef TEMP_4_PIN
  431. #define TEMP_4_PIN -1
  432. #endif
  433. #ifndef TEMP_BED_PIN
  434. #define TEMP_BED_PIN -1
  435. #endif
  436. #ifndef SD_DETECT_PIN
  437. #define SD_DETECT_PIN -1
  438. #endif
  439. #ifndef SDPOWER
  440. #define SDPOWER -1
  441. #endif
  442. #ifndef SDSS
  443. #define SDSS -1
  444. #endif
  445. #ifndef LED_PIN
  446. #define LED_PIN -1
  447. #endif
  448. #ifndef PS_ON_PIN
  449. #define PS_ON_PIN -1
  450. #endif
  451. #ifndef KILL_PIN
  452. #define KILL_PIN -1
  453. #endif
  454. #ifndef SUICIDE_PIN
  455. #define SUICIDE_PIN -1
  456. #endif
  457. #ifndef MAX_EXTRUDERS
  458. #define MAX_EXTRUDERS 5
  459. #endif
  460. //
  461. // Assign auto fan pins if needed
  462. //
  463. #ifndef E0_AUTO_FAN_PIN
  464. #ifdef ORIG_E0_AUTO_FAN_PIN
  465. #define E0_AUTO_FAN_PIN ORIG_E0_AUTO_FAN_PIN
  466. #else
  467. #define E0_AUTO_FAN_PIN -1
  468. #endif
  469. #endif
  470. #ifndef E1_AUTO_FAN_PIN
  471. #ifdef ORIG_E1_AUTO_FAN_PIN
  472. #define E1_AUTO_FAN_PIN ORIG_E1_AUTO_FAN_PIN
  473. #else
  474. #define E1_AUTO_FAN_PIN -1
  475. #endif
  476. #endif
  477. #ifndef E2_AUTO_FAN_PIN
  478. #ifdef ORIG_E2_AUTO_FAN_PIN
  479. #define E2_AUTO_FAN_PIN ORIG_E2_AUTO_FAN_PIN
  480. #else
  481. #define E2_AUTO_FAN_PIN -1
  482. #endif
  483. #endif
  484. #ifndef E3_AUTO_FAN_PIN
  485. #ifdef ORIG_E3_AUTO_FAN_PIN
  486. #define E3_AUTO_FAN_PIN ORIG_E3_AUTO_FAN_PIN
  487. #else
  488. #define E3_AUTO_FAN_PIN -1
  489. #endif
  490. #endif
  491. #ifndef E4_AUTO_FAN_PIN
  492. #ifdef ORIG_E4_AUTO_FAN_PIN
  493. #define E4_AUTO_FAN_PIN ORIG_E4_AUTO_FAN_PIN
  494. #else
  495. #define E4_AUTO_FAN_PIN -1
  496. #endif
  497. #endif
  498. #ifndef CHAMBER_AUTO_FAN_PIN
  499. #ifdef ORIG_CHAMBER_AUTO_FAN_PIN
  500. #define CHAMBER_AUTO_FAN_PIN ORIG_CHAMBER_AUTO_FAN_PIN
  501. #else
  502. #define CHAMBER_AUTO_FAN_PIN -1
  503. #endif
  504. #endif
  505. // List of pins which to ignore when asked to change by gcode, 0 and 1 are RX and TX, do not mess with those!
  506. #define _E0_PINS E0_STEP_PIN, E0_DIR_PIN, E0_ENABLE_PIN, E0_MS1_PIN, E0_MS2_PIN, E0_CS_PIN,
  507. #define _E1_PINS
  508. #define _E2_PINS
  509. #define _E3_PINS
  510. #define _E4_PINS
  511. #if ENABLED(SWITCHING_EXTRUDER)
  512. // Tools 0 and 1 use E0
  513. #if EXTRUDERS > 2 // Tools 2 and 3 use E1
  514. #undef _E1_PINS
  515. #define _E1_PINS E1_STEP_PIN, E1_DIR_PIN, E1_ENABLE_PIN, E1_MS1_PIN, E1_MS2_PIN, E1_CS_PIN,
  516. #if EXTRUDERS > 4 // Tools 4 and 5 use E2
  517. #undef _E2_PINS
  518. #define _E2_PINS E2_STEP_PIN, E2_DIR_PIN, E2_ENABLE_PIN, E2_MS1_PIN, E2_MS2_PIN, E2_CS_PIN,
  519. #endif
  520. #endif
  521. #elif EXTRUDERS > 1
  522. #undef _E1_PINS
  523. #define _E1_PINS E1_STEP_PIN, E1_DIR_PIN, E1_ENABLE_PIN, E1_MS1_PIN, E1_MS2_PIN, E1_CS_PIN,
  524. #if EXTRUDERS > 2
  525. #undef _E2_PINS
  526. #define _E2_PINS E2_STEP_PIN, E2_DIR_PIN, E2_ENABLE_PIN, E2_MS1_PIN, E2_MS2_PIN, E2_CS_PIN,
  527. #if EXTRUDERS > 3
  528. #undef _E3_PINS
  529. #define _E3_PINS E3_STEP_PIN, E3_DIR_PIN, E3_ENABLE_PIN, E3_MS1_PIN, E3_MS2_PIN, E3_MS3_PIN, E3_CS_PIN,
  530. #if EXTRUDERS > 4
  531. #undef _E4_PINS
  532. #define _E4_PINS E4_STEP_PIN, E4_DIR_PIN, E4_ENABLE_PIN, E4_MS1_PIN, E4_MS2_PIN, E4_MS3_PIN, E4_CS_PIN,
  533. #endif // EXTRUDERS > 4
  534. #endif // EXTRUDERS > 3
  535. #endif // EXTRUDERS > 2
  536. #endif // EXTRUDERS > 1
  537. // Marlin needs to account for pins that equal -1
  538. #define marlinAnalogInputToDigitalPin(p) ((p) == -1 ? -1 : analogInputToDigitalPin(p))
  539. #define _H0_PINS HEATER_0_PIN, E0_AUTO_FAN_PIN, marlinAnalogInputToDigitalPin(TEMP_0_PIN),
  540. #define _H1_PINS
  541. #define _H2_PINS
  542. #define _H3_PINS
  543. #define _H4_PINS
  544. #if HOTENDS > 1
  545. #undef _H1_PINS
  546. #define _H1_PINS HEATER_1_PIN, E1_AUTO_FAN_PIN, marlinAnalogInputToDigitalPin(TEMP_1_PIN),
  547. #if HOTENDS > 2
  548. #undef _H2_PINS
  549. #define _H2_PINS HEATER_2_PIN, E2_AUTO_FAN_PIN, marlinAnalogInputToDigitalPin(TEMP_2_PIN),
  550. #if HOTENDS > 3
  551. #undef _H3_PINS
  552. #define _H3_PINS HEATER_3_PIN, E3_AUTO_FAN_PIN, marlinAnalogInputToDigitalPin(TEMP_3_PIN),
  553. #if HOTENDS > 4
  554. #undef _H4_PINS
  555. #define _H4_PINS HEATER_4_PIN, marlinAnalogInputToDigitalPin(TEMP_4_PIN),
  556. #endif // HOTENDS > 4
  557. #endif // HOTENDS > 3
  558. #endif // HOTENDS > 2
  559. #elif ENABLED(MIXING_EXTRUDER)
  560. #undef _E1_PINS
  561. #define _E1_PINS E1_STEP_PIN, E1_DIR_PIN, E1_ENABLE_PIN, E1_MS1_PIN, E1_MS2_PIN, E1_CS_PIN,
  562. #if MIXING_STEPPERS > 2
  563. #undef _E2_PINS
  564. #define _E2_PINS E2_STEP_PIN, E2_DIR_PIN, E2_ENABLE_PIN, E2_MS1_PIN, E2_MS2_PIN, E2_CS_PIN,
  565. #if MIXING_STEPPERS > 3
  566. #undef _E3_PINS
  567. #define _E3_PINS E3_STEP_PIN, E3_DIR_PIN, E3_ENABLE_PIN, E3_MS1_PIN, E3_MS2_PIN, E3_CS_PIN,
  568. #if MIXING_STEPPERS > 4
  569. #undef _E4_PINS
  570. #define _E4_PINS E4_STEP_PIN, E4_DIR_PIN, E4_ENABLE_PIN, E4_MS1_PIN, E4_MS2_PIN, E4_CS_PIN,
  571. #endif // MIXING_STEPPERS > 4
  572. #endif // MIXING_STEPPERS > 3
  573. #endif // MIXING_STEPPERS > 2
  574. #endif // MIXING_STEPPERS > 1
  575. #define BED_PINS HEATER_BED_PIN, marlinAnalogInputToDigitalPin(TEMP_BED_PIN),
  576. //
  577. // Assign endstop pins for boards with only 3 connectors
  578. //
  579. #ifdef X_STOP_PIN
  580. #if X_HOME_DIR < 0
  581. #define X_MIN_PIN X_STOP_PIN
  582. #define X_MAX_PIN -1
  583. #else
  584. #define X_MIN_PIN -1
  585. #define X_MAX_PIN X_STOP_PIN
  586. #endif
  587. #endif
  588. #ifdef Y_STOP_PIN
  589. #if Y_HOME_DIR < 0
  590. #define Y_MIN_PIN Y_STOP_PIN
  591. #define Y_MAX_PIN -1
  592. #else
  593. #define Y_MIN_PIN -1
  594. #define Y_MAX_PIN Y_STOP_PIN
  595. #endif
  596. #endif
  597. #ifdef Z_STOP_PIN
  598. #if Z_HOME_DIR < 0
  599. #define Z_MIN_PIN Z_STOP_PIN
  600. #define Z_MAX_PIN -1
  601. #else
  602. #define Z_MIN_PIN -1
  603. #define Z_MAX_PIN Z_STOP_PIN
  604. #endif
  605. #endif
  606. //
  607. // Disable unused endstop / probe pins
  608. //
  609. #if DISABLED(Z_MIN_PROBE_ENDSTOP)
  610. #undef Z_MIN_PROBE_PIN
  611. #define Z_MIN_PROBE_PIN -1
  612. #endif
  613. #if DISABLED(USE_XMAX_PLUG)
  614. #undef X_MAX_PIN
  615. #define X_MAX_PIN -1
  616. #endif
  617. #if DISABLED(USE_YMAX_PLUG)
  618. #undef Y_MAX_PIN
  619. #define Y_MAX_PIN -1
  620. #endif
  621. #if DISABLED(USE_ZMAX_PLUG)
  622. #undef Z_MAX_PIN
  623. #define Z_MAX_PIN -1
  624. #endif
  625. #if DISABLED(USE_XMIN_PLUG)
  626. #undef X_MIN_PIN
  627. #define X_MIN_PIN -1
  628. #endif
  629. #if DISABLED(USE_YMIN_PLUG)
  630. #undef Y_MIN_PIN
  631. #define Y_MIN_PIN -1
  632. #endif
  633. #if DISABLED(USE_ZMIN_PLUG)
  634. #undef Z_MIN_PIN
  635. #define Z_MIN_PIN -1
  636. #endif
  637. #ifndef LCD_PINS_D4
  638. #define LCD_PINS_D4 -1
  639. #endif
  640. #ifndef LCD_PINS_D5
  641. #define LCD_PINS_D5 -1
  642. #endif
  643. #ifndef LCD_PINS_D6
  644. #define LCD_PINS_D6 -1
  645. #endif
  646. #ifndef LCD_PINS_D7
  647. #define LCD_PINS_D7 -1
  648. #endif
  649. //
  650. // Dual X-carriage, Dual Y, Dual Z support
  651. //
  652. #define _D_PINS
  653. #define _X2_PINS
  654. #define _Y2_PINS
  655. #define _Z2_PINS
  656. #define __EPIN(p,q) E##p##_##q##_PIN
  657. #define _EPIN(p,q) __EPIN(p,q)
  658. // The HANGPRINTER A, B, C, D axes
  659. #if ENABLED(HANGPRINTER)
  660. #define A_ENABLE_PIN X_ENABLE_PIN
  661. #define A_DIR_PIN X_DIR_PIN
  662. #define A_STEP_PIN X_STEP_PIN
  663. #define A_MS1_PIN X_MS1_PIN
  664. #define B_ENABLE_PIN Y_ENABLE_PIN
  665. #define B_DIR_PIN Y_DIR_PIN
  666. #define B_STEP_PIN Y_STEP_PIN
  667. #define B_MS1_PIN Y_MS1_PIN
  668. #define C_ENABLE_PIN Z_ENABLE_PIN
  669. #define C_DIR_PIN Z_DIR_PIN
  670. #define C_STEP_PIN Z_STEP_PIN
  671. #define C_MS1_PIN Z_MS1_PIN
  672. #ifndef D_STEP_PIN
  673. #define D_STEP_PIN _EPIN(E_STEPPERS, STEP)
  674. #define D_DIR_PIN _EPIN(E_STEPPERS, DIR)
  675. #define D_ENABLE_PIN _EPIN(E_STEPPERS, ENABLE)
  676. #ifndef D_CS_PIN
  677. #define D_CS_PIN _EPIN(E_STEPPERS, CS)
  678. #endif
  679. #ifndef D_MS1_PIN
  680. #define D_MS1_PIN _EPIN(E_STEPPERS, MS1)
  681. #endif
  682. #if E_STEPPERS >= MAX_EXTRUDERS || !PIN_EXISTS(D_ENABLE)
  683. #error "No E stepper plug left for D Axis!"
  684. #endif
  685. #endif
  686. #undef _D_PINS
  687. #define ___D_PINS D_STEP_PIN, D_DIR_PIN, D_ENABLE_PIN,
  688. #ifdef D_CS_PIN
  689. #define __D_PINS ___D_PINS D_CS_PIN,
  690. #else
  691. #define __D_PINS ___D_PINS
  692. #endif
  693. #ifdef D_MS1_PIN
  694. #define _D_PINS __D_PINS D_MS1_PIN,
  695. #else
  696. #define _D_PINS __D_PINS
  697. #endif
  698. #define X2_E_INDEX INCREMENT(E_STEPPERS)
  699. #else
  700. #define X2_E_INDEX E_STEPPERS
  701. #endif
  702. // The X2 axis, if any, should be the next open extruder port
  703. #if ENABLED(DUAL_X_CARRIAGE) || ENABLED(X_DUAL_STEPPER_DRIVERS)
  704. #ifndef X2_STEP_PIN
  705. #define X2_STEP_PIN _EPIN(X2_E_INDEX, STEP)
  706. #define X2_DIR_PIN _EPIN(X2_E_INDEX, DIR)
  707. #define X2_ENABLE_PIN _EPIN(X2_E_INDEX, ENABLE)
  708. #ifndef X2_CS_PIN
  709. #define X2_CS_PIN _EPIN(X2_E_INDEX, CS)
  710. #endif
  711. #if X2_E_INDEX >= MAX_EXTRUDERS || !PIN_EXISTS(X2_ENABLE)
  712. #error "No E stepper plug left for X2!"
  713. #endif
  714. #endif
  715. #undef _X2_PINS
  716. #define __X2_PINS X2_STEP_PIN, X2_DIR_PIN, X2_ENABLE_PIN,
  717. #ifdef X2_CS_PIN
  718. #define _X2_PINS __X2_PINS X2_CS_PIN,
  719. #else
  720. #define _X2_PINS __X2_PINS
  721. #endif
  722. #define Y2_E_INDEX INCREMENT(X2_E_INDEX)
  723. #else
  724. #define Y2_E_INDEX X2_E_INDEX
  725. #endif
  726. // The Y2 axis, if any, should be the next open extruder port
  727. #if ENABLED(Y_DUAL_STEPPER_DRIVERS)
  728. #ifndef Y2_STEP_PIN
  729. #define Y2_STEP_PIN _EPIN(Y2_E_INDEX, STEP)
  730. #define Y2_DIR_PIN _EPIN(Y2_E_INDEX, DIR)
  731. #define Y2_ENABLE_PIN _EPIN(Y2_E_INDEX, ENABLE)
  732. #ifndef Y2_CS_PIN
  733. #define Y2_CS_PIN _EPIN(Y2_E_INDEX, CS)
  734. #endif
  735. #if Y2_E_INDEX >= MAX_EXTRUDERS || !PIN_EXISTS(Y2_ENABLE)
  736. #error "No E stepper plug left for Y2!"
  737. #endif
  738. #endif
  739. #undef _Y2_PINS
  740. #define __Y2_PINS Y2_STEP_PIN, Y2_DIR_PIN, Y2_ENABLE_PIN,
  741. #ifdef Y2_CS_PIN
  742. #define _Y2_PINS __Y2_PINS Y2_CS_PIN,
  743. #else
  744. #define _Y2_PINS __Y2_PINS
  745. #endif
  746. #define Z2_E_INDEX INCREMENT(Y2_E_INDEX)
  747. #else
  748. #define Z2_E_INDEX Y2_E_INDEX
  749. #endif
  750. // The Z2 axis, if any, should be the next open extruder port
  751. #if ENABLED(Z_DUAL_STEPPER_DRIVERS)
  752. #ifndef Z2_STEP_PIN
  753. #define Z2_STEP_PIN _EPIN(Z2_E_INDEX, STEP)
  754. #define Z2_DIR_PIN _EPIN(Z2_E_INDEX, DIR)
  755. #define Z2_ENABLE_PIN _EPIN(Z2_E_INDEX, ENABLE)
  756. #ifndef Z2_CS_PIN
  757. #define Z2_CS_PIN _EPIN(Z2_E_INDEX, CS)
  758. #endif
  759. #if Z2_E_INDEX >= MAX_EXTRUDERS || !PIN_EXISTS(Z2_ENABLE)
  760. #error "No E stepper plug left for Z2!"
  761. #endif
  762. #endif
  763. #undef _Z2_PINS
  764. #define __Z2_PINS Z2_STEP_PIN, Z2_DIR_PIN, Z2_ENABLE_PIN,
  765. #ifdef Z2_CS_PIN
  766. #define _Z2_PINS __Z2_PINS Z2_CS_PIN,
  767. #else
  768. #define _Z2_PINS __Z2_PINS
  769. #endif
  770. #endif
  771. #define SENSITIVE_PINS { 0, 1, \
  772. X_STEP_PIN, X_DIR_PIN, X_ENABLE_PIN, X_MIN_PIN, X_MAX_PIN, X_MS1_PIN, X_MS2_PIN, X_CS_PIN, \
  773. Y_STEP_PIN, Y_DIR_PIN, Y_ENABLE_PIN, Y_MIN_PIN, Y_MAX_PIN, Y_MS1_PIN, Y_MS2_PIN, Y_CS_PIN, \
  774. Z_STEP_PIN, Z_DIR_PIN, Z_ENABLE_PIN, Z_MIN_PIN, Z_MAX_PIN, Z_MS1_PIN, Z_MS2_PIN, Z_MS3_PIN, Z_CS_PIN, Z_MIN_PROBE_PIN, \
  775. PS_ON_PIN, HEATER_BED_PIN, FAN_PIN, FAN1_PIN, FAN2_PIN, CONTROLLER_FAN_PIN, \
  776. _E0_PINS _E1_PINS _E2_PINS _E3_PINS _E4_PINS BED_PINS \
  777. _H0_PINS _H1_PINS _H2_PINS _H3_PINS _H4_PINS \
  778. _D_PINS _X2_PINS _Y2_PINS _Z2_PINS \
  779. }
  780. #define HAS_DIGIPOTSS (PIN_EXISTS(DIGIPOTSS))
  781. /**
  782. * Define SPI Pins: SCK, MISO, MOSI, SS
  783. */
  784. #if defined(__AVR_ATmega168__) || defined(__AVR_ATmega328__) || defined(__AVR_ATmega328P__)
  785. #define AVR_SCK_PIN 13
  786. #define AVR_MISO_PIN 12
  787. #define AVR_MOSI_PIN 11
  788. #define AVR_SS_PIN 10
  789. #elif defined(__AVR_ATmega644__) || defined(__AVR_ATmega644P__) || defined(__AVR_ATmega644PA__) || defined(__AVR_ATmega1284P__)
  790. #define AVR_SCK_PIN 7
  791. #define AVR_MISO_PIN 6
  792. #define AVR_MOSI_PIN 5
  793. #define AVR_SS_PIN 4
  794. #elif defined(__AVR_ATmega1280__) || defined(__AVR_ATmega2560__)
  795. #define AVR_SCK_PIN 52
  796. #define AVR_MISO_PIN 50
  797. #define AVR_MOSI_PIN 51
  798. #define AVR_SS_PIN 53
  799. #elif defined(__AVR_AT90USB1287__) || defined(__AVR_AT90USB1286__) || defined(__AVR_AT90USB646__) || defined(__AVR_AT90USB647__)
  800. #define AVR_SCK_PIN 21
  801. #define AVR_MISO_PIN 23
  802. #define AVR_MOSI_PIN 22
  803. #define AVR_SS_PIN 20
  804. #elif defined(__AVR_ATmega1281__) || defined(__AVR_ATmega2561__)
  805. #define AVR_SCK_PIN 10
  806. #define AVR_MISO_PIN 12
  807. #define AVR_MOSI_PIN 11
  808. #define AVR_SS_PIN 16
  809. #endif
  810. #ifndef SCK_PIN
  811. #define SCK_PIN AVR_SCK_PIN
  812. #endif
  813. #ifndef MISO_PIN
  814. #define MISO_PIN AVR_MISO_PIN
  815. #endif
  816. #ifndef MOSI_PIN
  817. #define MOSI_PIN AVR_MOSI_PIN
  818. #endif
  819. #ifndef SS_PIN
  820. #define SS_PIN AVR_SS_PIN
  821. #endif
  822. #endif // __PINS_H__