grblHAL core  20241107
motor_pins.h
Go to the documentation of this file.
1 /*
2  motor_pins.h - pin mappings resolver for ganged/squared/ABC axes
3 
4  NOTE: This file is not used by the core, it may be used by drivers to simplify board map files
5 
6  Part of grblHAL
7 
8  Copyright (c) 2021-2024 Terje Io
9 
10  grblHAL is free software: you can redistribute it and/or modify
11  it under the terms of the GNU General Public License as published by
12  the Free Software Foundation, either version 3 of the License, or
13  (at your option) any later version.
14 
15  grblHAL is distributed in the hope that it will be useful,
16  but WITHOUT ANY WARRANTY; without even the implied warranty of
17  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18  GNU General Public License for more details.
19 
20  You should have received a copy of the GNU General Public License
21  along with grblHAL. If not, see <http://www.gnu.org/licenses/>.
22 */
23 
24 #pragma once
25 
26 #if N_GANGED
27 
28 #if N_GANGED > N_ABC_MOTORS
29 #error "Axis configuration is not supported!"
30 #endif
31 
32 #if N_AUTO_SQUARED
33 #define SQUARING_ENABLED
34 #endif
35 
36 #if N_GANGED
37 #define GANGING_ENABLED
38 #endif
39 
40 #if Z_GANGED
41 #define Z_DOUBLED N_ABC_MOTORS
42 #elif Y_GANGED
43 #define Y_DOUBLED N_ABC_MOTORS
44 #elif X_GANGED
45 #define X_DOUBLED N_ABC_MOTORS
46 #endif
47 
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)
52 #endif
53 
54 #if X_GANGED && !defined(X_DOUBLED)
55 #define X_DOUBLED (N_ABC_MOTORS - 2)
56 #endif
57 
58 #if X_DOUBLED == 1
59 
60 #ifdef A_AXIS
61 #error "A-axis motor is used for ganged X motor"
62 #endif
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)
69 #ifdef M3_HOME_PIN
70  #if X_AUTO_SQUARE
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)
74  #endif
75 #elif X_AUTO_SQUARE && defined(X_HOME_PIN)
76  #error "Auto squared X-axis requires second home pin input"
77 #endif
78 #ifdef M3_LIMIT_PIN
79  #if X_AUTO_SQUARE
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)
87  #endif
88 #elif X_AUTO_SQUARE
89  #error "Auto squared X-axis requires second limit pin input"
90 #endif
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)
95 #endif
96 #ifdef M3_ENABLE_PIN
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)
100 #endif
101 
102 #elif X_DOUBLED == 2
103 
104 #ifdef B_AXIS
105 #error "B-axis motor is used for ganged X motor"
106 #endif
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)
113 #ifdef M4_HOME_PIN
114  #if X_AUTO_SQUARE
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)
118  #endif
119 #elif X_AUTO_SQUARE && defined(X_HOME_PIN)
120  #error "Auto squared X-axis requires second home pin input"
121 #endif
122 #ifdef M4_LIMIT_PIN
123  #if X_AUTO_SQUARE
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)
131  #endif
132 #elif X_AUTO_SQUARE
133  #error "Auto squared X-axis requires second limit pin input"
134 #endif
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)
139 #endif
140 #ifdef M4_ENABLE_PIN
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)
144 #endif
145 
146 #elif X_DOUBLED == 3
147 
148 #ifdef C_AXIS
149 #error "C-axis motor is used for ganged X motor"
150 #endif
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)
157 #ifdef M5_HOME_PIN
158  #if X_AUTO_SQUARE
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)
162  #endif
163 #elif X_AUTO_SQUARE && defined(X_HOME_PIN)
164  #error "Auto squared X-axis requires second home pin input"
165 #endif
166 #ifdef M5_LIMIT_PIN
167  #if X_AUTO_SQUARE
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)
175  #endif
176 #elif X_AUTO_SQUARE
177  #error "Auto squared X-axis requires second limit pin input"
178 #endif
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)
183 #endif
184 #ifdef M5_ENABLE_PIN
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)
188 #endif
189 
190 #elif X_DOUBLED == 4
191 
192 #ifdef U_AXIS
193 #error "U-axis motor is used for ganged X motor"
194 #endif
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)
201 #ifdef M6_HOME_PIN
202  #if X_AUTO_SQUARE
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)
206  #endif
207 #elif X_AUTO_SQUARE && defined(X_HOME_PIN)
208  #error "Auto squared X-axis requires second home pin input"
209 #endif
210 #ifdef M6_LIMIT_PIN
211  #if X_AUTO_SQUARE
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)
219  #endif
220 #elif X_AUTO_SQUARE
221  #error "Auto squared X-axis requires second limit pin input"
222 #endif
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)
227 #endif
228 #ifdef M6_ENABLE_PIN
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)
232 #endif
233 
234 #elif X_DOUBLED == 5
235 
236 #ifdef V_AXIS
237 #error "V-axis motor is used for ganged X motor"
238 #endif
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)
245 #ifdef M7_HOME_PIN
246  #if X_AUTO_SQUARE
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)
250  #endif
251 #elif X_AUTO_SQUARE && defined(X_HOME_PIN)
252  #error "Auto squared X-axis requires second home pin input"
253 #endif
254 #ifdef M7_LIMIT_PIN
255  #if X_AUTO_SQUARE
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)
263  #endif
264 #elif X_AUTO_SQUARE
265  #error "Auto squared X-axis requires second limit pin input"
266 #endif
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)
271 #endif
272 #ifdef M7_ENABLE_PIN
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)
276 #endif
277 
278 #endif // X_DOUBLED
279 
280 #if Y_DOUBLED == 1
281 
282 #ifdef A_AXIS
283 #error "A-axis motor is used for ganged Y motor"
284 #endif
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)
291 #ifdef M3_HOME_PIN
292  #if Y_AUTO_SQUARE
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)
296  #endif
297 #elif Y_AUTO_SQUARE && defined(Y_HOME_PIN)
298  #error "Auto squared Y-axis requires second home pin input"
299 #endif
300 #ifdef M3_LIMIT_PIN
301  #if Y_AUTO_SQUARE
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)
309  #endif
310 #elif Y_AUTO_SQUARE
311  #error "Auto squared Y-axis requires second limit pin input"
312 #endif
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)
317 #endif
318 #ifdef M3_ENABLE_PIN
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)
322 #endif
323 
324 #elif Y_DOUBLED == 2
325 
326 #ifdef B_AXIS
327 #error "B-axis motor is used for ganged Y motor"
328 #endif
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)
335 #ifdef M4_HOME_PIN
336  #if Y_AUTO_SQUARE
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)
340  #endif
341 #elif Y_AUTO_SQUARE && defined(Y_HOME_PIN)
342  #error "Auto squared Y-axis requires second home pin input"
343 #endif
344 #ifdef M4_LIMIT_PIN
345  #if Y_AUTO_SQUARE
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)
353  #endif
354 #elif Y_AUTO_SQUARE
355  #error "Auto squared Y-axis requires second limit pin input"
356 #endif
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)
361 #endif
362 #ifdef M4_ENABLE_PIN
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)
366 #endif
367 
368 #elif Y_DOUBLED == 3
369 
370 #ifdef C_AXIS
371 #error "C-axis motor is used for ganged Y motor"
372 #endif
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)
379 #ifdef M5_HOME_PIN
380  #if Y_AUTO_SQUARE
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)
384  #endif
385 #elif Y_AUTO_SQUARE && defined(Y_HOME_PIN)
386  #error "Auto squared Y-axis requires second home pin input"
387 #endif
388 #ifdef M5_LIMIT_PIN
389  #if Y_AUTO_SQUARE
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)
397  #endif
398 #elif Y_AUTO_SQUARE
399  #error "Auto squared Y-axis requires second limit pin input"
400 #endif
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)
405 #endif
406 #ifdef M5_ENABLE_PIN
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)
410 #endif
411 
412 #elif Y_DOUBLED == 4
413 
414 #ifdef U_AXIS
415 #error "U-axis motor is used for ganged Y motor"
416 #endif
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)
423 #ifdef M6_HOME_PIN
424  #if Y_AUTO_SQUARE
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)
428  #endif
429 #elif Y_AUTO_SQUARE && defined(Y_HOME_PIN)
430  #error "Auto squared Y-axis requires second home pin input"
431 #endif
432 #ifdef M6_LIMIT_PIN
433  #if Y_AUTO_SQUARE
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)
441  #endif
442 #elif Y_AUTO_SQUARE
443  #error "Auto squared Y-axis requires second limit pin input"
444 #endif
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)
449 #endif
450 #ifdef M6_ENABLE_PIN
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)
454 #endif
455 
456 #elif Y_DOUBLED == 5
457 
458 #ifdef V_AXIS
459 #error "V-axis motor is used for ganged Y motor"
460 #endif
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)
467 #ifdef M7_HOME_PIN
468  #if Y_AUTO_SQUARE
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)
472  #endif
473 #elif Y_AUTO_SQUARE && defined(Y_HOME_PIN)
474  #error "Auto squared Y-axis requires second home pin input"
475 #endif
476 #ifdef M7_LIMIT_PIN
477  #if Y_AUTO_SQUARE
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)
485  #endif
486 #elif Y_AUTO_SQUARE
487  #error "Auto squared Y-axis requires second limit pin input"
488 #endif
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)
493 #endif
494 #ifdef M7_ENABLE_PIN
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)
498 #endif
499 
500 #endif // Y_DOUBLED
501 
502 #if Z_DOUBLED == 1
503 
504 #ifdef A_AZIS
505 #error "A-axis motor is used for ganged Z motor"
506 #endif
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)
513 #ifdef M3_HOME_PIN
514  #if Z_AUTO_SQUARE
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)
518  #endif
519 #elif Z_AUTO_SQUARE && defined(Y_HOME_PIN)
520  #error "Auto squared Z-axis requires second home pin input"
521 #endif
522 #ifdef M3_LIMIT_PIN
523  #if Z_AUTO_SQUARE
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)
531  #endif
532 #elif Z_AUTO_SQUARE
533  #error "Auto squared Z-axis requires second limit pin input"
534 #endif
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)
539 #endif
540 #ifdef M3_ENABLE_PIN
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)
544 #endif
545 
546 #elif Z_DOUBLED == 2
547 
548 #ifdef B_AZIS
549 #error "B-axis motor is used for ganged Z motor"
550 #endif
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)
557 #ifdef M4_HOME_PIN
558  #if Z_AUTO_SQUARE
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)
562  #endif
563 #elif Z_AUTO_SQUARE && defined(Z_HOME_PIN)
564  #error "Auto squared Z-axis requires second home pin input"
565 #endif
566 #ifdef M4_LIMIT_PIN
567  #if Z_AUTO_SQUARE
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)
575  #endif
576 #elif Z_AUTO_SQUARE
577  #error "Auto squared Z-axis requires second limit pin input"
578 #endif
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)
583 #endif
584 #ifdef M4_ENABLE_PIN
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)
588 #endif
589 
590 #elif Z_DOUBLED == 3
591 
592 #ifdef C_AZIS
593 #error "C-axis motor is used for ganged Z motor"
594 #endif
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)
601 #ifdef M5_HOME_PIN
602  #if Z_AUTO_SQUARE
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)
606  #endif
607 #elif Z_AUTO_SQUARE && defined(Z_HOME_PIN)
608  #error "Auto squared Z-axis requires second home pin input"
609 #endif
610 #ifdef M5_LIMIT_PIN
611  #if Z_AUTO_SQUARE
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)
619  #endif
620 #elif Z_AUTO_SQUARE
621  #error "Auto squared Z-axis requires second limit pin input"
622 #endif
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)
627 #endif
628 #ifdef M5_ENABLE_PIN
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)
632 #endif
633 
634 #elif Z_DOUBLED == 4
635 
636 #ifdef U_AZIS
637 #error "U-axis motor is used for ganged Z motor"
638 #endif
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)
645 #ifdef M6_HOME_PIN
646  #if Z_AUTO_SQUARE
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)
650  #endif
651 #elif Z_AUTO_SQUARE && defined(Z_HOME_PIN)
652  #error "Auto squared Z-axis requires second home pin input"
653 #endif
654 #ifdef M6_LIMIT_PIN
655  #if Z_AUTO_SQUARE
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)
663  #endif
664 #elif Z_AUTO_SQUARE
665  #error "Auto squared Z-axis requires second limit pin input"
666 #endif
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)
671 #endif
672 #ifdef M6_ENABLE_PIN
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)
676 #endif
677 
678 #elif Z_DOUBLED == 5
679 
680 #ifdef V_AZIS
681 #error "V-axis motor is used for ganged Z motor"
682 #endif
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)
689 #ifdef M7_HOME_PIN
690  #if Z_AUTO_SQUARE
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)
694  #endif
695 #elif Z_AUTO_SQUARE && defined(Z_HOME_PIN)
696  #error "Auto squared Z-axis requires second home pin input"
697 #endif
698 #ifdef M7_LIMIT_PIN
699  #if Z_AUTO_SQUARE
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)
707  #endif
708 #elif Z_AUTO_SQUARE
709  #error "Auto squared Z-axis requires second limit pin input"
710 #endif
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)
715 #endif
716 #ifdef M7_ENABLE_PIN
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)
720 #endif
721 #endif // Z_DOUBLED
722 
723 #ifdef X_DOUBLED
724 #define X2_MOTOR (X_DOUBLED + 2)
725 #endif
726 #ifdef Y_DOUBLED
727 #define Y2_MOTOR (Y_DOUBLED + 2)
728 #endif
729 #ifdef Z_DOUBLED
730 #define Z2_MOTOR (Z_DOUBLED + 2)
731 #endif
732 
733 #endif // N_GANGED
734 
735 #if defined(X2_HOME_PIN) || defined(Y2_HOME_PIN) || defined(Z2_HOME_PIN)
736 #define DUAL_HOME_SWITCHES
737 #ifndef X2_HOME_BIT
738 #define X2_HOME_BIT 0
739 #endif
740 #ifndef Y2_HOME_BIT
741 #define Y2_HOME_BIT 0
742 #endif
743 #ifndef Z2_HOME_BIT
744 #define Z2_HOME_BIT 0
745 #endif
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)
748 #else
749 #define HOME2_MASK 0
750 #define HOME2_MASK_SUM 0
751 #endif
752 
753 #if defined(X2_LIMIT_PIN) || defined(Y2_LIMIT_PIN) || defined(Z2_LIMIT_PIN)
754 #define DUAL_LIMIT_SWITCHES
755 #ifndef X2_LIMIT_BIT
756 #define X2_LIMIT_BIT 0
757 #endif
758 #ifndef Y2_LIMIT_BIT
759 #define Y2_LIMIT_BIT 0
760 #endif
761 #ifndef Z2_LIMIT_BIT
762 #define Z2_LIMIT_BIT 0
763 #endif
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)
766 #else
767 #define LIMIT2_MASK 0
768 #define LIMIT2_MASK_SUM 0
769 #endif
770 
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
773 #endif
774 
775 #ifdef A_AXIS
776 #ifndef M3_AVAILABLE
777  #error "A_AXIS pins are not available"
778 #endif
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)
785 #ifdef M3_HOME_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)
789 #endif
790 #ifdef M3_LIMIT_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)
794 #endif
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)
799 #endif
800 #ifdef M3_ENABLE_PIN
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)
804 #endif
805 #endif
806 
807 #ifdef B_AXIS
808 #ifndef M4_AVAILABLE
809  #error "B_AXIS pins are not available"
810 #endif
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)
817 #ifdef M4_HOME_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)
821 #endif
822 #ifdef M4_LIMIT_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)
826 #endif
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)
831 #endif
832 #ifdef M4_ENABLE_PIN
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)
836 #endif
837 #endif
838 
839 #ifdef C_AXIS
840 #ifndef M5_AVAILABLE
841  #error "C_AXIS pins are not available"
842 #endif
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)
849 #ifdef M5_HOME_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)
853 #endif
854 #ifdef M5_LIMIT_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)
858 #endif
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)
863 #endif
864 #ifdef M5_ENABLE_PIN
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)
868 #endif
869 #endif
870 
871 #ifdef U_AXIS
872 #ifndef M6_AVAILABLE
873  #error "U_AXIS pins are not available"
874 #endif
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)
881 #ifdef M6_HOME_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)
885 #endif
886 #ifdef M6_LIMIT_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)
890 #endif
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)
895 #endif
896 #ifdef M6_ENABLE_PIN
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)
900 #endif
901 #endif
902 
903 #ifdef V_AXIS
904 #ifndef M7_AVAILABLE
905  #error "V_AXIS pins are not available"
906 #endif
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)
913 #ifdef M7_HOME_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)
917 #endif
918 #ifdef M7_LIMIT_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)
922 #endif
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)
927 #endif
928 #ifdef M7_ENABLE_PIN
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)
932 #endif
933 #endif
934 
935 
936 #ifdef STEP_PORT
937 #ifndef X_STEP_PORT
938 #define X_STEP_PORT STEP_PORT
939 #endif
940 #ifndef Y_STEP_PORT
941 #define Y_STEP_PORT STEP_PORT
942 #endif
943 #ifndef Z_STEP_PORT
944 #define Z_STEP_PORT STEP_PORT
945 #endif
946 #if defined(A_AXIS) && !defined(A_STEP_PORT)
947 #define A_STEP_PORT STEP_PORT
948 #endif
949 #if defined(B_AXIS) && !defined(B_STEP_PORT)
950 #define B_STEP_PORT STEP_PORT
951 #endif
952 #if defined(C_AXIS) && !defined(C_STEP_PORT)
953 #define C_STEP_PORT STEP_PORT
954 #endif
955 #if defined(U_AXIS) && !defined(U_STEP_PORT)
956 #define U_STEP_PORT STEP_PORT
957 #endif
958 #if defined(V_AXIS) && !defined(V_STEP_PORT)
959 #define V_STEP_PORT STEP_PORT
960 #endif
961 #endif
962 
963 #ifndef X_STEP_BIT
964 #define X_STEP_BIT (1<<X_STEP_PIN)
965 #endif
966 #ifndef Y_STEP_BIT
967 #define Y_STEP_BIT (1<<Y_STEP_PIN)
968 #endif
969 #ifndef Z_STEP_BIT
970 #define Z_STEP_BIT (1<<Z_STEP_PIN)
971 #endif
972 
973 #ifdef DIRECTION_PORT
974 #ifndef X_DIRECTION_PORT
975 #define X_DIRECTION_PORT DIRECTION_PORT
976 #endif
977 #ifndef Y_DIRECTION_PORT
978 #define Y_DIRECTION_PORT DIRECTION_PORT
979 #endif
980 #ifndef Z_DIRECTION_PORT
981 #define Z_DIRECTION_PORT DIRECTION_PORT
982 #endif
983 #if defined(A_AXIS) && !defined(A_DIRECTION_PORT)
984 #define A_DIRECTION_PORT DIRECTION_PORT
985 #endif
986 #if defined(B_AXIS) && !defined(B_DIRECTION_PORT)
987 #define B_DIRECTION_PORT DIRECTION_PORT
988 #endif
989 #if defined(C_AXIS) && !defined(B_DIRECTION_PORT)
990 #define C_DIRECTION_PORT DIRECTION_PORT
991 #endif
992 #if defined(U_AXIS) && !defined(U_DIRECTION_PORT)
993 #define U_DIRECTION_PORT DIRECTION_PORT
994 #endif
995 #if defined(V_AXIS) && !defined(V_DIRECTION_PORT)
996 #define V_DIRECTION_PORT DIRECTION_PORT
997 #endif
998 #endif
999 
1000 #ifndef X_DIRECTION_BIT
1001 #define X_DIRECTION_BIT (1<<X_DIRECTION_PIN)
1002 #endif
1003 #ifndef Y_DIRECTION_BIT
1004 #define Y_DIRECTION_BIT (1<<Y_DIRECTION_PIN)
1005 #endif
1006 #ifndef Z_DIRECTION_BIT
1007 #define Z_DIRECTION_BIT (1<<Z_DIRECTION_PIN)
1008 #endif
1009 
1010 #ifdef LIMIT_PORT
1011 #ifndef X_LIMIT_PORT
1012 #define X_LIMIT_PORT LIMIT_PORT
1013 #endif
1014 #ifndef Y_LIMIT_PORT
1015 #define Y_LIMIT_PORT LIMIT_PORT
1016 #endif
1017 #ifndef Z_LIMIT_PORT
1018 #define Z_LIMIT_PORT LIMIT_PORT
1019 #endif
1020 #if defined(A_AXIS) && !defined(A_LIMIT_PORT)
1021 #define A_LIMIT_PORT LIMIT_PORT
1022 #endif
1023 #if defined(B_AXIS) && !defined(B_LIMIT_PORT)
1024 #define B_LIMIT_PORT LIMIT_PORT
1025 #endif
1026 #if defined(C_AXIS) && !defined(C_LIMIT_PORT)
1027 #define C_LIMIT_PORT LIMIT_PORT
1028 #endif
1029 #if defined(U_AXIS) && !defined(U_LIMIT_PORT)
1030 #define U_LIMIT_PORT LIMIT_PORT
1031 #endif
1032 #if defined(V_AXIS) && !defined(V_LIMIT_PORT)
1033 #define V_LIMIT_PORT LIMIT_PORT
1034 #endif
1035 #endif
1036 
1037 #ifndef X_HOME_BIT
1038 #ifdef X_HOME_PIN
1039 #define X_HOME_BIT (1<<X_HOME_PIN)
1040 #else
1041 #define X_HOME_BIT 0
1042 #endif
1043 #endif
1044 #ifndef Y_HOME_BIT
1045 #ifdef Y_HOME_PIN
1046 #define Y_HOME_BIT (1<<Y_HOME_PIN)
1047 #else
1048 #define Y_HOME_BIT 0
1049 #endif
1050 #endif
1051 #ifndef Z_HOME_BIT
1052 #ifdef Z_HOME_PIN
1053 #define Z_HOME_BIT (1<<Z_HOME_PIN)
1054 #else
1055 #define Z_HOME_BIT 0
1056 #endif
1057 #endif
1058 
1059 #ifndef X_LIMIT_BIT
1060 #define X_LIMIT_BIT (1<<X_LIMIT_PIN)
1061 #endif
1062 #ifndef Y_LIMIT_BIT
1063 #define Y_LIMIT_BIT (1<<Y_LIMIT_PIN)
1064 #endif
1065 #ifndef Z_LIMIT_BIT
1066 #define Z_LIMIT_BIT (1<<Z_LIMIT_PIN)
1067 #endif
1068 #ifndef X_LIMIT_BIT_MAX
1069 #ifdef X_LIMIT_PIN_MAX
1070 #define X_LIMIT_BIT_MAX (1<<X_LIMIT_PIN_MAX)
1071 #else
1072 #define X_LIMIT_BIT_MAX 0
1073 #endif
1074 #endif
1075 #ifndef Y_LIMIT_BIT_MAX
1076 #ifdef Y_LIMIT_PIN_MAX
1077 #define Y_LIMIT_BIT_MAX (1<<Y_LIMIT_PIN_MAX)
1078 #else
1079 #define Y_LIMIT_BIT_MAX 0
1080 #endif
1081 #endif
1082 #ifndef Z_LIMIT_BIT_MAX
1083 #ifdef Z_LIMIT_PIN_MAX
1084 #define Z_LIMIT_BIT_MAX (1<<Z_LIMIT_PIN_MAX)
1085 #else
1086 #define Z_LIMIT_BIT_MAX 0
1087 #endif
1088 #endif
1089 
1090 #if !defined(X_ENABLE_BIT) && defined(X_ENABLE_PIN)
1091 #define X_ENABLE_BIT (1<<X_ENABLE_PIN)
1092 #endif
1093 #if !defined(Y_ENABLE_BIT) && defined(Y_ENABLE_PIN)
1094 #define Y_ENABLE_BIT (1<<Y_ENABLE_PIN)
1095 #endif
1096 #if !defined(Z_ENABLE_BIT) && defined(Z_ENABLE_PIN)
1097 #define Z_ENABLE_BIT (1<<Z_ENABLE_PIN)
1098 #endif
1099 
1100 #ifndef STEP_MASK
1101 #if N_AXIS == 3
1102 #define STEP_MASK (X_STEP_BIT|Y_STEP_BIT|Z_STEP_BIT)
1103 #elif N_AXIS == 4
1104 #define STEP_MASK (X_STEP_BIT|Y_STEP_BIT|Z_STEP_BIT|A_STEP_BIT)
1105 #elif N_AXIS == 5
1106 #define STEP_MASK (X_STEP_BIT|Y_STEP_BIT|Z_STEP_BIT|A_STEP_BIT|B_STEP_BIT)
1107 #elif N_AXIS == 6
1108 #define STEP_MASK (X_STEP_BIT|Y_STEP_BIT|Z_STEP_BIT|A_STEP_BIT|B_STEP_BIT|C_STEP_BIT)
1109 #elif N_AXIS == 7
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)
1111 #else
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)
1113 #endif
1114 #endif
1115 
1116 #ifndef DIRECTION_MASK
1117 #if N_AXIS == 3
1118 #define DIRECTION_MASK (X_DIRECTION_BIT|Y_DIRECTION_BIT|Z_DIRECTION_BIT)
1119 #elif N_AXIS == 4
1120 #define DIRECTION_MASK (X_DIRECTION_BIT|Y_DIRECTION_BIT|Z_DIRECTION_BIT|A_DIRECTION_BIT)
1121 #elif N_AXIS == 5
1122 #define DIRECTION_MASK (X_DIRECTION_BIT|Y_DIRECTION_BIT|Z_DIRECTION_BIT|A_DIRECTION_BIT|B_DIRECTION_BIT)
1123 #elif N_AXIS == 6
1124 #define DIRECTION_MASK (X_DIRECTION_BIT|Y_DIRECTION_BIT|Z_DIRECTION_BIT|A_DIRECTION_BIT|B_DIRECTION_BIT|C_DIRECTION_BIT)
1125 #elif N_AXIS == 7
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)
1127 #else
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)
1129 #endif
1130 #endif
1131 
1132 #if defined(STEPPERS_ENABLE_PIN) && !defined(STEPPERS_ENABLE_BIT)
1133 #define STEPPERS_ENABLE_BIT (1<<STEPPERS_ENABLE_PIN)
1134 #endif
1135 
1136 #ifndef STEPPERS_ENABLE_MASK
1137 
1138 #ifdef STEPPERS_ENABLE_BIT
1139 #define STEPPERS_ENABLE_MASK STEPPERS_ENABLE_BIT
1140 #else
1141 
1142 #if N_AXIS >= 4 && !defined(A_ENABLE_BIT)
1143 #define A_ENABLE_BIT 0
1144 #endif
1145 #if N_AXIS >= 5 && !defined(B_ENABLE_BIT)
1146 #define B_ENABLE_BIT 0
1147 #endif
1148 #if N_AXIS >= 6 && !defined(C_ENABLE_BIT)
1149 #define C_ENABLE_BIT 0
1150 #endif
1151 
1152 #if N_AXIS == 3
1153 #define STEPPERS_ENABLE_MASK (X_ENABLE_BIT|Y_ENABLE_BIT|Z_ENABLE_BIT)
1154 #elif N_AXIS == 4
1155 #define STEPPERS_ENABLE_MASK (X_ENABLE_BIT|Y_ENABLE_BIT|Z_ENABLE_BIT|A_ENABLE_BIT)
1156 #elif N_AXIS == 5
1157 #define STEPPERS_ENABLE_MASK (X_ENABLE_BIT|Y_ENABLE_BIT|Z_ENABLE_BIT|A_ENABLE_BIT|B_ENABLE_BIT)
1158 #elif N_AXIS == 6
1159 #define STEPPERS_ENABLE_MASK (X_ENABLE_BIT|Y_ENABLE_BIT|Z_ENABLE_BIT|A_ENABLE_BIT|B_ENABLE_BIT|C_ENABLE_BIT)
1160 #elif N_AXIS == 7
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)
1162 #else
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)
1164 #endif
1165 #endif
1166 
1167 #endif // STEPPERS_ENABLE_MASK
1168 
1169 #ifndef HOME_MASK
1170 
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)
1173 
1174 #if N_AXIS == 3
1175 #define HOME_MASK HOME_MASK_BASE
1176 #define HOME_MASK_SUM HOME_MASK_BASE_SUM
1177 #define HOME_MIN_CAP AXES_BITMASK
1178 #elif N_AXIS == 4
1179 #define HOME_MASK (HOME_MASK_BASE|A_HOME_BIT)
1180 #define HOME_MASK_SUM (HOME_MASK_BASE_SUM+A_HOME_BIT)
1181 #elif N_AXIS == 5
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)
1184 #elif N_AXIS == 6
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)
1187 #elif N_AXIS == 7
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)
1190 #else
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)
1193 #endif
1194 
1195 #endif // HOME_MASK
1196 
1197 #ifndef LIMIT_MASK
1198 
1199 #if N_AXIS >=4 && !defined(A_LIMIT_BIT)
1200 #ifdef A_LIMIT_PIN
1201 #define A_LIMIT_BIT (1<<A_LIMIT_PIN)
1202 #else
1203 #define A_LIMIT_BIT 0
1204 #endif
1205 #endif
1206 #if N_AXIS >=5 && !defined(B_LIMIT_BIT)
1207 #ifdef B_LIMIT_PIN
1208 #define B_LIMIT_BIT (1<<B_LIMIT_PIN)
1209 #else
1210 #define B_LIMIT_BIT 0
1211 #endif
1212 #endif
1213 #if N_AXIS >= 6 && !defined(C_LIMIT_BIT)
1214 #ifdef C_LIMIT_PIN
1215 #define C_LIMIT_BIT (1<<C_LIMIT_PIN)
1216 #else
1217 #define C_LIMIT_BIT 0
1218 #endif
1219 #endif
1220 #if N_AXIS >= 7 && !defined(U_LIMIT_BIT)
1221 #ifdef U_LIMIT_PIN
1222 #define U_LIMIT_BIT (1<<U_LIMIT_PIN)
1223 #else
1224 #define U_LIMIT_BIT 0
1225 #endif
1226 #endif
1227 #if N_AXIS == 8 && !defined(V_LIMIT_BIT)
1228 #ifdef V_LIMIT_PIN
1229 #define V_LIMIT_BIT (1<<V_LIMIT_PIN)
1230 #else
1231 #define V_LIMIT_BIT 0
1232 #endif
1233 #endif
1234 
1235 #ifdef Z_LIMIT_POLL
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)
1238 #else
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)
1241 #endif
1242 
1243 #if N_AXIS == 3
1244 #define LIMIT_MASK LIMIT_MASK_BASE
1245 #define LIMIT_MASK_SUM LIMIT_MASK_BASE_SUM
1246 #define LIMIT_MIN_CAP AXES_BITMASK
1247 #elif N_AXIS == 4
1248 #define LIMIT_MASK (LIMIT_MASK_BASE|A_LIMIT_BIT)
1249 #define LIMIT_MASK_SUM (LIMIT_MASK_BASE_SUM+A_LIMIT_BIT)
1250 #elif N_AXIS == 5
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)
1253 #elif N_AXIS == 6
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)
1256 #elif N_AXIS == 7
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)
1259 #else
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)
1262 #endif
1263 
1264 #endif // LIMIT_MASK
1265 
1266 #ifndef N_GANGED
1267 #define N_GANGED 0
1268 #endif
1269 
1270 static void motor_iterator (motor_iterator_callback_ptr callback)
1271 {
1272  motor_map_t motor;
1273 
1274  if(callback) for(motor.id = 0; motor.id < N_AXIS + N_GANGED; motor.id++)
1275  {
1276  if(motor.id < N_AXIS)
1277  motor.axis = motor.id;
1278  else switch (motor.id) {
1279 #ifdef X2_MOTOR
1280  case X2_MOTOR:
1281  motor.axis = X_AXIS;
1282  break;
1283 #endif
1284 #ifdef Y2_MOTOR
1285  case Y2_MOTOR:
1286  motor.axis = Y_AXIS;
1287  break;
1288 #endif
1289 #ifdef Z2_MOTOR
1290  case Z2_MOTOR:
1291  motor.axis = Z_AXIS;
1292  break;
1293 #endif
1294  }
1295  callback(motor);
1296  }
1297 }
1298 
1299 static inline limit_signals_t get_limits_cap (void)
1300 {
1301  limit_signals_t limits = {0};
1302 
1303 #if X_LIMIT_BIT
1304  limits.min.x = On;
1305 #endif
1306 #if Y_LIMIT_BIT
1307  limits.min.y = On;
1308 #endif
1309 #if Z_LIMIT_BIT
1310  limits.min.z = On;
1311 #endif
1312 #if A_LIMIT_BIT
1313  limits.min.a = On;
1314 #endif
1315 #if B_LIMIT_BIT
1316  limits.min.b = On;
1317 #endif
1318 #if C_LIMIT_BIT
1319  limits.min.c = On;
1320 #endif
1321 #if U_LIMIT_BIT
1322  limits.min.u = On;
1323 #endif
1324 #if V_LIMIT_BIT
1325  limits.min.v = On;
1326 #endif
1327 
1328 #if X2_LIMIT_BIT
1329  limits.min2.x = On;
1330 #endif
1331 #if Y2_LIMIT_BIT
1332  limits.min2.y = On;
1333 #endif
1334 #if Z2_LIMIT_BIT
1335  limits.min2.z = On;
1336 #endif
1337 
1338 #if X_LIMIT_BIT_MAX
1339  limits.max.x = On;
1340 #endif
1341 #if Y_LIMIT_BIT_MAX
1342  limits.max.y = On;
1343 #endif
1344 #if Z_LIMIT_BIT_MAX
1345  limits.max.z = On;
1346 #endif
1347 #if A_LIMIT_BIT_MAX
1348  limits.max.a = On;
1349 #endif
1350 #if B_LIMIT_BIT_MAX
1351  limits.max.b = On;
1352 #endif
1353 #if C_LIMIT_BIT_MAX
1354  limits.max.c = On;
1355 #endif
1356 #if U_LIMIT_BIT_MAX
1357  limits.max.u = On;
1358 #endif
1359 #if V_LIMIT_BIT_MAX
1360  limits.max.v = On;
1361 #endif
1362 
1363  return limits;
1364 }
1365 
1366 static inline home_signals_t get_home_cap (void)
1367 {
1368  home_signals_t home = {0};
1369 
1370 #if HOME_MASK
1371 
1372 #if X_HOME_BIT
1373  home.a.x = On;
1374 #endif
1375 #if Y_HOME_BIT
1376  home.a.y = On;
1377 #endif
1378 #if Z_HOME_BIT
1379  home.a.z = On;
1380 #endif
1381 #if A_HOME_BIT
1382  home.a.a = On;
1383 #endif
1384 #if B_HOME_BIT
1385  home.a.b = On;
1386 #endif
1387 #if C_HOME_BIT
1388  home.a.c = On;
1389 #endif
1390 #if U_HOME_BIT
1391  home.a.u = On;
1392 #endif
1393 #if V_HOME_BIT
1394  home.a.v = On;
1395 #endif
1396 
1397 #if X2_HOME_BIT
1398  home.b.x = On;
1399 #endif
1400 #if Y2_HOME_BIT
1401  home.b.y = On;
1402 #endif
1403 #if Z2_HOME_BIT
1404  home.b.z = On;
1405 #endif
1406 
1407 #endif // HOME_MASK
1408 
1409  return home;
1410 }
1411 
1412 /*EOF*/
#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