Go to the documentation of this file.
30 #if (DRIVER_SPINDLE_ENABLE & SPINDLE_ENA) && !defined(SPINDLE_ENABLE_PIN)
31 #warning "Selected spindle is not supported!"
34 #if (DRIVER_SPINDLE_ENABLE & SPINDLE_DIR) && !defined(SPINDLE_DIRECTION_PIN)
35 #warning "Selected spindle is not fully supported - no direction output!"
38 #if (DRIVER_SPINDLE_ENABLE & SPINDLE_PWM) && !defined(SPINDLE_PWM_PIN)
39 #warning "Selected spindle is not supported!"
42 #if (DRIVER_SPINDLE1_ENABLE & SPINDLE_PWM) && !defined(SPINDLE1_PWM_PIN)
43 #warning "Selected spindle 1 is not supported!"
46 #if ENCODER_ENABLE > 0 && !(defined(QEI_A_PIN) && defined(QEI_B_PIN))
47 #warning "ENCODER_ENABLE requires encoder input pins A and B to be defined!"
52 #if MPG_ENABLE == 1 && !defined(MPG_MODE_PIN)
53 #error "MPG_MODE_PIN must be defined!"
56 #if KEYPAD_ENABLE == 1 && !defined(I2C_STROBE_PIN)
57 #error Keypad plugin not supported!
58 #elif I2C_STROBE_ENABLE && !defined(I2C_STROBE_PIN)
59 #error "I2C strobe not supported!"
62 #define DRIVER_PROBES ((PROBE_ENABLE ? 1 : 0) + PROBE2_ENABLE + TOOLSETTER_ENABLE)
64 #ifndef CONTROL_ENABLE
65 #define CONTROL_ENABLE 0
68 #if EEPROM_ENABLE == 0
69 #define FLASH_ENABLE 1
71 #define FLASH_ENABLE 0
79 #if (SDCARD_ENABLE && !SDCARD_SDIO) || TRINAMIC_SPI_ENABLE
86 #if SDCARD_ENABLE && !SDCARD_SDIO && !defined(SD_CS_PIN)
87 #error SD card plugin not supported!
93 #ifdef STEPPERS_ENABLE_PIN
94 #ifndef STEPPERS_ENABLE_PORT
95 #define STEPPERS_ENABLE_PORT ENABLE_PORT
99 #ifndef XY_ENABLE_PORT
100 #define XY_ENABLE_PORT ENABLE_PORT
103 #ifndef X_ENABLE_PORT
104 #define X_ENABLE_PORT ENABLE_PORT
106 #ifndef Y_ENABLE_PORT
107 #define Y_ENABLE_PORT ENABLE_PORT
110 #ifndef Z_ENABLE_PORT
111 #define Z_ENABLE_PORT ENABLE_PORT
113 #if defined(M3_ENABLE_PIN) && !defined(M3_ENABLE_PORT)
114 #define M3_ENABLE_PORT ENABLE_PORT
116 #if defined(M4_ENABLE_PIN) && !defined(M4_ENABLE_PORT)
117 #define M4_ENABLE_PORT ENABLE_PORT
119 #if defined(M5_ENABLE_PIN) && !defined(M5_ENABLE_PORT)
120 #define M5_ENABLE_PORT ENABLE_PORT
122 #if defined(M6_ENABLE_PIN) && !defined(M6_ENABLE_PORT)
123 #define M6_ENABLE_PORT ENABLE_PORT
125 #if defined(M7_ENABLE_PIN) && !defined(M7_ENABLE_PORT)
126 #define M7_ENABLE_PORT ENABLE_PORT
133 #define X_STEP_PORT STEP_PORT
136 #define Y_STEP_PORT STEP_PORT
139 #define Z_STEP_PORT STEP_PORT
141 #if defined(M3_STEP_PIN) && !defined(M3_STEP_PORT)
142 #define M3_STEP_PORT STEP_PORT
144 #if defined(M4_STEP_PIN) && !defined(M4_STEP_PORT)
145 #define M4_STEP_PORT STEP_PORT
147 #if defined(M5_STEP_PIN) && !defined(M5_STEP_PORT)
148 #define M5_STEP_PORT STEP_PORT
150 #if defined(M6_STEP_PIN) && !defined(M6_STEP_PORT)
151 #define M6_STEP_PORT STEP_PORT
153 #if defined(M7_STEP_PIN) && !defined(M7_STEP_PORT)
154 #define M7_STEP_PORT STEP_PORT
158 #ifdef DIRECTION_PORT
159 #ifndef X_DIRECTION_PORT
160 #define X_DIRECTION_PORT DIRECTION_PORT
162 #ifndef Y_DIRECTION_PORT
163 #define Y_DIRECTION_PORT DIRECTION_PORT
165 #ifndef Z_DIRECTION_PORT
166 #define Z_DIRECTION_PORT DIRECTION_PORT
168 #if defined(M3_DIRECTION_PIN) && !defined(M3_DIRECTION_PORT)
169 #define M3_DIRECTION_PORT DIRECTION_PORT
171 #if defined(M4_DIRECTION_PIN) && !defined(M4_DIRECTION_PORT)
172 #define M4_DIRECTION_PORT DIRECTION_PORT
174 #if defined(M5_DIRECTION_PIN) && !defined(M5_DIRECTION_PORT)
175 #define M5_DIRECTION_PORT DIRECTION_PORT
177 #if defined(M6_DIRECTION_PIN) && !defined(M6_DIRECTION_PORT)
178 #define M6_DIRECTION_PORT DIRECTION_PORT
180 #if defined(M7_DIRECTION_PIN) && !defined(M7_DIRECTION_PORT)
181 #define M7_DIRECTION_PORT DIRECTION_PORT
186 #ifndef SPINDLE_ENABLE_PORT
187 #define SPINDLE_ENABLE_PORT SPINDLE_PORT
189 #if defined(SPINDLE_PWM_PIN) && !defined(SPINDLE_PWM_PORT)
190 #define SPINDLE_PWM_PORT SPINDLE_PORT
192 #if defined(SPINDLE_DIRECTION_PIN) && !defined(SPINDLE_DIRECTION_PORT)
193 #define SPINDLE_DIRECTION_PORT SPINDLE_PORT
198 #if defined(COOLANT_FLOOD_PIN) && !defined(COOLANT_FLOOD_PORT)
199 #define COOLANT_FLOOD_PORT COOLANT_PORT
201 #if defined(COOLANT_MIST_PIN) && !defined(COOLANT_MIST_PORT)
202 #define COOLANT_MIST_PORT COOLANT_PORT
210 #include "motors/trinamic.h"
212 #ifndef TRINAMIC_MIXED_DRIVERS
213 #define TRINAMIC_MIXED_DRIVERS 1
216 #if TRINAMIC_UART_ENABLE == 1 && !defined(TRINAMIC_STREAM)
217 #define TRINAMIC_STREAM 1
220 #if TRINAMIC_SPI_ENABLE == 1 || TRINAMIC_ENABLE == 2130 || TRINAMIC_ENABLE == 2660 || TRINAMIC_ENABLE == 5160
222 #undef TRINAMIC_SPI_ENABLE
223 #define TRINAMIC_SPI_40BIT (1<<1)
224 #define TRINAMIC_SPI_20BIT (1<<2)
225 #define TRINAMIC_SPI_CS_SINGLE (1<<3)
227 #if TRINAMIC_ENABLE == 2660
229 #define TRINAMIC_SPI_ENABLE (TRINAMIC_SPI_20BIT|TRINAMIC_SPI_CS_SINGLE)
231 #define TRINAMIC_SPI_ENABLE TRINAMIC_SPI_20BIT
235 #define TRINAMIC_SPI_ENABLE (TRINAMIC_SPI_40BIT|TRINAMIC_SPI_CS_SINGLE)
237 #define TRINAMIC_SPI_ENABLE TRINAMIC_SPI_40BIT
245 #define TRINAMIC_I2C 0
247 #if TRINAMIC_ENABLE && TRINAMIC_I2C
248 #define TRINAMIC_MOTOR_ENABLE 1
250 #define TRINAMIC_MOTOR_ENABLE 0
253 #if MPG_ENABLE && !defined(MPG_STREAM)
259 #if (MODBUS_ENABLE & MODBUS_RTU_ENABLED) && defined(MODBUS_RTU_STREAM) && MODBUS_RTU_STREAM == MPG_STREAM
261 #define MPG_STREAM (MODBUS_RTU_STREAM + 1)
265 #if MPG_ENABLE && MPG_ENABLE != 2 && MPG_STREAM == 20 && BLUETOOTH_ENABLE != 1
266 #error "MPG can only be used with native Bluetooth and character mode switching!"
269 #if BLUETOOTH_ENABLE == 2 && !defined(BLUETOOTH_STREAM)
270 #define BLUETOOTH_STREAM 255
273 #if USB_SERIAL_CDC && defined(SERIAL_PORT)
291 #if MODBUS_ENABLE & MODBUS_RTU_ENABLED
292 #define MODBUS_TEST 1
294 #define MODBUS_TEST 0
297 #if TRINAMIC_ENABLE && TRINAMIC_UART_ENABLE == 1
298 #define TRINAMIC_TEST 1
300 #define TRINAMIC_TEST 0
303 #if MPG_ENABLE && MPG_STREAM != 20
309 #if KEYPAD_ENABLE == 2 && !MPG_TEST
310 #define KEYPAD_TEST 1
312 #define KEYPAD_TEST 0
315 #if BLUETOOTH_ENABLE == 2 && (!MPG_ENABLE || MPG_STREAM != BLUETOOTH_STREAM)
321 #if (MODBUS_TEST + KEYPAD_TEST + MPG_TEST + TRINAMIC_TEST + BT_TEST) > (SP0 + SP1 + SP2)
322 #error "Too many options that requires a serial port are enabled!"
334 #if KEYPAD_ENABLE == 2 && !defined(KEYPAD_STREAM)
336 #define KEYPAD_STREAM MPG_STREAM
338 #define KEYPAD_STREAM 0
340 #define KEYPAD_STREAM 1
342 #if (MODBUS_ENABLE & MODBUS_RTU_ENABLED) && defined(MODBUS_RTU_STREAM) && MODBUS_RTU_STREAM == MPG_STREAM
344 #define KEYPAD_STREAM (MODBUS_RTU_STREAM + 1)
348 #if defined(COPROC_RESET_PIN) && defined(COPROC_BOOT0_PIN)
349 #define COPROC_PASSTHRU 1
351 #define COPROC_PASSTHRU 0
354 #ifndef COPROC_STREAM
356 #define COPROC_STREAM 0
358 #define COPROC_STREAM 1