|
@@ -88,40 +88,168 @@
|
88
|
88
|
* Serial3 | P0_00 | P0_01 |
|
89
|
89
|
*/
|
90
|
90
|
#if (defined(SERIAL_PORT) && SERIAL_PORT == 0) || (defined(SERIAL_PORT_2) && SERIAL_PORT_2 == 0) || (defined(DGUS_SERIAL_PORT) && DGUS_SERIAL_PORT == 0)
|
91
|
|
- #if X_CS_PIN == P0_02 || TMC_SW_MISO == P0_02 || (E_STEPPERS && E_MUX1_PIN == P0_02) \
|
92
|
|
- || Y_CS_PIN == P0_03 || TMC_SW_MOSI == P0_03 || (E_STEPPERS && E_MUX0_PIN == P0_03)
|
93
|
|
- #error "Serial port assignment (0) conflicts with other pins!"
|
|
91
|
+ #define IS_TX0(P) (P == P0_02)
|
|
92
|
+ #define IS_RX0(P) (P == P0_03)
|
|
93
|
+ #if IS_TX0(TMC_SW_MISO) || IS_RX0(TMC_SW_MOSI)
|
|
94
|
+ #error "Serial port pins (0) conflict with Trinamic SPI pins!"
|
|
95
|
+ #elif ENABLED(MK2_MULTIPLEXER) && (IS_TX0(E_MUX1_PIN) || IS_RX0(E_MUX0_PIN))
|
|
96
|
+ #error "Serial port pins (0) conflict with MK2 multiplexer pins!"
|
|
97
|
+ #elif (AXIS_HAS_SPI(X) && IS_TX0(X_CS_PIN)) || (AXIS_HAS_SPI(Y) && IS_RX0(Y_CS_PIN))
|
|
98
|
+ #error "Serial port pins (0) conflict with X/Y axis SPI pins!"
|
94
|
99
|
#endif
|
|
100
|
+ #undef IS_TX0
|
|
101
|
+ #undef IS_RX0
|
95
|
102
|
#endif
|
96
|
103
|
|
97
|
104
|
#if SERIAL_PORT == 1 || SERIAL_PORT_2 == 1 || DGUS_SERIAL_PORT == 1
|
98
|
|
- #if TMC_SW_SCK == P0_15
|
99
|
|
- #error "Serial port assignment (1) conflicts with other pins!"
|
|
105
|
+ #define IS_TX1(P) (P == P0_15)
|
|
106
|
+ #define IS_RX1(P) (P == P0_16)
|
|
107
|
+ #if IS_TX1(TMC_SW_SCK)
|
|
108
|
+ #error "Serial port pins (1) conflict with other pins!"
|
100
|
109
|
#elif HAS_SPI_LCD
|
101
|
|
- #if BTN_EN2 == P0_15 || SCK_PIN == P0_15 || LCD_PINS_D4 == P0_15 || DOGLCD_SCK == P0_15 || LCD_RESET_PIN == P0_15 || LCD_PINS_RS == P0_15 || SHIFT_CLK == P0_15 \
|
102
|
|
- || BTN_EN1 == P0_16 || LCD_SDSS == P0_16 || LCD_PINS_RS == P0_16 || MISO_PIN == P0_16 || DOGLCD_A0 == P0_16 || SS_PIN == P0_16 || LCD_SDSS == P0_16 || DOGLCD_CS == P0_16 || LCD_RESET_PIN == P0_16 || LCD_BACKLIGHT_PIN == P0_16
|
103
|
|
- #error "Serial port assignment (1) conflicts with other pins!"
|
|
110
|
+ #if IS_TX1(BTN_EN2) || IS_RX1(BTN_EN1)
|
|
111
|
+ #error "Serial port pins (1) conflict with Encoder Buttons!"
|
|
112
|
+ #elif IS_TX1(SCK_PIN) || IS_TX1(LCD_PINS_D4) || IS_TX1(DOGLCD_SCK) || IS_TX1(LCD_RESET_PIN) || IS_TX1(LCD_PINS_RS) || IS_TX1(SHIFT_CLK) \
|
|
113
|
+ || IS_RX1(LCD_SDSS) || IS_RX1(LCD_PINS_RS) || IS_RX1(MISO_PIN) || IS_RX1(DOGLCD_A0) || IS_RX1(SS_PIN) || IS_RX1(LCD_SDSS) || IS_RX1(DOGLCD_CS) || IS_RX1(LCD_RESET_PIN) || IS_RX1(LCD_BACKLIGHT_PIN)
|
|
114
|
+ #error "Serial port pins (1) conflict with LCD pins!"
|
104
|
115
|
#endif
|
105
|
116
|
#endif
|
|
117
|
+ #undef IS_TX1
|
|
118
|
+ #undef IS_RX1
|
106
|
119
|
#endif
|
107
|
120
|
|
108
|
121
|
#if SERIAL_PORT == 2 || SERIAL_PORT_2 == 2 || DGUS_SERIAL_PORT == 2
|
109
|
|
- #if Y_MIN_PIN == P0_10 || Z_MIN_PROBE_PIN == P0_10 \
|
110
|
|
- || X_ENABLE_PIN == P0_10 || Y_ENABLE_PIN == P0_10 || X2_ENABLE_PIN == P0_10 || Y2_ENABLE_PIN == P0_10 || Z2_ENABLE_PIN == P0_10 || Z3_ENABLE_PIN == P0_10 || Z4_ENABLE_PIN == P0_10 \
|
111
|
|
- || X2_CS_PIN == P0_10 || Y2_CS_PIN == P0_10 || Z2_CS_PIN == P0_10 || Z3_CS_PIN == P0_10 || Z4_CS_PIN == P0_10 \
|
112
|
|
- || X_DIR_PIN == P0_11 || Y_DIR_PIN == P0_11 || X2_DIR_PIN == P0_11 || Y2_DIR_PIN == P0_11 || Z2_DIR_PIN == P0_11 || Z3_DIR_PIN == P0_11 || Z4_DIR_PIN == P0_11 \
|
113
|
|
- || X2_STEP_PIN == P0_11 || Y2_STEP_PIN == P0_11 || Z2_STEP_PIN == P0_11 || Z3_STEP_PIN == P0_11 || Z4_STEP_PIN == P0_11
|
114
|
|
- #error "Serial port assignment (2) conflicts with other pins!"
|
115
|
|
- #elif (E_STEPPERS > 1 && (E1_ENABLE_PIN == P0_10 || E1_CS_PIN == P0_10)) || (E_STEPPERS > 0 && (E0_DIR_PIN == P0_11 || E0_STEP_PIN == P0_11))
|
116
|
|
- #error "Serial port assignment (2) conflicts with other pins!"
|
|
122
|
+ #define IS_TX2(P) (P == P0_10)
|
|
123
|
+ #define IS_RX2(P) (P == P0_11)
|
|
124
|
+ #if IS_TX2(X2_ENABLE_PIN) || IS_RX2(X2_DIR_PIN) || IS_RX2(X2_STEP_PIN) || (AXIS_HAS_SPI(X2) && IS_TX2(X2_CS_PIN))
|
|
125
|
+ #error "Serial port pins (2) conflict with X2 pins!"
|
|
126
|
+ #elif IS_TX2(Y2_ENABLE_PIN) || IS_RX2(Y2_DIR_PIN) || IS_RX2(Y2_STEP_PIN) || (AXIS_HAS_SPI(Y2) && IS_TX2(Y2_CS_PIN))
|
|
127
|
+ #error "Serial port pins (2) conflict with Y2 pins!"
|
|
128
|
+ #elif IS_TX2(Z2_ENABLE_PIN) || IS_RX2(Z2_DIR_PIN) || IS_RX2(Z2_STEP_PIN) || (AXIS_HAS_SPI(Z2) && IS_TX2(Z2_CS_PIN))
|
|
129
|
+ #error "Serial port pins (2) conflict with Z2 pins!"
|
|
130
|
+ #elif IS_TX2(Z3_ENABLE_PIN) || IS_RX2(Z3_DIR_PIN) || IS_RX2(Z3_STEP_PIN) || (AXIS_HAS_SPI(Z3) && IS_TX2(Z3_CS_PIN))
|
|
131
|
+ #error "Serial port pins (2) conflict with Z3 pins!"
|
|
132
|
+ #elif IS_TX2(Z4_ENABLE_PIN) || IS_RX2(Z4_DIR_PIN) || IS_RX2(Z4_STEP_PIN) || (AXIS_HAS_SPI(Z4) && IS_TX2(Z4_CS_PIN))
|
|
133
|
+ #error "Serial port pins (2) conflict with Z4 pins!"
|
|
134
|
+ #elif IS_RX2(X_DIR_PIN) || IS_RX2(Y_DIR_PIN)
|
|
135
|
+ #error "Serial port pins (2) conflict with other pins!"
|
|
136
|
+ #elif Y_HOME_DIR < 0 && IS_TX2(Y_STOP_PIN)
|
|
137
|
+ #error "Serial port pins (2) conflict with Y endstop pin!"
|
|
138
|
+ #elif HAS_CUSTOM_PROBE_PIN && IS_TX2(Z_MIN_PROBE_PIN)
|
|
139
|
+ #error "Serial port pins (2) conflict with probe pin!"
|
|
140
|
+ #elif IS_TX2(X_ENABLE_PIN) || IS_RX2(X_DIR_PIN) || IS_TX2(Y_ENABLE_PIN) || IS_RX2(Y_DIR_PIN)
|
|
141
|
+ #error "Serial port pins (2) conflict with X/Y stepper pins!"
|
|
142
|
+ #elif EXTRUDERS > 1 && (IS_TX2(E1_ENABLE_PIN) || (AXIS_HAS_SPI(E1) && IS_TX2(E1_CS_PIN)))
|
|
143
|
+ #error "Serial port pins (2) conflict with E1 stepper pins!"
|
|
144
|
+ #elif EXTRUDERS && (IS_RX2(E0_DIR_PIN) || IS_RX2(E0_STEP_PIN))
|
|
145
|
+ #error "Serial port pins (2) conflict with E stepper pins!"
|
117
|
146
|
#endif
|
|
147
|
+ #undef IS_TX2
|
|
148
|
+ #undef IS_RX2
|
118
|
149
|
#endif
|
119
|
150
|
|
120
|
151
|
#if SERIAL_PORT == 3 || SERIAL_PORT_2 == 3 || DGUS_SERIAL_PORT == 3
|
121
|
|
- #if X_MIN_PIN == P0_00 || Y_SERIAL_TX_PIN == P0_00 || Y_SERIAL_RX_PIN == P0_00 \
|
122
|
|
- || X_MAX_PIN == P0_01 || X_SERIAL_TX_PIN == P0_01 || X_SERIAL_RX_PIN == P0_01
|
123
|
|
- #error "Serial port assignment (2) conflicts with other pins!"
|
124
|
|
- #elif E_STEPPERS > 1 && (E1_DIR_PIN == P0_00 || E1_STEP_PIN == P0_01)
|
125
|
|
- #error "Serial port assignment (2) conflicts with other pins!"
|
|
152
|
+ #define PIN_IS_TX3(P) (PIN_EXISTS(P) && P##_PIN == P0_00)
|
|
153
|
+ #define PIN_IS_RX3(P) (P##_PIN == P0_01)
|
|
154
|
+ #if PIN_IS_TX3(X_MIN) || PIN_IS_RX3(X_MAX)
|
|
155
|
+ #error "Serial port pins (3) conflict with X endstop pins!"
|
|
156
|
+ #elif PIN_IS_TX3(Y_SERIAL_TX) || PIN_IS_TX3(Y_SERIAL_RX) \
|
|
157
|
+ || PIN_IS_RX3(X_SERIAL_TX) || PIN_IS_RX3(X_SERIAL_RX)
|
|
158
|
+ #error "Serial port pins (3) conflict with X/Y axis UART pins!"
|
|
159
|
+ #elif PIN_IS_TX3(X2_DIR) || PIN_IS_RX3(X2_STEP)
|
|
160
|
+ #error "Serial port pins (3) conflict with X2 pins!"
|
|
161
|
+ #elif PIN_IS_TX3(Y2_DIR) || PIN_IS_RX3(Y2_STEP)
|
|
162
|
+ #error "Serial port pins (3) conflict with Y2 pins!"
|
|
163
|
+ #elif PIN_IS_TX3(Z2_DIR) || PIN_IS_RX3(Z2_STEP)
|
|
164
|
+ #error "Serial port pins (3) conflict with Z2 pins!"
|
|
165
|
+ #elif PIN_IS_TX3(Z3_DIR) || PIN_IS_RX3(Z3_STEP)
|
|
166
|
+ #error "Serial port pins (3) conflict with Z3 pins!"
|
|
167
|
+ #elif PIN_IS_TX3(Z4_DIR) || PIN_IS_RX3(Z4_STEP)
|
|
168
|
+ #error "Serial port pins (3) conflict with Z4 pins!"
|
|
169
|
+ #elif EXTRUDERS > 1 && (PIN_IS_TX3(E1_DIR) || PIN_IS_RX3(E1_STEP))
|
|
170
|
+ #error "Serial port pins (3) conflict with E1 pins!"
|
126
|
171
|
#endif
|
|
172
|
+ #undef PIN_IS_TX3
|
|
173
|
+ #undef PIN_IS_RX3
|
|
174
|
+#endif
|
|
175
|
+
|
|
176
|
+//
|
|
177
|
+// Flag any i2c pin conflicts
|
|
178
|
+//
|
|
179
|
+#if ANY(DIGIPOT_I2C, DIGIPOT_MCP4018, DAC_STEPPER_CURRENT, EXPERIMENTAL_I2CBUS, I2C_POSITION_ENCODERS, NEOPIXEL_LED, PCA9632, I2C_EEPROM)
|
|
180
|
+ #define USEDI2CDEV_M 1 // <Arduino>/Wire.cpp
|
|
181
|
+
|
|
182
|
+ #if USEDI2CDEV_M == 0 // P0_27 [D57] (AUX-1) .......... P0_28 [D58] (AUX-1)
|
|
183
|
+ #define PIN_IS_SDA0(P) (P##_PIN == P0_27)
|
|
184
|
+ #define IS_SCL0(P) (P == P0_28)
|
|
185
|
+ #if ENABLED(SDSUPPORT) && PIN_IS_SDA0(SD_DETECT)
|
|
186
|
+ #error "SDA0 overlaps with SD_DETECT_PIN!"
|
|
187
|
+ #elif PIN_IS_SDA0(E0_AUTO_FAN)
|
|
188
|
+ #error "SDA0 overlaps with E0_AUTO_FAN_PIN!"
|
|
189
|
+ #elif PIN_IS_SDA0(BEEPER)
|
|
190
|
+ #error "SDA0 overlaps with BEEPER_PIN!"
|
|
191
|
+ #elif IS_SCL0(BTN_ENC)
|
|
192
|
+ #error "SCL0 overlaps with Encoder Button!"
|
|
193
|
+ #elif IS_SCL0(SS_PIN)
|
|
194
|
+ #error "SCL0 overlaps with SS_PIN!"
|
|
195
|
+ #elif IS_SCL0(LCD_SDSS)
|
|
196
|
+ #error "SCL0 overlaps with LCD_SDSS!"
|
|
197
|
+ #endif
|
|
198
|
+ #undef PIN_IS_SDA0
|
|
199
|
+ #undef IS_SCL0
|
|
200
|
+ #elif USEDI2CDEV_M == 1 // P0_00 [D20] (SCA) ............ P0_01 [D21] (SCL)
|
|
201
|
+ #define PIN_IS_SDA1(P) (PIN_EXISTS(P) && P##_PIN == P0_00)
|
|
202
|
+ #define PIN_IS_SCL1(P) (P##_PIN == P0_01)
|
|
203
|
+ #if PIN_IS_SDA1(X_MIN) || PIN_IS_SCL1(X_MAX)
|
|
204
|
+ #error "One or more i2c (1) pins overlaps with X endstop pins! Disable i2c peripherals."
|
|
205
|
+ #elif PIN_IS_SDA1(X2_DIR) || PIN_IS_SCL1(X2_STEP)
|
|
206
|
+ #error "One or more i2c (1) pins overlaps with X2 pins! Disable i2c peripherals."
|
|
207
|
+ #elif PIN_IS_SDA1(Y2_DIR) || PIN_IS_SCL1(Y2_STEP)
|
|
208
|
+ #error "One or more i2c (1) pins overlaps with Y2 pins! Disable i2c peripherals."
|
|
209
|
+ #elif PIN_IS_SDA1(Z2_DIR) || PIN_IS_SCL1(Z2_STEP)
|
|
210
|
+ #error "One or more i2c (1) pins overlaps with Z2 pins! Disable i2c peripherals."
|
|
211
|
+ #elif PIN_IS_SDA1(Z3_DIR) || PIN_IS_SCL1(Z3_STEP)
|
|
212
|
+ #error "One or more i2c (1) pins overlaps with Z3 pins! Disable i2c peripherals."
|
|
213
|
+ #elif PIN_IS_SDA1(Z4_DIR) || PIN_IS_SCL1(Z4_STEP)
|
|
214
|
+ #error "One or more i2c (1) pins overlaps with Z4 pins! Disable i2c peripherals."
|
|
215
|
+ #elif EXTRUDERS > 1 && (PIN_IS_SDA1(E1_DIR) || PIN_IS_SCL1(E1_STEP))
|
|
216
|
+ #error "One or more i2c (1) pins overlaps with E1 pins! Disable i2c peripherals."
|
|
217
|
+ #endif
|
|
218
|
+ #undef PIN_IS_SDA1
|
|
219
|
+ #undef PIN_IS_SCL1
|
|
220
|
+ #elif USEDI2CDEV_M == 2 // P0_10 [D38] (X_ENABLE_PIN) ... P0_11 [D55] (X_DIR_PIN)
|
|
221
|
+ #define PIN_IS_SDA2(P) (P##_PIN == P0_10)
|
|
222
|
+ #define PIN_IS_SCL2(P) (P##_PIN == P0_11)
|
|
223
|
+ #if PIN_IS_SDA2(Y_STOP)
|
|
224
|
+ #error "i2c SDA2 overlaps with Y endstop pin!"
|
|
225
|
+ #elif HAS_CUSTOM_PROBE_PIN && PIN_IS_SDA2(Z_MIN_PROBE)
|
|
226
|
+ #error "i2c SDA2 overlaps with Z probe pin!"
|
|
227
|
+ #elif PIN_IS_SDA2(X_ENABLE) || PIN_IS_SDA2(Y_ENABLE)
|
|
228
|
+ #error "i2c SDA2 overlaps with X/Y ENABLE pin!"
|
|
229
|
+ #elif AXIS_HAS_SPI(X) && PIN_IS_SDA2(X_CS)
|
|
230
|
+ #error "i2c SDA2 overlaps with X CS pin!"
|
|
231
|
+ #elif PIN_IS_SDA2(X2_ENABLE)
|
|
232
|
+ #error "i2c SDA2 overlaps with X2 enable pin! Disable i2c peripherals."
|
|
233
|
+ #elif PIN_IS_SDA2(Y2_ENABLE)
|
|
234
|
+ #error "i2c SDA2 overlaps with Y2 enable pin! Disable i2c peripherals."
|
|
235
|
+ #elif PIN_IS_SDA2(Z2_ENABLE)
|
|
236
|
+ #error "i2c SDA2 overlaps with Z2 enable pin! Disable i2c peripherals."
|
|
237
|
+ #elif PIN_IS_SDA2(Z3_ENABLE)
|
|
238
|
+ #error "i2c SDA2 overlaps with Z3 enable pin! Disable i2c peripherals."
|
|
239
|
+ #elif PIN_IS_SDA2(Z4_ENABLE)
|
|
240
|
+ #error "i2c SDA2 overlaps with Z4 enable pin! Disable i2c peripherals."
|
|
241
|
+ #elif EXTRUDERS > 1 && PIN_IS_SDA2(E1_ENABLE)
|
|
242
|
+ #error "i2c SDA2 overlaps with E1 enable pin! Disable i2c peripherals."
|
|
243
|
+ #elif EXTRUDERS > 1 && AXIS_HAS_SPI(E1) && PIN_IS_SDA2(E1_CS)
|
|
244
|
+ #error "i2c SDA2 overlaps with E1 CS pin! Disable i2c peripherals."
|
|
245
|
+ #elif EXTRUDERS && (PIN_IS_SDA2(E0_STEP) || PIN_IS_SDA2(E0_DIR))
|
|
246
|
+ #error "i2c SCL2 overlaps with E0 STEP/DIR pin! Disable i2c peripherals."
|
|
247
|
+ #elif PIN_IS_SDA2(X_DIR) || PIN_IS_SDA2(Y_DIR)
|
|
248
|
+ #error "One or more i2c pins overlaps with X/Y DIR pin! Disable i2c peripherals."
|
|
249
|
+ #endif
|
|
250
|
+ #undef PIN_IS_SDA2
|
|
251
|
+ #undef PIN_IS_SCL2
|
|
252
|
+ #endif
|
|
253
|
+
|
|
254
|
+ #undef USEDI2CDEV_M
|
127
|
255
|
#endif
|