Fix mega Port J endstop interrupts (#15758)

This commit is contained in:
Giuliano Zaro 2019-11-02 12:59:38 +01:00 committed by Scott Lahteine
parent a920b10483
commit 65ef774e8d
2 changed files with 6 additions and 6 deletions

View file

@ -46,16 +46,16 @@ void endstop_ISR() { endstops.update(); }
/**
* Patch for pins_arduino.h (...\Arduino\hardware\arduino\avr\variants\mega\pins_arduino.h)
*
* These macros for the Arduino MEGA do not include the two connected pins on Port J (D13, D14).
* These macros for the Arduino MEGA do not include the two connected pins on Port J (D14, D15).
* So we extend them here because these are the normal pins for Y_MIN and Y_MAX on RAMPS.
* There are more PCI-enabled processor pins on Port J, but they are not connected to Arduino MEGA.
*/
#if defined(ARDUINO_AVR_MEGA2560) || defined(ARDUINO_AVR_MEGA)
#define digitalPinHasPCICR(p) (WITHIN(p, 10, 15) || WITHIN(p, 50, 53) || WITHIN(p, 62, 69))
#define moreDigitalPinToPCICR(p) digitalPinToPCICR(WITHIN(p, 13, 14) ? 10 : p)
#define moreDigitalPinToPCICRbit(p) digitalPinToPCICRbit(p == 13 ? 10 : p == 14 ? 15 : p)
#define moreDigitalPinToPCMSK(p) digitalPinToPCMSK( p == 13 ? 10 : p == 14 ? 15 : p)
#define moreDigitalPinToPCMSKbit(p) digitalPinToPCMSKbit(p == 13 ? 10 : p == 14 ? 51 : p)
#define moreDigitalPinToPCICR(p) digitalPinToPCICR(WITHIN(p, 14, 15) ? 10 : p)
#define moreDigitalPinToPCICRbit(p) (WITHIN(p, 14, 15) ? 1 : digitalPinToPCICRbit(p))
#define moreDigitalPinToPCMSK(p) (WITHIN(p, 14, 15) ? (&PCMSK1) : digitalPinToPCMSK(p))
#define moreDigitalPinToPCMSKbit(p) digitalPinToPCMSKbit(WITHIN(p, 14, 15) ? (p)+36 : p)
#endif

View file

@ -2,7 +2,7 @@
// Compile with the same build settings you'd use for Marlin.
#if defined(ARDUINO_AVR_MEGA2560) || defined(ARDUINO_AVR_MEGA)
#define moreDigitalPinToPCICR(p) digitalPinToPCICR(WITHIN(p, 13, 14) ? 10 : p)
#define moreDigitalPinToPCICR(p) digitalPinToPCICR(WITHIN(p, 14, 15) ? 10 : p)
#else
#define moreDigitalPinToPCICR(p) digitalPinToPCICR(p)
#endif