pins.h 29 KB

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