PlatformIO package of the Teensy core framework compatible with GCC 10 & C++20
Du kannst nicht mehr als 25 Themen auswählen Themen müssen entweder mit einem Buchstaben oder einer Ziffer beginnen. Sie können Bindestriche („-“) enthalten und bis zu 35 Zeichen lang sein.

interrupt_pins.h 8.3KB

vor 3 Jahren
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291
  1. // interrupt pins for known boards
  2. // Teensy (and maybe others) define these automatically
  3. #if !defined(CORE_NUM_INTERRUPT)
  4. // Wiring boards
  5. #if defined(WIRING)
  6. #define CORE_NUM_INTERRUPT NUM_EXTERNAL_INTERRUPTS
  7. #if NUM_EXTERNAL_INTERRUPTS > 0
  8. #define CORE_INT0_PIN EI0
  9. #endif
  10. #if NUM_EXTERNAL_INTERRUPTS > 1
  11. #define CORE_INT1_PIN EI1
  12. #endif
  13. #if NUM_EXTERNAL_INTERRUPTS > 2
  14. #define CORE_INT2_PIN EI2
  15. #endif
  16. #if NUM_EXTERNAL_INTERRUPTS > 3
  17. #define CORE_INT3_PIN EI3
  18. #endif
  19. #if NUM_EXTERNAL_INTERRUPTS > 4
  20. #define CORE_INT4_PIN EI4
  21. #endif
  22. #if NUM_EXTERNAL_INTERRUPTS > 5
  23. #define CORE_INT5_PIN EI5
  24. #endif
  25. #if NUM_EXTERNAL_INTERRUPTS > 6
  26. #define CORE_INT6_PIN EI6
  27. #endif
  28. #if NUM_EXTERNAL_INTERRUPTS > 7
  29. #define CORE_INT7_PIN EI7
  30. #endif
  31. // Arduino Uno, Duemilanove, Diecimila, LilyPad, Mini, Fio, etc...
  32. #elif defined(__AVR_ATmega328P__) || defined(__AVR_ATmega328PB__) ||defined(__AVR_ATmega168__) || defined(__AVR_ATmega8__)
  33. #define CORE_NUM_INTERRUPT 2
  34. #define CORE_INT0_PIN 2
  35. #define CORE_INT1_PIN 3
  36. // Arduino Mega
  37. #elif defined(__AVR_ATmega1280__) || defined(__AVR_ATmega2560__)
  38. #define CORE_NUM_INTERRUPT 6
  39. #define CORE_INT0_PIN 2
  40. #define CORE_INT1_PIN 3
  41. #define CORE_INT2_PIN 21
  42. #define CORE_INT3_PIN 20
  43. #define CORE_INT4_PIN 19
  44. #define CORE_INT5_PIN 18
  45. // Arduino Nano Every, Uno R2 Wifi
  46. #elif defined(__AVR_ATmega4809__)
  47. #define CORE_NUM_INTERRUPT 13
  48. #define CORE_INT0_PIN 0
  49. #define CORE_INT1_PIN 1
  50. #define CORE_INT2_PIN 2
  51. #define CORE_INT3_PIN 3
  52. #define CORE_INT4_PIN 4
  53. #define CORE_INT5_PIN 5
  54. #define CORE_INT6_PIN 6
  55. #define CORE_INT7_PIN 7
  56. #define CORE_INT8_PIN 8
  57. #define CORE_INT9_PIN 9
  58. #define CORE_INT10_PIN 10
  59. #define CORE_INT11_PIN 11
  60. #define CORE_INT12_PIN 12
  61. #define CORE_INT13_PIN 13
  62. // Arduino Leonardo (untested)
  63. #elif defined(__AVR_ATmega32U4__) && !defined(CORE_TEENSY)
  64. #define CORE_NUM_INTERRUPT 5
  65. #define CORE_INT0_PIN 3
  66. #define CORE_INT1_PIN 2
  67. #define CORE_INT2_PIN 0
  68. #define CORE_INT3_PIN 1
  69. #define CORE_INT4_PIN 7
  70. // Sanguino (untested) and ATmega1284P
  71. #elif defined(__AVR_ATmega644P__) || defined(__AVR_ATmega644__) || defined(__AVR_ATmega1284P__)
  72. #define CORE_NUM_INTERRUPT 3
  73. #define CORE_INT0_PIN 10
  74. #define CORE_INT1_PIN 11
  75. #define CORE_INT2_PIN 2
  76. // ATmega32u2 and ATmega32u16 based boards with HoodLoader2
  77. #elif defined(__AVR_ATmega32U2__) || defined(__AVR_ATmega16U2__)
  78. #define CORE_NUM_INTERRUPT 8
  79. #define CORE_INT0_PIN 8
  80. #define CORE_INT1_PIN 17
  81. #define CORE_INT2_PIN 13
  82. #define CORE_INT3_PIN 14
  83. #define CORE_INT4_PIN 15
  84. #define CORE_INT5_PIN 16
  85. #define CORE_INT6_PIN 19
  86. #define CORE_INT7_PIN 20
  87. // Chipkit Uno32 - attachInterrupt may not support CHANGE option
  88. #elif defined(__PIC32MX__) && defined(_BOARD_UNO_)
  89. #define CORE_NUM_INTERRUPT 5
  90. #define CORE_INT0_PIN 38
  91. #define CORE_INT1_PIN 2
  92. #define CORE_INT2_PIN 7
  93. #define CORE_INT3_PIN 8
  94. #define CORE_INT4_PIN 35
  95. // Chipkit Uno32 - attachInterrupt may not support CHANGE option
  96. #elif defined(__PIC32MX__) && defined(_BOARD_MEGA_)
  97. #define CORE_NUM_INTERRUPT 5
  98. #define CORE_INT0_PIN 3
  99. #define CORE_INT1_PIN 2
  100. #define CORE_INT2_PIN 7
  101. #define CORE_INT3_PIN 21
  102. #define CORE_INT4_PIN 20
  103. // http://hlt.media.mit.edu/?p=1229
  104. #elif defined(__AVR_ATtiny45__) || defined(__AVR_ATtiny85__)
  105. #define CORE_NUM_INTERRUPT 1
  106. #define CORE_INT0_PIN 2
  107. // ATtiny441 ATtiny841
  108. #elif defined(__AVR_ATtiny441__) || defined(__AVR_ATtiny841__)
  109. #define CORE_NUM_INTERRUPT 1
  110. #define CORE_INT0_PIN 9
  111. //https://github.com/SpenceKonde/ATTinyCore/blob/master/avr/extras/ATtiny_x313.md
  112. #elif defined(__AVR_ATtinyX313__)
  113. #define CORE_NUM_INTERRUPT 2
  114. #define CORE_INT0_PIN 4
  115. #define CORE_INT1_PIN 5
  116. // Attiny167 same core as abobe
  117. #elif defined(__AVR_ATtiny167__)
  118. #define CORE_NUM_INTERRUPT 2
  119. #define CORE_INT0_PIN 14
  120. #define CORE_INT1_PIN 3
  121. // Arduino Due
  122. #elif defined(__SAM3X8E__)
  123. #define CORE_NUM_INTERRUPT 54
  124. #define CORE_INT0_PIN 0
  125. #define CORE_INT1_PIN 1
  126. #define CORE_INT2_PIN 2
  127. #define CORE_INT3_PIN 3
  128. #define CORE_INT4_PIN 4
  129. #define CORE_INT5_PIN 5
  130. #define CORE_INT6_PIN 6
  131. #define CORE_INT7_PIN 7
  132. #define CORE_INT8_PIN 8
  133. #define CORE_INT9_PIN 9
  134. #define CORE_INT10_PIN 10
  135. #define CORE_INT11_PIN 11
  136. #define CORE_INT12_PIN 12
  137. #define CORE_INT13_PIN 13
  138. #define CORE_INT14_PIN 14
  139. #define CORE_INT15_PIN 15
  140. #define CORE_INT16_PIN 16
  141. #define CORE_INT17_PIN 17
  142. #define CORE_INT18_PIN 18
  143. #define CORE_INT19_PIN 19
  144. #define CORE_INT20_PIN 20
  145. #define CORE_INT21_PIN 21
  146. #define CORE_INT22_PIN 22
  147. #define CORE_INT23_PIN 23
  148. #define CORE_INT24_PIN 24
  149. #define CORE_INT25_PIN 25
  150. #define CORE_INT26_PIN 26
  151. #define CORE_INT27_PIN 27
  152. #define CORE_INT28_PIN 28
  153. #define CORE_INT29_PIN 29
  154. #define CORE_INT30_PIN 30
  155. #define CORE_INT31_PIN 31
  156. #define CORE_INT32_PIN 32
  157. #define CORE_INT33_PIN 33
  158. #define CORE_INT34_PIN 34
  159. #define CORE_INT35_PIN 35
  160. #define CORE_INT36_PIN 36
  161. #define CORE_INT37_PIN 37
  162. #define CORE_INT38_PIN 38
  163. #define CORE_INT39_PIN 39
  164. #define CORE_INT40_PIN 40
  165. #define CORE_INT41_PIN 41
  166. #define CORE_INT42_PIN 42
  167. #define CORE_INT43_PIN 43
  168. #define CORE_INT44_PIN 44
  169. #define CORE_INT45_PIN 45
  170. #define CORE_INT46_PIN 46
  171. #define CORE_INT47_PIN 47
  172. #define CORE_INT48_PIN 48
  173. #define CORE_INT49_PIN 49
  174. #define CORE_INT50_PIN 50
  175. #define CORE_INT51_PIN 51
  176. #define CORE_INT52_PIN 52
  177. #define CORE_INT53_PIN 53
  178. // ESP8266 (https://github.com/esp8266/Arduino/)
  179. #elif defined(ESP8266)
  180. #define CORE_NUM_INTERRUPT EXTERNAL_NUM_INTERRUPTS
  181. #define CORE_INT0_PIN 0
  182. #define CORE_INT1_PIN 1
  183. #define CORE_INT2_PIN 2
  184. #define CORE_INT3_PIN 3
  185. #define CORE_INT4_PIN 4
  186. #define CORE_INT5_PIN 5
  187. // GPIO6-GPIO11 are typically used to interface with the flash memory IC on
  188. // most esp8266 modules, so we should avoid adding interrupts to these pins.
  189. #define CORE_INT12_PIN 12
  190. #define CORE_INT13_PIN 13
  191. #define CORE_INT14_PIN 14
  192. #define CORE_INT15_PIN 15
  193. // ESP32 (https://github.com/espressif/arduino-esp32)
  194. #elif defined(ESP32)
  195. #define CORE_NUM_INTERRUPT 40
  196. #define CORE_INT0_PIN 0
  197. #define CORE_INT1_PIN 1
  198. #define CORE_INT2_PIN 2
  199. #define CORE_INT3_PIN 3
  200. #define CORE_INT4_PIN 4
  201. #define CORE_INT5_PIN 5
  202. // GPIO6-GPIO11 are typically used to interface with the flash memory IC on
  203. // esp32, so we should avoid adding interrupts to these pins.
  204. #define CORE_INT12_PIN 12
  205. #define CORE_INT13_PIN 13
  206. #define CORE_INT14_PIN 14
  207. #define CORE_INT15_PIN 15
  208. #define CORE_INT16_PIN 16
  209. #define CORE_INT17_PIN 17
  210. #define CORE_INT18_PIN 18
  211. #define CORE_INT19_PIN 19
  212. #define CORE_INT21_PIN 21
  213. #define CORE_INT22_PIN 22
  214. #define CORE_INT23_PIN 23
  215. #define CORE_INT25_PIN 25
  216. #define CORE_INT26_PIN 26
  217. #define CORE_INT27_PIN 27
  218. #define CORE_INT32_PIN 32
  219. #define CORE_INT33_PIN 33
  220. #define CORE_INT34_PIN 34
  221. #define CORE_INT35_PIN 35
  222. #define CORE_INT36_PIN 36
  223. #define CORE_INT39_PIN 39
  224. // Arduino Zero - TODO: interrupts do not seem to work
  225. // please help, contribute a fix!
  226. #elif defined(__SAMD21G18A__) || defined(__SAMD51__)
  227. #define CORE_NUM_INTERRUPT 20
  228. #define CORE_INT0_PIN 0
  229. #define CORE_INT1_PIN 1
  230. #define CORE_INT2_PIN 2
  231. #define CORE_INT3_PIN 3
  232. #define CORE_INT5_PIN 5
  233. #define CORE_INT6_PIN 6
  234. #define CORE_INT7_PIN 7
  235. #define CORE_INT8_PIN 8
  236. #define CORE_INT9_PIN 9
  237. #define CORE_INT10_PIN 10
  238. #define CORE_INT11_PIN 11
  239. #define CORE_INT12_PIN 12
  240. #define CORE_INT13_PIN 13
  241. #define CORE_INT14_PIN 14
  242. #define CORE_INT15_PIN 15
  243. #define CORE_INT16_PIN 16
  244. #define CORE_INT17_PIN 17
  245. #define CORE_INT18_PIN 18
  246. #define CORE_INT19_PIN 19
  247. // Arduino 101
  248. #elif defined(__arc__)
  249. #define CORE_NUM_INTERRUPT 14
  250. #define CORE_INT2_PIN 2
  251. #define CORE_INT5_PIN 5
  252. #define CORE_INT7_PIN 7
  253. #define CORE_INT8_PIN 8
  254. #define CORE_INT10_PIN 10
  255. #define CORE_INT11_PIN 11
  256. #define CORE_INT12_PIN 12
  257. #define CORE_INT13_PIN 13
  258. #endif
  259. #endif
  260. #if !defined(CORE_NUM_INTERRUPT)
  261. #error "Interrupts are unknown for this board, please add to this code"
  262. #endif
  263. #if CORE_NUM_INTERRUPT <= 0
  264. #error "Encoder requires interrupt pins, but this board does not have any :("
  265. #error "You could try defining ENCODER_DO_NOT_USE_INTERRUPTS as a kludge."
  266. #endif