Prusa MINI Firmware overview
Main Page
Modules
Classes
Files
File List
File Members
sensitive_pins.h
Go to the documentation of this file.
1
/**
2
* Marlin 3D Printer Firmware
3
* Copyright (c) 2019 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
#pragma once
23
24
//
25
// Prepare a list of protected pins for M42/M43
26
//
27
28
#if PIN_EXISTS(X_MIN)
29
#define _X_MIN X_MIN_PIN,
30
#else
31
#define _X_MIN
32
#endif
33
#if PIN_EXISTS(X_MAX)
34
#define _X_MAX X_MAX_PIN,
35
#else
36
#define _X_MAX
37
#endif
38
#if PIN_EXISTS(X_CS) && AXIS_HAS_SPI(X)
39
#define _X_CS X_CS_PIN,
40
#else
41
#define _X_CS
42
#endif
43
#if PIN_EXISTS(X_MS1)
44
#define _X_MS1 X_MS1_PIN,
45
#else
46
#define _X_MS1
47
#endif
48
#if PIN_EXISTS(X_MS2)
49
#define _X_MS2 X_MS2_PIN,
50
#else
51
#define _X_MS2
52
#endif
53
#if PIN_EXISTS(X_MS3)
54
#define _X_MS3 X_MS3_PIN,
55
#else
56
#define _X_MS3
57
#endif
58
59
#define _X_PINS X_STEP_PIN, X_DIR_PIN, X_ENABLE_PIN, _X_MIN _X_MAX _X_MS1 _X_MS2 _X_MS3 _X_CS
60
61
#if PIN_EXISTS(Y_MIN)
62
#define _Y_MIN Y_MIN_PIN,
63
#else
64
#define _Y_MIN
65
#endif
66
#if PIN_EXISTS(Y_MAX)
67
#define _Y_MAX Y_MAX_PIN,
68
#else
69
#define _Y_MAX
70
#endif
71
#if PIN_EXISTS(Y_CS) && AXIS_HAS_SPI(Y)
72
#define _Y_CS Y_CS_PIN,
73
#else
74
#define _Y_CS
75
#endif
76
#if PIN_EXISTS(Y_MS1)
77
#define _Y_MS1 Y_MS1_PIN,
78
#else
79
#define _Y_MS1
80
#endif
81
#if PIN_EXISTS(Y_MS2)
82
#define _Y_MS2 Y_MS2_PIN,
83
#else
84
#define _Y_MS2
85
#endif
86
#if PIN_EXISTS(Y_MS3)
87
#define _Y_MS3 Y_MS3_PIN,
88
#else
89
#define _Y_MS3
90
#endif
91
92
#define _Y_PINS Y_STEP_PIN, Y_DIR_PIN, Y_ENABLE_PIN, _Y_MIN _Y_MAX _Y_MS1 _Y_MS2 _Y_MS3 _Y_CS
93
94
#if PIN_EXISTS(Z_MIN)
95
#define _Z_MIN Z_MIN_PIN,
96
#else
97
#define _Z_MIN
98
#endif
99
#if PIN_EXISTS(Z_MAX)
100
#define _Z_MAX Z_MAX_PIN,
101
#else
102
#define _Z_MAX
103
#endif
104
#if PIN_EXISTS(Z_CS) && AXIS_HAS_SPI(Z)
105
#define _Z_CS Z_CS_PIN,
106
#else
107
#define _Z_CS
108
#endif
109
#if PIN_EXISTS(Z_MS1)
110
#define _Z_MS1 Z_MS1_PIN,
111
#else
112
#define _Z_MS1
113
#endif
114
#if PIN_EXISTS(Z_MS2)
115
#define _Z_MS2 Z_MS2_PIN,
116
#else
117
#define _Z_MS2
118
#endif
119
#if PIN_EXISTS(Z_MS3)
120
#define _Z_MS3 Z_MS3_PIN,
121
#else
122
#define _Z_MS3
123
#endif
124
125
#define _Z_PINS Z_STEP_PIN, Z_DIR_PIN, Z_ENABLE_PIN, _Z_MIN _Z_MAX _Z_MS1 _Z_MS2 _Z_MS3 _Z_CS
126
127
//
128
// Extruder Chip Select, Digital Micro-steps
129
//
130
131
// Mixing stepper, Switching stepper, or regular stepper
132
#define E_NEEDED(N) (ENABLED(MIXING_EXTRUDER) && MIXING_STEPPERS > N) \
133
|| (ENABLED(SWITCHING_EXTRUDER) && E_STEPPERS > N) \
134
|| (NONE(SWITCHING_EXTRUDER, MIXING_EXTRUDER) && EXTRUDERS > N)
135
136
#define _E0_CS
137
#define _E0_MS1
138
#define _E0_MS2
139
#define _E0_MS3
140
141
#if E_NEEDED(0)
142
#if PIN_EXISTS(E0_CS) && AXIS_HAS_SPI(E0)
143
#undef _E0_CS
144
#define _E0_CS E0_CS_PIN,
145
#endif
146
#if PIN_EXISTS(E0_MS1)
147
#undef _E0_MS1
148
#define _E0_MS1 E0_MS1_PIN,
149
#endif
150
#if PIN_EXISTS(E0_MS2)
151
#undef _E0_MS2
152
#define _E0_MS2 E0_MS2_PIN,
153
#endif
154
#if PIN_EXISTS(E0_MS3)
155
#undef _E0_MS3
156
#define _E0_MS3 E0_MS3_PIN,
157
#endif
158
#endif
159
160
#define _E1_CS
161
#define _E1_MS1
162
#define _E1_MS2
163
#define _E1_MS3
164
165
#if E_NEEDED(1)
166
#if PIN_EXISTS(E1_CS) && AXIS_HAS_SPI(E1)
167
#undef _E1_CS
168
#define _E1_CS E1_CS_PIN,
169
#endif
170
#if PIN_EXISTS(E1_MS1)
171
#undef _E1_MS1
172
#define _E1_MS1 E1_MS1_PIN,
173
#endif
174
#if PIN_EXISTS(E1_MS2)
175
#undef _E1_MS2
176
#define _E1_MS2 E1_MS2_PIN,
177
#endif
178
#if PIN_EXISTS(E1_MS3)
179
#undef _E1_MS3
180
#define _E1_MS3 E1_MS3_PIN,
181
#endif
182
#endif
183
184
#define _E2_CS
185
#define _E2_MS1
186
#define _E2_MS2
187
#define _E2_MS3
188
189
#if E_NEEDED(2)
190
#if PIN_EXISTS(E2_CS) && AXIS_HAS_SPI(E2)
191
#undef _E2_CS
192
#define _E2_CS E2_CS_PIN,
193
#endif
194
#if PIN_EXISTS(E2_MS1)
195
#undef _E2_MS1
196
#define _E2_MS1 E2_MS1_PIN,
197
#endif
198
#if PIN_EXISTS(E2_MS2)
199
#undef _E2_MS2
200
#define _E2_MS2 E2_MS2_PIN,
201
#endif
202
#if PIN_EXISTS(E2_MS3)
203
#undef _E2_MS3
204
#define _E2_MS3 E2_MS3_PIN,
205
#endif
206
#endif
207
208
#define _E3_CS
209
#define _E3_MS1
210
#define _E3_MS2
211
#define _E3_MS3
212
213
#if E_NEEDED(3)
214
#if PIN_EXISTS(E3_CS) && AXIS_HAS_SPI(E3)
215
#undef _E3_CS
216
#define _E3_CS E3_CS_PIN,
217
#endif
218
#if PIN_EXISTS(E3_MS1)
219
#undef _E3_MS1
220
#define _E3_MS1 E3_MS1_PIN,
221
#endif
222
#if PIN_EXISTS(E3_MS2)
223
#undef _E3_MS2
224
#define _E3_MS2 E3_MS2_PIN,
225
#endif
226
#if PIN_EXISTS(E3_MS3)
227
#undef _E3_MS3
228
#define _E3_MS3 E3_MS3_PIN,
229
#endif
230
#endif
231
232
#define _E4_CS
233
#define _E4_MS1
234
#define _E4_MS2
235
#define _E4_MS3
236
237
#if E_NEEDED(4)
238
#if PIN_EXISTS(E4_CS) && AXIS_HAS_SPI(E4)
239
#undef _E4_CS
240
#define _E4_CS E4_CS_PIN,
241
#endif
242
#if PIN_EXISTS(E4_MS1)
243
#undef _E4_MS1
244
#define _E4_MS1 E4_MS1_PIN,
245
#endif
246
#if PIN_EXISTS(E4_MS2)
247
#undef _E4_MS2
248
#define _E4_MS2 E4_MS2_PIN,
249
#endif
250
#if PIN_EXISTS(E4_MS3)
251
#undef _E4_MS3
252
#define _E4_MS3 E4_MS3_PIN,
253
#endif
254
#endif
255
256
#define _E5_CS
257
#define _E5_MS1
258
#define _E5_MS2
259
#define _E5_MS3
260
261
#if E_NEEDED(5)
262
#if PIN_EXISTS(E5_CS) && AXIS_HAS_SPI(E5)
263
#undef _E5_CS
264
#define _E5_CS E5_CS_PIN,
265
#endif
266
#if PIN_EXISTS(E5_MS1)
267
#undef _E5_MS1
268
#define _E5_MS1 E5_MS1_PIN,
269
#endif
270
#if PIN_EXISTS(E5_MS2)
271
#undef _E5_MS2
272
#define _E5_MS2 E5_MS2_PIN,
273
#endif
274
#if PIN_EXISTS(E5_MS3)
275
#undef _E5_MS3
276
#define _E5_MS3 E5_MS3_PIN,
277
#endif
278
#endif
279
280
//
281
// E Steppers
282
//
283
284
#define _E0_PINS
285
#define _E1_PINS
286
#define _E2_PINS
287
#define _E3_PINS
288
#define _E4_PINS
289
#define _E5_PINS
290
291
#if EXTRUDERS
292
#undef _E0_PINS
293
#define _E0_PINS E0_STEP_PIN, E0_DIR_PIN, E0_ENABLE_PIN, _E0_CS _E0_MS1 _E0_MS2 _E0_MS3
294
#endif
295
296
#if ENABLED(SWITCHING_EXTRUDER)
297
// Tools 0 and 1 use E0
298
#if EXTRUDERS > 2 // Tools 2 and 3 use E1
299
#undef _E1_PINS
300
#define _E1_PINS E1_STEP_PIN, E1_DIR_PIN, E1_ENABLE_PIN, _E1_CS _E1_MS1 _E1_MS2 _E1_MS3
301
#if EXTRUDERS > 4 // Tools 4 and 5 use E2
302
#undef _E2_PINS
303
#define _E2_PINS E2_STEP_PIN, E2_DIR_PIN, E2_ENABLE_PIN, _E2_CS _E2_MS1 _E2_MS2 _E2_MS3
304
#endif
305
#endif
306
#elif EXTRUDERS > 1 || ENABLED(MIXING_EXTRUDER)
307
#undef _E1_PINS
308
#define _E1_PINS E1_STEP_PIN, E1_DIR_PIN, E1_ENABLE_PIN, _E1_CS _E1_MS1 _E1_MS2 _E1_MS3
309
#if EXTRUDERS > 2 || (ENABLED(MIXING_EXTRUDER) && MIXING_STEPPERS > 2)
310
#undef _E2_PINS
311
#define _E2_PINS E2_STEP_PIN, E2_DIR_PIN, E2_ENABLE_PIN, _E2_CS _E2_MS1 _E2_MS2 _E2_MS3
312
#if EXTRUDERS > 3 || (ENABLED(MIXING_EXTRUDER) && MIXING_STEPPERS > 3)
313
#undef _E3_PINS
314
#define _E3_PINS E3_STEP_PIN, E3_DIR_PIN, E3_ENABLE_PIN, _E3_CS _E3_MS1 _E3_MS2 _E3_MS3
315
#if EXTRUDERS > 4 || (ENABLED(MIXING_EXTRUDER) && MIXING_STEPPERS > 4)
316
#undef _E4_PINS
317
#define _E4_PINS E4_STEP_PIN, E4_DIR_PIN, E4_ENABLE_PIN, _E4_CS _E4_MS1 _E4_MS2 _E4_MS3
318
#if EXTRUDERS > 5 || (ENABLED(MIXING_EXTRUDER) && MIXING_STEPPERS > 5)
319
#undef _E5_PINS
320
#define _E5_PINS E5_STEP_PIN, E5_DIR_PIN, E5_ENABLE_PIN, _E5_CS _E5_MS1 _E5_MS2 _E5_MS3
321
#endif // EXTRUDERS > 5 || MIXING_EXTRUDER > 5
322
#endif // EXTRUDERS > 4 || MIXING_EXTRUDER > 4
323
#endif // EXTRUDERS > 3 || MIXING_EXTRUDER > 3
324
#endif // EXTRUDERS > 2 || MIXING_EXTRUDER > 2
325
#endif // EXTRUDERS > 1 || MIXING_EXTRUDER
326
327
//
328
// Heaters, Fans, Temp Sensors
329
//
330
331
#define _H0_PINS
332
#define _H1_PINS
333
#define _H2_PINS
334
#define _H3_PINS
335
#define _H4_PINS
336
#define _H5_PINS
337
338
#if HOTENDS
339
#undef _H0_PINS
340
#define _H0_PINS HEATER_0_PIN, E0_AUTO_FAN_PIN, analogInputToDigitalPin(TEMP_0_PIN),
341
#if HOTENDS > 1
342
#undef _H1_PINS
343
#define _H1_PINS HEATER_1_PIN, E1_AUTO_FAN_PIN, analogInputToDigitalPin(TEMP_1_PIN),
344
#if HOTENDS > 2
345
#undef _H2_PINS
346
#define _H2_PINS HEATER_2_PIN, E2_AUTO_FAN_PIN, analogInputToDigitalPin(TEMP_2_PIN),
347
#if HOTENDS > 3
348
#undef _H3_PINS
349
#define _H3_PINS HEATER_3_PIN, E3_AUTO_FAN_PIN, analogInputToDigitalPin(TEMP_3_PIN),
350
#if HOTENDS > 4
351
#undef _H4_PINS
352
#define _H4_PINS HEATER_4_PIN, E4_AUTO_FAN_PIN, analogInputToDigitalPin(TEMP_4_PIN),
353
#if HOTENDS > 5
354
#undef _H5_PINS
355
#define _H5_PINS HEATER_5_PIN, E5_AUTO_FAN_PIN, analogInputToDigitalPin(TEMP_5_PIN),
356
#endif // HOTENDS > 5
357
#endif // HOTENDS > 4
358
#endif // HOTENDS > 3
359
#endif // HOTENDS > 2
360
#endif // HOTENDS > 1
361
#endif // HOTENDS
362
363
#define _BED_PINS HEATER_BED_PIN, analogInputToDigitalPin(TEMP_BED_PIN),
364
365
//
366
// Dual X, Dual Y, Multi-Z
367
// Chip Select and Digital Micro-stepping
368
//
369
370
#if EITHER(DUAL_X_CARRIAGE, X_DUAL_STEPPER_DRIVERS)
371
#if PIN_EXISTS(X2_CS) && AXIS_HAS_SPI(X2)
372
#define _X2_CS X2_CS_PIN,
373
#else
374
#define _X2_CS
375
#endif
376
#if PIN_EXISTS(X2_MS1)
377
#define _X2_MS1 X2_MS1_PIN,
378
#else
379
#define _X2_MS1
380
#endif
381
#if PIN_EXISTS(X2_MS2)
382
#define _X2_MS2 X2_MS2_PIN,
383
#else
384
#define _X2_MS2
385
#endif
386
#if PIN_EXISTS(X2_MS3)
387
#define _X2_MS3 X2_MS3_PIN,
388
#else
389
#define _X2_MS3
390
#endif
391
#define _X2_PINS X2_STEP_PIN, X2_DIR_PIN, X2_ENABLE_PIN, _X2_CS _X2_MS1 _X2_MS2 _X2_MS3
392
#else
393
#define _X2_PINS
394
#endif
395
396
#if ENABLED(Y_DUAL_STEPPER_DRIVERS)
397
#if PIN_EXISTS(Y2_CS) && AXIS_HAS_SPI(Y2)
398
#define _Y2_CS Y2_CS_PIN,
399
#else
400
#define _Y2_CS
401
#endif
402
#if PIN_EXISTS(Y2_MS1)
403
#define _Y2_MS1 Y2_MS1_PIN,
404
#else
405
#define _Y2_MS1
406
#endif
407
#if PIN_EXISTS(Y2_MS2)
408
#define _Y2_MS2 Y2_MS2_PIN,
409
#else
410
#define _Y2_MS2
411
#endif
412
#if PIN_EXISTS(Y2_MS3)
413
#define _Y2_MS3 Y2_MS3_PIN,
414
#else
415
#define _Y2_MS3
416
#endif
417
#define _Y2_PINS Y2_STEP_PIN, Y2_DIR_PIN, Y2_ENABLE_PIN, _Y2_CS _Y2_MS1 _Y2_MS2 _Y2_MS3
418
#else
419
#define _Y2_PINS
420
#endif
421
422
#if Z_MULTI_STEPPER_DRIVERS
423
#if PIN_EXISTS(Z2_CS) && AXIS_HAS_SPI(Z2)
424
#define _Z2_CS Z2_CS_PIN,
425
#else
426
#define _Z2_CS
427
#endif
428
#if PIN_EXISTS(Z2_MS1)
429
#define _Z2_MS1 Z2_MS1_PIN,
430
#else
431
#define _Z2_MS1
432
#endif
433
#if PIN_EXISTS(Z2_MS2)
434
#define _Z2_MS2 Z2_MS2_PIN,
435
#else
436
#define _Z2_MS2
437
#endif
438
#if PIN_EXISTS(Z2_MS3)
439
#define _Z2_MS3 Z2_MS3_PIN,
440
#else
441
#define _Z2_MS3
442
#endif
443
#define _Z2_PINS Z2_STEP_PIN, Z2_DIR_PIN, Z2_ENABLE_PIN, _Z2_CS _Z2_MS1 _Z2_MS2 _Z2_MS3
444
#else
445
#define _Z2_PINS
446
#endif
447
448
#if ENABLED(Z_TRIPLE_STEPPER_DRIVERS)
449
#if PIN_EXISTS(Z3_CS) && AXIS_HAS_SPI(Z3)
450
#define _Z3_CS Z3_CS_PIN,
451
#else
452
#define _Z3_CS
453
#endif
454
#if PIN_EXISTS(Z3_MS1)
455
#define _Z3_MS1 Z3_MS1_PIN,
456
#else
457
#define _Z3_MS1
458
#endif
459
#if PIN_EXISTS(Z3_MS2)
460
#define _Z3_MS2 Z3_MS2_PIN,
461
#else
462
#define _Z3_MS2
463
#endif
464
#if PIN_EXISTS(Z3_MS3)
465
#define _Z3_MS3 Z3_MS3_PIN,
466
#else
467
#define _Z3_MS3
468
#endif
469
#define _Z3_PINS Z3_STEP_PIN, Z3_DIR_PIN, Z3_ENABLE_PIN, _Z3_CS _Z3_MS1 _Z3_MS2 _Z3_MS3
470
#else
471
#define _Z3_PINS
472
#endif
473
474
//
475
// Generate the final Sensitive Pins array,
476
// keeping the array as small as possible.
477
//
478
479
#if PIN_EXISTS(PS_ON)
480
#define _PS_ON PS_ON_PIN,
481
#else
482
#define _PS_ON
483
#endif
484
485
#if HAS_BED_PROBE && PIN_EXISTS(Z_MIN_PROBE)
486
#define _Z_PROBE Z_MIN_PROBE_PIN,
487
#else
488
#define _Z_PROBE
489
#endif
490
491
#if TEMP_SENSOR_BED && PIN_EXISTS(HEATER_BED)
492
#define _HEATER_BED HEATER_BED_PIN,
493
#else
494
#define _HEATER_BED
495
#endif
496
497
#if PIN_EXISTS(FAN)
498
#define _FAN0 FAN_PIN,
499
#else
500
#define _FAN0
501
#endif
502
#if PIN_EXISTS(FAN1)
503
#define _FAN1 FAN1_PIN,
504
#else
505
#define _FAN1
506
#endif
507
#if PIN_EXISTS(FAN2)
508
#define _FAN2 FAN2_PIN,
509
#else
510
#define _FAN2
511
#endif
512
#if PIN_EXISTS(CONTROLLER_FAN)
513
#define _FANC CONTROLLER_FAN_PIN,
514
#else
515
#define _FANC
516
#endif
517
518
#ifndef HAL_SENSITIVE_PINS
519
#define HAL_SENSITIVE_PINS
520
#endif
521
522
#define SENSITIVE_PINS { \
523
_X_PINS _Y_PINS _Z_PINS _X2_PINS _Y2_PINS _Z2_PINS _Z3_PINS _Z_PROBE \
524
_E0_PINS _E1_PINS _E2_PINS _E3_PINS _E4_PINS _E5_PINS _BED_PINS \
525
_H0_PINS _H1_PINS _H2_PINS _H3_PINS _H4_PINS _H5_PINS \
526
_PS_ON _HEATER_BED _FAN0 _FAN1 _FAN2 _FANC \
527
HAL_SENSITIVE_PINS \
528
}
Prusa-Firmware-Buddy-Private1
lib
Marlin
Marlin
src
pins
sensitive_pins.h
Generated by
1.8.16