Subversion Repositories Tronxy-X3A-Marlin

Rev

Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
1 ron 1
// Search pins usable for endstop-interrupts
2
// Compile with the same build settings you'd use for Marlin.
3
 
4
#if defined(ARDUINO_AVR_MEGA2560) || defined(ARDUINO_AVR_MEGA)
5
    #undef  digitalPinToPCICR
6
    #define digitalPinToPCICR(p)    ( ((p) >= 10 && (p) <= 15) || \
7
                                      ((p) >= 50 && (p) <= 53) || \
8
                                      ((p) >= 62 && (p) <= 69) ? &PCICR : (uint8_t *)0)
9
#endif
10
 
11
void setup() {
12
  Serial.begin(9600);
13
  Serial.println("PINs causing interrups are:");
14
  for (int i = 2; i < NUM_DIGITAL_PINS; i++) {
15
    if (digitalPinToPCICR(i) || (int)digitalPinToInterrupt(i) != -1) {
16
      for (int j = 0; j < NUM_ANALOG_INPUTS; j++) {
17
        if (analogInputToDigitalPin(j) == i) {
18
          Serial.print('A');
19
          Serial.print(j);
20
          Serial.print(" = ");
21
        }
22
      }
23
      Serial.print('D');
24
      Serial.println(i);
25
    }
26
  }
27
  Serial.println("Arduino pin numbering!");
28
}
29
 
30
void loop() {
31
  // put your main code here, to run repeatedly:
32
}