_PCINT_struct.h 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. #if ! ( defined __AVR_ATmega2560__ || defined __AVR_ATmega1280__ || defined __AVR_ATmega1281__ || defined __AVR_ATmega2561__ || defined __AVR_ATmega640__ )
  2. #error "This sketch only works on chips in the ATmega2560 family."
  3. #endif
  4. // PIN NAMING
  5. // For the Analog Input pins used as digital input pins, you can call them 14, 15, 16, etc.
  6. // or you can use A0, A1, A2, etc. (the Arduino code will properly recognize the symbolic names,
  7. // for example, pinMode(A0, INPUT_PULLUP);
  8. // For Arduino MEGA (AT2560-based), besides the regular pins and the A (analog) pins,
  9. // you have 4 more pins with defined names:
  10. // SS = 53
  11. // MOSI = 51
  12. // MISO = 50
  13. // SCK = 52
  14. // NOW CHOOSE PINS
  15. #define FIRST_ANALOG_PIN 54
  16. #define TOTAL_PINS 69 //97 // 69 // But only 18 of them (not including RX0) are PinChangeInt-compatible
  17. // Don't use RX0 (Arduino pin 0) in this program- it won't work this is the
  18. // pin that Serial.print() uses!
  19. // See the Arduino and the chip documentation for more details.
  20. #define MYPIN1 ROTTARY_SW_clk // ROTTARY_SW_sw // ROTTARY_SW_sw // SS
  21. #define MYPIN2 ROTTARY_SW_dt // SCK
  22. #define MYPIN3 ROTTARY_SW_sw // A8 //ROTTARY_SW_sw // MOSI
  23. //#define MYPIN4 ROTTARY_SW_sw // A8 //ROTTARY_SW_sw // MOSI
  24. #define PIN3TEXT "ROTTARY_SW_sw " // This will say what MYPIN3 is, on the serial monitor
  25. volatile uint8_t latest_interrupted_pin;
  26. volatile uint8_t interrupt_count[TOTAL_PINS]={0}; // possible arduino pins
  27. volatile uint8_t pin3Count=0;
  28. /*
  29. volatile unsigned int encoder0Pos = 0;
  30. static boolean rotating = false;
  31. */