28 #if N_GANGED > N_ABC_MOTORS
29 #error "Axis configuration is not supported!"
33 #define SQUARING_ENABLED
37 #define GANGING_ENABLED
41 #define Z_DOUBLED N_ABC_MOTORS
43 #define Y_DOUBLED N_ABC_MOTORS
45 #define X_DOUBLED N_ABC_MOTORS
48 #if Y_GANGED && !defined(Y_DOUBLED)
49 #define Y_DOUBLED (N_ABC_MOTORS - 1)
50 #elif X_GANGED && !defined(X_DOUBLED)
51 #define X_DOUBLED (N_ABC_MOTORS - 1)
54 #if X_GANGED && !defined(X_DOUBLED)
55 #define X_DOUBLED (N_ABC_MOTORS - 2)
61 #error "A-axis motor is used for ganged X motor"
63 #define X2_STEP_PORT M3_STEP_PORT
64 #define X2_STEP_PIN M3_STEP_PIN
65 #define X2_STEP_BIT (1<<M3_STEP_PIN)
66 #define X2_DIRECTION_PORT M3_DIRECTION_PORT
67 #define X2_DIRECTION_PIN M3_DIRECTION_PIN
68 #define X2_DIRECTION_BIT (1<<M3_DIRECTION_PIN)
71 #define X2_HOME_PORT M3_HOME_PORT
72 #define X2_HOME_PIN M3_HOME_PIN
73 #define X2_HOME_BIT (1<<M3_HOME_PIN)
75 #elif X_AUTO_SQUARE && defined(X_HOME_PIN)
76 #error "Auto squared X-axis requires second home pin input"
80 #define X2_LIMIT_PORT M3_LIMIT_PORT
81 #define X2_LIMIT_PIN M3_LIMIT_PIN
82 #define X2_LIMIT_BIT (1<<M3_LIMIT_PIN)
83 #elif X_GANGED_LIM_MAX && !defined(M3_LIMIT_PIN_MAX)
84 #define X_LIMIT_PORT_MAX M3_LIMIT_PORT
85 #define X_LIMIT_PIN_MAX M3_LIMIT_PIN
86 #define X_LIMIT_BIT_MAX (1<<M3_LIMIT_PIN)
89 #error "Auto squared X-axis requires second limit pin input"
91 #ifdef M3_LIMIT_PIN_MAX
92 #define X_LIMIT_PORT_MAX M3_LIMIT_PORT_MAX
93 #define X_LIMIT_PIN_MAX M3_LIMIT_PIN_MAX
94 #define X_LIMIT_BIT_MAX (1<<M3_LIMIT_PIN_MAX)
97 #define X2_ENABLE_PORT M3_ENABLE_PORT
98 #define X2_ENABLE_PIN M3_ENABLE_PIN
99 #define X2_ENABLE_BIT (1<<M3_ENABLE_PIN)
105 #error "B-axis motor is used for ganged X motor"
107 #define X2_STEP_PORT M4_STEP_PORT
108 #define X2_STEP_PIN M4_STEP_PIN
109 #define X2_STEP_BIT (1<<M4_STEP_PIN)
110 #define X2_DIRECTION_PORT M4_DIRECTION_PORT
111 #define X2_DIRECTION_PIN M4_DIRECTION_PIN
112 #define X2_DIRECTION_BIT (1<<M4_DIRECTION_PIN)
115 #define X2_HOME_PORT M4_HOME_PORT
116 #define X2_HOME_PIN M4_HOME_PIN
117 #define X2_HOME_BIT (1<<M4_HOME_PIN)
119 #elif X_AUTO_SQUARE && defined(X_HOME_PIN)
120 #error "Auto squared X-axis requires second home pin input"
124 #define X2_LIMIT_PORT M4_LIMIT_PORT
125 #define X2_LIMIT_PIN M4_LIMIT_PIN
126 #define X2_LIMIT_BIT (1<<M4_LIMIT_PIN)
127 #elif X_GANGED_LIM_MAX && !defined(M4_LIMIT_PIN_MAX)
128 #define X_LIMIT_PORT_MAX M4_LIMIT_PORT
129 #define X_LIMIT_PIN_MAX M4_LIMIT_PIN
130 #define X_LIMIT_BIT_MAX (1<<M4_LIMIT_PIN)
133 #error "Auto squared X-axis requires second limit pin input"
135 #ifdef M4_LIMIT_PIN_MAX
136 #define X_LIMIT_PORT_MAX M4_LIMIT_PORT_MAX
137 #define X_LIMIT_PIN_MAX M4_LIMIT_PIN_MAX
138 #define X_LIMIT_BIT_MAX (1<<M4_LIMIT_PIN_MAX)
141 #define X2_ENABLE_PORT M4_ENABLE_PORT
142 #define X2_ENABLE_PIN M4_ENABLE_PIN
143 #define X2_ENABLE_BIT (1<<M4_ENABLE_PIN)
149 #error "C-axis motor is used for ganged X motor"
151 #define X2_STEP_PORT M5_STEP_PORT
152 #define X2_STEP_PIN M5_STEP_PIN
153 #define X2_STEP_BIT (1<<M5_STEP_PIN)
154 #define X2_DIRECTION_PORT M5_DIRECTION_PORT
155 #define X2_DIRECTION_PIN M5_DIRECTION_PIN
156 #define X2_DIRECTION_BIT (1<<M5_DIRECTION_PIN)
159 #define X2_HOME_PORT M5_HOME_PORT
160 #define X2_HOME_PIN M5_HOME_PIN
161 #define X2_HOME_BIT (1<<M5_HOME_PIN)
163 #elif X_AUTO_SQUARE && defined(X_HOME_PIN)
164 #error "Auto squared X-axis requires second home pin input"
168 #define X2_LIMIT_PORT M5_LIMIT_PORT
169 #define X2_LIMIT_PIN M5_LIMIT_PIN
170 #define X2_LIMIT_BIT (1<<M5_LIMIT_PIN)
171 #elif X_GANGED_LIM_MAX && !defined(M5_LIMIT_PIN_MAX)
172 #define X_LIMIT_PORT_MAX M5_LIMIT_PORT
173 #define X_LIMIT_PIN_MAX M5_LIMIT_PIN
174 #define X_LIMIT_BIT_MAX (1<<M5_LIMIT_PIN)
177 #error "Auto squared X-axis requires second limit pin input"
179 #ifdef M5_LIMIT_PIN_MAX
180 #define X_LIMIT_PORT_MAX M5_LIMIT_PORT_MAX
181 #define X_LIMIT_PIN_MAX M5_LIMIT_PIN_MAX
182 #define X_LIMIT_BIT_MAX (1<<M5_LIMIT_PIN_MAX)
185 #define X2_ENABLE_PORT M5_ENABLE_PORT
186 #define X2_ENABLE_PIN M5_ENABLE_PIN
187 #define X2_ENABLE_BIT (1<<M5_ENABLE_PIN)
193 #error "U-axis motor is used for ganged X motor"
195 #define X2_STEP_PORT M6_STEP_PORT
196 #define X2_STEP_PIN M6_STEP_PIN
197 #define X2_STEP_BIT (1<<M6_STEP_PIN)
198 #define X2_DIRECTION_PORT M6_DIRECTION_PORT
199 #define X2_DIRECTION_PIN M6_DIRECTION_PIN
200 #define X2_DIRECTION_BIT (1<<M6_DIRECTION_PIN)
203 #define X2_HOME_PORT M6_HOME_PORT
204 #define X2_HOME_PIN M6_HOME_PIN
205 #define X2_HOME_BIT (1<<M6_HOME_PIN)
207 #elif X_AUTO_SQUARE && defined(X_HOME_PIN)
208 #error "Auto squared X-axis requires second home pin input"
212 #define X2_LIMIT_PORT M6_LIMIT_PORT
213 #define X2_LIMIT_PIN M6_LIMIT_PIN
214 #define X2_LIMIT_BIT (1<<M6_LIMIT_PIN)
215 #elif X_GANGED_LIM_MAX && !defined(M6_LIMIT_PIN_MAX)
216 #define X_LIMIT_PORT_MAX M6_LIMIT_PORT
217 #define X_LIMIT_PIN_MAX M6_LIMIT_PIN
218 #define X_LIMIT_BIT_MAX (1<<M6_LIMIT_PIN)
221 #error "Auto squared X-axis requires second limit pin input"
223 #ifdef M6_LIMIT_PIN_MAX
224 #define X_LIMIT_PORT_MAX M6_LIMIT_PORT_MAX
225 #define X_LIMIT_PIN_MAX M6_LIMIT_PIN_MAX
226 #define X_LIMIT_BIT_MAX (1<<M6_LIMIT_PIN_MAX)
229 #define X2_ENABLE_PORT M6_ENABLE_PORT
230 #define X2_ENABLE_PIN M6_ENABLE_PIN
231 #define X2_ENABLE_BIT (1<<M6_ENABLE_PIN)
237 #error "V-axis motor is used for ganged X motor"
239 #define X2_STEP_PORT M7_STEP_PORT
240 #define X2_STEP_PIN M7_STEP_PIN
241 #define X2_STEP_BIT (1<<M7_STEP_PIN)
242 #define X2_DIRECTION_PORT M7_DIRECTION_PORT
243 #define X2_DIRECTION_PIN M7_DIRECTION_PIN
244 #define X2_DIRECTION_BIT (1<<M7_DIRECTION_PIN)
247 #define X2_HOME_PORT M7_HOME_PORT
248 #define X2_HOME_PIN M7_HOME_PIN
249 #define X2_HOME_BIT (1<<M7_HOME_PIN)
251 #elif X_AUTO_SQUARE && defined(X_HOME_PIN)
252 #error "Auto squared X-axis requires second home pin input"
256 #define X2_LIMIT_PORT M7_LIMIT_PORT
257 #define X2_LIMIT_PIN M7_LIMIT_PIN
258 #define X2_LIMIT_BIT (1<<M7_LIMIT_PIN)
259 #elif X_GANGED_LIM_MAX && !defined(M7_LIMIT_PIN_MAX)
260 #define X_LIMIT_PORT_MAX M7_LIMIT_PORT
261 #define X_LIMIT_PIN_MAX M7_LIMIT_PIN
262 #define X_LIMIT_BIT_MAX (1<<M7_LIMIT_PIN)
265 #error "Auto squared X-axis requires second limit pin input"
267 #ifdef M7_LIMIT_PIN_MAX
268 #define X_LIMIT_PORT_MAX M7_LIMIT_PORT_MAX
269 #define X_LIMIT_PIN_MAX M7_LIMIT_PIN_MAX
270 #define X_LIMIT_BIT_MAX (1<<M7_LIMIT_PIN_MAX)
273 #define X2_ENABLE_PORT M7_ENABLE_PORT
274 #define X2_ENABLE_PIN M7_ENABLE_PIN
275 #define X2_ENABLE_BIT (1<<M7_ENABLE_PIN)
283 #error "A-axis motor is used for ganged Y motor"
285 #define Y2_STEP_PORT M3_STEP_PORT
286 #define Y2_STEP_PIN M3_STEP_PIN
287 #define Y2_STEP_BIT (1<<M3_STEP_PIN)
288 #define Y2_DIRECTION_PORT M3_DIRECTION_PORT
289 #define Y2_DIRECTION_PIN M3_DIRECTION_PIN
290 #define Y2_DIRECTION_BIT (1<<M3_DIRECTION_PIN)
293 #define Y2_HOME_PORT M3_HOME_PORT
294 #define Y2_HOME_PIN M3_HOME_PIN
295 #define Y2_HOME_BIT (1<<M3_HOME_PIN)
297 #elif Y_AUTO_SQUARE && defined(Y_HOME_PIN)
298 #error "Auto squared Y-axis requires second home pin input"
302 #define Y2_LIMIT_PORT M3_LIMIT_PORT
303 #define Y2_LIMIT_PIN M3_LIMIT_PIN
304 #define Y2_LIMIT_BIT (1<<M3_LIMIT_PIN)
305 #elif Y_GANGED_LIM_MAX && !defined(M3_LIMIT_PIN_MAX)
306 #define Y_LIMIT_PORT_MAX M3_LIMIT_PORT
307 #define Y_LIMIT_PIN_MAX M3_LIMIT_PIN
308 #define Y_LIMIT_BIT_MAX (1<<M3_LIMIT_PIN)
311 #error "Auto squared Y-axis requires second limit pin input"
313 #ifdef M3_LIMIT_PIN_MAX
314 #define Y_LIMIT_PORT_MAX M3_LIMIT_PORT_MAX
315 #define Y_LIMIT_PIN_MAX M3_LIMIT_PIN_MAX
316 #define Y_LIMIT_BIT_MAX (1<<M3_LIMIT_PIN_MAX)
319 #define Y2_ENABLE_PORT M3_ENABLE_PORT
320 #define Y2_ENABLE_PIN M3_ENABLE_PIN
321 #define Y2_ENABLE_BIT (1<<M3_ENABLE_PIN)
327 #error "B-axis motor is used for ganged Y motor"
329 #define Y2_STEP_PORT M4_STEP_PORT
330 #define Y2_STEP_PIN M4_STEP_PIN
331 #define Y2_STEP_BIT (1<<M4_STEP_PIN)
332 #define Y2_DIRECTION_PORT M4_DIRECTION_PORT
333 #define Y2_DIRECTION_PIN M4_DIRECTION_PIN
334 #define Y2_DIRECTION_BIT (1<<M4_DIRECTION_PIN)
337 #define Y2_HOME_PORT M4_HOME_PORT
338 #define Y2_HOME_PIN M4_HOME_PIN
339 #define Y2_HOME_BIT (1<<M4_HOME_PIN)
341 #elif Y_AUTO_SQUARE && defined(Y_HOME_PIN)
342 #error "Auto squared Y-axis requires second home pin input"
346 #define Y2_LIMIT_PORT M4_LIMIT_PORT
347 #define Y2_LIMIT_PIN M4_LIMIT_PIN
348 #define Y2_LIMIT_BIT (1<<M4_LIMIT_PIN)
349 #elif Y_GANGED_LIM_MAX && !defined(M4_LIMIT_PIN_MAX)
350 #define Y_LIMIT_PORT_MAX M4_LIMIT_PORT
351 #define Y_LIMIT_PIN_MAX M4_LIMIT_PIN
352 #define Y_LIMIT_BIT_MAX (1<<M4_LIMIT_PIN)
355 #error "Auto squared Y-axis requires second limit pin input"
357 #ifdef M4_LIMIT_PIN_MAX
358 #define Y_LIMIT_PORT_MAX M4_LIMIT_PORT_MAX
359 #define Y_LIMIT_PIN_MAX M4_LIMIT_PIN_MAX
360 #define Y_LIMIT_BIT_MAX (1<<M4_LIMIT_PIN_MAX)
363 #define Y2_ENABLE_PORT M4_ENABLE_PORT
364 #define Y2_ENABLE_PIN M4_ENABLE_PIN
365 #define Y2_ENABLE_BIT (1<<M4_ENABLE_PIN)
371 #error "C-axis motor is used for ganged Y motor"
373 #define Y2_STEP_PORT M5_STEP_PORT
374 #define Y2_STEP_PIN M5_STEP_PIN
375 #define Y2_STEP_BIT (1<<M5_STEP_PIN)
376 #define Y2_DIRECTION_PORT M5_DIRECTION_PORT
377 #define Y2_DIRECTION_PIN M5_DIRECTION_PIN
378 #define Y2_DIRECTION_BIT (1<<M5_DIRECTION_PIN)
381 #define Y2_HOME_PORT M5_HOME_PORT
382 #define Y2_HOME_PIN M5_HOME_PIN
383 #define Y2_HOME_BIT (1<<M5_HOME_PIN)
385 #elif Y_AUTO_SQUARE && defined(Y_HOME_PIN)
386 #error "Auto squared Y-axis requires second home pin input"
390 #define Y2_LIMIT_PORT M5_LIMIT_PORT
391 #define Y2_LIMIT_PIN M5_LIMIT_PIN
392 #define Y2_LIMIT_BIT (1<<M5_LIMIT_PIN)
393 #elif Y_GANGED_LIM_MAX && !defined(M5_LIMIT_PIN_MAX)
394 #define Y_LIMIT_PORT_MAX M5_LIMIT_PORT
395 #define Y_LIMIT_PIN_MAX M5_LIMIT_PIN
396 #define Y_LIMIT_BIT_MAX (1<<M5_LIMIT_PIN)
399 #error "Auto squared Y-axis requires second limit pin input"
401 #ifdef M5_LIMIT_PIN_MAX
402 #define Y_LIMIT_PORT_MAX M5_LIMIT_PORT_MAX
403 #define Y_LIMIT_PIN_MAX M5_LIMIT_PIN_MAX
404 #define Y_LIMIT_BIT_MAX (1<<M5_LIMIT_PIN_MAX)
407 #define Y2_ENABLE_PORT M5_ENABLE_PORT
408 #define Y2_ENABLE_PIN M5_ENABLE_PIN
409 #define Y2_ENABLE_BIT (1<<M5_ENABLE_PIN)
415 #error "U-axis motor is used for ganged Y motor"
417 #define Y2_STEP_PORT M6_STEP_PORT
418 #define Y2_STEP_PIN M6_STEP_PIN
419 #define Y2_STEP_BIT (1<<M6_STEP_PIN)
420 #define Y2_DIRECTION_PORT M6_DIRECTION_PORT
421 #define Y2_DIRECTION_PIN M6_DIRECTION_PIN
422 #define Y2_DIRECTION_BIT (1<<M6_DIRECTION_PIN)
425 #define Y2_HOME_PORT M6_HOME_PORT
426 #define Y2_HOME_PIN M6_HOME_PIN
427 #define Y2_HOME_BIT (1<<M6_HOME_PIN)
429 #elif Y_AUTO_SQUARE && defined(Y_HOME_PIN)
430 #error "Auto squared Y-axis requires second home pin input"
434 #define Y2_LIMIT_PORT M6_LIMIT_PORT
435 #define Y2_LIMIT_PIN M6_LIMIT_PIN
436 #define Y2_LIMIT_BIT (1<<M6_LIMIT_PIN)
437 #elif Y_GANGED_LIM_MAX && !defined(M6_LIMIT_PIN_MAX)
438 #define Y_LIMIT_PORT_MAX M6_LIMIT_PORT
439 #define Y_LIMIT_PIN_MAX M6_LIMIT_PIN
440 #define Y_LIMIT_BIT_MAX (1<<M6_LIMIT_PIN)
443 #error "Auto squared Y-axis requires second limit pin input"
445 #ifdef M6_LIMIT_PIN_MAX
446 #define Y_LIMIT_PORT_MAX M6_LIMIT_PORT_MAX
447 #define Y_LIMIT_PIN_MAX M6_LIMIT_PIN_MAX
448 #define Y_LIMIT_BIT_MAX (1<<M6_LIMIT_PIN_MAX)
451 #define Y2_ENABLE_PORT M6_ENABLE_PORT
452 #define Y2_ENABLE_PIN M6_ENABLE_PIN
453 #define Y2_ENABLE_BIT (1<<M6_ENABLE_PIN)
459 #error "V-axis motor is used for ganged Y motor"
461 #define Y2_STEP_PORT M7_STEP_PORT
462 #define Y2_STEP_PIN M7_STEP_PIN
463 #define Y2_STEP_BIT (1<<M7_STEP_PIN)
464 #define Y2_DIRECTION_PORT M7_DIRECTION_PORT
465 #define Y2_DIRECTION_PIN M7_DIRECTION_PIN
466 #define Y2_DIRECTION_BIT (1<<M7_DIRECTION_PIN)
469 #define Y2_HOME_PORT M7_HOME_PORT
470 #define Y2_HOME_PIN M7_HOME_PIN
471 #define Y2_HOME_BIT (1<<M7_HOME_PIN)
473 #elif Y_AUTO_SQUARE && defined(Y_HOME_PIN)
474 #error "Auto squared Y-axis requires second home pin input"
478 #define Y2_LIMIT_PORT M7_LIMIT_PORT
479 #define Y2_LIMIT_PIN M7_LIMIT_PIN
480 #define Y2_LIMIT_BIT (1<<M7_LIMIT_PIN)
481 #elif Y_GANGED_LIM_MAX && !defined(M7_LIMIT_PIN_MAX)
482 #define Y_LIMIT_PORT_MAX M7_LIMIT_PORT
483 #define Y_LIMIT_PIN_MAX M7_LIMIT_PIN
484 #define Y_LIMIT_BIT_MAX (1<<M7_LIMIT_PIN)
487 #error "Auto squared Y-axis requires second limit pin input"
489 #ifdef M7_LIMIT_PIN_MAX
490 #define Y_LIMIT_PORT_MAX M7_LIMIT_PORT_MAX
491 #define Y_LIMIT_PIN_MAX M7_LIMIT_PIN_MAX
492 #define Y_LIMIT_BIT_MAX (1<<M7_LIMIT_PIN_MAX)
495 #define Y2_ENABLE_PORT M7_ENABLE_PORT
496 #define Y2_ENABLE_PIN M7_ENABLE_PIN
497 #define Y2_ENABLE_BIT (1<<M7_ENABLE_PIN)
505 #error "A-axis motor is used for ganged Z motor"
507 #define Z2_STEP_PORT M3_STEP_PORT
508 #define Z2_STEP_PIN M3_STEP_PIN
509 #define Z2_STEP_BIT (1<<M3_STEP_PIN)
510 #define Z2_DIRECTION_PORT M3_DIRECTION_PORT
511 #define Z2_DIRECTION_PIN M3_DIRECTION_PIN
512 #define Z2_DIRECTION_BIT (1<<M3_DIRECTION_PIN)
515 #define Z2_HOME_PORT M3_HOME_PORT
516 #define Z2_HOME_PIN M3_HOME_PIN
517 #define Z2_HOME_BIT (1<<M3_HOME_PIN)
519 #elif Z_AUTO_SQUARE && defined(Y_HOME_PIN)
520 #error "Auto squared Z-axis requires second home pin input"
524 #define Z2_LIMIT_PORT M3_LIMIT_PORT
525 #define Z2_LIMIT_PIN M3_LIMIT_PIN
526 #define Z2_LIMIT_BIT (1<<M3_LIMIT_PIN)
527 #elif Z_GANGED_LIM_MAX && !defined(M3_LIMIT_PIN_MAX)
528 #define Z_LIMIT_PORT_MAX M3_LIMIT_PORT
529 #define Z_LIMIT_PIN_MAX M3_LIMIT_PIN
530 #define Z_LIMIT_BIT_MAX (1<<M3_LIMIT_PIN)
533 #error "Auto squared Z-axis requires second limit pin input"
535 #ifdef M3_LIMIT_PIN_MAX
536 #define Z_LIMIT_PORT_MAX M3_LIMIT_PORT_MAX
537 #define Z_LIMIT_PIN_MAX M3_LIMIT_PIN_MAX
538 #define Z_LIMIT_BIT_MAX (1<<M3_LIMIT_PIN_MAX)
541 #define Z2_ENABLE_PORT M3_ENABLE_PORT
542 #define Z2_ENABLE_PIN M3_ENABLE_PIN
543 #define Z2_ENABLE_BIT (1<<M3_ENABLE_PIN)
549 #error "B-axis motor is used for ganged Z motor"
551 #define Z2_STEP_PORT M4_STEP_PORT
552 #define Z2_STEP_PIN M4_STEP_PIN
553 #define Z2_STEP_BIT (1<<M4_STEP_PIN)
554 #define Z2_DIRECTION_PORT M4_DIRECTION_PORT
555 #define Z2_DIRECTION_PIN M4_DIRECTION_PIN
556 #define Z2_DIRECTION_BIT (1<<M4_DIRECTION_PIN)
559 #define Z2_HOME_PORT M4_HOME_PORT
560 #define Z2_HOME_PIN M4_HOME_PIN
561 #define Z2_HOME_BIT (1<<M4_HOME_PIN)
563 #elif Z_AUTO_SQUARE && defined(Z_HOME_PIN)
564 #error "Auto squared Z-axis requires second home pin input"
568 #define Z2_LIMIT_PORT M4_LIMIT_PORT
569 #define Z2_LIMIT_PIN M4_LIMIT_PIN
570 #define Z2_LIMIT_BIT (1<<M4_LIMIT_PIN)
571 #elif Z_GANGED_LIM_MAX && !defined(M4_LIMIT_PIN_MAX)
572 #define Z_LIMIT_PORT_MAX M4_LIMIT_PORT
573 #define Z_LIMIT_PIN_MAX M4_LIMIT_PIN
574 #define Z_LIMIT_BIT_MAX (1<<M4_LIMIT_PIN)
577 #error "Auto squared Z-axis requires second limit pin input"
579 #ifdef M4_LIMIT_PIN_MAX
580 #define Z_LIMIT_PORT_MAX M4_LIMIT_PORT_MAX
581 #define Z_LIMIT_PIN_MAX M4_LIMIT_PIN_MAX
582 #define Z_LIMIT_BIT_MAX (1<<M4_LIMIT_PIN_MAX)
585 #define Z2_ENABLE_PORT M4_ENABLE_PORT
586 #define Z2_ENABLE_PIN M4_ENABLE_PIN
587 #define Z2_ENABLE_BIT (1<<M4_ENABLE_PIN)
593 #error "C-axis motor is used for ganged Z motor"
595 #define Z2_STEP_PORT M5_STEP_PORT
596 #define Z2_STEP_PIN M5_STEP_PIN
597 #define Z2_STEP_BIT (1<<M5_STEP_PIN)
598 #define Z2_DIRECTION_PORT M5_DIRECTION_PORT
599 #define Z2_DIRECTION_PIN M5_DIRECTION_PIN
600 #define Z2_DIRECTION_BIT (1<<M5_DIRECTION_PIN)
603 #define Z2_HOME_PORT M5_HOME_PORT
604 #define Z2_HOME_PIN M5_HOME_PIN
605 #define Z2_HOME_BIT (1<<M5_HOME_PIN)
607 #elif Z_AUTO_SQUARE && defined(Z_HOME_PIN)
608 #error "Auto squared Z-axis requires second home pin input"
612 #define Z2_LIMIT_PORT M5_LIMIT_PORT
613 #define Z2_LIMIT_PIN M5_LIMIT_PIN
614 #define Z2_LIMIT_BIT (1<<M5_LIMIT_PIN)
615 #elif Z_GANGED_LIM_MAX && !defined(M5_LIMIT_PIN_MAX)
616 #define Z_LIMIT_PORT_MAX M5_LIMIT_PORT
617 #define Z_LIMIT_PIN_MAX M5_LIMIT_PIN
618 #define Z_LIMIT_BIT_MAX (1<<M5_LIMIT_PIN)
621 #error "Auto squared Z-axis requires second limit pin input"
623 #ifdef M5_LIMIT_PIN_MAX
624 #define Z_LIMIT_PORT_MAX M5_LIMIT_PORT_MAX
625 #define Z_LIMIT_PIN_MAX M5_LIMIT_PIN_MAX
626 #define Z_LIMIT_BIT_MAX (1<<M5_LIMIT_PIN_MAX)
629 #define Z2_ENABLE_PORT M5_ENABLE_PORT
630 #define Z2_ENABLE_PIN M5_ENABLE_PIN
631 #define Z2_ENABLE_BIT (1<<M5_ENABLE_PIN)
637 #error "U-axis motor is used for ganged Z motor"
639 #define Z2_STEP_PORT M6_STEP_PORT
640 #define Z2_STEP_PIN M6_STEP_PIN
641 #define Z2_STEP_BIT (1<<M6_STEP_PIN)
642 #define Z2_DIRECTION_PORT M6_DIRECTION_PORT
643 #define Z2_DIRECTION_PIN M6_DIRECTION_PIN
644 #define Z2_DIRECTION_BIT (1<<M6_DIRECTION_PIN)
647 #define Z2_HOME_PORT M6_HOME_PORT
648 #define Z2_HOME_PIN M6_HOME_PIN
649 #define Z2_HOME_BIT (1<<M6_HOME_PIN)
651 #elif Z_AUTO_SQUARE && defined(Z_HOME_PIN)
652 #error "Auto squared Z-axis requires second home pin input"
656 #define Z2_LIMIT_PORT M6_LIMIT_PORT
657 #define Z2_LIMIT_PIN M6_LIMIT_PIN
658 #define Z2_LIMIT_BIT (1<<M6_LIMIT_PIN)
659 #elif Z_GANGED_LIM_MAX && !defined(M6_LIMIT_PIN_MAX)
660 #define Z_LIMIT_PORT_MAX M6_LIMIT_PORT
661 #define Z_LIMIT_PIN_MAX M6_LIMIT_PIN
662 #define Z_LIMIT_BIT_MAX (1<<M6_LIMIT_PIN)
665 #error "Auto squared Z-axis requires second limit pin input"
667 #ifdef M6_LIMIT_PIN_MAX
668 #define Z_LIMIT_PORT_MAX M6_LIMIT_PORT_MAX
669 #define Z_LIMIT_PIN_MAX M6_LIMIT_PIN_MAX
670 #define Z_LIMIT_BIT_MAX (1<<M6_LIMIT_PIN_MAX)
673 #define Z2_ENABLE_PORT M6_ENABLE_PORT
674 #define Z2_ENABLE_PIN M6_ENABLE_PIN
675 #define Z2_ENABLE_BIT (1<<M6_ENABLE_PIN)
681 #error "V-axis motor is used for ganged Z motor"
683 #define Z2_STEP_PORT M7_STEP_PORT
684 #define Z2_STEP_PIN M7_STEP_PIN
685 #define Z2_STEP_BIT (1<<M7_STEP_PIN)
686 #define Z2_DIRECTION_PORT M7_DIRECTION_PORT
687 #define Z2_DIRECTION_PIN M7_DIRECTION_PIN
688 #define Z2_DIRECTION_BIT (1<<M7_DIRECTION_PIN)
691 #define Z2_HOME_PORT M7_HOME_PORT
692 #define Z2_HOME_PIN M7_HOME_PIN
693 #define Z2_HOME_BIT (1<<M7_HOME_PIN)
695 #elif Z_AUTO_SQUARE && defined(Z_HOME_PIN)
696 #error "Auto squared Z-axis requires second home pin input"
700 #define Z2_LIMIT_PORT M7_LIMIT_PORT
701 #define Z2_LIMIT_PIN M7_LIMIT_PIN
702 #define Z2_LIMIT_BIT (1<<M7_LIMIT_PIN)
703 #elif Z_GANGED_LIM_MAX && !defined(M7_LIMIT_PIN_MAX)
704 #define Z_LIMIT_PORT_MAX M7_LIMIT_PORT
705 #define Z_LIMIT_PIN_MAX M7_LIMIT_PIN
706 #define Z_LIMIT_BIT_MAX (1<<M7_LIMIT_PIN)
709 #error "Auto squared Z-axis requires second limit pin input"
711 #ifdef M7_LIMIT_PIN_MAX
712 #define Z_LIMIT_PORT_MAX M7_LIMIT_PORT_MAX
713 #define Z_LIMIT_PIN_MAX M7_LIMIT_PIN_MAX
714 #define Z_LIMIT_BIT_MAX (1<<M7_LIMIT_PIN_MAX)
717 #define Z2_ENABLE_PORT M7_ENABLE_PORT
718 #define Z2_ENABLE_PIN M7_ENABLE_PIN
719 #define Z2_ENABLE_BIT (1<<M7_ENABLE_PIN)
724 #define X2_MOTOR (X_DOUBLED + 2)
727 #define Y2_MOTOR (Y_DOUBLED + 2)
730 #define Z2_MOTOR (Z_DOUBLED + 2)
735 #if defined(X2_HOME_PIN) || defined(Y2_HOME_PIN) || defined(Z2_HOME_PIN)
736 #define DUAL_HOME_SWITCHES
738 #define X2_HOME_BIT 0
741 #define Y2_HOME_BIT 0
744 #define Z2_HOME_BIT 0
746 #define HOME2_MASK (X2_HOME_BIT|Y2_HOME_BIT|Z2_HOME_BIT)
747 #define HOME2_MASK_SUM (X2_HOME_BIT+Y2_HOME_BIT+Z2_HOME_BIT)
750 #define HOME2_MASK_SUM 0
753 #if defined(X2_LIMIT_PIN) || defined(Y2_LIMIT_PIN) || defined(Z2_LIMIT_PIN)
754 #define DUAL_LIMIT_SWITCHES
756 #define X2_LIMIT_BIT 0
759 #define Y2_LIMIT_BIT 0
762 #define Z2_LIMIT_BIT 0
764 #define LIMIT2_MASK (X2_LIMIT_BIT|Y2_LIMIT_BIT|Z2_LIMIT_BIT)
765 #define LIMIT2_MASK_SUM (X2_LIMIT_BIT+Y2_LIMIT_BIT+Z2_LIMIT_BIT)
767 #define LIMIT2_MASK 0
768 #define LIMIT2_MASK_SUM 0
771 #if defined(X_LIMIT_PIN_MAX) || defined(Y_LIMIT_PIN_MAX) || defined(Z_LIMIT_PIN_MAX) || defined(A_LIMIT_PIN_MAX) || defined(B_LIMIT_PIN_MAX) || defined(C_LIMIT_PIN_MAX)
772 #define MAX_LIMIT_SWITCHES
777 #error "A_AXIS pins are not available"
779 #define A_STEP_PORT M3_STEP_PORT
780 #define A_STEP_PIN M3_STEP_PIN
781 #define A_STEP_BIT (1<<M3_STEP_PIN)
782 #define A_DIRECTION_PORT M3_DIRECTION_PORT
783 #define A_DIRECTION_PIN M3_DIRECTION_PIN
784 #define A_DIRECTION_BIT (1<<M3_DIRECTION_PIN)
786 #define A_HOME_PORT M3_HOME_PORT
787 #define A_HOME_PIN M3_HOME_PIN
788 #define A_HOME_BIT (1<<M3_HOME_PIN)
791 #define A_LIMIT_PORT M3_LIMIT_PORT
792 #define A_LIMIT_PIN M3_LIMIT_PIN
793 #define A_LIMIT_BIT (1<<M3_LIMIT_PIN)
795 #ifdef M3_LIMIT_PIN_MAX
796 #define A_LIMIT_PORT_MAX M3_LIMIT_PORT_MAX
797 #define A_LIMIT_PIN_MAX M3_LIMIT_PIN_MAX
798 #define A_LIMIT_BIT_MAX (1<<M3_LIMIT_PIN_MAX)
801 #define A_ENABLE_PORT M3_ENABLE_PORT
802 #define A_ENABLE_PIN M3_ENABLE_PIN
803 #define A_ENABLE_BIT (1<<M3_ENABLE_PIN)
809 #error "B_AXIS pins are not available"
811 #define B_STEP_PORT M4_STEP_PORT
812 #define B_STEP_PIN M4_STEP_PIN
813 #define B_STEP_BIT (1<<M4_STEP_PIN)
814 #define B_DIRECTION_PORT M4_DIRECTION_PORT
815 #define B_DIRECTION_PIN M4_DIRECTION_PIN
816 #define B_DIRECTION_BIT (1<<M4_DIRECTION_PIN)
818 #define B_HOME_PORT M4_HOME_PORT
819 #define B_HOME_PIN M4_HOME_PIN
820 #define B_HOME_BIT (1<<M4_HOME_PIN)
823 #define B_LIMIT_PORT M4_LIMIT_PORT
824 #define B_LIMIT_PIN M4_LIMIT_PIN
825 #define B_LIMIT_BIT (1<<M4_LIMIT_PIN)
827 #ifdef M4_LIMIT_PIN_MAX
828 #define B_LIMIT_PORT_MAX M4_LIMIT_PORT_MAX
829 #define B_LIMIT_PIN_MAX M4_LIMIT_PIN_MAX
830 #define B_LIMIT_BIT_MAX (1<<M4_LIMIT_PIN_MAX)
833 #define B_ENABLE_PORT M4_ENABLE_PORT
834 #define B_ENABLE_PIN M4_ENABLE_PIN
835 #define B_ENABLE_BIT (1<<M4_ENABLE_PIN)
841 #error "C_AXIS pins are not available"
843 #define C_STEP_PORT M5_STEP_PORT
844 #define C_STEP_PIN M5_STEP_PIN
845 #define C_STEP_BIT (1<<M5_STEP_PIN)
846 #define C_DIRECTION_PORT M5_DIRECTION_PORT
847 #define C_DIRECTION_PIN M5_DIRECTION_PIN
848 #define C_DIRECTION_BIT (1<<M5_DIRECTION_PIN)
850 #define C_HOME_PORT M5_HOME_PORT
851 #define C_HOME_PIN M5_HOME_PIN
852 #define C_HOME_BIT (1<<M5_HOME_PIN)
855 #define C_LIMIT_PORT M5_LIMIT_PORT
856 #define C_LIMIT_PIN M5_LIMIT_PIN
857 #define C_LIMIT_BIT (1<<M5_LIMIT_PIN)
859 #ifdef M5_LIMIT_PIN_MAX
860 #define C_LIMIT_PORT_MAX M5_LIMIT_PORT_MAX
861 #define C_LIMIT_PIN_MAX M5_LIMIT_PIN_MAX
862 #define C_LIMIT_BIT_MAX (1<<M5_LIMIT_PIN_MAX)
865 #define C_ENABLE_PORT M5_ENABLE_PORT
866 #define C_ENABLE_PIN M5_ENABLE_PIN
867 #define C_ENABLE_BIT (1<<M5_ENABLE_PIN)
873 #error "U_AXIS pins are not available"
875 #define U_STEP_PORT M6_STEP_PORT
876 #define U_STEP_PIN M6_STEP_PIN
877 #define U_STEP_BIT (1<<M6_STEP_PIN)
878 #define U_DIRECTION_PORT M6_DIRECTION_PORT
879 #define U_DIRECTION_PIN M6_DIRECTION_PIN
880 #define U_DIRECTION_BIT (1<<M6_DIRECTION_PIN)
882 #define U_HOME_PORT M6_HOME_PORT
883 #define U_HOME_PIN M6_HOME_PIN
884 #define U_HOME_BIT (1<<M6_HOME_PIN)
887 #define U_LIMIT_PORT M6_LIMIT_PORT
888 #define U_LIMIT_PIN M6_LIMIT_PIN
889 #define U_LIMIT_BIT (1<<M6_LIMIT_PIN)
891 #ifdef M6_LIMIT_PIN_MAX
892 #define U_LIMIT_PORT_MAX M6_LIMIT_PORT_MAX
893 #define U_LIMIT_PIN_MAX M6_LIMIT_PIN_MAX
894 #define U_LIMIT_BIT_MAX (1<<M6_LIMIT_PIN_MAX)
897 #define U_ENABLE_PORT M6_ENABLE_PORT
898 #define U_ENABLE_PIN M6_ENABLE_PIN
899 #define U_ENABLE_BIT (1<<M6_ENABLE_PIN)
905 #error "V_AXIS pins are not available"
907 #define V_STEP_PORT M7_STEP_PORT
908 #define V_STEP_PIN M7_STEP_PIN
909 #define V_STEP_BIT (1<<M7_STEP_PIN)
910 #define V_DIRECTION_PORT M7_DIRECTION_PORT
911 #define V_DIRECTION_PIN M7_DIRECTION_PIN
912 #define V_DIRECTION_BIT (1<<M7_DIRECTION_PIN)
914 #define V_HOME_PORT M7_HOME_PORT
915 #define V_HOME_PIN M7_HOME_PIN
916 #define V_HOME_BIT (1<<M7_HOME_PIN)
919 #define V_LIMIT_PORT M7_LIMIT_PORT
920 #define V_LIMIT_PIN M7_LIMIT_PIN
921 #define V_LIMIT_BIT (1<<M7_LIMIT_PIN)
923 #ifdef M7_LIMIT_PIN_MAX
924 #define V_LIMIT_PORT_MAX M7_LIMIT_PORT_MAX
925 #define V_LIMIT_PIN_MAX M7_LIMIT_PIN_MAX
926 #define V_LIMIT_BIT_MAX (1<<M7_LIMIT_PIN_MAX)
929 #define V_ENABLE_PORT M7_ENABLE_PORT
930 #define V_ENABLE_PIN M7_ENABLE_PIN
931 #define V_ENABLE_BIT (1<<M7_ENABLE_PIN)
938 #define X_STEP_PORT STEP_PORT
941 #define Y_STEP_PORT STEP_PORT
944 #define Z_STEP_PORT STEP_PORT
946 #if defined(A_AXIS) && !defined(A_STEP_PORT)
947 #define A_STEP_PORT STEP_PORT
949 #if defined(B_AXIS) && !defined(B_STEP_PORT)
950 #define B_STEP_PORT STEP_PORT
952 #if defined(C_AXIS) && !defined(C_STEP_PORT)
953 #define C_STEP_PORT STEP_PORT
955 #if defined(U_AXIS) && !defined(U_STEP_PORT)
956 #define U_STEP_PORT STEP_PORT
958 #if defined(V_AXIS) && !defined(V_STEP_PORT)
959 #define V_STEP_PORT STEP_PORT
964 #define X_STEP_BIT (1<<X_STEP_PIN)
967 #define Y_STEP_BIT (1<<Y_STEP_PIN)
970 #define Z_STEP_BIT (1<<Z_STEP_PIN)
973 #ifdef DIRECTION_PORT
974 #ifndef X_DIRECTION_PORT
975 #define X_DIRECTION_PORT DIRECTION_PORT
977 #ifndef Y_DIRECTION_PORT
978 #define Y_DIRECTION_PORT DIRECTION_PORT
980 #ifndef Z_DIRECTION_PORT
981 #define Z_DIRECTION_PORT DIRECTION_PORT
983 #if defined(A_AXIS) && !defined(A_DIRECTION_PORT)
984 #define A_DIRECTION_PORT DIRECTION_PORT
986 #if defined(B_AXIS) && !defined(B_DIRECTION_PORT)
987 #define B_DIRECTION_PORT DIRECTION_PORT
989 #if defined(C_AXIS) && !defined(B_DIRECTION_PORT)
990 #define C_DIRECTION_PORT DIRECTION_PORT
992 #if defined(U_AXIS) && !defined(U_DIRECTION_PORT)
993 #define U_DIRECTION_PORT DIRECTION_PORT
995 #if defined(V_AXIS) && !defined(V_DIRECTION_PORT)
996 #define V_DIRECTION_PORT DIRECTION_PORT
1000 #ifndef X_DIRECTION_BIT
1001 #define X_DIRECTION_BIT (1<<X_DIRECTION_PIN)
1003 #ifndef Y_DIRECTION_BIT
1004 #define Y_DIRECTION_BIT (1<<Y_DIRECTION_PIN)
1006 #ifndef Z_DIRECTION_BIT
1007 #define Z_DIRECTION_BIT (1<<Z_DIRECTION_PIN)
1011 #ifndef X_LIMIT_PORT
1012 #define X_LIMIT_PORT LIMIT_PORT
1014 #ifndef Y_LIMIT_PORT
1015 #define Y_LIMIT_PORT LIMIT_PORT
1017 #ifndef Z_LIMIT_PORT
1018 #define Z_LIMIT_PORT LIMIT_PORT
1020 #if defined(A_AXIS) && !defined(A_LIMIT_PORT)
1021 #define A_LIMIT_PORT LIMIT_PORT
1023 #if defined(B_AXIS) && !defined(B_LIMIT_PORT)
1024 #define B_LIMIT_PORT LIMIT_PORT
1026 #if defined(C_AXIS) && !defined(C_LIMIT_PORT)
1027 #define C_LIMIT_PORT LIMIT_PORT
1029 #if defined(U_AXIS) && !defined(U_LIMIT_PORT)
1030 #define U_LIMIT_PORT LIMIT_PORT
1032 #if defined(V_AXIS) && !defined(V_LIMIT_PORT)
1033 #define V_LIMIT_PORT LIMIT_PORT
1039 #define X_HOME_BIT (1<<X_HOME_PIN)
1041 #define X_HOME_BIT 0
1046 #define Y_HOME_BIT (1<<Y_HOME_PIN)
1048 #define Y_HOME_BIT 0
1053 #define Z_HOME_BIT (1<<Z_HOME_PIN)
1055 #define Z_HOME_BIT 0
1060 #define X_LIMIT_BIT (1<<X_LIMIT_PIN)
1063 #define Y_LIMIT_BIT (1<<Y_LIMIT_PIN)
1066 #define Z_LIMIT_BIT (1<<Z_LIMIT_PIN)
1068 #ifndef X_LIMIT_BIT_MAX
1069 #ifdef X_LIMIT_PIN_MAX
1070 #define X_LIMIT_BIT_MAX (1<<X_LIMIT_PIN_MAX)
1072 #define X_LIMIT_BIT_MAX 0
1075 #ifndef Y_LIMIT_BIT_MAX
1076 #ifdef Y_LIMIT_PIN_MAX
1077 #define Y_LIMIT_BIT_MAX (1<<Y_LIMIT_PIN_MAX)
1079 #define Y_LIMIT_BIT_MAX 0
1082 #ifndef Z_LIMIT_BIT_MAX
1083 #ifdef Z_LIMIT_PIN_MAX
1084 #define Z_LIMIT_BIT_MAX (1<<Z_LIMIT_PIN_MAX)
1086 #define Z_LIMIT_BIT_MAX 0
1090 #if !defined(X_ENABLE_BIT) && defined(X_ENABLE_PIN)
1091 #define X_ENABLE_BIT (1<<X_ENABLE_PIN)
1093 #if !defined(Y_ENABLE_BIT) && defined(Y_ENABLE_PIN)
1094 #define Y_ENABLE_BIT (1<<Y_ENABLE_PIN)
1096 #if !defined(Z_ENABLE_BIT) && defined(Z_ENABLE_PIN)
1097 #define Z_ENABLE_BIT (1<<Z_ENABLE_PIN)
1102 #define STEP_MASK (X_STEP_BIT|Y_STEP_BIT|Z_STEP_BIT)
1104 #define STEP_MASK (X_STEP_BIT|Y_STEP_BIT|Z_STEP_BIT|A_STEP_BIT)
1106 #define STEP_MASK (X_STEP_BIT|Y_STEP_BIT|Z_STEP_BIT|A_STEP_BIT|B_STEP_BIT)
1108 #define STEP_MASK (X_STEP_BIT|Y_STEP_BIT|Z_STEP_BIT|A_STEP_BIT|B_STEP_BIT|C_STEP_BIT)
1110 #define STEP_MASK (X_STEP_BIT|Y_STEP_BIT|Z_STEP_BIT|A_STEP_BIT|B_STEP_BIT|C_STEP_BIT|U_STEP_BIT)
1112 #define STEP_MASK (X_STEP_BIT|Y_STEP_BIT|Z_STEP_BIT|A_STEP_BIT|B_STEP_BIT|C_STEP_BIT|U_STEP_BIT|V_STEP_BIT)
1116 #ifndef DIRECTION_MASK
1118 #define DIRECTION_MASK (X_DIRECTION_BIT|Y_DIRECTION_BIT|Z_DIRECTION_BIT)
1120 #define DIRECTION_MASK (X_DIRECTION_BIT|Y_DIRECTION_BIT|Z_DIRECTION_BIT|A_DIRECTION_BIT)
1122 #define DIRECTION_MASK (X_DIRECTION_BIT|Y_DIRECTION_BIT|Z_DIRECTION_BIT|A_DIRECTION_BIT|B_DIRECTION_BIT)
1124 #define DIRECTION_MASK (X_DIRECTION_BIT|Y_DIRECTION_BIT|Z_DIRECTION_BIT|A_DIRECTION_BIT|B_DIRECTION_BIT|C_DIRECTION_BIT)
1126 #define DIRECTION_MASK (X_DIRECTION_BIT|Y_DIRECTION_BIT|Z_DIRECTION_BIT|A_DIRECTION_BIT|B_DIRECTION_BIT|C_DIRECTION_BIT|U_DIRECTION_BIT)
1128 #define DIRECTION_MASK (X_DIRECTION_BIT|Y_DIRECTION_BIT|Z_DIRECTION_BIT|A_DIRECTION_BIT|B_DIRECTION_BIT|C_DIRECTION_BIT|U_DIRECTION_BIT|V_DIRECTION_BIT)
1132 #if defined(STEPPERS_ENABLE_PIN) && !defined(STEPPERS_ENABLE_BIT)
1133 #define STEPPERS_ENABLE_BIT (1<<STEPPERS_ENABLE_PIN)
1136 #ifndef STEPPERS_ENABLE_MASK
1138 #ifdef STEPPERS_ENABLE_BIT
1139 #define STEPPERS_ENABLE_MASK STEPPERS_ENABLE_BIT
1142 #if N_AXIS >= 4 && !defined(A_ENABLE_BIT)
1143 #define A_ENABLE_BIT 0
1145 #if N_AXIS >= 5 && !defined(B_ENABLE_BIT)
1146 #define B_ENABLE_BIT 0
1148 #if N_AXIS >= 6 && !defined(C_ENABLE_BIT)
1149 #define C_ENABLE_BIT 0
1153 #define STEPPERS_ENABLE_MASK (X_ENABLE_BIT|Y_ENABLE_BIT|Z_ENABLE_BIT)
1155 #define STEPPERS_ENABLE_MASK (X_ENABLE_BIT|Y_ENABLE_BIT|Z_ENABLE_BIT|A_ENABLE_BIT)
1157 #define STEPPERS_ENABLE_MASK (X_ENABLE_BIT|Y_ENABLE_BIT|Z_ENABLE_BIT|A_ENABLE_BIT|B_ENABLE_BIT)
1159 #define STEPPERS_ENABLE_MASK (X_ENABLE_BIT|Y_ENABLE_BIT|Z_ENABLE_BIT|A_ENABLE_BIT|B_ENABLE_BIT|C_ENABLE_BIT)
1161 #define STEPPERS_ENABLE_MASK (X_ENABLE_BIT|Y_ENABLE_BIT|Z_ENABLE_BIT|A_ENABLE_BIT|B_ENABLE_BIT|C_ENABLE_BIT|U_ENABLE_BIT)
1163 #define STEPPERS_ENABLE_MASK (X_ENABLE_BIT|Y_ENABLE_BIT|Z_ENABLE_BIT|A_ENABLE_BIT|B_ENABLE_BIT|C_ENABLE_BIT|U_ENABLE_BIT|V_ENABLE_BIT)
1171 #define HOME_MASK_BASE (X_HOME_BIT|Y_HOME_BIT|Z_HOME_BIT|HOME2_MASK)
1172 #define HOME_MASK_BASE_SUM (X_HOME_BIT+Y_HOME_BIT+Z_HOME_BIT+HOME2_MASK_SUM)
1175 #define HOME_MASK HOME_MASK_BASE
1176 #define HOME_MASK_SUM HOME_MASK_BASE_SUM
1177 #define HOME_MIN_CAP AXES_BITMASK
1179 #define HOME_MASK (HOME_MASK_BASE|A_HOME_BIT)
1180 #define HOME_MASK_SUM (HOME_MASK_BASE_SUM+A_HOME_BIT)
1182 #define HOME_MASK (HOME_MASK_BASE|A_HOME_BIT|B_HOME_BIT)
1183 #define HOME_MASK_SUM (HOME_MASK_BASE_SUM+A_HOME_BIT+B_HOME_BIT)
1185 #define HOME_MASK (HOME_MASK_BASE|A_HOME_BIT|B_HOME_BIT|C_HOME_BIT)
1186 #define HOME_MASK_SUM (HOME_MASK_BASE_SUM+A_HOME_BIT+B_HOME_BIT+C_HOME_BIT)
1188 #define HOME_MASK (HOME_MASK_BASE|A_HOME_BIT|B_HOME_BIT|C_HOME_BIT|U_HOME_BIT)
1189 #define HOME_MASK_SUM (HOME_MASK_BASE_SUM+A_HOME_BIT+B_HOME_BIT+C_HOME_BIT+U_HOME_BIT)
1191 #define HOME_MASK (HOME_MASK_BASE|A_HOME_BIT|B_HOME_BIT|C_HOME_BIT|U_HOME_BIT|V_HOME_BIT)
1192 #define HOME_MASK_SUM (HOME_MASK_BASE_SUM+A_HOME_BIT+B_HOME_BIT+C_HOME_BIT+U_HOME_BIT+V_HOME_BIT)
1199 #if N_AXIS >=4 && !defined(A_LIMIT_BIT)
1201 #define A_LIMIT_BIT (1<<A_LIMIT_PIN)
1203 #define A_LIMIT_BIT 0
1206 #if N_AXIS >=5 && !defined(B_LIMIT_BIT)
1208 #define B_LIMIT_BIT (1<<B_LIMIT_PIN)
1210 #define B_LIMIT_BIT 0
1213 #if N_AXIS >= 6 && !defined(C_LIMIT_BIT)
1215 #define C_LIMIT_BIT (1<<C_LIMIT_PIN)
1217 #define C_LIMIT_BIT 0
1220 #if N_AXIS >= 7 && !defined(U_LIMIT_BIT)
1222 #define U_LIMIT_BIT (1<<U_LIMIT_PIN)
1224 #define U_LIMIT_BIT 0
1227 #if N_AXIS == 8 && !defined(V_LIMIT_BIT)
1229 #define V_LIMIT_BIT (1<<V_LIMIT_PIN)
1231 #define V_LIMIT_BIT 0
1236 #define LIMIT_MASK_BASE (X_LIMIT_BIT|Y_LIMIT_BIT|LIMIT2_MASK)
1237 #define LIMIT_MASK_BASE_SUM (X_LIMIT_BIT+Y_LIMIT_BIT+LIMIT2_MASK_SUM)
1239 #define LIMIT_MASK_BASE (X_LIMIT_BIT|Y_LIMIT_BIT|Z_LIMIT_BIT|X_LIMIT_BIT_MAX|Y_LIMIT_BIT_MAX|Z_LIMIT_BIT_MAX|LIMIT2_MASK)
1240 #define LIMIT_MASK_BASE_SUM (X_LIMIT_BIT+Y_LIMIT_BIT+Z_LIMIT_BIT+X_LIMIT_BIT_MAX+Y_LIMIT_BIT_MAX+Z_LIMIT_BIT_MAX+LIMIT2_MASK_SUM)
1244 #define LIMIT_MASK LIMIT_MASK_BASE
1245 #define LIMIT_MASK_SUM LIMIT_MASK_BASE_SUM
1246 #define LIMIT_MIN_CAP AXES_BITMASK
1248 #define LIMIT_MASK (LIMIT_MASK_BASE|A_LIMIT_BIT)
1249 #define LIMIT_MASK_SUM (LIMIT_MASK_BASE_SUM+A_LIMIT_BIT)
1251 #define LIMIT_MASK (LIMIT_MASK_BASE|A_LIMIT_BIT|B_LIMIT_BIT)
1252 #define LIMIT_MASK_SUM (LIMIT_MASK_BASE_SUM+A_LIMIT_BIT+B_LIMIT_BIT)
1254 #define LIMIT_MASK (LIMIT_MASK_BASE|A_LIMIT_BIT|B_LIMIT_BIT|C_LIMIT_BIT)
1255 #define LIMIT_MASK_SUM (LIMIT_MASK_BASE_SUM+A_LIMIT_BIT+B_LIMIT_BIT+C_LIMIT_BIT)
1257 #define LIMIT_MASK (LIMIT_MASK_BASE|A_LIMIT_BIT|B_LIMIT_BIT|C_LIMIT_BIT|U_LIMIT_BIT)
1258 #define LIMIT_MASK_SUM (LIMIT_MASK_BASE_SUM+A_LIMIT_BIT+B_LIMIT_BIT+C_LIMIT_BIT+U_LIMIT_BIT)
1260 #define LIMIT_MASK (LIMIT_MASK_BASE|A_LIMIT_BIT|B_LIMIT_BIT|C_LIMIT_BIT|U_LIMIT_BIT|V_LIMIT_BIT)
1261 #define LIMIT_MASK_SUM (LIMIT_MASK_BASE_SUM+A_LIMIT_BIT+B_LIMIT_BIT+C_LIMIT_BIT+U_LIMIT_BIT+V_LIMIT_BIT)
1278 else switch (motor.
id) {
#define N_AXIS
Defines number of axes supported - minimum 3, maximum 8. If more than 3 axes are configured a complia...
Definition: config.h:42
void(* motor_iterator_callback_ptr)(motor_map_t motor)
Signature of the callback function to receive motor vs. axis mappings.
Definition: hal.h:221
#define N_GANGED
Definition: motor_pins.h:1267
#define X_AXIS
Definition: nuts_bolts.h:73
#define Z_AXIS
Definition: nuts_bolts.h:75
#define On
Definition: nuts_bolts.h:36
#define Y_AXIS
Definition: nuts_bolts.h:74
Home switches struct, consists of two packed axes_signals_t structs.
Definition: nuts_bolts.h:165
axes_signals_t a
Primary home switches status, optional. Limit signals are used for homing if not available.
Definition: nuts_bolts.h:166
axes_signals_t b
Secondary home switch(es) status, required for auto squaring enabled axes if primary switches are ava...
Definition: nuts_bolts.h:167
Limit switches struct, consists of four packed axes_signals_t structs in 32 bits.
Definition: nuts_bolts.h:157
axes_signals_t min
Min limit switches status, required.
Definition: nuts_bolts.h:158
axes_signals_t min2
Secondary min limit switch(es) status, required for auto squaring enabled axes.
Definition: nuts_bolts.h:160
axes_signals_t max
Max limit switches status, optional.
Definition: nuts_bolts.h:159
uint8_t u
Definition: nuts_bolts.h:141
uint8_t x
Definition: nuts_bolts.h:135
uint8_t y
Definition: nuts_bolts.h:136
uint8_t c
Definition: nuts_bolts.h:140
uint8_t b
Definition: nuts_bolts.h:139
uint8_t v
Definition: nuts_bolts.h:142
uint8_t z
Definition: nuts_bolts.h:137
uint8_t a
Definition: nuts_bolts.h:138
Motor vs. axis mapping NOTE: id and axis values are equal for primary motors, unequal for secondary (...
Definition: hal.h:210
uint32_t axis
Definition: hal.h:214
uint32_t id
Definition: hal.h:213