aboutsummaryrefslogtreecommitdiff
path: root/buildroot/share/pin_interrupt_test
diff options
context:
space:
mode:
authorGeorgiy Bondarenko <69736697+nehilo@users.noreply.github.com>2021-03-04 20:54:23 +0300
committerGeorgiy Bondarenko <69736697+nehilo@users.noreply.github.com>2021-03-04 20:54:23 +0300
commite8701195e66f2d27ffe17fb514eae8173795aaf7 (patch)
tree9f519c4abf6556b9ae7190a6210d87ead1dfadde /buildroot/share/pin_interrupt_test
downloadkp3s-lgvl-e8701195e66f2d27ffe17fb514eae8173795aaf7.tar.xz
kp3s-lgvl-e8701195e66f2d27ffe17fb514eae8173795aaf7.zip
Initial commit
Diffstat (limited to 'buildroot/share/pin_interrupt_test')
-rw-r--r--buildroot/share/pin_interrupt_test/pin_interrupt_test.ino32
1 files changed, 32 insertions, 0 deletions
diff --git a/buildroot/share/pin_interrupt_test/pin_interrupt_test.ino b/buildroot/share/pin_interrupt_test/pin_interrupt_test.ino
new file mode 100644
index 0000000..6dcfb67
--- /dev/null
+++ b/buildroot/share/pin_interrupt_test/pin_interrupt_test.ino
@@ -0,0 +1,32 @@
+// Search pins usable for endstop-interrupts
+// Compile with the same build settings you'd use for Marlin.
+
+#if defined(ARDUINO_AVR_MEGA2560) || defined(ARDUINO_AVR_MEGA)
+ #undef digitalPinToPCICR
+ #define digitalPinToPCICR(p) ( ((p) >= 10 && (p) <= 15) || \
+ ((p) >= 50 && (p) <= 53) || \
+ ((p) >= 62 && (p) <= 69) ? (&PCICR) : nullptr)
+#endif
+
+void setup() {
+ Serial.begin(9600);
+ Serial.println("PINs causing interrupts are:");
+ for (int i = 2; i < NUM_DIGITAL_PINS; i++) {
+ if (digitalPinToPCICR(i) || (int)digitalPinToInterrupt(i) != -1) {
+ for (int j = 0; j < NUM_ANALOG_INPUTS; j++) {
+ if (analogInputToDigitalPin(j) == i) {
+ Serial.print('A');
+ Serial.print(j);
+ Serial.print(" = ");
+ }
+ }
+ Serial.print('D');
+ Serial.println(i);
+ }
+ }
+ Serial.println("Arduino pin numbering!");
+}
+
+void loop() {
+ // put your main code here, to run repeatedly:
+}