|
|
@ -102,153 +102,124 @@ void pciSetup(const int8_t pin) { |
|
|
|
ISR(PCINT3_vect, ISR_ALIASOF(PCINT0_vect)); |
|
|
|
#endif |
|
|
|
|
|
|
|
void setup_endstop_interrupts( void ) { |
|
|
|
|
|
|
|
void setup_endstop_interrupts(void) { |
|
|
|
#define _ATTACH(P) attachInterrupt(digitalPinToInterrupt(P), endstop_ISR, CHANGE) |
|
|
|
#if HAS_X_MAX |
|
|
|
#if (digitalPinToInterrupt(X_MAX_PIN) != NOT_AN_INTERRUPT) // if pin has an external interrupt
|
|
|
|
attachInterrupt(digitalPinToInterrupt(X_MAX_PIN), endstop_ISR, CHANGE); // assign it
|
|
|
|
#if (digitalPinToInterrupt(X_MAX_PIN) != NOT_AN_INTERRUPT) |
|
|
|
_ATTACH(X_MAX_PIN); |
|
|
|
#else |
|
|
|
// Not all used endstop/probe -pins can raise interrupts. Please deactivate ENDSTOP_INTERRUPTS or change the pin configuration!
|
|
|
|
static_assert(digitalPinToPCICR(X_MAX_PIN), "X_MAX_PIN is not interrupt-capable"); // if pin has no pin change interrupt - error
|
|
|
|
pciSetup(X_MAX_PIN); // assign it
|
|
|
|
static_assert(digitalPinToPCICR(X_MAX_PIN), "X_MAX_PIN is not interrupt-capable"); |
|
|
|
pciSetup(X_MAX_PIN); |
|
|
|
#endif |
|
|
|
#endif |
|
|
|
|
|
|
|
#if HAS_X_MIN |
|
|
|
#if (digitalPinToInterrupt(X_MIN_PIN) != NOT_AN_INTERRUPT) |
|
|
|
attachInterrupt(digitalPinToInterrupt(X_MIN_PIN), endstop_ISR, CHANGE); |
|
|
|
_ATTACH(X_MIN_PIN); |
|
|
|
#else |
|
|
|
// Not all used endstop/probe -pins can raise interrupts. Please deactivate ENDSTOP_INTERRUPTS or change the pin configuration!
|
|
|
|
static_assert(digitalPinToPCICR(X_MIN_PIN), "X_MIN_PIN is not interrupt-capable"); |
|
|
|
pciSetup(X_MIN_PIN); |
|
|
|
#endif |
|
|
|
#endif |
|
|
|
|
|
|
|
#if HAS_Y_MAX |
|
|
|
#if (digitalPinToInterrupt(Y_MAX_PIN) != NOT_AN_INTERRUPT) |
|
|
|
attachInterrupt(digitalPinToInterrupt(Y_MAX_PIN), endstop_ISR, CHANGE); |
|
|
|
_ATTACH(Y_MAX_PIN); |
|
|
|
#else |
|
|
|
// Not all used endstop/probe -pins can raise interrupts. Please deactivate ENDSTOP_INTERRUPTS or change the pin configuration!
|
|
|
|
static_assert(digitalPinToPCICR(Y_MAX_PIN), "Y_MAX_PIN is not interrupt-capable"); |
|
|
|
pciSetup(Y_MAX_PIN); |
|
|
|
#endif |
|
|
|
#endif |
|
|
|
|
|
|
|
#if HAS_Y_MIN |
|
|
|
#if (digitalPinToInterrupt(Y_MIN_PIN) != NOT_AN_INTERRUPT) |
|
|
|
attachInterrupt(digitalPinToInterrupt(Y_MIN_PIN), endstop_ISR, CHANGE); |
|
|
|
_ATTACH(Y_MIN_PIN); |
|
|
|
#else |
|
|
|
// Not all used endstop/probe -pins can raise interrupts. Please deactivate ENDSTOP_INTERRUPTS or change the pin configuration!
|
|
|
|
static_assert(digitalPinToPCICR(Y_MIN_PIN), "Y_MIN_PIN is not interrupt-capable"); |
|
|
|
pciSetup(Y_MIN_PIN); |
|
|
|
#endif |
|
|
|
#endif |
|
|
|
|
|
|
|
#if HAS_Z_MAX |
|
|
|
#if (digitalPinToInterrupt(Z_MAX_PIN) != NOT_AN_INTERRUPT) |
|
|
|
attachInterrupt(digitalPinToInterrupt(Z_MAX_PIN), endstop_ISR, CHANGE); |
|
|
|
_ATTACH(Z_MAX_PIN); |
|
|
|
#else |
|
|
|
// Not all used endstop/probe -pins can raise interrupts. Please deactivate ENDSTOP_INTERRUPTS or change the pin configuration!
|
|
|
|
static_assert(digitalPinToPCICR(Z_MAX_PIN), "Z_MAX_PIN is not interrupt-capable"); |
|
|
|
pciSetup(Z_MAX_PIN); |
|
|
|
#endif |
|
|
|
#endif |
|
|
|
|
|
|
|
#if HAS_Z_MIN |
|
|
|
#if (digitalPinToInterrupt(Z_MIN_PIN) != NOT_AN_INTERRUPT) |
|
|
|
attachInterrupt(digitalPinToInterrupt(Z_MIN_PIN), endstop_ISR, CHANGE); |
|
|
|
_ATTACH(Z_MIN_PIN); |
|
|
|
#else |
|
|
|
// Not all used endstop/probe -pins can raise interrupts. Please deactivate ENDSTOP_INTERRUPTS or change the pin configuration!
|
|
|
|
static_assert(digitalPinToPCICR(Z_MIN_PIN), "Z_MIN_PIN is not interrupt-capable"); |
|
|
|
pciSetup(Z_MIN_PIN); |
|
|
|
#endif |
|
|
|
#endif |
|
|
|
|
|
|
|
#if HAS_X2_MAX |
|
|
|
#if (digitalPinToInterrupt(X2_MAX_PIN) != NOT_AN_INTERRUPT) |
|
|
|
attachInterrupt(digitalPinToInterrupt(X2_MAX_PIN), endstop_ISR, CHANGE); |
|
|
|
_ATTACH(X2_MAX_PIN); |
|
|
|
#else |
|
|
|
// Not all used endstop/probe -pins can raise interrupts. Please deactivate ENDSTOP_INTERRUPTS or change the pin configuration!
|
|
|
|
static_assert(digitalPinToPCICR(X2_MAX_PIN), "X2_MAX_PIN is not interrupt-capable"); |
|
|
|
pciSetup(X2_MAX_PIN); |
|
|
|
#endif |
|
|
|
#endif |
|
|
|
|
|
|
|
#if HAS_X2_MIN |
|
|
|
#if (digitalPinToInterrupt(X2_MIN_PIN) != NOT_AN_INTERRUPT) |
|
|
|
attachInterrupt(digitalPinToInterrupt(X2_MIN_PIN), endstop_ISR, CHANGE); |
|
|
|
_ATTACH(X2_MIN_PIN); |
|
|
|
#else |
|
|
|
// Not all used endstop/probe -pins can raise interrupts. Please deactivate ENDSTOP_INTERRUPTS or change the pin configuration!
|
|
|
|
static_assert(digitalPinToPCICR(X2_MIN_PIN), "X2_MIN_PIN is not interrupt-capable"); |
|
|
|
pciSetup(X2_MIN_PIN); |
|
|
|
#endif |
|
|
|
#endif |
|
|
|
|
|
|
|
#if HAS_Y2_MAX |
|
|
|
#if (digitalPinToInterrupt(Y2_MAX_PIN) != NOT_AN_INTERRUPT) |
|
|
|
attachInterrupt(digitalPinToInterrupt(Y2_MAX_PIN), endstop_ISR, CHANGE); |
|
|
|
_ATTACH(Y2_MAX_PIN); |
|
|
|
#else |
|
|
|
// Not all used endstop/probe -pins can raise interrupts. Please deactivate ENDSTOP_INTERRUPTS or change the pin configuration!
|
|
|
|
static_assert(digitalPinToPCICR(Y2_MAX_PIN), "Y2_MAX_PIN is not interrupt-capable"); |
|
|
|
pciSetup(Y2_MAX_PIN); |
|
|
|
#endif |
|
|
|
#endif |
|
|
|
|
|
|
|
#if HAS_Y2_MIN |
|
|
|
#if (digitalPinToInterrupt(Y2_MIN_PIN) != NOT_AN_INTERRUPT) |
|
|
|
attachInterrupt(digitalPinToInterrupt(Y2_MIN_PIN), endstop_ISR, CHANGE); |
|
|
|
_ATTACH(Y2_MIN_PIN); |
|
|
|
#else |
|
|
|
// Not all used endstop/probe -pins can raise interrupts. Please deactivate ENDSTOP_INTERRUPTS or change the pin configuration!
|
|
|
|
static_assert(digitalPinToPCICR(Y2_MIN_PIN), "Y2_MIN_PIN is not interrupt-capable"); |
|
|
|
pciSetup(Y2_MIN_PIN); |
|
|
|
#endif |
|
|
|
#endif |
|
|
|
|
|
|
|
#if HAS_Z2_MAX |
|
|
|
#if (digitalPinToInterrupt(Z2_MAX_PIN) != NOT_AN_INTERRUPT) |
|
|
|
attachInterrupt(digitalPinToInterrupt(Z2_MAX_PIN), endstop_ISR, CHANGE); |
|
|
|
_ATTACH(Z2_MAX_PIN); |
|
|
|
#else |
|
|
|
// Not all used endstop/probe -pins can raise interrupts. Please deactivate ENDSTOP_INTERRUPTS or change the pin configuration!
|
|
|
|
static_assert(digitalPinToPCICR(Z2_MAX_PIN), "Z2_MAX_PIN is not interrupt-capable"); |
|
|
|
pciSetup(Z2_MAX_PIN); |
|
|
|
#endif |
|
|
|
#endif |
|
|
|
|
|
|
|
#if HAS_Z2_MIN |
|
|
|
#if (digitalPinToInterrupt(Z2_MIN_PIN) != NOT_AN_INTERRUPT) |
|
|
|
attachInterrupt(digitalPinToInterrupt(Z2_MIN_PIN), endstop_ISR, CHANGE); |
|
|
|
_ATTACH(Z2_MIN_PIN); |
|
|
|
#else |
|
|
|
// Not all used endstop/probe -pins can raise interrupts. Please deactivate ENDSTOP_INTERRUPTS or change the pin configuration!
|
|
|
|
static_assert(digitalPinToPCICR(Z2_MIN_PIN), "Z2_MIN_PIN is not interrupt-capable"); |
|
|
|
pciSetup(Z2_MIN_PIN); |
|
|
|
#endif |
|
|
|
#endif |
|
|
|
|
|
|
|
#if HAS_Z3_MAX |
|
|
|
#if (digitalPinToInterrupt(Z3_MAX_PIN) != NOT_AN_INTERRUPT) |
|
|
|
attachInterrupt(digitalPinToInterrupt(Z3_MAX_PIN), endstop_ISR, CHANGE); |
|
|
|
_ATTACH(Z3_MAX_PIN); |
|
|
|
#else |
|
|
|
// Not all used endstop/probe -pins can raise interrupts. Please deactivate ENDSTOP_INTERRUPTS or change the pin configuration!
|
|
|
|
static_assert(digitalPinToPCICR(Z3_MAX_PIN), "Z3_MAX_PIN is not interrupt-capable"); |
|
|
|
pciSetup(Z3_MAX_PIN); |
|
|
|
#endif |
|
|
|
#endif |
|
|
|
|
|
|
|
#if HAS_Z3_MIN |
|
|
|
#if (digitalPinToInterrupt(Z3_MIN_PIN) != NOT_AN_INTERRUPT) |
|
|
|
attachInterrupt(digitalPinToInterrupt(Z3_MIN_PIN), endstop_ISR, CHANGE); |
|
|
|
_ATTACH(Z3_MIN_PIN); |
|
|
|
#else |
|
|
|
// Not all used endstop/probe -pins can raise interrupts. Please deactivate ENDSTOP_INTERRUPTS or change the pin configuration!
|
|
|
|
static_assert(digitalPinToPCICR(Z3_MIN_PIN), "Z3_MIN_PIN is not interrupt-capable"); |
|
|
|
pciSetup(Z3_MIN_PIN); |
|
|
|
#endif |
|
|
|
#endif |
|
|
|
|
|
|
|
#if HAS_Z_MIN_PROBE_PIN |
|
|
|
#if (digitalPinToInterrupt(Z_MIN_PROBE_PIN) != NOT_AN_INTERRUPT) |
|
|
|
attachInterrupt(digitalPinToInterrupt(Z_MIN_PROBE_PIN), endstop_ISR, CHANGE); |
|
|
|
_ATTACH(Z_MIN_PROBE_PIN); |
|
|
|
#else |
|
|
|
// Not all used endstop/probe -pins can raise interrupts. Please deactivate ENDSTOP_INTERRUPTS or change the pin configuration!
|
|
|
|
static_assert(digitalPinToPCICR(Z_MIN_PROBE_PIN), "Z_MIN_PROBE_PIN is not interrupt-capable"); |
|
|
|
pciSetup(Z_MIN_PROBE_PIN); |
|
|
|
#endif |
|
|
|