|
@@ -102,153 +102,124 @@ void pciSetup(const int8_t pin) {
|
102
|
102
|
ISR(PCINT3_vect, ISR_ALIASOF(PCINT0_vect));
|
103
|
103
|
#endif
|
104
|
104
|
|
105
|
|
-void setup_endstop_interrupts( void ) {
|
106
|
|
-
|
|
105
|
+void setup_endstop_interrupts(void) {
|
|
106
|
+ #define _ATTACH(P) attachInterrupt(digitalPinToInterrupt(P), endstop_ISR, CHANGE)
|
107
|
107
|
#if HAS_X_MAX
|
108
|
|
- #if (digitalPinToInterrupt(X_MAX_PIN) != NOT_AN_INTERRUPT) // if pin has an external interrupt
|
109
|
|
- attachInterrupt(digitalPinToInterrupt(X_MAX_PIN), endstop_ISR, CHANGE); // assign it
|
|
108
|
+ #if (digitalPinToInterrupt(X_MAX_PIN) != NOT_AN_INTERRUPT)
|
|
109
|
+ _ATTACH(X_MAX_PIN);
|
110
|
110
|
#else
|
111
|
|
- // Not all used endstop/probe -pins can raise interrupts. Please deactivate ENDSTOP_INTERRUPTS or change the pin configuration!
|
112
|
|
- static_assert(digitalPinToPCICR(X_MAX_PIN), "X_MAX_PIN is not interrupt-capable"); // if pin has no pin change interrupt - error
|
113
|
|
- pciSetup(X_MAX_PIN); // assign it
|
|
111
|
+ static_assert(digitalPinToPCICR(X_MAX_PIN), "X_MAX_PIN is not interrupt-capable");
|
|
112
|
+ pciSetup(X_MAX_PIN);
|
114
|
113
|
#endif
|
115
|
114
|
#endif
|
116
|
|
-
|
117
|
115
|
#if HAS_X_MIN
|
118
|
116
|
#if (digitalPinToInterrupt(X_MIN_PIN) != NOT_AN_INTERRUPT)
|
119
|
|
- attachInterrupt(digitalPinToInterrupt(X_MIN_PIN), endstop_ISR, CHANGE);
|
|
117
|
+ _ATTACH(X_MIN_PIN);
|
120
|
118
|
#else
|
121
|
|
- // Not all used endstop/probe -pins can raise interrupts. Please deactivate ENDSTOP_INTERRUPTS or change the pin configuration!
|
122
|
119
|
static_assert(digitalPinToPCICR(X_MIN_PIN), "X_MIN_PIN is not interrupt-capable");
|
123
|
120
|
pciSetup(X_MIN_PIN);
|
124
|
121
|
#endif
|
125
|
122
|
#endif
|
126
|
|
-
|
127
|
123
|
#if HAS_Y_MAX
|
128
|
124
|
#if (digitalPinToInterrupt(Y_MAX_PIN) != NOT_AN_INTERRUPT)
|
129
|
|
- attachInterrupt(digitalPinToInterrupt(Y_MAX_PIN), endstop_ISR, CHANGE);
|
|
125
|
+ _ATTACH(Y_MAX_PIN);
|
130
|
126
|
#else
|
131
|
|
- // Not all used endstop/probe -pins can raise interrupts. Please deactivate ENDSTOP_INTERRUPTS or change the pin configuration!
|
132
|
127
|
static_assert(digitalPinToPCICR(Y_MAX_PIN), "Y_MAX_PIN is not interrupt-capable");
|
133
|
128
|
pciSetup(Y_MAX_PIN);
|
134
|
129
|
#endif
|
135
|
130
|
#endif
|
136
|
|
-
|
137
|
131
|
#if HAS_Y_MIN
|
138
|
132
|
#if (digitalPinToInterrupt(Y_MIN_PIN) != NOT_AN_INTERRUPT)
|
139
|
|
- attachInterrupt(digitalPinToInterrupt(Y_MIN_PIN), endstop_ISR, CHANGE);
|
|
133
|
+ _ATTACH(Y_MIN_PIN);
|
140
|
134
|
#else
|
141
|
|
- // Not all used endstop/probe -pins can raise interrupts. Please deactivate ENDSTOP_INTERRUPTS or change the pin configuration!
|
142
|
135
|
static_assert(digitalPinToPCICR(Y_MIN_PIN), "Y_MIN_PIN is not interrupt-capable");
|
143
|
136
|
pciSetup(Y_MIN_PIN);
|
144
|
137
|
#endif
|
145
|
138
|
#endif
|
146
|
|
-
|
147
|
139
|
#if HAS_Z_MAX
|
148
|
140
|
#if (digitalPinToInterrupt(Z_MAX_PIN) != NOT_AN_INTERRUPT)
|
149
|
|
- attachInterrupt(digitalPinToInterrupt(Z_MAX_PIN), endstop_ISR, CHANGE);
|
|
141
|
+ _ATTACH(Z_MAX_PIN);
|
150
|
142
|
#else
|
151
|
|
- // Not all used endstop/probe -pins can raise interrupts. Please deactivate ENDSTOP_INTERRUPTS or change the pin configuration!
|
152
|
143
|
static_assert(digitalPinToPCICR(Z_MAX_PIN), "Z_MAX_PIN is not interrupt-capable");
|
153
|
144
|
pciSetup(Z_MAX_PIN);
|
154
|
145
|
#endif
|
155
|
146
|
#endif
|
156
|
|
-
|
157
|
147
|
#if HAS_Z_MIN
|
158
|
148
|
#if (digitalPinToInterrupt(Z_MIN_PIN) != NOT_AN_INTERRUPT)
|
159
|
|
- attachInterrupt(digitalPinToInterrupt(Z_MIN_PIN), endstop_ISR, CHANGE);
|
|
149
|
+ _ATTACH(Z_MIN_PIN);
|
160
|
150
|
#else
|
161
|
|
- // Not all used endstop/probe -pins can raise interrupts. Please deactivate ENDSTOP_INTERRUPTS or change the pin configuration!
|
162
|
151
|
static_assert(digitalPinToPCICR(Z_MIN_PIN), "Z_MIN_PIN is not interrupt-capable");
|
163
|
152
|
pciSetup(Z_MIN_PIN);
|
164
|
153
|
#endif
|
165
|
154
|
#endif
|
166
|
|
-
|
167
|
155
|
#if HAS_X2_MAX
|
168
|
156
|
#if (digitalPinToInterrupt(X2_MAX_PIN) != NOT_AN_INTERRUPT)
|
169
|
|
- attachInterrupt(digitalPinToInterrupt(X2_MAX_PIN), endstop_ISR, CHANGE);
|
|
157
|
+ _ATTACH(X2_MAX_PIN);
|
170
|
158
|
#else
|
171
|
|
- // Not all used endstop/probe -pins can raise interrupts. Please deactivate ENDSTOP_INTERRUPTS or change the pin configuration!
|
172
|
159
|
static_assert(digitalPinToPCICR(X2_MAX_PIN), "X2_MAX_PIN is not interrupt-capable");
|
173
|
160
|
pciSetup(X2_MAX_PIN);
|
174
|
161
|
#endif
|
175
|
162
|
#endif
|
176
|
|
-
|
177
|
163
|
#if HAS_X2_MIN
|
178
|
164
|
#if (digitalPinToInterrupt(X2_MIN_PIN) != NOT_AN_INTERRUPT)
|
179
|
|
- attachInterrupt(digitalPinToInterrupt(X2_MIN_PIN), endstop_ISR, CHANGE);
|
|
165
|
+ _ATTACH(X2_MIN_PIN);
|
180
|
166
|
#else
|
181
|
|
- // Not all used endstop/probe -pins can raise interrupts. Please deactivate ENDSTOP_INTERRUPTS or change the pin configuration!
|
182
|
167
|
static_assert(digitalPinToPCICR(X2_MIN_PIN), "X2_MIN_PIN is not interrupt-capable");
|
183
|
168
|
pciSetup(X2_MIN_PIN);
|
184
|
169
|
#endif
|
185
|
170
|
#endif
|
186
|
|
-
|
187
|
171
|
#if HAS_Y2_MAX
|
188
|
172
|
#if (digitalPinToInterrupt(Y2_MAX_PIN) != NOT_AN_INTERRUPT)
|
189
|
|
- attachInterrupt(digitalPinToInterrupt(Y2_MAX_PIN), endstop_ISR, CHANGE);
|
|
173
|
+ _ATTACH(Y2_MAX_PIN);
|
190
|
174
|
#else
|
191
|
|
- // Not all used endstop/probe -pins can raise interrupts. Please deactivate ENDSTOP_INTERRUPTS or change the pin configuration!
|
192
|
175
|
static_assert(digitalPinToPCICR(Y2_MAX_PIN), "Y2_MAX_PIN is not interrupt-capable");
|
193
|
176
|
pciSetup(Y2_MAX_PIN);
|
194
|
177
|
#endif
|
195
|
178
|
#endif
|
196
|
|
-
|
197
|
179
|
#if HAS_Y2_MIN
|
198
|
180
|
#if (digitalPinToInterrupt(Y2_MIN_PIN) != NOT_AN_INTERRUPT)
|
199
|
|
- attachInterrupt(digitalPinToInterrupt(Y2_MIN_PIN), endstop_ISR, CHANGE);
|
|
181
|
+ _ATTACH(Y2_MIN_PIN);
|
200
|
182
|
#else
|
201
|
|
- // Not all used endstop/probe -pins can raise interrupts. Please deactivate ENDSTOP_INTERRUPTS or change the pin configuration!
|
202
|
183
|
static_assert(digitalPinToPCICR(Y2_MIN_PIN), "Y2_MIN_PIN is not interrupt-capable");
|
203
|
184
|
pciSetup(Y2_MIN_PIN);
|
204
|
185
|
#endif
|
205
|
186
|
#endif
|
206
|
|
-
|
207
|
187
|
#if HAS_Z2_MAX
|
208
|
188
|
#if (digitalPinToInterrupt(Z2_MAX_PIN) != NOT_AN_INTERRUPT)
|
209
|
|
- attachInterrupt(digitalPinToInterrupt(Z2_MAX_PIN), endstop_ISR, CHANGE);
|
|
189
|
+ _ATTACH(Z2_MAX_PIN);
|
210
|
190
|
#else
|
211
|
|
- // Not all used endstop/probe -pins can raise interrupts. Please deactivate ENDSTOP_INTERRUPTS or change the pin configuration!
|
212
|
191
|
static_assert(digitalPinToPCICR(Z2_MAX_PIN), "Z2_MAX_PIN is not interrupt-capable");
|
213
|
192
|
pciSetup(Z2_MAX_PIN);
|
214
|
193
|
#endif
|
215
|
194
|
#endif
|
216
|
|
-
|
217
|
195
|
#if HAS_Z2_MIN
|
218
|
196
|
#if (digitalPinToInterrupt(Z2_MIN_PIN) != NOT_AN_INTERRUPT)
|
219
|
|
- attachInterrupt(digitalPinToInterrupt(Z2_MIN_PIN), endstop_ISR, CHANGE);
|
|
197
|
+ _ATTACH(Z2_MIN_PIN);
|
220
|
198
|
#else
|
221
|
|
- // Not all used endstop/probe -pins can raise interrupts. Please deactivate ENDSTOP_INTERRUPTS or change the pin configuration!
|
222
|
199
|
static_assert(digitalPinToPCICR(Z2_MIN_PIN), "Z2_MIN_PIN is not interrupt-capable");
|
223
|
200
|
pciSetup(Z2_MIN_PIN);
|
224
|
201
|
#endif
|
225
|
202
|
#endif
|
226
|
|
-
|
227
|
203
|
#if HAS_Z3_MAX
|
228
|
204
|
#if (digitalPinToInterrupt(Z3_MAX_PIN) != NOT_AN_INTERRUPT)
|
229
|
|
- attachInterrupt(digitalPinToInterrupt(Z3_MAX_PIN), endstop_ISR, CHANGE);
|
|
205
|
+ _ATTACH(Z3_MAX_PIN);
|
230
|
206
|
#else
|
231
|
|
- // Not all used endstop/probe -pins can raise interrupts. Please deactivate ENDSTOP_INTERRUPTS or change the pin configuration!
|
232
|
207
|
static_assert(digitalPinToPCICR(Z3_MAX_PIN), "Z3_MAX_PIN is not interrupt-capable");
|
233
|
208
|
pciSetup(Z3_MAX_PIN);
|
234
|
209
|
#endif
|
235
|
210
|
#endif
|
236
|
|
-
|
237
|
211
|
#if HAS_Z3_MIN
|
238
|
212
|
#if (digitalPinToInterrupt(Z3_MIN_PIN) != NOT_AN_INTERRUPT)
|
239
|
|
- attachInterrupt(digitalPinToInterrupt(Z3_MIN_PIN), endstop_ISR, CHANGE);
|
|
213
|
+ _ATTACH(Z3_MIN_PIN);
|
240
|
214
|
#else
|
241
|
|
- // Not all used endstop/probe -pins can raise interrupts. Please deactivate ENDSTOP_INTERRUPTS or change the pin configuration!
|
242
|
215
|
static_assert(digitalPinToPCICR(Z3_MIN_PIN), "Z3_MIN_PIN is not interrupt-capable");
|
243
|
216
|
pciSetup(Z3_MIN_PIN);
|
244
|
217
|
#endif
|
245
|
218
|
#endif
|
246
|
|
-
|
247
|
219
|
#if HAS_Z_MIN_PROBE_PIN
|
248
|
220
|
#if (digitalPinToInterrupt(Z_MIN_PROBE_PIN) != NOT_AN_INTERRUPT)
|
249
|
|
- attachInterrupt(digitalPinToInterrupt(Z_MIN_PROBE_PIN), endstop_ISR, CHANGE);
|
|
221
|
+ _ATTACH(Z_MIN_PROBE_PIN);
|
250
|
222
|
#else
|
251
|
|
- // Not all used endstop/probe -pins can raise interrupts. Please deactivate ENDSTOP_INTERRUPTS or change the pin configuration!
|
252
|
223
|
static_assert(digitalPinToPCICR(Z_MIN_PROBE_PIN), "Z_MIN_PROBE_PIN is not interrupt-capable");
|
253
|
224
|
pciSetup(Z_MIN_PROBE_PIN);
|
254
|
225
|
#endif
|