intpin.h 738 B

123456789101112131415161718192021222324252627
  1. #ifndef _INTPIN_H_
  2. #define _INTPIN_H_
  3. #ifndef INTPIN
  4. #error you must define INTPIN (interrupt number such as 0, 1 or 2) before calling intpin.h !
  5. #endif
  6. #if INTPIN==0
  7. #define INTPIN_IF INTCONbits.INT0IF
  8. #define INTPIN_IE INTCONbits.INT0IE
  9. #define INTPIN_IP WREG // INT0 is always high
  10. #define INTPIN_EDGE INTCON2bits.INTEDG0
  11. #elif INTPIN==1
  12. #define INTPIN_IF INTCON3bits.INT1IF
  13. #define INTPIN_IE INTCON3bits.INT1IE
  14. #define INTPIN_IP INTCON3bits.INT1IP
  15. #define INTPIN_EDGE INTCON2bits.INTEDG1
  16. #elif INTPIN==2
  17. #define INTPIN_IF INTCON3bits.INT2IF
  18. #define INTPIN_IE INTCON3bits.INT2IE
  19. #define INTPIN_IP INTCON3bits.INT2IP
  20. #define INTPIN_EDGE INTCON2bits.INTEDG2
  21. #endif
  22. #endif // _INTPIN_H