2018-10-03 03:26:07 -05:00
|
|
|
/**
|
|
|
|
* Marlin 3D Printer Firmware
|
2020-02-03 08:00:57 -06:00
|
|
|
* Copyright (c) 2020 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
|
2018-10-03 03:26:07 -05:00
|
|
|
*
|
|
|
|
* Based on Sprinter and grbl.
|
2019-06-27 23:57:50 -05:00
|
|
|
* Copyright (c) 2011 Camiel Gubbels / Erik van der Zalm
|
|
|
|
* Copyright (c) 2017 Victor Perez
|
2018-10-03 03:26:07 -05:00
|
|
|
*
|
|
|
|
* This program is free software: you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU General Public License as published by
|
|
|
|
* the Free Software Foundation, either version 3 of the License, or
|
|
|
|
* (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License
|
2020-07-22 22:20:14 -05:00
|
|
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
2018-10-03 03:26:07 -05:00
|
|
|
*
|
|
|
|
*/
|
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include "../../module/endstops.h"
|
|
|
|
|
|
|
|
// One ISR for all EXT-Interrupts
|
2019-09-16 20:31:08 -05:00
|
|
|
void endstop_ISR() { endstops.update(); }
|
2018-10-03 03:26:07 -05:00
|
|
|
|
2019-09-16 20:31:08 -05:00
|
|
|
void setup_endstop_interrupts() {
|
2020-04-22 16:35:03 -05:00
|
|
|
#define _ATTACH(P) attachInterrupt(P, endstop_ISR, CHANGE)
|
|
|
|
TERN_(HAS_X_MAX, _ATTACH(X_MAX_PIN));
|
|
|
|
TERN_(HAS_X_MIN, _ATTACH(X_MIN_PIN));
|
|
|
|
TERN_(HAS_Y_MAX, _ATTACH(Y_MAX_PIN));
|
|
|
|
TERN_(HAS_Y_MIN, _ATTACH(Y_MIN_PIN));
|
|
|
|
TERN_(HAS_Z_MAX, _ATTACH(Z_MAX_PIN));
|
|
|
|
TERN_(HAS_Z_MIN, _ATTACH(Z_MIN_PIN));
|
|
|
|
TERN_(HAS_X2_MAX, _ATTACH(X2_MAX_PIN));
|
|
|
|
TERN_(HAS_X2_MIN, _ATTACH(X2_MIN_PIN));
|
|
|
|
TERN_(HAS_Y2_MAX, _ATTACH(Y2_MAX_PIN));
|
|
|
|
TERN_(HAS_Y2_MIN, _ATTACH(Y2_MIN_PIN));
|
|
|
|
TERN_(HAS_Z2_MAX, _ATTACH(Z2_MAX_PIN));
|
|
|
|
TERN_(HAS_Z2_MIN, _ATTACH(Z2_MIN_PIN));
|
|
|
|
TERN_(HAS_Z3_MAX, _ATTACH(Z3_MAX_PIN));
|
|
|
|
TERN_(HAS_Z3_MIN, _ATTACH(Z3_MIN_PIN));
|
|
|
|
TERN_(HAS_Z4_MAX, _ATTACH(Z4_MAX_PIN));
|
|
|
|
TERN_(HAS_Z4_MIN, _ATTACH(Z4_MIN_PIN));
|
|
|
|
TERN_(HAS_Z_MIN_PROBE_PIN, _ATTACH(Z_MIN_PROBE_PIN));
|
2018-10-03 03:26:07 -05:00
|
|
|
}
|