Subversion Repositories Tronxy-X3A-Marlin

Rev

Details | Last modification | View Log | RSS feed

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