You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

пре 4 година
пре 4 година
пре 4 година
пре 4 година
пре 4 година
пре 4 година
пре 4 година
пре 4 година
пре 4 година
пре 4 година
пре 4 година
пре 4 година
пре 4 година
пре 5 година
пре 4 година
пре 4 година
пре 4 година
пре 4 година
пре 4 година
пре 4 година
пре 4 година
пре 4 година
пре 5 година
пре 4 година
пре 4 година
пре 4 година
пре 4 година
пре 4 година
пре 4 година
пре 4 година
пре 5 година
пре 5 година
12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408
  1. /* Teensyduino Core Library
  2. * http://www.pjrc.com/teensy/
  3. * Copyright (c) 2018 PJRC.COM, LLC.
  4. *
  5. * Permission is hereby granted, free of charge, to any person obtaining
  6. * a copy of this software and associated documentation files (the
  7. * "Software"), to deal in the Software without restriction, including
  8. * without limitation the rights to use, copy, modify, merge, publish,
  9. * distribute, sublicense, and/or sell copies of the Software, and to
  10. * permit persons to whom the Software is furnished to do so, subject to
  11. * the following conditions:
  12. *
  13. * 1. The above copyright notice and this permission notice shall be
  14. * included in all copies or substantial portions of the Software.
  15. *
  16. * 2. If the Software is incorporated into a build system that allows
  17. * selection among a list of target devices, then similar target
  18. * devices manufactured by PJRC.COM must be included in the list of
  19. * target devices and selectable in the same manner.
  20. *
  21. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
  22. * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
  23. * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
  24. * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
  25. * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
  26. * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
  27. * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
  28. * SOFTWARE.
  29. */
  30. #pragma once
  31. #include "imxrt.h"
  32. #include "pins_arduino.h"
  33. #define HIGH 1
  34. #define LOW 0
  35. #define INPUT 0
  36. #define OUTPUT 1
  37. #define INPUT_PULLUP 2
  38. #define INPUT_PULLDOWN 3
  39. #define OUTPUT_OPENDRAIN 4
  40. #define INPUT_DISABLE 5
  41. #define LSBFIRST 0
  42. #define MSBFIRST 1
  43. #define _BV(n) (1<<(n))
  44. #define CHANGE 4
  45. #define FALLING 2
  46. #define RISING 3
  47. #if defined(__IMXRT1062__) && defined(ARDUINO_TEENSY40)
  48. #define CORE_NUM_TOTAL_PINS 40
  49. #define CORE_NUM_DIGITAL 40
  50. #define CORE_NUM_INTERRUPT 40
  51. #define CORE_NUM_ANALOG 14
  52. #define CORE_NUM_PWM 27
  53. #define CORE_PIN0_BIT 3
  54. #define CORE_PIN1_BIT 2
  55. #define CORE_PIN2_BIT 4
  56. #define CORE_PIN3_BIT 5
  57. #define CORE_PIN4_BIT 6
  58. #define CORE_PIN5_BIT 8
  59. #define CORE_PIN6_BIT 10
  60. #define CORE_PIN7_BIT 17
  61. #define CORE_PIN8_BIT 16
  62. #define CORE_PIN9_BIT 11
  63. #define CORE_PIN10_BIT 0
  64. #define CORE_PIN11_BIT 2
  65. #define CORE_PIN12_BIT 1
  66. #define CORE_PIN13_BIT 3
  67. #define CORE_PIN14_BIT 18
  68. #define CORE_PIN15_BIT 19
  69. #define CORE_PIN16_BIT 23
  70. #define CORE_PIN17_BIT 22
  71. #define CORE_PIN18_BIT 17
  72. #define CORE_PIN19_BIT 16
  73. #define CORE_PIN20_BIT 26
  74. #define CORE_PIN21_BIT 27
  75. #define CORE_PIN22_BIT 24
  76. #define CORE_PIN23_BIT 25
  77. #define CORE_PIN24_BIT 12
  78. #define CORE_PIN25_BIT 13
  79. #define CORE_PIN26_BIT 30
  80. #define CORE_PIN27_BIT 31
  81. #define CORE_PIN28_BIT 18
  82. #define CORE_PIN29_BIT 31
  83. #define CORE_PIN30_BIT 23
  84. #define CORE_PIN31_BIT 22
  85. #define CORE_PIN32_BIT 12
  86. #define CORE_PIN33_BIT 7
  87. #define CORE_PIN34_BIT 15
  88. #define CORE_PIN35_BIT 14
  89. #define CORE_PIN36_BIT 13
  90. #define CORE_PIN37_BIT 12
  91. #define CORE_PIN38_BIT 17
  92. #define CORE_PIN39_BIT 16
  93. #define CORE_PIN0_BITMASK (1<<(CORE_PIN0_BIT))
  94. #define CORE_PIN1_BITMASK (1<<(CORE_PIN1_BIT))
  95. #define CORE_PIN2_BITMASK (1<<(CORE_PIN2_BIT))
  96. #define CORE_PIN3_BITMASK (1<<(CORE_PIN3_BIT))
  97. #define CORE_PIN4_BITMASK (1<<(CORE_PIN4_BIT))
  98. #define CORE_PIN5_BITMASK (1<<(CORE_PIN5_BIT))
  99. #define CORE_PIN6_BITMASK (1<<(CORE_PIN6_BIT))
  100. #define CORE_PIN7_BITMASK (1<<(CORE_PIN7_BIT))
  101. #define CORE_PIN8_BITMASK (1<<(CORE_PIN8_BIT))
  102. #define CORE_PIN9_BITMASK (1<<(CORE_PIN9_BIT))
  103. #define CORE_PIN10_BITMASK (1<<(CORE_PIN10_BIT))
  104. #define CORE_PIN11_BITMASK (1<<(CORE_PIN11_BIT))
  105. #define CORE_PIN12_BITMASK (1<<(CORE_PIN12_BIT))
  106. #define CORE_PIN13_BITMASK (1<<(CORE_PIN13_BIT))
  107. #define CORE_PIN14_BITMASK (1<<(CORE_PIN14_BIT))
  108. #define CORE_PIN15_BITMASK (1<<(CORE_PIN15_BIT))
  109. #define CORE_PIN16_BITMASK (1<<(CORE_PIN16_BIT))
  110. #define CORE_PIN17_BITMASK (1<<(CORE_PIN17_BIT))
  111. #define CORE_PIN18_BITMASK (1<<(CORE_PIN18_BIT))
  112. #define CORE_PIN19_BITMASK (1<<(CORE_PIN19_BIT))
  113. #define CORE_PIN20_BITMASK (1<<(CORE_PIN20_BIT))
  114. #define CORE_PIN21_BITMASK (1<<(CORE_PIN21_BIT))
  115. #define CORE_PIN22_BITMASK (1<<(CORE_PIN22_BIT))
  116. #define CORE_PIN23_BITMASK (1<<(CORE_PIN23_BIT))
  117. #define CORE_PIN24_BITMASK (1<<(CORE_PIN24_BIT))
  118. #define CORE_PIN25_BITMASK (1<<(CORE_PIN25_BIT))
  119. #define CORE_PIN26_BITMASK (1<<(CORE_PIN26_BIT))
  120. #define CORE_PIN27_BITMASK (1<<(CORE_PIN27_BIT))
  121. #define CORE_PIN28_BITMASK (1<<(CORE_PIN28_BIT))
  122. #define CORE_PIN29_BITMASK (1<<(CORE_PIN29_BIT))
  123. #define CORE_PIN30_BITMASK (1<<(CORE_PIN30_BIT))
  124. #define CORE_PIN31_BITMASK (1<<(CORE_PIN31_BIT))
  125. #define CORE_PIN32_BITMASK (1<<(CORE_PIN32_BIT))
  126. #define CORE_PIN33_BITMASK (1<<(CORE_PIN33_BIT))
  127. #define CORE_PIN34_BITMASK (1<<(CORE_PIN34_BIT))
  128. #define CORE_PIN35_BITMASK (1<<(CORE_PIN35_BIT))
  129. #define CORE_PIN36_BITMASK (1<<(CORE_PIN36_BIT))
  130. #define CORE_PIN37_BITMASK (1<<(CORE_PIN37_BIT))
  131. #define CORE_PIN38_BITMASK (1<<(CORE_PIN38_BIT))
  132. #define CORE_PIN39_BITMASK (1<<(CORE_PIN39_BIT))
  133. // Fast GPIO
  134. #define CORE_PIN0_PORTREG GPIO6_DR
  135. #define CORE_PIN1_PORTREG GPIO6_DR
  136. #define CORE_PIN2_PORTREG GPIO9_DR
  137. #define CORE_PIN3_PORTREG GPIO9_DR
  138. #define CORE_PIN4_PORTREG GPIO9_DR
  139. #define CORE_PIN5_PORTREG GPIO9_DR
  140. #define CORE_PIN6_PORTREG GPIO7_DR
  141. #define CORE_PIN7_PORTREG GPIO7_DR
  142. #define CORE_PIN8_PORTREG GPIO7_DR
  143. #define CORE_PIN9_PORTREG GPIO7_DR
  144. #define CORE_PIN10_PORTREG GPIO7_DR
  145. #define CORE_PIN11_PORTREG GPIO7_DR
  146. #define CORE_PIN12_PORTREG GPIO7_DR
  147. #define CORE_PIN13_PORTREG GPIO7_DR
  148. #define CORE_PIN14_PORTREG GPIO6_DR
  149. #define CORE_PIN15_PORTREG GPIO6_DR
  150. #define CORE_PIN16_PORTREG GPIO6_DR
  151. #define CORE_PIN17_PORTREG GPIO6_DR
  152. #define CORE_PIN18_PORTREG GPIO6_DR
  153. #define CORE_PIN19_PORTREG GPIO6_DR
  154. #define CORE_PIN20_PORTREG GPIO6_DR
  155. #define CORE_PIN21_PORTREG GPIO6_DR
  156. #define CORE_PIN22_PORTREG GPIO6_DR
  157. #define CORE_PIN23_PORTREG GPIO6_DR
  158. #define CORE_PIN24_PORTREG GPIO6_DR
  159. #define CORE_PIN25_PORTREG GPIO6_DR
  160. #define CORE_PIN26_PORTREG GPIO6_DR
  161. #define CORE_PIN27_PORTREG GPIO6_DR
  162. #define CORE_PIN28_PORTREG GPIO8_DR
  163. #define CORE_PIN29_PORTREG GPIO9_DR
  164. #define CORE_PIN30_PORTREG GPIO8_DR
  165. #define CORE_PIN31_PORTREG GPIO8_DR
  166. #define CORE_PIN32_PORTREG GPIO7_DR
  167. #define CORE_PIN33_PORTREG GPIO9_DR
  168. #define CORE_PIN34_PORTREG GPIO8_DR
  169. #define CORE_PIN35_PORTREG GPIO8_DR
  170. #define CORE_PIN36_PORTREG GPIO8_DR
  171. #define CORE_PIN37_PORTREG GPIO8_DR
  172. #define CORE_PIN38_PORTREG GPIO8_DR
  173. #define CORE_PIN39_PORTREG GPIO8_DR
  174. #define CORE_PIN0_PORTSET GPIO6_DR_SET
  175. #define CORE_PIN1_PORTSET GPIO6_DR_SET
  176. #define CORE_PIN2_PORTSET GPIO9_DR_SET
  177. #define CORE_PIN3_PORTSET GPIO9_DR_SET
  178. #define CORE_PIN4_PORTSET GPIO9_DR_SET
  179. #define CORE_PIN5_PORTSET GPIO9_DR_SET
  180. #define CORE_PIN6_PORTSET GPIO7_DR_SET
  181. #define CORE_PIN7_PORTSET GPIO7_DR_SET
  182. #define CORE_PIN8_PORTSET GPIO7_DR_SET
  183. #define CORE_PIN9_PORTSET GPIO7_DR_SET
  184. #define CORE_PIN10_PORTSET GPIO7_DR_SET
  185. #define CORE_PIN11_PORTSET GPIO7_DR_SET
  186. #define CORE_PIN12_PORTSET GPIO7_DR_SET
  187. #define CORE_PIN13_PORTSET GPIO7_DR_SET
  188. #define CORE_PIN14_PORTSET GPIO6_DR_SET
  189. #define CORE_PIN15_PORTSET GPIO6_DR_SET
  190. #define CORE_PIN16_PORTSET GPIO6_DR_SET
  191. #define CORE_PIN17_PORTSET GPIO6_DR_SET
  192. #define CORE_PIN18_PORTSET GPIO6_DR_SET
  193. #define CORE_PIN19_PORTSET GPIO6_DR_SET
  194. #define CORE_PIN20_PORTSET GPIO6_DR_SET
  195. #define CORE_PIN21_PORTSET GPIO6_DR_SET
  196. #define CORE_PIN22_PORTSET GPIO6_DR_SET
  197. #define CORE_PIN23_PORTSET GPIO6_DR_SET
  198. #define CORE_PIN24_PORTSET GPIO6_DR_SET
  199. #define CORE_PIN25_PORTSET GPIO6_DR_SET
  200. #define CORE_PIN26_PORTSET GPIO6_DR_SET
  201. #define CORE_PIN27_PORTSET GPIO6_DR_SET
  202. #define CORE_PIN28_PORTSET GPIO8_DR_SET
  203. #define CORE_PIN29_PORTSET GPIO9_DR_SET
  204. #define CORE_PIN30_PORTSET GPIO8_DR_SET
  205. #define CORE_PIN31_PORTSET GPIO8_DR_SET
  206. #define CORE_PIN32_PORTSET GPIO7_DR_SET
  207. #define CORE_PIN33_PORTSET GPIO9_DR_SET
  208. #define CORE_PIN34_PORTSET GPIO8_DR_SET
  209. #define CORE_PIN35_PORTSET GPIO8_DR_SET
  210. #define CORE_PIN36_PORTSET GPIO8_DR_SET
  211. #define CORE_PIN37_PORTSET GPIO8_DR_SET
  212. #define CORE_PIN38_PORTSET GPIO8_DR_SET
  213. #define CORE_PIN39_PORTSET GPIO8_DR_SET
  214. #define CORE_PIN0_PORTCLEAR GPIO6_DR_CLEAR
  215. #define CORE_PIN1_PORTCLEAR GPIO6_DR_CLEAR
  216. #define CORE_PIN2_PORTCLEAR GPIO9_DR_CLEAR
  217. #define CORE_PIN3_PORTCLEAR GPIO9_DR_CLEAR
  218. #define CORE_PIN4_PORTCLEAR GPIO9_DR_CLEAR
  219. #define CORE_PIN5_PORTCLEAR GPIO9_DR_CLEAR
  220. #define CORE_PIN6_PORTCLEAR GPIO7_DR_CLEAR
  221. #define CORE_PIN7_PORTCLEAR GPIO7_DR_CLEAR
  222. #define CORE_PIN8_PORTCLEAR GPIO7_DR_CLEAR
  223. #define CORE_PIN9_PORTCLEAR GPIO7_DR_CLEAR
  224. #define CORE_PIN10_PORTCLEAR GPIO7_DR_CLEAR
  225. #define CORE_PIN11_PORTCLEAR GPIO7_DR_CLEAR
  226. #define CORE_PIN12_PORTCLEAR GPIO7_DR_CLEAR
  227. #define CORE_PIN13_PORTCLEAR GPIO7_DR_CLEAR
  228. #define CORE_PIN14_PORTCLEAR GPIO6_DR_CLEAR
  229. #define CORE_PIN15_PORTCLEAR GPIO6_DR_CLEAR
  230. #define CORE_PIN16_PORTCLEAR GPIO6_DR_CLEAR
  231. #define CORE_PIN17_PORTCLEAR GPIO6_DR_CLEAR
  232. #define CORE_PIN18_PORTCLEAR GPIO6_DR_CLEAR
  233. #define CORE_PIN19_PORTCLEAR GPIO6_DR_CLEAR
  234. #define CORE_PIN20_PORTCLEAR GPIO6_DR_CLEAR
  235. #define CORE_PIN21_PORTCLEAR GPIO6_DR_CLEAR
  236. #define CORE_PIN22_PORTCLEAR GPIO6_DR_CLEAR
  237. #define CORE_PIN23_PORTCLEAR GPIO6_DR_CLEAR
  238. #define CORE_PIN24_PORTCLEAR GPIO6_DR_CLEAR
  239. #define CORE_PIN25_PORTCLEAR GPIO6_DR_CLEAR
  240. #define CORE_PIN26_PORTCLEAR GPIO6_DR_CLEAR
  241. #define CORE_PIN27_PORTCLEAR GPIO6_DR_CLEAR
  242. #define CORE_PIN28_PORTCLEAR GPIO8_DR_CLEAR
  243. #define CORE_PIN29_PORTCLEAR GPIO9_DR_CLEAR
  244. #define CORE_PIN30_PORTCLEAR GPIO8_DR_CLEAR
  245. #define CORE_PIN31_PORTCLEAR GPIO8_DR_CLEAR
  246. #define CORE_PIN32_PORTCLEAR GPIO7_DR_CLEAR
  247. #define CORE_PIN33_PORTCLEAR GPIO9_DR_CLEAR
  248. #define CORE_PIN34_PORTCLEAR GPIO8_DR_CLEAR
  249. #define CORE_PIN35_PORTCLEAR GPIO8_DR_CLEAR
  250. #define CORE_PIN36_PORTCLEAR GPIO8_DR_CLEAR
  251. #define CORE_PIN37_PORTCLEAR GPIO8_DR_CLEAR
  252. #define CORE_PIN38_PORTCLEAR GPIO8_DR_CLEAR
  253. #define CORE_PIN39_PORTCLEAR GPIO8_DR_CLEAR
  254. #define CORE_PIN0_PORTTOGGLE GPIO6_DR_TOGGLE
  255. #define CORE_PIN1_PORTTOGGLE GPIO6_DR_TOGGLE
  256. #define CORE_PIN2_PORTTOGGLE GPIO9_DR_TOGGLE
  257. #define CORE_PIN3_PORTTOGGLE GPIO9_DR_TOGGLE
  258. #define CORE_PIN4_PORTTOGGLE GPIO9_DR_TOGGLE
  259. #define CORE_PIN5_PORTTOGGLE GPIO9_DR_TOGGLE
  260. #define CORE_PIN6_PORTTOGGLE GPIO7_DR_TOGGLE
  261. #define CORE_PIN7_PORTTOGGLE GPIO7_DR_TOGGLE
  262. #define CORE_PIN8_PORTTOGGLE GPIO7_DR_TOGGLE
  263. #define CORE_PIN9_PORTTOGGLE GPIO7_DR_TOGGLE
  264. #define CORE_PIN10_PORTTOGGLE GPIO7_DR_TOGGLE
  265. #define CORE_PIN11_PORTTOGGLE GPIO7_DR_TOGGLE
  266. #define CORE_PIN12_PORTTOGGLE GPIO7_DR_TOGGLE
  267. #define CORE_PIN13_PORTTOGGLE GPIO7_DR_TOGGLE
  268. #define CORE_PIN14_PORTTOGGLE GPIO6_DR_TOGGLE
  269. #define CORE_PIN15_PORTTOGGLE GPIO6_DR_TOGGLE
  270. #define CORE_PIN16_PORTTOGGLE GPIO6_DR_TOGGLE
  271. #define CORE_PIN17_PORTTOGGLE GPIO6_DR_TOGGLE
  272. #define CORE_PIN18_PORTTOGGLE GPIO6_DR_TOGGLE
  273. #define CORE_PIN19_PORTTOGGLE GPIO6_DR_TOGGLE
  274. #define CORE_PIN20_PORTTOGGLE GPIO6_DR_TOGGLE
  275. #define CORE_PIN21_PORTTOGGLE GPIO6_DR_TOGGLE
  276. #define CORE_PIN22_PORTTOGGLE GPIO6_DR_TOGGLE
  277. #define CORE_PIN23_PORTTOGGLE GPIO6_DR_TOGGLE
  278. #define CORE_PIN24_PORTTOGGLE GPIO6_DR_TOGGLE
  279. #define CORE_PIN25_PORTTOGGLE GPIO6_DR_TOGGLE
  280. #define CORE_PIN26_PORTTOGGLE GPIO6_DR_TOGGLE
  281. #define CORE_PIN27_PORTTOGGLE GPIO6_DR_TOGGLE
  282. #define CORE_PIN28_PORTTOGGLE GPIO8_DR_TOGGLE
  283. #define CORE_PIN29_PORTTOGGLE GPIO9_DR_TOGGLE
  284. #define CORE_PIN30_PORTTOGGLE GPIO8_DR_TOGGLE
  285. #define CORE_PIN31_PORTTOGGLE GPIO8_DR_TOGGLE
  286. #define CORE_PIN32_PORTTOGGLE GPIO7_DR_TOGGLE
  287. #define CORE_PIN33_PORTTOGGLE GPIO9_DR_TOGGLE
  288. #define CORE_PIN34_PORTTOGGLE GPIO8_DR_TOGGLE
  289. #define CORE_PIN35_PORTTOGGLE GPIO8_DR_TOGGLE
  290. #define CORE_PIN36_PORTTOGGLE GPIO8_DR_TOGGLE
  291. #define CORE_PIN37_PORTTOGGLE GPIO8_DR_TOGGLE
  292. #define CORE_PIN38_PORTTOGGLE GPIO8_DR_TOGGLE
  293. #define CORE_PIN39_PORTTOGGLE GPIO8_DR_TOGGLE
  294. #define CORE_PIN0_DDRREG GPIO6_GDIR
  295. #define CORE_PIN1_DDRREG GPIO6_GDIR
  296. #define CORE_PIN2_DDRREG GPIO9_GDIR
  297. #define CORE_PIN3_DDRREG GPIO9_GDIR
  298. #define CORE_PIN4_DDRREG GPIO9_GDIR
  299. #define CORE_PIN5_DDRREG GPIO9_GDIR
  300. #define CORE_PIN6_DDRREG GPIO7_GDIR
  301. #define CORE_PIN7_DDRREG GPIO7_GDIR
  302. #define CORE_PIN8_DDRREG GPIO7_GDIR
  303. #define CORE_PIN9_DDRREG GPIO7_GDIR
  304. #define CORE_PIN10_DDRREG GPIO7_GDIR
  305. #define CORE_PIN11_DDRREG GPIO7_GDIR
  306. #define CORE_PIN12_DDRREG GPIO7_GDIR
  307. #define CORE_PIN13_DDRREG GPIO7_GDIR
  308. #define CORE_PIN14_DDRREG GPIO6_GDIR
  309. #define CORE_PIN15_DDRREG GPIO6_GDIR
  310. #define CORE_PIN16_DDRREG GPIO6_GDIR
  311. #define CORE_PIN17_DDRREG GPIO6_GDIR
  312. #define CORE_PIN18_DDRREG GPIO6_GDIR
  313. #define CORE_PIN19_DDRREG GPIO6_GDIR
  314. #define CORE_PIN20_DDRREG GPIO6_GDIR
  315. #define CORE_PIN21_DDRREG GPIO6_GDIR
  316. #define CORE_PIN22_DDRREG GPIO6_GDIR
  317. #define CORE_PIN23_DDRREG GPIO6_GDIR
  318. #define CORE_PIN24_DDRREG GPIO6_GDIR
  319. #define CORE_PIN25_DDRREG GPIO6_GDIR
  320. #define CORE_PIN26_DDRREG GPIO6_GDIR
  321. #define CORE_PIN27_DDRREG GPIO6_GDIR
  322. #define CORE_PIN28_DDRREG GPIO8_GDIR
  323. #define CORE_PIN29_DDRREG GPIO9_GDIR
  324. #define CORE_PIN30_DDRREG GPIO8_GDIR
  325. #define CORE_PIN31_DDRREG GPIO8_GDIR
  326. #define CORE_PIN32_DDRREG GPIO7_GDIR
  327. #define CORE_PIN33_DDRREG GPIO9_GDIR
  328. #define CORE_PIN34_DDRREG GPIO8_GDIR
  329. #define CORE_PIN35_DDRREG GPIO8_GDIR
  330. #define CORE_PIN36_DDRREG GPIO8_GDIR
  331. #define CORE_PIN37_DDRREG GPIO8_GDIR
  332. #define CORE_PIN38_DDRREG GPIO8_GDIR
  333. #define CORE_PIN39_DDRREG GPIO8_GDIR
  334. #define CORE_PIN0_PINREG GPIO6_PSR
  335. #define CORE_PIN1_PINREG GPIO6_PSR
  336. #define CORE_PIN2_PINREG GPIO9_PSR
  337. #define CORE_PIN3_PINREG GPIO9_PSR
  338. #define CORE_PIN4_PINREG GPIO9_PSR
  339. #define CORE_PIN5_PINREG GPIO9_PSR
  340. #define CORE_PIN6_PINREG GPIO7_PSR
  341. #define CORE_PIN7_PINREG GPIO7_PSR
  342. #define CORE_PIN8_PINREG GPIO7_PSR
  343. #define CORE_PIN9_PINREG GPIO7_PSR
  344. #define CORE_PIN10_PINREG GPIO7_PSR
  345. #define CORE_PIN11_PINREG GPIO7_PSR
  346. #define CORE_PIN12_PINREG GPIO7_PSR
  347. #define CORE_PIN13_PINREG GPIO7_PSR
  348. #define CORE_PIN14_PINREG GPIO6_PSR
  349. #define CORE_PIN15_PINREG GPIO6_PSR
  350. #define CORE_PIN16_PINREG GPIO6_PSR
  351. #define CORE_PIN17_PINREG GPIO6_PSR
  352. #define CORE_PIN18_PINREG GPIO6_PSR
  353. #define CORE_PIN19_PINREG GPIO6_PSR
  354. #define CORE_PIN20_PINREG GPIO6_PSR
  355. #define CORE_PIN21_PINREG GPIO6_PSR
  356. #define CORE_PIN22_PINREG GPIO6_PSR
  357. #define CORE_PIN23_PINREG GPIO6_PSR
  358. #define CORE_PIN24_PINREG GPIO6_PSR
  359. #define CORE_PIN25_PINREG GPIO6_PSR
  360. #define CORE_PIN26_PINREG GPIO6_PSR
  361. #define CORE_PIN27_PINREG GPIO6_PSR
  362. #define CORE_PIN28_PINREG GPIO8_PSR
  363. #define CORE_PIN29_PINREG GPIO9_PSR
  364. #define CORE_PIN30_PINREG GPIO8_PSR
  365. #define CORE_PIN31_PINREG GPIO8_PSR
  366. #define CORE_PIN32_PINREG GPIO7_PSR
  367. #define CORE_PIN33_PINREG GPIO9_PSR
  368. #define CORE_PIN34_PINREG GPIO8_PSR
  369. #define CORE_PIN35_PINREG GPIO8_PSR
  370. #define CORE_PIN36_PINREG GPIO8_PSR
  371. #define CORE_PIN37_PINREG GPIO8_PSR
  372. #define CORE_PIN38_PINREG GPIO8_PSR
  373. #define CORE_PIN39_PINREG GPIO8_PSR
  374. // mux config registers control which peripheral uses the pin
  375. #define CORE_PIN0_CONFIG IOMUXC_SW_MUX_CTL_PAD_GPIO_AD_B0_03
  376. #define CORE_PIN1_CONFIG IOMUXC_SW_MUX_CTL_PAD_GPIO_AD_B0_02
  377. #define CORE_PIN2_CONFIG IOMUXC_SW_MUX_CTL_PAD_GPIO_EMC_04
  378. #define CORE_PIN3_CONFIG IOMUXC_SW_MUX_CTL_PAD_GPIO_EMC_05
  379. #define CORE_PIN4_CONFIG IOMUXC_SW_MUX_CTL_PAD_GPIO_EMC_06
  380. #define CORE_PIN5_CONFIG IOMUXC_SW_MUX_CTL_PAD_GPIO_EMC_08
  381. #define CORE_PIN6_CONFIG IOMUXC_SW_MUX_CTL_PAD_GPIO_B0_10
  382. #define CORE_PIN7_CONFIG IOMUXC_SW_MUX_CTL_PAD_GPIO_B1_01
  383. #define CORE_PIN8_CONFIG IOMUXC_SW_MUX_CTL_PAD_GPIO_B1_00
  384. #define CORE_PIN9_CONFIG IOMUXC_SW_MUX_CTL_PAD_GPIO_B0_11
  385. #define CORE_PIN10_CONFIG IOMUXC_SW_MUX_CTL_PAD_GPIO_B0_00
  386. #define CORE_PIN11_CONFIG IOMUXC_SW_MUX_CTL_PAD_GPIO_B0_02
  387. #define CORE_PIN12_CONFIG IOMUXC_SW_MUX_CTL_PAD_GPIO_B0_01
  388. #define CORE_PIN13_CONFIG IOMUXC_SW_MUX_CTL_PAD_GPIO_B0_03
  389. #define CORE_PIN14_CONFIG IOMUXC_SW_MUX_CTL_PAD_GPIO_AD_B1_02
  390. #define CORE_PIN15_CONFIG IOMUXC_SW_MUX_CTL_PAD_GPIO_AD_B1_03
  391. #define CORE_PIN16_CONFIG IOMUXC_SW_MUX_CTL_PAD_GPIO_AD_B1_07
  392. #define CORE_PIN17_CONFIG IOMUXC_SW_MUX_CTL_PAD_GPIO_AD_B1_06
  393. #define CORE_PIN18_CONFIG IOMUXC_SW_MUX_CTL_PAD_GPIO_AD_B1_01
  394. #define CORE_PIN19_CONFIG IOMUXC_SW_MUX_CTL_PAD_GPIO_AD_B1_00
  395. #define CORE_PIN20_CONFIG IOMUXC_SW_MUX_CTL_PAD_GPIO_AD_B1_10
  396. #define CORE_PIN21_CONFIG IOMUXC_SW_MUX_CTL_PAD_GPIO_AD_B1_11
  397. #define CORE_PIN22_CONFIG IOMUXC_SW_MUX_CTL_PAD_GPIO_AD_B1_08
  398. #define CORE_PIN23_CONFIG IOMUXC_SW_MUX_CTL_PAD_GPIO_AD_B1_09
  399. #define CORE_PIN24_CONFIG IOMUXC_SW_MUX_CTL_PAD_GPIO_AD_B0_12
  400. #define CORE_PIN25_CONFIG IOMUXC_SW_MUX_CTL_PAD_GPIO_AD_B0_13
  401. #define CORE_PIN26_CONFIG IOMUXC_SW_MUX_CTL_PAD_GPIO_AD_B1_14
  402. #define CORE_PIN27_CONFIG IOMUXC_SW_MUX_CTL_PAD_GPIO_AD_B1_15
  403. #define CORE_PIN28_CONFIG IOMUXC_SW_MUX_CTL_PAD_GPIO_EMC_32
  404. #define CORE_PIN29_CONFIG IOMUXC_SW_MUX_CTL_PAD_GPIO_EMC_31
  405. #define CORE_PIN30_CONFIG IOMUXC_SW_MUX_CTL_PAD_GPIO_EMC_37
  406. #define CORE_PIN31_CONFIG IOMUXC_SW_MUX_CTL_PAD_GPIO_EMC_36
  407. #define CORE_PIN32_CONFIG IOMUXC_SW_MUX_CTL_PAD_GPIO_B0_12
  408. #define CORE_PIN33_CONFIG IOMUXC_SW_MUX_CTL_PAD_GPIO_EMC_07
  409. #define CORE_PIN34_CONFIG IOMUXC_SW_MUX_CTL_PAD_GPIO_SD_B0_03
  410. #define CORE_PIN35_CONFIG IOMUXC_SW_MUX_CTL_PAD_GPIO_SD_B0_02
  411. #define CORE_PIN36_CONFIG IOMUXC_SW_MUX_CTL_PAD_GPIO_SD_B0_01
  412. #define CORE_PIN37_CONFIG IOMUXC_SW_MUX_CTL_PAD_GPIO_SD_B0_00
  413. #define CORE_PIN38_CONFIG IOMUXC_SW_MUX_CTL_PAD_GPIO_SD_B0_05
  414. #define CORE_PIN39_CONFIG IOMUXC_SW_MUX_CTL_PAD_GPIO_SD_B0_04
  415. // pad config registers control pullup/pulldown/keeper, drive strength, etc
  416. #define CORE_PIN0_PADCONFIG IOMUXC_SW_PAD_CTL_PAD_GPIO_AD_B0_03
  417. #define CORE_PIN1_PADCONFIG IOMUXC_SW_PAD_CTL_PAD_GPIO_AD_B0_02
  418. #define CORE_PIN2_PADCONFIG IOMUXC_SW_PAD_CTL_PAD_GPIO_EMC_04
  419. #define CORE_PIN3_PADCONFIG IOMUXC_SW_PAD_CTL_PAD_GPIO_EMC_05
  420. #define CORE_PIN4_PADCONFIG IOMUXC_SW_PAD_CTL_PAD_GPIO_EMC_06
  421. #define CORE_PIN5_PADCONFIG IOMUXC_SW_PAD_CTL_PAD_GPIO_EMC_08
  422. #define CORE_PIN6_PADCONFIG IOMUXC_SW_PAD_CTL_PAD_GPIO_B0_10
  423. #define CORE_PIN7_PADCONFIG IOMUXC_SW_PAD_CTL_PAD_GPIO_B1_01
  424. #define CORE_PIN8_PADCONFIG IOMUXC_SW_PAD_CTL_PAD_GPIO_B1_00
  425. #define CORE_PIN9_PADCONFIG IOMUXC_SW_PAD_CTL_PAD_GPIO_B0_11
  426. #define CORE_PIN10_PADCONFIG IOMUXC_SW_PAD_CTL_PAD_GPIO_B0_00
  427. #define CORE_PIN11_PADCONFIG IOMUXC_SW_PAD_CTL_PAD_GPIO_B0_02
  428. #define CORE_PIN12_PADCONFIG IOMUXC_SW_PAD_CTL_PAD_GPIO_B0_01
  429. #define CORE_PIN13_PADCONFIG IOMUXC_SW_PAD_CTL_PAD_GPIO_B0_03
  430. #define CORE_PIN14_PADCONFIG IOMUXC_SW_PAD_CTL_PAD_GPIO_AD_B1_02
  431. #define CORE_PIN15_PADCONFIG IOMUXC_SW_PAD_CTL_PAD_GPIO_AD_B1_03
  432. #define CORE_PIN16_PADCONFIG IOMUXC_SW_PAD_CTL_PAD_GPIO_AD_B1_07
  433. #define CORE_PIN17_PADCONFIG IOMUXC_SW_PAD_CTL_PAD_GPIO_AD_B1_06
  434. #define CORE_PIN18_PADCONFIG IOMUXC_SW_PAD_CTL_PAD_GPIO_AD_B1_01
  435. #define CORE_PIN19_PADCONFIG IOMUXC_SW_PAD_CTL_PAD_GPIO_AD_B1_00
  436. #define CORE_PIN20_PADCONFIG IOMUXC_SW_PAD_CTL_PAD_GPIO_AD_B1_10
  437. #define CORE_PIN21_PADCONFIG IOMUXC_SW_PAD_CTL_PAD_GPIO_AD_B1_11
  438. #define CORE_PIN22_PADCONFIG IOMUXC_SW_PAD_CTL_PAD_GPIO_AD_B1_08
  439. #define CORE_PIN23_PADCONFIG IOMUXC_SW_PAD_CTL_PAD_GPIO_AD_B1_09
  440. #define CORE_PIN24_PADCONFIG IOMUXC_SW_PAD_CTL_PAD_GPIO_AD_B0_12
  441. #define CORE_PIN25_PADCONFIG IOMUXC_SW_PAD_CTL_PAD_GPIO_AD_B0_13
  442. #define CORE_PIN26_PADCONFIG IOMUXC_SW_PAD_CTL_PAD_GPIO_AD_B1_14
  443. #define CORE_PIN27_PADCONFIG IOMUXC_SW_PAD_CTL_PAD_GPIO_AD_B1_15
  444. #define CORE_PIN28_PADCONFIG IOMUXC_SW_PAD_CTL_PAD_GPIO_EMC_32
  445. #define CORE_PIN29_PADCONFIG IOMUXC_SW_PAD_CTL_PAD_GPIO_EMC_31
  446. #define CORE_PIN30_PADCONFIG IOMUXC_SW_PAD_CTL_PAD_GPIO_EMC_37
  447. #define CORE_PIN31_PADCONFIG IOMUXC_SW_PAD_CTL_PAD_GPIO_EMC_36
  448. #define CORE_PIN32_PADCONFIG IOMUXC_SW_PAD_CTL_PAD_GPIO_B0_12
  449. #define CORE_PIN33_PADCONFIG IOMUXC_SW_PAD_CTL_PAD_GPIO_EMC_07
  450. #define CORE_PIN34_PADCONFIG IOMUXC_SW_PAD_CTL_PAD_GPIO_SD_B0_03
  451. #define CORE_PIN35_PADCONFIG IOMUXC_SW_PAD_CTL_PAD_GPIO_SD_B0_02
  452. #define CORE_PIN36_PADCONFIG IOMUXC_SW_PAD_CTL_PAD_GPIO_SD_B0_01
  453. #define CORE_PIN37_PADCONFIG IOMUXC_SW_PAD_CTL_PAD_GPIO_SD_B0_00
  454. #define CORE_PIN38_PADCONFIG IOMUXC_SW_PAD_CTL_PAD_GPIO_SD_B0_05
  455. #define CORE_PIN39_PADCONFIG IOMUXC_SW_PAD_CTL_PAD_GPIO_SD_B0_04
  456. #define CORE_LED0_PIN 13
  457. #define CORE_ADC0_PIN 14
  458. #define CORE_ADC1_PIN 15
  459. #define CORE_ADC2_PIN 16
  460. #define CORE_ADC3_PIN 17
  461. #define CORE_ADC4_PIN 18
  462. #define CORE_ADC5_PIN 19
  463. #define CORE_ADC6_PIN 20
  464. #define CORE_ADC7_PIN 21
  465. #define CORE_ADC8_PIN 22
  466. #define CORE_ADC9_PIN 23
  467. #define CORE_RXD0_PIN 0
  468. #define CORE_TXD0_PIN 1
  469. #define CORE_RXD1_PIN 7
  470. #define CORE_TXD1_PIN 8
  471. #define CORE_RXD2_PIN 15
  472. #define CORE_TXD2_PIN 14
  473. #define CORE_RXD3_PIN 16
  474. #define CORE_TXD3_PIN 17
  475. #define CORE_RXD4_PIN 21
  476. #define CORE_TXD4_PIN 20
  477. #define CORE_RXD5_PIN 25
  478. #define CORE_TXD5_PIN 24
  479. #define CORE_RXD6_PIN 28
  480. #define CORE_TXD6_PIN 29
  481. #define CORE_INT0_PIN 0
  482. #define CORE_INT1_PIN 1
  483. #define CORE_INT2_PIN 2
  484. #define CORE_INT3_PIN 3
  485. #define CORE_INT4_PIN 4
  486. #define CORE_INT5_PIN 5
  487. #define CORE_INT6_PIN 6
  488. #define CORE_INT7_PIN 7
  489. #define CORE_INT8_PIN 8
  490. #define CORE_INT9_PIN 9
  491. #define CORE_INT10_PIN 10
  492. #define CORE_INT11_PIN 11
  493. #define CORE_INT12_PIN 12
  494. #define CORE_INT13_PIN 13
  495. #define CORE_INT14_PIN 14
  496. #define CORE_INT15_PIN 15
  497. #define CORE_INT16_PIN 16
  498. #define CORE_INT17_PIN 17
  499. #define CORE_INT18_PIN 18
  500. #define CORE_INT19_PIN 19
  501. #define CORE_INT20_PIN 20
  502. #define CORE_INT21_PIN 21
  503. #define CORE_INT22_PIN 22
  504. #define CORE_INT23_PIN 23
  505. #define CORE_INT24_PIN 24
  506. #define CORE_INT25_PIN 25
  507. #define CORE_INT26_PIN 26
  508. #define CORE_INT27_PIN 27
  509. #define CORE_INT28_PIN 28
  510. #define CORE_INT29_PIN 29
  511. #define CORE_INT30_PIN 30
  512. #define CORE_INT31_PIN 31
  513. #define CORE_INT32_PIN 32
  514. #define CORE_INT33_PIN 33
  515. #define CORE_INT34_PIN 34
  516. #define CORE_INT35_PIN 35
  517. #define CORE_INT36_PIN 36
  518. #define CORE_INT37_PIN 37
  519. #define CORE_INT38_PIN 38
  520. #define CORE_INT39_PIN 39
  521. #define CORE_INT_EVERY_PIN 1
  522. #elif defined(__IMXRT1062__) && defined(ARDUINO_TEENSY41)
  523. #define CORE_NUM_TOTAL_PINS 55
  524. #define CORE_NUM_DIGITAL 55
  525. #define CORE_NUM_INTERRUPT 55
  526. #define CORE_NUM_ANALOG 18
  527. #define CORE_NUM_PWM 31
  528. #define CORE_PIN0_BIT 3
  529. #define CORE_PIN1_BIT 2
  530. #define CORE_PIN2_BIT 4
  531. #define CORE_PIN3_BIT 5
  532. #define CORE_PIN4_BIT 6
  533. #define CORE_PIN5_BIT 8
  534. #define CORE_PIN6_BIT 10
  535. #define CORE_PIN7_BIT 17
  536. #define CORE_PIN8_BIT 16
  537. #define CORE_PIN9_BIT 11
  538. #define CORE_PIN10_BIT 0
  539. #define CORE_PIN11_BIT 2
  540. #define CORE_PIN12_BIT 1
  541. #define CORE_PIN13_BIT 3
  542. #define CORE_PIN14_BIT 18
  543. #define CORE_PIN15_BIT 19
  544. #define CORE_PIN16_BIT 23
  545. #define CORE_PIN17_BIT 22
  546. #define CORE_PIN18_BIT 17
  547. #define CORE_PIN19_BIT 16
  548. #define CORE_PIN20_BIT 26
  549. #define CORE_PIN21_BIT 27
  550. #define CORE_PIN22_BIT 24
  551. #define CORE_PIN23_BIT 25
  552. #define CORE_PIN24_BIT 12
  553. #define CORE_PIN25_BIT 13
  554. #define CORE_PIN26_BIT 30
  555. #define CORE_PIN27_BIT 31
  556. #define CORE_PIN28_BIT 18
  557. #define CORE_PIN29_BIT 31
  558. #define CORE_PIN30_BIT 23
  559. #define CORE_PIN31_BIT 22
  560. #define CORE_PIN32_BIT 12
  561. #define CORE_PIN33_BIT 7
  562. #define CORE_PIN34_BIT 29
  563. #define CORE_PIN35_BIT 28
  564. #define CORE_PIN36_BIT 18
  565. #define CORE_PIN37_BIT 19
  566. #define CORE_PIN38_BIT 28
  567. #define CORE_PIN39_BIT 29
  568. #define CORE_PIN40_BIT 20
  569. #define CORE_PIN41_BIT 21
  570. #define CORE_PIN42_BIT 15
  571. #define CORE_PIN43_BIT 14
  572. #define CORE_PIN44_BIT 13
  573. #define CORE_PIN45_BIT 12
  574. #define CORE_PIN46_BIT 17
  575. #define CORE_PIN47_BIT 16
  576. #define CORE_PIN48_BIT 24
  577. #define CORE_PIN49_BIT 27
  578. #define CORE_PIN50_BIT 28
  579. #define CORE_PIN51_BIT 22
  580. #define CORE_PIN52_BIT 26
  581. #define CORE_PIN53_BIT 25
  582. #define CORE_PIN54_BIT 29
  583. #define CORE_PIN0_BITMASK (1<<(CORE_PIN0_BIT))
  584. #define CORE_PIN1_BITMASK (1<<(CORE_PIN1_BIT))
  585. #define CORE_PIN2_BITMASK (1<<(CORE_PIN2_BIT))
  586. #define CORE_PIN3_BITMASK (1<<(CORE_PIN3_BIT))
  587. #define CORE_PIN4_BITMASK (1<<(CORE_PIN4_BIT))
  588. #define CORE_PIN5_BITMASK (1<<(CORE_PIN5_BIT))
  589. #define CORE_PIN6_BITMASK (1<<(CORE_PIN6_BIT))
  590. #define CORE_PIN7_BITMASK (1<<(CORE_PIN7_BIT))
  591. #define CORE_PIN8_BITMASK (1<<(CORE_PIN8_BIT))
  592. #define CORE_PIN9_BITMASK (1<<(CORE_PIN9_BIT))
  593. #define CORE_PIN10_BITMASK (1<<(CORE_PIN10_BIT))
  594. #define CORE_PIN11_BITMASK (1<<(CORE_PIN11_BIT))
  595. #define CORE_PIN12_BITMASK (1<<(CORE_PIN12_BIT))
  596. #define CORE_PIN13_BITMASK (1<<(CORE_PIN13_BIT))
  597. #define CORE_PIN14_BITMASK (1<<(CORE_PIN14_BIT))
  598. #define CORE_PIN15_BITMASK (1<<(CORE_PIN15_BIT))
  599. #define CORE_PIN16_BITMASK (1<<(CORE_PIN16_BIT))
  600. #define CORE_PIN17_BITMASK (1<<(CORE_PIN17_BIT))
  601. #define CORE_PIN18_BITMASK (1<<(CORE_PIN18_BIT))
  602. #define CORE_PIN19_BITMASK (1<<(CORE_PIN19_BIT))
  603. #define CORE_PIN20_BITMASK (1<<(CORE_PIN20_BIT))
  604. #define CORE_PIN21_BITMASK (1<<(CORE_PIN21_BIT))
  605. #define CORE_PIN22_BITMASK (1<<(CORE_PIN22_BIT))
  606. #define CORE_PIN23_BITMASK (1<<(CORE_PIN23_BIT))
  607. #define CORE_PIN24_BITMASK (1<<(CORE_PIN24_BIT))
  608. #define CORE_PIN25_BITMASK (1<<(CORE_PIN25_BIT))
  609. #define CORE_PIN26_BITMASK (1<<(CORE_PIN26_BIT))
  610. #define CORE_PIN27_BITMASK (1<<(CORE_PIN27_BIT))
  611. #define CORE_PIN28_BITMASK (1<<(CORE_PIN28_BIT))
  612. #define CORE_PIN29_BITMASK (1<<(CORE_PIN29_BIT))
  613. #define CORE_PIN30_BITMASK (1<<(CORE_PIN30_BIT))
  614. #define CORE_PIN31_BITMASK (1<<(CORE_PIN31_BIT))
  615. #define CORE_PIN32_BITMASK (1<<(CORE_PIN32_BIT))
  616. #define CORE_PIN33_BITMASK (1<<(CORE_PIN33_BIT))
  617. #define CORE_PIN34_BITMASK (1<<(CORE_PIN34_BIT))
  618. #define CORE_PIN35_BITMASK (1<<(CORE_PIN35_BIT))
  619. #define CORE_PIN36_BITMASK (1<<(CORE_PIN36_BIT))
  620. #define CORE_PIN37_BITMASK (1<<(CORE_PIN37_BIT))
  621. #define CORE_PIN38_BITMASK (1<<(CORE_PIN38_BIT))
  622. #define CORE_PIN39_BITMASK (1<<(CORE_PIN39_BIT))
  623. #define CORE_PIN40_BITMASK (1<<(CORE_PIN40_BIT))
  624. #define CORE_PIN41_BITMASK (1<<(CORE_PIN41_BIT))
  625. #define CORE_PIN42_BITMASK (1<<(CORE_PIN42_BIT))
  626. #define CORE_PIN43_BITMASK (1<<(CORE_PIN43_BIT))
  627. #define CORE_PIN44_BITMASK (1<<(CORE_PIN44_BIT))
  628. #define CORE_PIN45_BITMASK (1<<(CORE_PIN45_BIT))
  629. #define CORE_PIN46_BITMASK (1<<(CORE_PIN46_BIT))
  630. #define CORE_PIN47_BITMASK (1<<(CORE_PIN47_BIT))
  631. #define CORE_PIN48_BITMASK (1<<(CORE_PIN48_BIT))
  632. #define CORE_PIN49_BITMASK (1<<(CORE_PIN49_BIT))
  633. #define CORE_PIN50_BITMASK (1<<(CORE_PIN50_BIT))
  634. #define CORE_PIN51_BITMASK (1<<(CORE_PIN51_BIT))
  635. #define CORE_PIN52_BITMASK (1<<(CORE_PIN52_BIT))
  636. #define CORE_PIN53_BITMASK (1<<(CORE_PIN53_BIT))
  637. #define CORE_PIN54_BITMASK (1<<(CORE_PIN54_BIT))
  638. // Fast GPIO
  639. #define CORE_PIN0_PORTREG GPIO6_DR
  640. #define CORE_PIN1_PORTREG GPIO6_DR
  641. #define CORE_PIN2_PORTREG GPIO9_DR
  642. #define CORE_PIN3_PORTREG GPIO9_DR
  643. #define CORE_PIN4_PORTREG GPIO9_DR
  644. #define CORE_PIN5_PORTREG GPIO9_DR
  645. #define CORE_PIN6_PORTREG GPIO7_DR
  646. #define CORE_PIN7_PORTREG GPIO7_DR
  647. #define CORE_PIN8_PORTREG GPIO7_DR
  648. #define CORE_PIN9_PORTREG GPIO7_DR
  649. #define CORE_PIN10_PORTREG GPIO7_DR
  650. #define CORE_PIN11_PORTREG GPIO7_DR
  651. #define CORE_PIN12_PORTREG GPIO7_DR
  652. #define CORE_PIN13_PORTREG GPIO7_DR
  653. #define CORE_PIN14_PORTREG GPIO6_DR
  654. #define CORE_PIN15_PORTREG GPIO6_DR
  655. #define CORE_PIN16_PORTREG GPIO6_DR
  656. #define CORE_PIN17_PORTREG GPIO6_DR
  657. #define CORE_PIN18_PORTREG GPIO6_DR
  658. #define CORE_PIN19_PORTREG GPIO6_DR
  659. #define CORE_PIN20_PORTREG GPIO6_DR
  660. #define CORE_PIN21_PORTREG GPIO6_DR
  661. #define CORE_PIN22_PORTREG GPIO6_DR
  662. #define CORE_PIN23_PORTREG GPIO6_DR
  663. #define CORE_PIN24_PORTREG GPIO6_DR
  664. #define CORE_PIN25_PORTREG GPIO6_DR
  665. #define CORE_PIN26_PORTREG GPIO6_DR
  666. #define CORE_PIN27_PORTREG GPIO6_DR
  667. #define CORE_PIN28_PORTREG GPIO8_DR
  668. #define CORE_PIN29_PORTREG GPIO9_DR
  669. #define CORE_PIN30_PORTREG GPIO8_DR
  670. #define CORE_PIN31_PORTREG GPIO8_DR
  671. #define CORE_PIN32_PORTREG GPIO7_DR
  672. #define CORE_PIN33_PORTREG GPIO9_DR
  673. #define CORE_PIN34_PORTREG GPIO7_DR
  674. #define CORE_PIN35_PORTREG GPIO7_DR
  675. #define CORE_PIN36_PORTREG GPIO7_DR
  676. #define CORE_PIN37_PORTREG GPIO7_DR
  677. #define CORE_PIN38_PORTREG GPIO6_DR
  678. #define CORE_PIN39_PORTREG GPIO6_DR
  679. #define CORE_PIN40_PORTREG GPIO6_DR
  680. #define CORE_PIN41_PORTREG GPIO6_DR
  681. #define CORE_PIN42_PORTREG GPIO8_DR
  682. #define CORE_PIN43_PORTREG GPIO8_DR
  683. #define CORE_PIN44_PORTREG GPIO8_DR
  684. #define CORE_PIN45_PORTREG GPIO8_DR
  685. #define CORE_PIN46_PORTREG GPIO8_DR
  686. #define CORE_PIN47_PORTREG GPIO8_DR
  687. #define CORE_PIN48_PORTREG GPIO9_DR
  688. #define CORE_PIN49_PORTREG GPIO9_DR
  689. #define CORE_PIN50_PORTREG GPIO9_DR
  690. #define CORE_PIN51_PORTREG GPIO9_DR
  691. #define CORE_PIN52_PORTREG GPIO9_DR
  692. #define CORE_PIN53_PORTREG GPIO9_DR
  693. #define CORE_PIN54_PORTREG GPIO9_DR
  694. #define CORE_PIN0_PORTSET GPIO6_DR_SET
  695. #define CORE_PIN1_PORTSET GPIO6_DR_SET
  696. #define CORE_PIN2_PORTSET GPIO9_DR_SET
  697. #define CORE_PIN3_PORTSET GPIO9_DR_SET
  698. #define CORE_PIN4_PORTSET GPIO9_DR_SET
  699. #define CORE_PIN5_PORTSET GPIO9_DR_SET
  700. #define CORE_PIN6_PORTSET GPIO7_DR_SET
  701. #define CORE_PIN7_PORTSET GPIO7_DR_SET
  702. #define CORE_PIN8_PORTSET GPIO7_DR_SET
  703. #define CORE_PIN9_PORTSET GPIO7_DR_SET
  704. #define CORE_PIN10_PORTSET GPIO7_DR_SET
  705. #define CORE_PIN11_PORTSET GPIO7_DR_SET
  706. #define CORE_PIN12_PORTSET GPIO7_DR_SET
  707. #define CORE_PIN13_PORTSET GPIO7_DR_SET
  708. #define CORE_PIN14_PORTSET GPIO6_DR_SET
  709. #define CORE_PIN15_PORTSET GPIO6_DR_SET
  710. #define CORE_PIN16_PORTSET GPIO6_DR_SET
  711. #define CORE_PIN17_PORTSET GPIO6_DR_SET
  712. #define CORE_PIN18_PORTSET GPIO6_DR_SET
  713. #define CORE_PIN19_PORTSET GPIO6_DR_SET
  714. #define CORE_PIN20_PORTSET GPIO6_DR_SET
  715. #define CORE_PIN21_PORTSET GPIO6_DR_SET
  716. #define CORE_PIN22_PORTSET GPIO6_DR_SET
  717. #define CORE_PIN23_PORTSET GPIO6_DR_SET
  718. #define CORE_PIN24_PORTSET GPIO6_DR_SET
  719. #define CORE_PIN25_PORTSET GPIO6_DR_SET
  720. #define CORE_PIN26_PORTSET GPIO6_DR_SET
  721. #define CORE_PIN27_PORTSET GPIO6_DR_SET
  722. #define CORE_PIN28_PORTSET GPIO8_DR_SET
  723. #define CORE_PIN29_PORTSET GPIO9_DR_SET
  724. #define CORE_PIN30_PORTSET GPIO8_DR_SET
  725. #define CORE_PIN31_PORTSET GPIO8_DR_SET
  726. #define CORE_PIN32_PORTSET GPIO7_DR_SET
  727. #define CORE_PIN33_PORTSET GPIO9_DR_SET
  728. #define CORE_PIN34_PORTSET GPIO7_DR_SET
  729. #define CORE_PIN35_PORTSET GPIO7_DR_SET
  730. #define CORE_PIN36_PORTSET GPIO7_DR_SET
  731. #define CORE_PIN37_PORTSET GPIO7_DR_SET
  732. #define CORE_PIN38_PORTSET GPIO6_DR_SET
  733. #define CORE_PIN39_PORTSET GPIO6_DR_SET
  734. #define CORE_PIN40_PORTSET GPIO6_DR_SET
  735. #define CORE_PIN41_PORTSET GPIO6_DR_SET
  736. #define CORE_PIN42_PORTSET GPIO8_DR_SET
  737. #define CORE_PIN43_PORTSET GPIO8_DR_SET
  738. #define CORE_PIN44_PORTSET GPIO8_DR_SET
  739. #define CORE_PIN45_PORTSET GPIO8_DR_SET
  740. #define CORE_PIN46_PORTSET GPIO8_DR_SET
  741. #define CORE_PIN47_PORTSET GPIO8_DR_SET
  742. #define CORE_PIN48_PORTSET GPIO9_DR_SET
  743. #define CORE_PIN49_PORTSET GPIO9_DR_SET
  744. #define CORE_PIN50_PORTSET GPIO9_DR_SET
  745. #define CORE_PIN51_PORTSET GPIO9_DR_SET
  746. #define CORE_PIN52_PORTSET GPIO9_DR_SET
  747. #define CORE_PIN53_PORTSET GPIO9_DR_SET
  748. #define CORE_PIN54_PORTSET GPIO9_DR_SET
  749. #define CORE_PIN0_PORTCLEAR GPIO6_DR_CLEAR
  750. #define CORE_PIN1_PORTCLEAR GPIO6_DR_CLEAR
  751. #define CORE_PIN2_PORTCLEAR GPIO9_DR_CLEAR
  752. #define CORE_PIN3_PORTCLEAR GPIO9_DR_CLEAR
  753. #define CORE_PIN4_PORTCLEAR GPIO9_DR_CLEAR
  754. #define CORE_PIN5_PORTCLEAR GPIO9_DR_CLEAR
  755. #define CORE_PIN6_PORTCLEAR GPIO7_DR_CLEAR
  756. #define CORE_PIN7_PORTCLEAR GPIO7_DR_CLEAR
  757. #define CORE_PIN8_PORTCLEAR GPIO7_DR_CLEAR
  758. #define CORE_PIN9_PORTCLEAR GPIO7_DR_CLEAR
  759. #define CORE_PIN10_PORTCLEAR GPIO7_DR_CLEAR
  760. #define CORE_PIN11_PORTCLEAR GPIO7_DR_CLEAR
  761. #define CORE_PIN12_PORTCLEAR GPIO7_DR_CLEAR
  762. #define CORE_PIN13_PORTCLEAR GPIO7_DR_CLEAR
  763. #define CORE_PIN14_PORTCLEAR GPIO6_DR_CLEAR
  764. #define CORE_PIN15_PORTCLEAR GPIO6_DR_CLEAR
  765. #define CORE_PIN16_PORTCLEAR GPIO6_DR_CLEAR
  766. #define CORE_PIN17_PORTCLEAR GPIO6_DR_CLEAR
  767. #define CORE_PIN18_PORTCLEAR GPIO6_DR_CLEAR
  768. #define CORE_PIN19_PORTCLEAR GPIO6_DR_CLEAR
  769. #define CORE_PIN20_PORTCLEAR GPIO6_DR_CLEAR
  770. #define CORE_PIN21_PORTCLEAR GPIO6_DR_CLEAR
  771. #define CORE_PIN22_PORTCLEAR GPIO6_DR_CLEAR
  772. #define CORE_PIN23_PORTCLEAR GPIO6_DR_CLEAR
  773. #define CORE_PIN24_PORTCLEAR GPIO6_DR_CLEAR
  774. #define CORE_PIN25_PORTCLEAR GPIO6_DR_CLEAR
  775. #define CORE_PIN26_PORTCLEAR GPIO6_DR_CLEAR
  776. #define CORE_PIN27_PORTCLEAR GPIO6_DR_CLEAR
  777. #define CORE_PIN28_PORTCLEAR GPIO8_DR_CLEAR
  778. #define CORE_PIN29_PORTCLEAR GPIO9_DR_CLEAR
  779. #define CORE_PIN30_PORTCLEAR GPIO8_DR_CLEAR
  780. #define CORE_PIN31_PORTCLEAR GPIO8_DR_CLEAR
  781. #define CORE_PIN32_PORTCLEAR GPIO7_DR_CLEAR
  782. #define CORE_PIN33_PORTCLEAR GPIO9_DR_CLEAR
  783. #define CORE_PIN34_PORTCLEAR GPIO7_DR_CLEAR
  784. #define CORE_PIN35_PORTCLEAR GPIO7_DR_CLEAR
  785. #define CORE_PIN36_PORTCLEAR GPIO7_DR_CLEAR
  786. #define CORE_PIN37_PORTCLEAR GPIO7_DR_CLEAR
  787. #define CORE_PIN38_PORTCLEAR GPIO6_DR_CLEAR
  788. #define CORE_PIN39_PORTCLEAR GPIO6_DR_CLEAR
  789. #define CORE_PIN40_PORTCLEAR GPIO6_DR_CLEAR
  790. #define CORE_PIN41_PORTCLEAR GPIO6_DR_CLEAR
  791. #define CORE_PIN42_PORTCLEAR GPIO8_DR_CLEAR
  792. #define CORE_PIN43_PORTCLEAR GPIO8_DR_CLEAR
  793. #define CORE_PIN44_PORTCLEAR GPIO8_DR_CLEAR
  794. #define CORE_PIN45_PORTCLEAR GPIO8_DR_CLEAR
  795. #define CORE_PIN46_PORTCLEAR GPIO8_DR_CLEAR
  796. #define CORE_PIN47_PORTCLEAR GPIO8_DR_CLEAR
  797. #define CORE_PIN48_PORTCLEAR GPIO9_DR_CLEAR
  798. #define CORE_PIN49_PORTCLEAR GPIO9_DR_CLEAR
  799. #define CORE_PIN50_PORTCLEAR GPIO9_DR_CLEAR
  800. #define CORE_PIN51_PORTCLEAR GPIO9_DR_CLEAR
  801. #define CORE_PIN52_PORTCLEAR GPIO9_DR_CLEAR
  802. #define CORE_PIN53_PORTCLEAR GPIO9_DR_CLEAR
  803. #define CORE_PIN54_PORTCLEAR GPIO9_DR_CLEAR
  804. #define CORE_PIN0_PORTTOGGLE GPIO6_DR_TOGGLE
  805. #define CORE_PIN1_PORTTOGGLE GPIO6_DR_TOGGLE
  806. #define CORE_PIN2_PORTTOGGLE GPIO9_DR_TOGGLE
  807. #define CORE_PIN3_PORTTOGGLE GPIO9_DR_TOGGLE
  808. #define CORE_PIN4_PORTTOGGLE GPIO9_DR_TOGGLE
  809. #define CORE_PIN5_PORTTOGGLE GPIO9_DR_TOGGLE
  810. #define CORE_PIN6_PORTTOGGLE GPIO7_DR_TOGGLE
  811. #define CORE_PIN7_PORTTOGGLE GPIO7_DR_TOGGLE
  812. #define CORE_PIN8_PORTTOGGLE GPIO7_DR_TOGGLE
  813. #define CORE_PIN9_PORTTOGGLE GPIO7_DR_TOGGLE
  814. #define CORE_PIN10_PORTTOGGLE GPIO7_DR_TOGGLE
  815. #define CORE_PIN11_PORTTOGGLE GPIO7_DR_TOGGLE
  816. #define CORE_PIN12_PORTTOGGLE GPIO7_DR_TOGGLE
  817. #define CORE_PIN13_PORTTOGGLE GPIO7_DR_TOGGLE
  818. #define CORE_PIN14_PORTTOGGLE GPIO6_DR_TOGGLE
  819. #define CORE_PIN15_PORTTOGGLE GPIO6_DR_TOGGLE
  820. #define CORE_PIN16_PORTTOGGLE GPIO6_DR_TOGGLE
  821. #define CORE_PIN17_PORTTOGGLE GPIO6_DR_TOGGLE
  822. #define CORE_PIN18_PORTTOGGLE GPIO6_DR_TOGGLE
  823. #define CORE_PIN19_PORTTOGGLE GPIO6_DR_TOGGLE
  824. #define CORE_PIN20_PORTTOGGLE GPIO6_DR_TOGGLE
  825. #define CORE_PIN21_PORTTOGGLE GPIO6_DR_TOGGLE
  826. #define CORE_PIN22_PORTTOGGLE GPIO6_DR_TOGGLE
  827. #define CORE_PIN23_PORTTOGGLE GPIO6_DR_TOGGLE
  828. #define CORE_PIN24_PORTTOGGLE GPIO6_DR_TOGGLE
  829. #define CORE_PIN25_PORTTOGGLE GPIO6_DR_TOGGLE
  830. #define CORE_PIN26_PORTTOGGLE GPIO6_DR_TOGGLE
  831. #define CORE_PIN27_PORTTOGGLE GPIO6_DR_TOGGLE
  832. #define CORE_PIN28_PORTTOGGLE GPIO8_DR_TOGGLE
  833. #define CORE_PIN29_PORTTOGGLE GPIO9_DR_TOGGLE
  834. #define CORE_PIN30_PORTTOGGLE GPIO8_DR_TOGGLE
  835. #define CORE_PIN31_PORTTOGGLE GPIO8_DR_TOGGLE
  836. #define CORE_PIN32_PORTTOGGLE GPIO7_DR_TOGGLE
  837. #define CORE_PIN33_PORTTOGGLE GPIO9_DR_TOGGLE
  838. #define CORE_PIN34_PORTTOGGLE GPIO7_DR_TOGGLE
  839. #define CORE_PIN35_PORTTOGGLE GPIO7_DR_TOGGLE
  840. #define CORE_PIN36_PORTTOGGLE GPIO7_DR_TOGGLE
  841. #define CORE_PIN37_PORTTOGGLE GPIO7_DR_TOGGLE
  842. #define CORE_PIN38_PORTTOGGLE GPIO6_DR_TOGGLE
  843. #define CORE_PIN39_PORTTOGGLE GPIO6_DR_TOGGLE
  844. #define CORE_PIN40_PORTTOGGLE GPIO6_DR_TOGGLE
  845. #define CORE_PIN41_PORTTOGGLE GPIO6_DR_TOGGLE
  846. #define CORE_PIN42_PORTTOGGLE GPIO8_DR_TOGGLE
  847. #define CORE_PIN43_PORTTOGGLE GPIO8_DR_TOGGLE
  848. #define CORE_PIN44_PORTTOGGLE GPIO8_DR_TOGGLE
  849. #define CORE_PIN45_PORTTOGGLE GPIO8_DR_TOGGLE
  850. #define CORE_PIN46_PORTTOGGLE GPIO8_DR_TOGGLE
  851. #define CORE_PIN47_PORTTOGGLE GPIO8_DR_TOGGLE
  852. #define CORE_PIN48_PORTTOGGLE GPIO9_DR_TOGGLE
  853. #define CORE_PIN49_PORTTOGGLE GPIO9_DR_TOGGLE
  854. #define CORE_PIN50_PORTTOGGLE GPIO9_DR_TOGGLE
  855. #define CORE_PIN51_PORTTOGGLE GPIO9_DR_TOGGLE
  856. #define CORE_PIN52_PORTTOGGLE GPIO9_DR_TOGGLE
  857. #define CORE_PIN53_PORTTOGGLE GPIO9_DR_TOGGLE
  858. #define CORE_PIN54_PORTTOGGLE GPIO9_DR_TOGGLE
  859. #define CORE_PIN0_DDRREG GPIO6_GDIR
  860. #define CORE_PIN1_DDRREG GPIO6_GDIR
  861. #define CORE_PIN2_DDRREG GPIO9_GDIR
  862. #define CORE_PIN3_DDRREG GPIO9_GDIR
  863. #define CORE_PIN4_DDRREG GPIO9_GDIR
  864. #define CORE_PIN5_DDRREG GPIO9_GDIR
  865. #define CORE_PIN6_DDRREG GPIO7_GDIR
  866. #define CORE_PIN7_DDRREG GPIO7_GDIR
  867. #define CORE_PIN8_DDRREG GPIO7_GDIR
  868. #define CORE_PIN9_DDRREG GPIO7_GDIR
  869. #define CORE_PIN10_DDRREG GPIO7_GDIR
  870. #define CORE_PIN11_DDRREG GPIO7_GDIR
  871. #define CORE_PIN12_DDRREG GPIO7_GDIR
  872. #define CORE_PIN13_DDRREG GPIO7_GDIR
  873. #define CORE_PIN14_DDRREG GPIO6_GDIR
  874. #define CORE_PIN15_DDRREG GPIO6_GDIR
  875. #define CORE_PIN16_DDRREG GPIO6_GDIR
  876. #define CORE_PIN17_DDRREG GPIO6_GDIR
  877. #define CORE_PIN18_DDRREG GPIO6_GDIR
  878. #define CORE_PIN19_DDRREG GPIO6_GDIR
  879. #define CORE_PIN20_DDRREG GPIO6_GDIR
  880. #define CORE_PIN21_DDRREG GPIO6_GDIR
  881. #define CORE_PIN22_DDRREG GPIO6_GDIR
  882. #define CORE_PIN23_DDRREG GPIO6_GDIR
  883. #define CORE_PIN24_DDRREG GPIO6_GDIR
  884. #define CORE_PIN25_DDRREG GPIO6_GDIR
  885. #define CORE_PIN26_DDRREG GPIO6_GDIR
  886. #define CORE_PIN27_DDRREG GPIO6_GDIR
  887. #define CORE_PIN28_DDRREG GPIO8_GDIR
  888. #define CORE_PIN29_DDRREG GPIO9_GDIR
  889. #define CORE_PIN30_DDRREG GPIO8_GDIR
  890. #define CORE_PIN31_DDRREG GPIO8_GDIR
  891. #define CORE_PIN32_DDRREG GPIO7_GDIR
  892. #define CORE_PIN33_DDRREG GPIO9_GDIR
  893. #define CORE_PIN34_DDRREG GPIO7_GDIR
  894. #define CORE_PIN35_DDRREG GPIO7_GDIR
  895. #define CORE_PIN36_DDRREG GPIO7_GDIR
  896. #define CORE_PIN37_DDRREG GPIO7_GDIR
  897. #define CORE_PIN38_DDRREG GPIO6_GDIR
  898. #define CORE_PIN39_DDRREG GPIO6_GDIR
  899. #define CORE_PIN40_DDRREG GPIO6_GDIR
  900. #define CORE_PIN41_DDRREG GPIO6_GDIR
  901. #define CORE_PIN42_DDRREG GPIO8_GDIR
  902. #define CORE_PIN43_DDRREG GPIO8_GDIR
  903. #define CORE_PIN44_DDRREG GPIO8_GDIR
  904. #define CORE_PIN45_DDRREG GPIO8_GDIR
  905. #define CORE_PIN46_DDRREG GPIO8_GDIR
  906. #define CORE_PIN47_DDRREG GPIO8_GDIR
  907. #define CORE_PIN48_DDRREG GPIO9_GDIR
  908. #define CORE_PIN49_DDRREG GPIO9_GDIR
  909. #define CORE_PIN50_DDRREG GPIO9_GDIR
  910. #define CORE_PIN51_DDRREG GPIO9_GDIR
  911. #define CORE_PIN52_DDRREG GPIO9_GDIR
  912. #define CORE_PIN53_DDRREG GPIO9_GDIR
  913. #define CORE_PIN54_DDRREG GPIO9_GDIR
  914. #define CORE_PIN0_PINREG GPIO6_PSR
  915. #define CORE_PIN1_PINREG GPIO6_PSR
  916. #define CORE_PIN2_PINREG GPIO9_PSR
  917. #define CORE_PIN3_PINREG GPIO9_PSR
  918. #define CORE_PIN4_PINREG GPIO9_PSR
  919. #define CORE_PIN5_PINREG GPIO9_PSR
  920. #define CORE_PIN6_PINREG GPIO7_PSR
  921. #define CORE_PIN7_PINREG GPIO7_PSR
  922. #define CORE_PIN8_PINREG GPIO7_PSR
  923. #define CORE_PIN9_PINREG GPIO7_PSR
  924. #define CORE_PIN10_PINREG GPIO7_PSR
  925. #define CORE_PIN11_PINREG GPIO7_PSR
  926. #define CORE_PIN12_PINREG GPIO7_PSR
  927. #define CORE_PIN13_PINREG GPIO7_PSR
  928. #define CORE_PIN14_PINREG GPIO6_PSR
  929. #define CORE_PIN15_PINREG GPIO6_PSR
  930. #define CORE_PIN16_PINREG GPIO6_PSR
  931. #define CORE_PIN17_PINREG GPIO6_PSR
  932. #define CORE_PIN18_PINREG GPIO6_PSR
  933. #define CORE_PIN19_PINREG GPIO6_PSR
  934. #define CORE_PIN20_PINREG GPIO6_PSR
  935. #define CORE_PIN21_PINREG GPIO6_PSR
  936. #define CORE_PIN22_PINREG GPIO6_PSR
  937. #define CORE_PIN23_PINREG GPIO6_PSR
  938. #define CORE_PIN24_PINREG GPIO6_PSR
  939. #define CORE_PIN25_PINREG GPIO6_PSR
  940. #define CORE_PIN26_PINREG GPIO6_PSR
  941. #define CORE_PIN27_PINREG GPIO6_PSR
  942. #define CORE_PIN28_PINREG GPIO8_PSR
  943. #define CORE_PIN29_PINREG GPIO9_PSR
  944. #define CORE_PIN30_PINREG GPIO8_PSR
  945. #define CORE_PIN31_PINREG GPIO8_PSR
  946. #define CORE_PIN32_PINREG GPIO7_PSR
  947. #define CORE_PIN33_PINREG GPIO9_PSR
  948. #define CORE_PIN34_PINREG GPIO7_PSR
  949. #define CORE_PIN35_PINREG GPIO7_PSR
  950. #define CORE_PIN36_PINREG GPIO7_PSR
  951. #define CORE_PIN37_PINREG GPIO7_PSR
  952. #define CORE_PIN38_PINREG GPIO6_PSR
  953. #define CORE_PIN39_PINREG GPIO6_PSR
  954. #define CORE_PIN40_PINREG GPIO6_PSR
  955. #define CORE_PIN41_PINREG GPIO6_PSR
  956. #define CORE_PIN42_PINREG GPIO8_PSR
  957. #define CORE_PIN43_PINREG GPIO8_PSR
  958. #define CORE_PIN44_PINREG GPIO8_PSR
  959. #define CORE_PIN45_PINREG GPIO8_PSR
  960. #define CORE_PIN46_PINREG GPIO8_PSR
  961. #define CORE_PIN47_PINREG GPIO8_PSR
  962. #define CORE_PIN48_PINREG GPIO9_PSR
  963. #define CORE_PIN49_PINREG GPIO9_PSR
  964. #define CORE_PIN50_PINREG GPIO9_PSR
  965. #define CORE_PIN51_PINREG GPIO9_PSR
  966. #define CORE_PIN52_PINREG GPIO9_PSR
  967. #define CORE_PIN53_PINREG GPIO9_PSR
  968. #define CORE_PIN54_PINREG GPIO9_PSR
  969. // mux config registers control which peripheral uses the pin
  970. #define CORE_PIN0_CONFIG IOMUXC_SW_MUX_CTL_PAD_GPIO_AD_B0_03
  971. #define CORE_PIN1_CONFIG IOMUXC_SW_MUX_CTL_PAD_GPIO_AD_B0_02
  972. #define CORE_PIN2_CONFIG IOMUXC_SW_MUX_CTL_PAD_GPIO_EMC_04
  973. #define CORE_PIN3_CONFIG IOMUXC_SW_MUX_CTL_PAD_GPIO_EMC_05
  974. #define CORE_PIN4_CONFIG IOMUXC_SW_MUX_CTL_PAD_GPIO_EMC_06
  975. #define CORE_PIN5_CONFIG IOMUXC_SW_MUX_CTL_PAD_GPIO_EMC_08
  976. #define CORE_PIN6_CONFIG IOMUXC_SW_MUX_CTL_PAD_GPIO_B0_10
  977. #define CORE_PIN7_CONFIG IOMUXC_SW_MUX_CTL_PAD_GPIO_B1_01
  978. #define CORE_PIN8_CONFIG IOMUXC_SW_MUX_CTL_PAD_GPIO_B1_00
  979. #define CORE_PIN9_CONFIG IOMUXC_SW_MUX_CTL_PAD_GPIO_B0_11
  980. #define CORE_PIN10_CONFIG IOMUXC_SW_MUX_CTL_PAD_GPIO_B0_00
  981. #define CORE_PIN11_CONFIG IOMUXC_SW_MUX_CTL_PAD_GPIO_B0_02
  982. #define CORE_PIN12_CONFIG IOMUXC_SW_MUX_CTL_PAD_GPIO_B0_01
  983. #define CORE_PIN13_CONFIG IOMUXC_SW_MUX_CTL_PAD_GPIO_B0_03
  984. #define CORE_PIN14_CONFIG IOMUXC_SW_MUX_CTL_PAD_GPIO_AD_B1_02
  985. #define CORE_PIN15_CONFIG IOMUXC_SW_MUX_CTL_PAD_GPIO_AD_B1_03
  986. #define CORE_PIN16_CONFIG IOMUXC_SW_MUX_CTL_PAD_GPIO_AD_B1_07
  987. #define CORE_PIN17_CONFIG IOMUXC_SW_MUX_CTL_PAD_GPIO_AD_B1_06
  988. #define CORE_PIN18_CONFIG IOMUXC_SW_MUX_CTL_PAD_GPIO_AD_B1_01
  989. #define CORE_PIN19_CONFIG IOMUXC_SW_MUX_CTL_PAD_GPIO_AD_B1_00
  990. #define CORE_PIN20_CONFIG IOMUXC_SW_MUX_CTL_PAD_GPIO_AD_B1_10
  991. #define CORE_PIN21_CONFIG IOMUXC_SW_MUX_CTL_PAD_GPIO_AD_B1_11
  992. #define CORE_PIN22_CONFIG IOMUXC_SW_MUX_CTL_PAD_GPIO_AD_B1_08
  993. #define CORE_PIN23_CONFIG IOMUXC_SW_MUX_CTL_PAD_GPIO_AD_B1_09
  994. #define CORE_PIN24_CONFIG IOMUXC_SW_MUX_CTL_PAD_GPIO_AD_B0_12
  995. #define CORE_PIN25_CONFIG IOMUXC_SW_MUX_CTL_PAD_GPIO_AD_B0_13
  996. #define CORE_PIN26_CONFIG IOMUXC_SW_MUX_CTL_PAD_GPIO_AD_B1_14
  997. #define CORE_PIN27_CONFIG IOMUXC_SW_MUX_CTL_PAD_GPIO_AD_B1_15
  998. #define CORE_PIN28_CONFIG IOMUXC_SW_MUX_CTL_PAD_GPIO_EMC_32
  999. #define CORE_PIN29_CONFIG IOMUXC_SW_MUX_CTL_PAD_GPIO_EMC_31
  1000. #define CORE_PIN30_CONFIG IOMUXC_SW_MUX_CTL_PAD_GPIO_EMC_37
  1001. #define CORE_PIN31_CONFIG IOMUXC_SW_MUX_CTL_PAD_GPIO_EMC_36
  1002. #define CORE_PIN32_CONFIG IOMUXC_SW_MUX_CTL_PAD_GPIO_B0_12
  1003. #define CORE_PIN33_CONFIG IOMUXC_SW_MUX_CTL_PAD_GPIO_EMC_07
  1004. #define CORE_PIN34_CONFIG IOMUXC_SW_MUX_CTL_PAD_GPIO_B1_13
  1005. #define CORE_PIN35_CONFIG IOMUXC_SW_MUX_CTL_PAD_GPIO_B1_12
  1006. #define CORE_PIN36_CONFIG IOMUXC_SW_MUX_CTL_PAD_GPIO_B1_02
  1007. #define CORE_PIN37_CONFIG IOMUXC_SW_MUX_CTL_PAD_GPIO_B1_03
  1008. #define CORE_PIN38_CONFIG IOMUXC_SW_MUX_CTL_PAD_GPIO_AD_B1_12
  1009. #define CORE_PIN39_CONFIG IOMUXC_SW_MUX_CTL_PAD_GPIO_AD_B1_13
  1010. #define CORE_PIN40_CONFIG IOMUXC_SW_MUX_CTL_PAD_GPIO_AD_B1_04
  1011. #define CORE_PIN41_CONFIG IOMUXC_SW_MUX_CTL_PAD_GPIO_AD_B1_05
  1012. #define CORE_PIN42_CONFIG IOMUXC_SW_MUX_CTL_PAD_GPIO_SD_B0_03
  1013. #define CORE_PIN43_CONFIG IOMUXC_SW_MUX_CTL_PAD_GPIO_SD_B0_02
  1014. #define CORE_PIN44_CONFIG IOMUXC_SW_MUX_CTL_PAD_GPIO_SD_B0_01
  1015. #define CORE_PIN45_CONFIG IOMUXC_SW_MUX_CTL_PAD_GPIO_SD_B0_00
  1016. #define CORE_PIN46_CONFIG IOMUXC_SW_MUX_CTL_PAD_GPIO_SD_B0_05
  1017. #define CORE_PIN47_CONFIG IOMUXC_SW_MUX_CTL_PAD_GPIO_SD_B0_04
  1018. #define CORE_PIN48_CONFIG IOMUXC_SW_MUX_CTL_PAD_GPIO_EMC_24
  1019. #define CORE_PIN49_CONFIG IOMUXC_SW_MUX_CTL_PAD_GPIO_EMC_27
  1020. #define CORE_PIN50_CONFIG IOMUXC_SW_MUX_CTL_PAD_GPIO_EMC_28
  1021. #define CORE_PIN51_CONFIG IOMUXC_SW_MUX_CTL_PAD_GPIO_EMC_22
  1022. #define CORE_PIN52_CONFIG IOMUXC_SW_MUX_CTL_PAD_GPIO_EMC_26
  1023. #define CORE_PIN53_CONFIG IOMUXC_SW_MUX_CTL_PAD_GPIO_EMC_25
  1024. #define CORE_PIN54_CONFIG IOMUXC_SW_MUX_CTL_PAD_GPIO_EMC_29
  1025. // pad config registers control pullup/pulldown/keeper, drive strength, etc
  1026. #define CORE_PIN0_PADCONFIG IOMUXC_SW_PAD_CTL_PAD_GPIO_AD_B0_03
  1027. #define CORE_PIN1_PADCONFIG IOMUXC_SW_PAD_CTL_PAD_GPIO_AD_B0_02
  1028. #define CORE_PIN2_PADCONFIG IOMUXC_SW_PAD_CTL_PAD_GPIO_EMC_04
  1029. #define CORE_PIN3_PADCONFIG IOMUXC_SW_PAD_CTL_PAD_GPIO_EMC_05
  1030. #define CORE_PIN4_PADCONFIG IOMUXC_SW_PAD_CTL_PAD_GPIO_EMC_06
  1031. #define CORE_PIN5_PADCONFIG IOMUXC_SW_PAD_CTL_PAD_GPIO_EMC_08
  1032. #define CORE_PIN6_PADCONFIG IOMUXC_SW_PAD_CTL_PAD_GPIO_B0_10
  1033. #define CORE_PIN7_PADCONFIG IOMUXC_SW_PAD_CTL_PAD_GPIO_B1_01
  1034. #define CORE_PIN8_PADCONFIG IOMUXC_SW_PAD_CTL_PAD_GPIO_B1_00
  1035. #define CORE_PIN9_PADCONFIG IOMUXC_SW_PAD_CTL_PAD_GPIO_B0_11
  1036. #define CORE_PIN10_PADCONFIG IOMUXC_SW_PAD_CTL_PAD_GPIO_B0_00
  1037. #define CORE_PIN11_PADCONFIG IOMUXC_SW_PAD_CTL_PAD_GPIO_B0_02
  1038. #define CORE_PIN12_PADCONFIG IOMUXC_SW_PAD_CTL_PAD_GPIO_B0_01
  1039. #define CORE_PIN13_PADCONFIG IOMUXC_SW_PAD_CTL_PAD_GPIO_B0_03
  1040. #define CORE_PIN14_PADCONFIG IOMUXC_SW_PAD_CTL_PAD_GPIO_AD_B1_02
  1041. #define CORE_PIN15_PADCONFIG IOMUXC_SW_PAD_CTL_PAD_GPIO_AD_B1_03
  1042. #define CORE_PIN16_PADCONFIG IOMUXC_SW_PAD_CTL_PAD_GPIO_AD_B1_07
  1043. #define CORE_PIN17_PADCONFIG IOMUXC_SW_PAD_CTL_PAD_GPIO_AD_B1_06
  1044. #define CORE_PIN18_PADCONFIG IOMUXC_SW_PAD_CTL_PAD_GPIO_AD_B1_01
  1045. #define CORE_PIN19_PADCONFIG IOMUXC_SW_PAD_CTL_PAD_GPIO_AD_B1_00
  1046. #define CORE_PIN20_PADCONFIG IOMUXC_SW_PAD_CTL_PAD_GPIO_AD_B1_10
  1047. #define CORE_PIN21_PADCONFIG IOMUXC_SW_PAD_CTL_PAD_GPIO_AD_B1_11
  1048. #define CORE_PIN22_PADCONFIG IOMUXC_SW_PAD_CTL_PAD_GPIO_AD_B1_08
  1049. #define CORE_PIN23_PADCONFIG IOMUXC_SW_PAD_CTL_PAD_GPIO_AD_B1_09
  1050. #define CORE_PIN24_PADCONFIG IOMUXC_SW_PAD_CTL_PAD_GPIO_AD_B0_12
  1051. #define CORE_PIN25_PADCONFIG IOMUXC_SW_PAD_CTL_PAD_GPIO_AD_B0_13
  1052. #define CORE_PIN26_PADCONFIG IOMUXC_SW_PAD_CTL_PAD_GPIO_AD_B1_14
  1053. #define CORE_PIN27_PADCONFIG IOMUXC_SW_PAD_CTL_PAD_GPIO_AD_B1_15
  1054. #define CORE_PIN28_PADCONFIG IOMUXC_SW_PAD_CTL_PAD_GPIO_EMC_32
  1055. #define CORE_PIN29_PADCONFIG IOMUXC_SW_PAD_CTL_PAD_GPIO_EMC_31
  1056. #define CORE_PIN30_PADCONFIG IOMUXC_SW_PAD_CTL_PAD_GPIO_EMC_37
  1057. #define CORE_PIN31_PADCONFIG IOMUXC_SW_PAD_CTL_PAD_GPIO_EMC_36
  1058. #define CORE_PIN32_PADCONFIG IOMUXC_SW_PAD_CTL_PAD_GPIO_B0_12
  1059. #define CORE_PIN33_PADCONFIG IOMUXC_SW_PAD_CTL_PAD_GPIO_EMC_07
  1060. #define CORE_PIN34_PADCONFIG IOMUXC_SW_PAD_CTL_PAD_GPIO_B1_13
  1061. #define CORE_PIN35_PADCONFIG IOMUXC_SW_PAD_CTL_PAD_GPIO_B1_12
  1062. #define CORE_PIN36_PADCONFIG IOMUXC_SW_PAD_CTL_PAD_GPIO_B1_02
  1063. #define CORE_PIN37_PADCONFIG IOMUXC_SW_PAD_CTL_PAD_GPIO_B1_03
  1064. #define CORE_PIN38_PADCONFIG IOMUXC_SW_PAD_CTL_PAD_GPIO_AD_B1_12
  1065. #define CORE_PIN39_PADCONFIG IOMUXC_SW_PAD_CTL_PAD_GPIO_AD_B1_13
  1066. #define CORE_PIN40_PADCONFIG IOMUXC_SW_PAD_CTL_PAD_GPIO_AD_B1_04
  1067. #define CORE_PIN41_PADCONFIG IOMUXC_SW_PAD_CTL_PAD_GPIO_AD_B1_05
  1068. #define CORE_PIN42_PADCONFIG IOMUXC_SW_PAD_CTL_PAD_GPIO_SD_B0_03
  1069. #define CORE_PIN43_PADCONFIG IOMUXC_SW_PAD_CTL_PAD_GPIO_SD_B0_02
  1070. #define CORE_PIN44_PADCONFIG IOMUXC_SW_PAD_CTL_PAD_GPIO_SD_B0_01
  1071. #define CORE_PIN45_PADCONFIG IOMUXC_SW_PAD_CTL_PAD_GPIO_SD_B0_00
  1072. #define CORE_PIN46_PADCONFIG IOMUXC_SW_PAD_CTL_PAD_GPIO_SD_B0_05
  1073. #define CORE_PIN47_PADCONFIG IOMUXC_SW_PAD_CTL_PAD_GPIO_SD_B0_04
  1074. #define CORE_PIN48_PADCONFIG IOMUXC_SW_PAD_CTL_PAD_GPIO_EMC_24
  1075. #define CORE_PIN49_PADCONFIG IOMUXC_SW_PAD_CTL_PAD_GPIO_EMC_27
  1076. #define CORE_PIN50_PADCONFIG IOMUXC_SW_PAD_CTL_PAD_GPIO_EMC_28
  1077. #define CORE_PIN51_PADCONFIG IOMUXC_SW_PAD_CTL_PAD_GPIO_EMC_22
  1078. #define CORE_PIN52_PADCONFIG IOMUXC_SW_PAD_CTL_PAD_GPIO_EMC_26
  1079. #define CORE_PIN53_PADCONFIG IOMUXC_SW_PAD_CTL_PAD_GPIO_EMC_25
  1080. #define CORE_PIN54_PADCONFIG IOMUXC_SW_PAD_CTL_PAD_GPIO_EMC_29
  1081. #define CORE_LED0_PIN 13
  1082. #define CORE_ADC0_PIN 14
  1083. #define CORE_ADC1_PIN 15
  1084. #define CORE_ADC2_PIN 16
  1085. #define CORE_ADC3_PIN 17
  1086. #define CORE_ADC4_PIN 18
  1087. #define CORE_ADC5_PIN 19
  1088. #define CORE_ADC6_PIN 20
  1089. #define CORE_ADC7_PIN 21
  1090. #define CORE_ADC8_PIN 22
  1091. #define CORE_ADC9_PIN 23
  1092. #define CORE_RXD0_PIN 0
  1093. #define CORE_TXD0_PIN 1
  1094. #define CORE_RXD1_PIN 7
  1095. #define CORE_TXD1_PIN 8
  1096. #define CORE_RXD2_PIN 15
  1097. #define CORE_TXD2_PIN 14
  1098. #define CORE_RXD3_PIN 16
  1099. #define CORE_TXD3_PIN 17
  1100. #define CORE_RXD4_PIN 21
  1101. #define CORE_TXD4_PIN 20
  1102. #define CORE_RXD5_PIN 25
  1103. #define CORE_TXD5_PIN 24
  1104. #define CORE_RXD6_PIN 28
  1105. #define CORE_TXD6_PIN 29
  1106. #define CORE_RXD7_PIN 34
  1107. #define CORE_TXD7_PIN 35
  1108. #define CORE_INT0_PIN 0
  1109. #define CORE_INT1_PIN 1
  1110. #define CORE_INT2_PIN 2
  1111. #define CORE_INT3_PIN 3
  1112. #define CORE_INT4_PIN 4
  1113. #define CORE_INT5_PIN 5
  1114. #define CORE_INT6_PIN 6
  1115. #define CORE_INT7_PIN 7
  1116. #define CORE_INT8_PIN 8
  1117. #define CORE_INT9_PIN 9
  1118. #define CORE_INT10_PIN 10
  1119. #define CORE_INT11_PIN 11
  1120. #define CORE_INT12_PIN 12
  1121. #define CORE_INT13_PIN 13
  1122. #define CORE_INT14_PIN 14
  1123. #define CORE_INT15_PIN 15
  1124. #define CORE_INT16_PIN 16
  1125. #define CORE_INT17_PIN 17
  1126. #define CORE_INT18_PIN 18
  1127. #define CORE_INT19_PIN 19
  1128. #define CORE_INT20_PIN 20
  1129. #define CORE_INT21_PIN 21
  1130. #define CORE_INT22_PIN 22
  1131. #define CORE_INT23_PIN 23
  1132. #define CORE_INT24_PIN 24
  1133. #define CORE_INT25_PIN 25
  1134. #define CORE_INT26_PIN 26
  1135. #define CORE_INT27_PIN 27
  1136. #define CORE_INT28_PIN 28
  1137. #define CORE_INT29_PIN 29
  1138. #define CORE_INT30_PIN 30
  1139. #define CORE_INT31_PIN 31
  1140. #define CORE_INT32_PIN 32
  1141. #define CORE_INT33_PIN 33
  1142. #define CORE_INT34_PIN 34
  1143. #define CORE_INT35_PIN 35
  1144. #define CORE_INT36_PIN 36
  1145. #define CORE_INT37_PIN 37
  1146. #define CORE_INT38_PIN 38
  1147. #define CORE_INT39_PIN 39
  1148. #define CORE_INT40_PIN 40
  1149. #define CORE_INT41_PIN 41
  1150. #define CORE_INT42_PIN 42
  1151. #define CORE_INT43_PIN 43
  1152. #define CORE_INT44_PIN 44
  1153. #define CORE_INT45_PIN 45
  1154. #define CORE_INT46_PIN 46
  1155. #define CORE_INT47_PIN 47
  1156. #define CORE_INT48_PIN 48
  1157. #define CORE_INT49_PIN 49
  1158. #define CORE_INT50_PIN 50
  1159. #define CORE_INT51_PIN 51
  1160. #define CORE_INT52_PIN 52
  1161. #define CORE_INT53_PIN 53
  1162. #define CORE_INT54_PIN 54
  1163. #define CORE_INT_EVERY_PIN 1
  1164. #elif defined(__IMXRT1062__) && defined(ARDUINO_TEENSY_MICROMOD)
  1165. #define CORE_NUM_TOTAL_PINS 46
  1166. #define CORE_NUM_DIGITAL 46
  1167. #define CORE_NUM_INTERRUPT 46
  1168. #define CORE_NUM_ANALOG 14
  1169. #define CORE_NUM_PWM 30
  1170. #define CORE_PIN0_BIT 3
  1171. #define CORE_PIN1_BIT 2
  1172. #define CORE_PIN2_BIT 4
  1173. #define CORE_PIN3_BIT 5
  1174. #define CORE_PIN4_BIT 6
  1175. #define CORE_PIN5_BIT 8
  1176. #define CORE_PIN6_BIT 10
  1177. #define CORE_PIN7_BIT 17
  1178. #define CORE_PIN8_BIT 16
  1179. #define CORE_PIN9_BIT 11
  1180. #define CORE_PIN10_BIT 0
  1181. #define CORE_PIN11_BIT 2
  1182. #define CORE_PIN12_BIT 1
  1183. #define CORE_PIN13_BIT 3
  1184. #define CORE_PIN14_BIT 18
  1185. #define CORE_PIN15_BIT 19
  1186. #define CORE_PIN16_BIT 23
  1187. #define CORE_PIN17_BIT 22
  1188. #define CORE_PIN18_BIT 17
  1189. #define CORE_PIN19_BIT 16
  1190. #define CORE_PIN20_BIT 26
  1191. #define CORE_PIN21_BIT 27
  1192. #define CORE_PIN22_BIT 24
  1193. #define CORE_PIN23_BIT 25
  1194. #define CORE_PIN24_BIT 12
  1195. #define CORE_PIN25_BIT 13
  1196. #define CORE_PIN26_BIT 30
  1197. #define CORE_PIN27_BIT 31
  1198. #define CORE_PIN28_BIT 18
  1199. #define CORE_PIN29_BIT 31
  1200. #define CORE_PIN30_BIT 23
  1201. #define CORE_PIN31_BIT 22
  1202. #define CORE_PIN32_BIT 12
  1203. #define CORE_PIN33_BIT 7
  1204. #define CORE_PIN34_BIT 15
  1205. #define CORE_PIN35_BIT 14
  1206. #define CORE_PIN36_BIT 13
  1207. #define CORE_PIN37_BIT 12
  1208. #define CORE_PIN38_BIT 17
  1209. #define CORE_PIN39_BIT 16
  1210. #define CORE_PIN40_BIT 4
  1211. #define CORE_PIN41_BIT 5
  1212. #define CORE_PIN42_BIT 6
  1213. #define CORE_PIN43_BIT 7
  1214. #define CORE_PIN44_BIT 8
  1215. #define CORE_PIN45_BIT 9
  1216. #define CORE_PIN0_BITMASK (1<<(CORE_PIN0_BIT))
  1217. #define CORE_PIN1_BITMASK (1<<(CORE_PIN1_BIT))
  1218. #define CORE_PIN2_BITMASK (1<<(CORE_PIN2_BIT))
  1219. #define CORE_PIN3_BITMASK (1<<(CORE_PIN3_BIT))
  1220. #define CORE_PIN4_BITMASK (1<<(CORE_PIN4_BIT))
  1221. #define CORE_PIN5_BITMASK (1<<(CORE_PIN5_BIT))
  1222. #define CORE_PIN6_BITMASK (1<<(CORE_PIN6_BIT))
  1223. #define CORE_PIN7_BITMASK (1<<(CORE_PIN7_BIT))
  1224. #define CORE_PIN8_BITMASK (1<<(CORE_PIN8_BIT))
  1225. #define CORE_PIN9_BITMASK (1<<(CORE_PIN9_BIT))
  1226. #define CORE_PIN10_BITMASK (1<<(CORE_PIN10_BIT))
  1227. #define CORE_PIN11_BITMASK (1<<(CORE_PIN11_BIT))
  1228. #define CORE_PIN12_BITMASK (1<<(CORE_PIN12_BIT))
  1229. #define CORE_PIN13_BITMASK (1<<(CORE_PIN13_BIT))
  1230. #define CORE_PIN14_BITMASK (1<<(CORE_PIN14_BIT))
  1231. #define CORE_PIN15_BITMASK (1<<(CORE_PIN15_BIT))
  1232. #define CORE_PIN16_BITMASK (1<<(CORE_PIN16_BIT))
  1233. #define CORE_PIN17_BITMASK (1<<(CORE_PIN17_BIT))
  1234. #define CORE_PIN18_BITMASK (1<<(CORE_PIN18_BIT))
  1235. #define CORE_PIN19_BITMASK (1<<(CORE_PIN19_BIT))
  1236. #define CORE_PIN20_BITMASK (1<<(CORE_PIN20_BIT))
  1237. #define CORE_PIN21_BITMASK (1<<(CORE_PIN21_BIT))
  1238. #define CORE_PIN22_BITMASK (1<<(CORE_PIN22_BIT))
  1239. #define CORE_PIN23_BITMASK (1<<(CORE_PIN23_BIT))
  1240. #define CORE_PIN24_BITMASK (1<<(CORE_PIN24_BIT))
  1241. #define CORE_PIN25_BITMASK (1<<(CORE_PIN25_BIT))
  1242. #define CORE_PIN26_BITMASK (1<<(CORE_PIN26_BIT))
  1243. #define CORE_PIN27_BITMASK (1<<(CORE_PIN27_BIT))
  1244. #define CORE_PIN28_BITMASK (1<<(CORE_PIN28_BIT))
  1245. #define CORE_PIN29_BITMASK (1<<(CORE_PIN29_BIT))
  1246. #define CORE_PIN30_BITMASK (1<<(CORE_PIN30_BIT))
  1247. #define CORE_PIN31_BITMASK (1<<(CORE_PIN31_BIT))
  1248. #define CORE_PIN32_BITMASK (1<<(CORE_PIN32_BIT))
  1249. #define CORE_PIN33_BITMASK (1<<(CORE_PIN33_BIT))
  1250. #define CORE_PIN34_BITMASK (1<<(CORE_PIN34_BIT))
  1251. #define CORE_PIN35_BITMASK (1<<(CORE_PIN35_BIT))
  1252. #define CORE_PIN36_BITMASK (1<<(CORE_PIN36_BIT))
  1253. #define CORE_PIN37_BITMASK (1<<(CORE_PIN37_BIT))
  1254. #define CORE_PIN38_BITMASK (1<<(CORE_PIN38_BIT))
  1255. #define CORE_PIN39_BITMASK (1<<(CORE_PIN39_BIT))
  1256. #define CORE_PIN40_BITMASK (1<<(CORE_PIN40_BIT))
  1257. #define CORE_PIN41_BITMASK (1<<(CORE_PIN41_BIT))
  1258. #define CORE_PIN42_BITMASK (1<<(CORE_PIN42_BIT))
  1259. #define CORE_PIN43_BITMASK (1<<(CORE_PIN43_BIT))
  1260. #define CORE_PIN44_BITMASK (1<<(CORE_PIN44_BIT))
  1261. #define CORE_PIN45_BITMASK (1<<(CORE_PIN45_BIT))
  1262. // Fast GPIO
  1263. #define CORE_PIN0_PORTREG GPIO6_DR
  1264. #define CORE_PIN1_PORTREG GPIO6_DR
  1265. #define CORE_PIN2_PORTREG GPIO9_DR
  1266. #define CORE_PIN3_PORTREG GPIO9_DR
  1267. #define CORE_PIN4_PORTREG GPIO9_DR
  1268. #define CORE_PIN5_PORTREG GPIO9_DR
  1269. #define CORE_PIN6_PORTREG GPIO7_DR
  1270. #define CORE_PIN7_PORTREG GPIO7_DR
  1271. #define CORE_PIN8_PORTREG GPIO7_DR
  1272. #define CORE_PIN9_PORTREG GPIO7_DR
  1273. #define CORE_PIN10_PORTREG GPIO7_DR
  1274. #define CORE_PIN11_PORTREG GPIO7_DR
  1275. #define CORE_PIN12_PORTREG GPIO7_DR
  1276. #define CORE_PIN13_PORTREG GPIO7_DR
  1277. #define CORE_PIN14_PORTREG GPIO6_DR
  1278. #define CORE_PIN15_PORTREG GPIO6_DR
  1279. #define CORE_PIN16_PORTREG GPIO6_DR
  1280. #define CORE_PIN17_PORTREG GPIO6_DR
  1281. #define CORE_PIN18_PORTREG GPIO6_DR
  1282. #define CORE_PIN19_PORTREG GPIO6_DR
  1283. #define CORE_PIN20_PORTREG GPIO6_DR
  1284. #define CORE_PIN21_PORTREG GPIO6_DR
  1285. #define CORE_PIN22_PORTREG GPIO6_DR
  1286. #define CORE_PIN23_PORTREG GPIO6_DR
  1287. #define CORE_PIN24_PORTREG GPIO6_DR
  1288. #define CORE_PIN25_PORTREG GPIO6_DR
  1289. #define CORE_PIN26_PORTREG GPIO6_DR
  1290. #define CORE_PIN27_PORTREG GPIO6_DR
  1291. #define CORE_PIN28_PORTREG GPIO8_DR
  1292. #define CORE_PIN29_PORTREG GPIO9_DR
  1293. #define CORE_PIN30_PORTREG GPIO8_DR
  1294. #define CORE_PIN31_PORTREG GPIO8_DR
  1295. #define CORE_PIN32_PORTREG GPIO7_DR
  1296. #define CORE_PIN33_PORTREG GPIO9_DR
  1297. #define CORE_PIN34_PORTREG GPIO8_DR
  1298. #define CORE_PIN35_PORTREG GPIO8_DR
  1299. #define CORE_PIN36_PORTREG GPIO8_DR
  1300. #define CORE_PIN37_PORTREG GPIO8_DR
  1301. #define CORE_PIN38_PORTREG GPIO8_DR
  1302. #define CORE_PIN39_PORTREG GPIO8_DR
  1303. #define CORE_PIN40_PORTREG GPIO7_DR
  1304. #define CORE_PIN41_PORTREG GPIO7_DR
  1305. #define CORE_PIN42_PORTREG GPIO7_DR
  1306. #define CORE_PIN43_PORTREG GPIO7_DR
  1307. #define CORE_PIN44_PORTREG GPIO7_DR
  1308. #define CORE_PIN45_PORTREG GPIO7_DR
  1309. #define CORE_PIN0_PORTSET GPIO6_DR_SET
  1310. #define CORE_PIN1_PORTSET GPIO6_DR_SET
  1311. #define CORE_PIN2_PORTSET GPIO9_DR_SET
  1312. #define CORE_PIN3_PORTSET GPIO9_DR_SET
  1313. #define CORE_PIN4_PORTSET GPIO9_DR_SET
  1314. #define CORE_PIN5_PORTSET GPIO9_DR_SET
  1315. #define CORE_PIN6_PORTSET GPIO7_DR_SET
  1316. #define CORE_PIN7_PORTSET GPIO7_DR_SET
  1317. #define CORE_PIN8_PORTSET GPIO7_DR_SET
  1318. #define CORE_PIN9_PORTSET GPIO7_DR_SET
  1319. #define CORE_PIN10_PORTSET GPIO7_DR_SET
  1320. #define CORE_PIN11_PORTSET GPIO7_DR_SET
  1321. #define CORE_PIN12_PORTSET GPIO7_DR_SET
  1322. #define CORE_PIN13_PORTSET GPIO7_DR_SET
  1323. #define CORE_PIN14_PORTSET GPIO6_DR_SET
  1324. #define CORE_PIN15_PORTSET GPIO6_DR_SET
  1325. #define CORE_PIN16_PORTSET GPIO6_DR_SET
  1326. #define CORE_PIN17_PORTSET GPIO6_DR_SET
  1327. #define CORE_PIN18_PORTSET GPIO6_DR_SET
  1328. #define CORE_PIN19_PORTSET GPIO6_DR_SET
  1329. #define CORE_PIN20_PORTSET GPIO6_DR_SET
  1330. #define CORE_PIN21_PORTSET GPIO6_DR_SET
  1331. #define CORE_PIN22_PORTSET GPIO6_DR_SET
  1332. #define CORE_PIN23_PORTSET GPIO6_DR_SET
  1333. #define CORE_PIN24_PORTSET GPIO6_DR_SET
  1334. #define CORE_PIN25_PORTSET GPIO6_DR_SET
  1335. #define CORE_PIN26_PORTSET GPIO6_DR_SET
  1336. #define CORE_PIN27_PORTSET GPIO6_DR_SET
  1337. #define CORE_PIN28_PORTSET GPIO8_DR_SET
  1338. #define CORE_PIN29_PORTSET GPIO9_DR_SET
  1339. #define CORE_PIN30_PORTSET GPIO8_DR_SET
  1340. #define CORE_PIN31_PORTSET GPIO8_DR_SET
  1341. #define CORE_PIN32_PORTSET GPIO7_DR_SET
  1342. #define CORE_PIN33_PORTSET GPIO9_DR_SET
  1343. #define CORE_PIN34_PORTSET GPIO8_DR_SET
  1344. #define CORE_PIN35_PORTSET GPIO8_DR_SET
  1345. #define CORE_PIN36_PORTSET GPIO8_DR_SET
  1346. #define CORE_PIN37_PORTSET GPIO8_DR_SET
  1347. #define CORE_PIN38_PORTSET GPIO8_DR_SET
  1348. #define CORE_PIN39_PORTSET GPIO8_DR_SET
  1349. #define CORE_PIN40_PORTSET GPIO7_DR_SET
  1350. #define CORE_PIN41_PORTSET GPIO7_DR_SET
  1351. #define CORE_PIN42_PORTSET GPIO7_DR_SET
  1352. #define CORE_PIN43_PORTSET GPIO7_DR_SET
  1353. #define CORE_PIN44_PORTSET GPIO7_DR_SET
  1354. #define CORE_PIN45_PORTSET GPIO7_DR_SET
  1355. #define CORE_PIN0_PORTCLEAR GPIO6_DR_CLEAR
  1356. #define CORE_PIN1_PORTCLEAR GPIO6_DR_CLEAR
  1357. #define CORE_PIN2_PORTCLEAR GPIO9_DR_CLEAR
  1358. #define CORE_PIN3_PORTCLEAR GPIO9_DR_CLEAR
  1359. #define CORE_PIN4_PORTCLEAR GPIO9_DR_CLEAR
  1360. #define CORE_PIN5_PORTCLEAR GPIO9_DR_CLEAR
  1361. #define CORE_PIN6_PORTCLEAR GPIO7_DR_CLEAR
  1362. #define CORE_PIN7_PORTCLEAR GPIO7_DR_CLEAR
  1363. #define CORE_PIN8_PORTCLEAR GPIO7_DR_CLEAR
  1364. #define CORE_PIN9_PORTCLEAR GPIO7_DR_CLEAR
  1365. #define CORE_PIN10_PORTCLEAR GPIO7_DR_CLEAR
  1366. #define CORE_PIN11_PORTCLEAR GPIO7_DR_CLEAR
  1367. #define CORE_PIN12_PORTCLEAR GPIO7_DR_CLEAR
  1368. #define CORE_PIN13_PORTCLEAR GPIO7_DR_CLEAR
  1369. #define CORE_PIN14_PORTCLEAR GPIO6_DR_CLEAR
  1370. #define CORE_PIN15_PORTCLEAR GPIO6_DR_CLEAR
  1371. #define CORE_PIN16_PORTCLEAR GPIO6_DR_CLEAR
  1372. #define CORE_PIN17_PORTCLEAR GPIO6_DR_CLEAR
  1373. #define CORE_PIN18_PORTCLEAR GPIO6_DR_CLEAR
  1374. #define CORE_PIN19_PORTCLEAR GPIO6_DR_CLEAR
  1375. #define CORE_PIN20_PORTCLEAR GPIO6_DR_CLEAR
  1376. #define CORE_PIN21_PORTCLEAR GPIO6_DR_CLEAR
  1377. #define CORE_PIN22_PORTCLEAR GPIO6_DR_CLEAR
  1378. #define CORE_PIN23_PORTCLEAR GPIO6_DR_CLEAR
  1379. #define CORE_PIN24_PORTCLEAR GPIO6_DR_CLEAR
  1380. #define CORE_PIN25_PORTCLEAR GPIO6_DR_CLEAR
  1381. #define CORE_PIN26_PORTCLEAR GPIO6_DR_CLEAR
  1382. #define CORE_PIN27_PORTCLEAR GPIO6_DR_CLEAR
  1383. #define CORE_PIN28_PORTCLEAR GPIO8_DR_CLEAR
  1384. #define CORE_PIN29_PORTCLEAR GPIO9_DR_CLEAR
  1385. #define CORE_PIN30_PORTCLEAR GPIO8_DR_CLEAR
  1386. #define CORE_PIN31_PORTCLEAR GPIO8_DR_CLEAR
  1387. #define CORE_PIN32_PORTCLEAR GPIO7_DR_CLEAR
  1388. #define CORE_PIN33_PORTCLEAR GPIO9_DR_CLEAR
  1389. #define CORE_PIN34_PORTCLEAR GPIO8_DR_CLEAR
  1390. #define CORE_PIN35_PORTCLEAR GPIO8_DR_CLEAR
  1391. #define CORE_PIN36_PORTCLEAR GPIO8_DR_CLEAR
  1392. #define CORE_PIN37_PORTCLEAR GPIO8_DR_CLEAR
  1393. #define CORE_PIN38_PORTCLEAR GPIO8_DR_CLEAR
  1394. #define CORE_PIN39_PORTCLEAR GPIO8_DR_CLEAR
  1395. #define CORE_PIN40_PORTCLEAR GPIO7_DR_CLEAR
  1396. #define CORE_PIN41_PORTCLEAR GPIO7_DR_CLEAR
  1397. #define CORE_PIN42_PORTCLEAR GPIO7_DR_CLEAR
  1398. #define CORE_PIN43_PORTCLEAR GPIO7_DR_CLEAR
  1399. #define CORE_PIN44_PORTCLEAR GPIO7_DR_CLEAR
  1400. #define CORE_PIN45_PORTCLEAR GPIO7_DR_CLEAR
  1401. #define CORE_PIN0_PORTTOGGLE GPIO6_DR_TOGGLE
  1402. #define CORE_PIN1_PORTTOGGLE GPIO6_DR_TOGGLE
  1403. #define CORE_PIN2_PORTTOGGLE GPIO9_DR_TOGGLE
  1404. #define CORE_PIN3_PORTTOGGLE GPIO9_DR_TOGGLE
  1405. #define CORE_PIN4_PORTTOGGLE GPIO9_DR_TOGGLE
  1406. #define CORE_PIN5_PORTTOGGLE GPIO9_DR_TOGGLE
  1407. #define CORE_PIN6_PORTTOGGLE GPIO7_DR_TOGGLE
  1408. #define CORE_PIN7_PORTTOGGLE GPIO7_DR_TOGGLE
  1409. #define CORE_PIN8_PORTTOGGLE GPIO7_DR_TOGGLE
  1410. #define CORE_PIN9_PORTTOGGLE GPIO7_DR_TOGGLE
  1411. #define CORE_PIN10_PORTTOGGLE GPIO7_DR_TOGGLE
  1412. #define CORE_PIN11_PORTTOGGLE GPIO7_DR_TOGGLE
  1413. #define CORE_PIN12_PORTTOGGLE GPIO7_DR_TOGGLE
  1414. #define CORE_PIN13_PORTTOGGLE GPIO7_DR_TOGGLE
  1415. #define CORE_PIN14_PORTTOGGLE GPIO6_DR_TOGGLE
  1416. #define CORE_PIN15_PORTTOGGLE GPIO6_DR_TOGGLE
  1417. #define CORE_PIN16_PORTTOGGLE GPIO6_DR_TOGGLE
  1418. #define CORE_PIN17_PORTTOGGLE GPIO6_DR_TOGGLE
  1419. #define CORE_PIN18_PORTTOGGLE GPIO6_DR_TOGGLE
  1420. #define CORE_PIN19_PORTTOGGLE GPIO6_DR_TOGGLE
  1421. #define CORE_PIN20_PORTTOGGLE GPIO6_DR_TOGGLE
  1422. #define CORE_PIN21_PORTTOGGLE GPIO6_DR_TOGGLE
  1423. #define CORE_PIN22_PORTTOGGLE GPIO6_DR_TOGGLE
  1424. #define CORE_PIN23_PORTTOGGLE GPIO6_DR_TOGGLE
  1425. #define CORE_PIN24_PORTTOGGLE GPIO6_DR_TOGGLE
  1426. #define CORE_PIN25_PORTTOGGLE GPIO6_DR_TOGGLE
  1427. #define CORE_PIN26_PORTTOGGLE GPIO6_DR_TOGGLE
  1428. #define CORE_PIN27_PORTTOGGLE GPIO6_DR_TOGGLE
  1429. #define CORE_PIN28_PORTTOGGLE GPIO8_DR_TOGGLE
  1430. #define CORE_PIN29_PORTTOGGLE GPIO9_DR_TOGGLE
  1431. #define CORE_PIN30_PORTTOGGLE GPIO8_DR_TOGGLE
  1432. #define CORE_PIN31_PORTTOGGLE GPIO8_DR_TOGGLE
  1433. #define CORE_PIN32_PORTTOGGLE GPIO7_DR_TOGGLE
  1434. #define CORE_PIN33_PORTTOGGLE GPIO9_DR_TOGGLE
  1435. #define CORE_PIN34_PORTTOGGLE GPIO8_DR_TOGGLE
  1436. #define CORE_PIN35_PORTTOGGLE GPIO8_DR_TOGGLE
  1437. #define CORE_PIN36_PORTTOGGLE GPIO8_DR_TOGGLE
  1438. #define CORE_PIN37_PORTTOGGLE GPIO8_DR_TOGGLE
  1439. #define CORE_PIN38_PORTTOGGLE GPIO8_DR_TOGGLE
  1440. #define CORE_PIN39_PORTTOGGLE GPIO8_DR_TOGGLE
  1441. #define CORE_PIN40_PORTTOGGLE GPIO7_DR_TOGGLE
  1442. #define CORE_PIN41_PORTTOGGLE GPIO7_DR_TOGGLE
  1443. #define CORE_PIN42_PORTTOGGLE GPIO7_DR_TOGGLE
  1444. #define CORE_PIN43_PORTTOGGLE GPIO7_DR_TOGGLE
  1445. #define CORE_PIN44_PORTTOGGLE GPIO7_DR_TOGGLE
  1446. #define CORE_PIN45_PORTTOGGLE GPIO7_DR_TOGGLE
  1447. #define CORE_PIN0_DDRREG GPIO6_GDIR
  1448. #define CORE_PIN1_DDRREG GPIO6_GDIR
  1449. #define CORE_PIN2_DDRREG GPIO9_GDIR
  1450. #define CORE_PIN3_DDRREG GPIO9_GDIR
  1451. #define CORE_PIN4_DDRREG GPIO9_GDIR
  1452. #define CORE_PIN5_DDRREG GPIO9_GDIR
  1453. #define CORE_PIN6_DDRREG GPIO7_GDIR
  1454. #define CORE_PIN7_DDRREG GPIO7_GDIR
  1455. #define CORE_PIN8_DDRREG GPIO7_GDIR
  1456. #define CORE_PIN9_DDRREG GPIO7_GDIR
  1457. #define CORE_PIN10_DDRREG GPIO7_GDIR
  1458. #define CORE_PIN11_DDRREG GPIO7_GDIR
  1459. #define CORE_PIN12_DDRREG GPIO7_GDIR
  1460. #define CORE_PIN13_DDRREG GPIO7_GDIR
  1461. #define CORE_PIN14_DDRREG GPIO6_GDIR
  1462. #define CORE_PIN15_DDRREG GPIO6_GDIR
  1463. #define CORE_PIN16_DDRREG GPIO6_GDIR
  1464. #define CORE_PIN17_DDRREG GPIO6_GDIR
  1465. #define CORE_PIN18_DDRREG GPIO6_GDIR
  1466. #define CORE_PIN19_DDRREG GPIO6_GDIR
  1467. #define CORE_PIN20_DDRREG GPIO6_GDIR
  1468. #define CORE_PIN21_DDRREG GPIO6_GDIR
  1469. #define CORE_PIN22_DDRREG GPIO6_GDIR
  1470. #define CORE_PIN23_DDRREG GPIO6_GDIR
  1471. #define CORE_PIN24_DDRREG GPIO6_GDIR
  1472. #define CORE_PIN25_DDRREG GPIO6_GDIR
  1473. #define CORE_PIN26_DDRREG GPIO6_GDIR
  1474. #define CORE_PIN27_DDRREG GPIO6_GDIR
  1475. #define CORE_PIN28_DDRREG GPIO8_GDIR
  1476. #define CORE_PIN29_DDRREG GPIO9_GDIR
  1477. #define CORE_PIN30_DDRREG GPIO8_GDIR
  1478. #define CORE_PIN31_DDRREG GPIO8_GDIR
  1479. #define CORE_PIN32_DDRREG GPIO7_GDIR
  1480. #define CORE_PIN33_DDRREG GPIO9_GDIR
  1481. #define CORE_PIN34_DDRREG GPIO8_GDIR
  1482. #define CORE_PIN35_DDRREG GPIO8_GDIR
  1483. #define CORE_PIN36_DDRREG GPIO8_GDIR
  1484. #define CORE_PIN37_DDRREG GPIO8_GDIR
  1485. #define CORE_PIN38_DDRREG GPIO8_GDIR
  1486. #define CORE_PIN39_DDRREG GPIO8_GDIR
  1487. #define CORE_PIN40_DDRREG GPIO7_GDIR
  1488. #define CORE_PIN41_DDRREG GPIO7_GDIR
  1489. #define CORE_PIN42_DDRREG GPIO7_GDIR
  1490. #define CORE_PIN43_DDRREG GPIO7_GDIR
  1491. #define CORE_PIN44_DDRREG GPIO7_GDIR
  1492. #define CORE_PIN45_DDRREG GPIO7_GDIR
  1493. #define CORE_PIN0_PINREG GPIO6_PSR
  1494. #define CORE_PIN1_PINREG GPIO6_PSR
  1495. #define CORE_PIN2_PINREG GPIO9_PSR
  1496. #define CORE_PIN3_PINREG GPIO9_PSR
  1497. #define CORE_PIN4_PINREG GPIO9_PSR
  1498. #define CORE_PIN5_PINREG GPIO9_PSR
  1499. #define CORE_PIN6_PINREG GPIO7_PSR
  1500. #define CORE_PIN7_PINREG GPIO7_PSR
  1501. #define CORE_PIN8_PINREG GPIO7_PSR
  1502. #define CORE_PIN9_PINREG GPIO7_PSR
  1503. #define CORE_PIN10_PINREG GPIO7_PSR
  1504. #define CORE_PIN11_PINREG GPIO7_PSR
  1505. #define CORE_PIN12_PINREG GPIO7_PSR
  1506. #define CORE_PIN13_PINREG GPIO7_PSR
  1507. #define CORE_PIN14_PINREG GPIO6_PSR
  1508. #define CORE_PIN15_PINREG GPIO6_PSR
  1509. #define CORE_PIN16_PINREG GPIO6_PSR
  1510. #define CORE_PIN17_PINREG GPIO6_PSR
  1511. #define CORE_PIN18_PINREG GPIO6_PSR
  1512. #define CORE_PIN19_PINREG GPIO6_PSR
  1513. #define CORE_PIN20_PINREG GPIO6_PSR
  1514. #define CORE_PIN21_PINREG GPIO6_PSR
  1515. #define CORE_PIN22_PINREG GPIO6_PSR
  1516. #define CORE_PIN23_PINREG GPIO6_PSR
  1517. #define CORE_PIN24_PINREG GPIO6_PSR
  1518. #define CORE_PIN25_PINREG GPIO6_PSR
  1519. #define CORE_PIN26_PINREG GPIO6_PSR
  1520. #define CORE_PIN27_PINREG GPIO6_PSR
  1521. #define CORE_PIN28_PINREG GPIO8_PSR
  1522. #define CORE_PIN29_PINREG GPIO9_PSR
  1523. #define CORE_PIN30_PINREG GPIO8_PSR
  1524. #define CORE_PIN31_PINREG GPIO8_PSR
  1525. #define CORE_PIN32_PINREG GPIO7_PSR
  1526. #define CORE_PIN33_PINREG GPIO9_PSR
  1527. #define CORE_PIN34_PINREG GPIO8_PSR
  1528. #define CORE_PIN35_PINREG GPIO8_PSR
  1529. #define CORE_PIN36_PINREG GPIO8_PSR
  1530. #define CORE_PIN37_PINREG GPIO8_PSR
  1531. #define CORE_PIN38_PINREG GPIO8_PSR
  1532. #define CORE_PIN39_PINREG GPIO8_PSR
  1533. #define CORE_PIN40_PINREG GPIO7_PSR
  1534. #define CORE_PIN41_PINREG GPIO7_PSR
  1535. #define CORE_PIN42_PINREG GPIO7_PSR
  1536. #define CORE_PIN43_PINREG GPIO7_PSR
  1537. #define CORE_PIN44_PINREG GPIO7_PSR
  1538. #define CORE_PIN45_PINREG GPIO7_PSR
  1539. // mux config registers control which peripheral uses the pin
  1540. #define CORE_PIN0_CONFIG IOMUXC_SW_MUX_CTL_PAD_GPIO_AD_B0_03
  1541. #define CORE_PIN1_CONFIG IOMUXC_SW_MUX_CTL_PAD_GPIO_AD_B0_02
  1542. #define CORE_PIN2_CONFIG IOMUXC_SW_MUX_CTL_PAD_GPIO_EMC_04
  1543. #define CORE_PIN3_CONFIG IOMUXC_SW_MUX_CTL_PAD_GPIO_EMC_05
  1544. #define CORE_PIN4_CONFIG IOMUXC_SW_MUX_CTL_PAD_GPIO_EMC_06
  1545. #define CORE_PIN5_CONFIG IOMUXC_SW_MUX_CTL_PAD_GPIO_EMC_08
  1546. #define CORE_PIN6_CONFIG IOMUXC_SW_MUX_CTL_PAD_GPIO_B0_10
  1547. #define CORE_PIN7_CONFIG IOMUXC_SW_MUX_CTL_PAD_GPIO_B1_01
  1548. #define CORE_PIN8_CONFIG IOMUXC_SW_MUX_CTL_PAD_GPIO_B1_00
  1549. #define CORE_PIN9_CONFIG IOMUXC_SW_MUX_CTL_PAD_GPIO_B0_11
  1550. #define CORE_PIN10_CONFIG IOMUXC_SW_MUX_CTL_PAD_GPIO_B0_00
  1551. #define CORE_PIN11_CONFIG IOMUXC_SW_MUX_CTL_PAD_GPIO_B0_02
  1552. #define CORE_PIN12_CONFIG IOMUXC_SW_MUX_CTL_PAD_GPIO_B0_01
  1553. #define CORE_PIN13_CONFIG IOMUXC_SW_MUX_CTL_PAD_GPIO_B0_03
  1554. #define CORE_PIN14_CONFIG IOMUXC_SW_MUX_CTL_PAD_GPIO_AD_B1_02
  1555. #define CORE_PIN15_CONFIG IOMUXC_SW_MUX_CTL_PAD_GPIO_AD_B1_03
  1556. #define CORE_PIN16_CONFIG IOMUXC_SW_MUX_CTL_PAD_GPIO_AD_B1_07
  1557. #define CORE_PIN17_CONFIG IOMUXC_SW_MUX_CTL_PAD_GPIO_AD_B1_06
  1558. #define CORE_PIN18_CONFIG IOMUXC_SW_MUX_CTL_PAD_GPIO_AD_B1_01
  1559. #define CORE_PIN19_CONFIG IOMUXC_SW_MUX_CTL_PAD_GPIO_AD_B1_00
  1560. #define CORE_PIN20_CONFIG IOMUXC_SW_MUX_CTL_PAD_GPIO_AD_B1_10
  1561. #define CORE_PIN21_CONFIG IOMUXC_SW_MUX_CTL_PAD_GPIO_AD_B1_11
  1562. #define CORE_PIN22_CONFIG IOMUXC_SW_MUX_CTL_PAD_GPIO_AD_B1_08
  1563. #define CORE_PIN23_CONFIG IOMUXC_SW_MUX_CTL_PAD_GPIO_AD_B1_09
  1564. #define CORE_PIN24_CONFIG IOMUXC_SW_MUX_CTL_PAD_GPIO_AD_B0_12
  1565. #define CORE_PIN25_CONFIG IOMUXC_SW_MUX_CTL_PAD_GPIO_AD_B0_13
  1566. #define CORE_PIN26_CONFIG IOMUXC_SW_MUX_CTL_PAD_GPIO_AD_B1_14
  1567. #define CORE_PIN27_CONFIG IOMUXC_SW_MUX_CTL_PAD_GPIO_AD_B1_15
  1568. #define CORE_PIN28_CONFIG IOMUXC_SW_MUX_CTL_PAD_GPIO_EMC_32
  1569. #define CORE_PIN29_CONFIG IOMUXC_SW_MUX_CTL_PAD_GPIO_EMC_31
  1570. #define CORE_PIN30_CONFIG IOMUXC_SW_MUX_CTL_PAD_GPIO_EMC_37
  1571. #define CORE_PIN31_CONFIG IOMUXC_SW_MUX_CTL_PAD_GPIO_EMC_36
  1572. #define CORE_PIN32_CONFIG IOMUXC_SW_MUX_CTL_PAD_GPIO_B0_12
  1573. #define CORE_PIN33_CONFIG IOMUXC_SW_MUX_CTL_PAD_GPIO_EMC_07
  1574. #define CORE_PIN34_CONFIG IOMUXC_SW_MUX_CTL_PAD_GPIO_SD_B0_03
  1575. #define CORE_PIN35_CONFIG IOMUXC_SW_MUX_CTL_PAD_GPIO_SD_B0_02
  1576. #define CORE_PIN36_CONFIG IOMUXC_SW_MUX_CTL_PAD_GPIO_SD_B0_01
  1577. #define CORE_PIN37_CONFIG IOMUXC_SW_MUX_CTL_PAD_GPIO_SD_B0_00
  1578. #define CORE_PIN38_CONFIG IOMUXC_SW_MUX_CTL_PAD_GPIO_SD_B0_05
  1579. #define CORE_PIN39_CONFIG IOMUXC_SW_MUX_CTL_PAD_GPIO_SD_B0_04
  1580. #define CORE_PIN40_CONFIG IOMUXC_SW_MUX_CTL_PAD_GPIO_B0_04
  1581. #define CORE_PIN41_CONFIG IOMUXC_SW_MUX_CTL_PAD_GPIO_B0_05
  1582. #define CORE_PIN42_CONFIG IOMUXC_SW_MUX_CTL_PAD_GPIO_B0_06
  1583. #define CORE_PIN43_CONFIG IOMUXC_SW_MUX_CTL_PAD_GPIO_B0_07
  1584. #define CORE_PIN44_CONFIG IOMUXC_SW_MUX_CTL_PAD_GPIO_B0_08
  1585. #define CORE_PIN45_CONFIG IOMUXC_SW_MUX_CTL_PAD_GPIO_B0_09
  1586. // pad config registers control pullup/pulldown/keeper, drive strength, etc
  1587. #define CORE_PIN0_PADCONFIG IOMUXC_SW_PAD_CTL_PAD_GPIO_AD_B0_03
  1588. #define CORE_PIN1_PADCONFIG IOMUXC_SW_PAD_CTL_PAD_GPIO_AD_B0_02
  1589. #define CORE_PIN2_PADCONFIG IOMUXC_SW_PAD_CTL_PAD_GPIO_EMC_04
  1590. #define CORE_PIN3_PADCONFIG IOMUXC_SW_PAD_CTL_PAD_GPIO_EMC_05
  1591. #define CORE_PIN4_PADCONFIG IOMUXC_SW_PAD_CTL_PAD_GPIO_EMC_06
  1592. #define CORE_PIN5_PADCONFIG IOMUXC_SW_PAD_CTL_PAD_GPIO_EMC_08
  1593. #define CORE_PIN6_PADCONFIG IOMUXC_SW_PAD_CTL_PAD_GPIO_B0_10
  1594. #define CORE_PIN7_PADCONFIG IOMUXC_SW_PAD_CTL_PAD_GPIO_B1_01
  1595. #define CORE_PIN8_PADCONFIG IOMUXC_SW_PAD_CTL_PAD_GPIO_B1_00
  1596. #define CORE_PIN9_PADCONFIG IOMUXC_SW_PAD_CTL_PAD_GPIO_B0_11
  1597. #define CORE_PIN10_PADCONFIG IOMUXC_SW_PAD_CTL_PAD_GPIO_B0_00
  1598. #define CORE_PIN11_PADCONFIG IOMUXC_SW_PAD_CTL_PAD_GPIO_B0_02
  1599. #define CORE_PIN12_PADCONFIG IOMUXC_SW_PAD_CTL_PAD_GPIO_B0_01
  1600. #define CORE_PIN13_PADCONFIG IOMUXC_SW_PAD_CTL_PAD_GPIO_B0_03
  1601. #define CORE_PIN14_PADCONFIG IOMUXC_SW_PAD_CTL_PAD_GPIO_AD_B1_02
  1602. #define CORE_PIN15_PADCONFIG IOMUXC_SW_PAD_CTL_PAD_GPIO_AD_B1_03
  1603. #define CORE_PIN16_PADCONFIG IOMUXC_SW_PAD_CTL_PAD_GPIO_AD_B1_07
  1604. #define CORE_PIN17_PADCONFIG IOMUXC_SW_PAD_CTL_PAD_GPIO_AD_B1_06
  1605. #define CORE_PIN18_PADCONFIG IOMUXC_SW_PAD_CTL_PAD_GPIO_AD_B1_01
  1606. #define CORE_PIN19_PADCONFIG IOMUXC_SW_PAD_CTL_PAD_GPIO_AD_B1_00
  1607. #define CORE_PIN20_PADCONFIG IOMUXC_SW_PAD_CTL_PAD_GPIO_AD_B1_10
  1608. #define CORE_PIN21_PADCONFIG IOMUXC_SW_PAD_CTL_PAD_GPIO_AD_B1_11
  1609. #define CORE_PIN22_PADCONFIG IOMUXC_SW_PAD_CTL_PAD_GPIO_AD_B1_08
  1610. #define CORE_PIN23_PADCONFIG IOMUXC_SW_PAD_CTL_PAD_GPIO_AD_B1_09
  1611. #define CORE_PIN24_PADCONFIG IOMUXC_SW_PAD_CTL_PAD_GPIO_AD_B0_12
  1612. #define CORE_PIN25_PADCONFIG IOMUXC_SW_PAD_CTL_PAD_GPIO_AD_B0_13
  1613. #define CORE_PIN26_PADCONFIG IOMUXC_SW_PAD_CTL_PAD_GPIO_AD_B1_14
  1614. #define CORE_PIN27_PADCONFIG IOMUXC_SW_PAD_CTL_PAD_GPIO_AD_B1_15
  1615. #define CORE_PIN28_PADCONFIG IOMUXC_SW_PAD_CTL_PAD_GPIO_EMC_32
  1616. #define CORE_PIN29_PADCONFIG IOMUXC_SW_PAD_CTL_PAD_GPIO_EMC_31
  1617. #define CORE_PIN30_PADCONFIG IOMUXC_SW_PAD_CTL_PAD_GPIO_EMC_37
  1618. #define CORE_PIN31_PADCONFIG IOMUXC_SW_PAD_CTL_PAD_GPIO_EMC_36
  1619. #define CORE_PIN32_PADCONFIG IOMUXC_SW_PAD_CTL_PAD_GPIO_B0_12
  1620. #define CORE_PIN33_PADCONFIG IOMUXC_SW_PAD_CTL_PAD_GPIO_EMC_07
  1621. #define CORE_PIN34_PADCONFIG IOMUXC_SW_PAD_CTL_PAD_GPIO_SD_B0_03
  1622. #define CORE_PIN35_PADCONFIG IOMUXC_SW_PAD_CTL_PAD_GPIO_SD_B0_02
  1623. #define CORE_PIN36_PADCONFIG IOMUXC_SW_PAD_CTL_PAD_GPIO_SD_B0_01
  1624. #define CORE_PIN37_PADCONFIG IOMUXC_SW_PAD_CTL_PAD_GPIO_SD_B0_00
  1625. #define CORE_PIN38_PADCONFIG IOMUXC_SW_PAD_CTL_PAD_GPIO_SD_B0_05
  1626. #define CORE_PIN39_PADCONFIG IOMUXC_SW_PAD_CTL_PAD_GPIO_SD_B0_04
  1627. #define CORE_PIN40_PADCONFIG IOMUXC_SW_PAD_CTL_PAD_GPIO_B0_04
  1628. #define CORE_PIN41_PADCONFIG IOMUXC_SW_PAD_CTL_PAD_GPIO_B0_05
  1629. #define CORE_PIN42_PADCONFIG IOMUXC_SW_PAD_CTL_PAD_GPIO_B0_06
  1630. #define CORE_PIN43_PADCONFIG IOMUXC_SW_PAD_CTL_PAD_GPIO_B0_07
  1631. #define CORE_PIN44_PADCONFIG IOMUXC_SW_PAD_CTL_PAD_GPIO_B0_08
  1632. #define CORE_PIN45_PADCONFIG IOMUXC_SW_PAD_CTL_PAD_GPIO_B0_09
  1633. #define CORE_LED0_PIN 13
  1634. #define CORE_ADC0_PIN 14
  1635. #define CORE_ADC1_PIN 15
  1636. #define CORE_ADC2_PIN 16
  1637. #define CORE_ADC3_PIN 17
  1638. #define CORE_ADC4_PIN 18
  1639. #define CORE_ADC5_PIN 19
  1640. #define CORE_ADC6_PIN 20
  1641. #define CORE_ADC7_PIN 21
  1642. #define CORE_ADC8_PIN 22
  1643. #define CORE_ADC9_PIN 23
  1644. #define CORE_RXD0_PIN 0
  1645. #define CORE_TXD0_PIN 1
  1646. #define CORE_RXD1_PIN 7
  1647. #define CORE_TXD1_PIN 8
  1648. #define CORE_RXD2_PIN 15
  1649. #define CORE_TXD2_PIN 14
  1650. #define CORE_RXD3_PIN 16
  1651. #define CORE_TXD3_PIN 17
  1652. #define CORE_RXD4_PIN 21
  1653. #define CORE_TXD4_PIN 20
  1654. #define CORE_RXD5_PIN 25
  1655. #define CORE_TXD5_PIN 24
  1656. #define CORE_RXD6_PIN 28
  1657. #define CORE_TXD6_PIN 29
  1658. #define CORE_INT0_PIN 0
  1659. #define CORE_INT1_PIN 1
  1660. #define CORE_INT2_PIN 2
  1661. #define CORE_INT3_PIN 3
  1662. #define CORE_INT4_PIN 4
  1663. #define CORE_INT5_PIN 5
  1664. #define CORE_INT6_PIN 6
  1665. #define CORE_INT7_PIN 7
  1666. #define CORE_INT8_PIN 8
  1667. #define CORE_INT9_PIN 9
  1668. #define CORE_INT10_PIN 10
  1669. #define CORE_INT11_PIN 11
  1670. #define CORE_INT12_PIN 12
  1671. #define CORE_INT13_PIN 13
  1672. #define CORE_INT14_PIN 14
  1673. #define CORE_INT15_PIN 15
  1674. #define CORE_INT16_PIN 16
  1675. #define CORE_INT17_PIN 17
  1676. #define CORE_INT18_PIN 18
  1677. #define CORE_INT19_PIN 19
  1678. #define CORE_INT20_PIN 20
  1679. #define CORE_INT21_PIN 21
  1680. #define CORE_INT22_PIN 22
  1681. #define CORE_INT23_PIN 23
  1682. #define CORE_INT24_PIN 24
  1683. #define CORE_INT25_PIN 25
  1684. #define CORE_INT26_PIN 26
  1685. #define CORE_INT27_PIN 27
  1686. #define CORE_INT28_PIN 28
  1687. #define CORE_INT29_PIN 29
  1688. #define CORE_INT30_PIN 30
  1689. #define CORE_INT31_PIN 31
  1690. #define CORE_INT32_PIN 32
  1691. #define CORE_INT33_PIN 33
  1692. #define CORE_INT34_PIN 34
  1693. #define CORE_INT35_PIN 35
  1694. #define CORE_INT36_PIN 36
  1695. #define CORE_INT37_PIN 37
  1696. #define CORE_INT38_PIN 38
  1697. #define CORE_INT39_PIN 39
  1698. #define CORE_INT40_PIN 40
  1699. #define CORE_INT41_PIN 41
  1700. #define CORE_INT42_PIN 42
  1701. #define CORE_INT43_PIN 43
  1702. #define CORE_INT44_PIN 44
  1703. #define CORE_INT45_PIN 45
  1704. #define CORE_INT_EVERY_PIN 1
  1705. #endif // __IMXRT1062__
  1706. #ifdef __cplusplus
  1707. extern "C" {
  1708. #endif
  1709. //TODO:
  1710. //#define analogInputToDigitalPin(p)
  1711. //#define digitalPinHasPWM(p)
  1712. #define digitalPinToInterrupt(p) ((p) < NUM_DIGITAL_PINS ? (p) : -1)
  1713. void digitalWrite(uint8_t pin, uint8_t val);
  1714. static inline void digitalWriteFast(uint8_t pin, uint8_t val) __attribute__((always_inline, unused));
  1715. static inline void digitalWriteFast(uint8_t pin, uint8_t val)
  1716. {
  1717. if (__builtin_constant_p(pin)) {
  1718. if (val) {
  1719. if (pin == 0) {
  1720. CORE_PIN0_PORTSET = CORE_PIN0_BITMASK;
  1721. } else if (pin == 1) {
  1722. CORE_PIN1_PORTSET = CORE_PIN1_BITMASK;
  1723. } else if (pin == 2) {
  1724. CORE_PIN2_PORTSET = CORE_PIN2_BITMASK;
  1725. } else if (pin == 3) {
  1726. CORE_PIN3_PORTSET = CORE_PIN3_BITMASK;
  1727. } else if (pin == 4) {
  1728. CORE_PIN4_PORTSET = CORE_PIN4_BITMASK;
  1729. } else if (pin == 5) {
  1730. CORE_PIN5_PORTSET = CORE_PIN5_BITMASK;
  1731. } else if (pin == 6) {
  1732. CORE_PIN6_PORTSET = CORE_PIN6_BITMASK;
  1733. } else if (pin == 7) {
  1734. CORE_PIN7_PORTSET = CORE_PIN7_BITMASK;
  1735. } else if (pin == 8) {
  1736. CORE_PIN8_PORTSET = CORE_PIN8_BITMASK;
  1737. } else if (pin == 9) {
  1738. CORE_PIN9_PORTSET = CORE_PIN9_BITMASK;
  1739. } else if (pin == 10) {
  1740. CORE_PIN10_PORTSET = CORE_PIN10_BITMASK;
  1741. } else if (pin == 11) {
  1742. CORE_PIN11_PORTSET = CORE_PIN11_BITMASK;
  1743. } else if (pin == 12) {
  1744. CORE_PIN12_PORTSET = CORE_PIN12_BITMASK;
  1745. } else if (pin == 13) {
  1746. CORE_PIN13_PORTSET = CORE_PIN13_BITMASK;
  1747. } else if (pin == 14) {
  1748. CORE_PIN14_PORTSET = CORE_PIN14_BITMASK;
  1749. } else if (pin == 15) {
  1750. CORE_PIN15_PORTSET = CORE_PIN15_BITMASK;
  1751. } else if (pin == 16) {
  1752. CORE_PIN16_PORTSET = CORE_PIN16_BITMASK;
  1753. } else if (pin == 17) {
  1754. CORE_PIN17_PORTSET = CORE_PIN17_BITMASK;
  1755. } else if (pin == 18) {
  1756. CORE_PIN18_PORTSET = CORE_PIN18_BITMASK;
  1757. } else if (pin == 19) {
  1758. CORE_PIN19_PORTSET = CORE_PIN19_BITMASK;
  1759. } else if (pin == 20) {
  1760. CORE_PIN20_PORTSET = CORE_PIN20_BITMASK;
  1761. } else if (pin == 21) {
  1762. CORE_PIN21_PORTSET = CORE_PIN21_BITMASK;
  1763. } else if (pin == 22) {
  1764. CORE_PIN22_PORTSET = CORE_PIN22_BITMASK;
  1765. } else if (pin == 23) {
  1766. CORE_PIN23_PORTSET = CORE_PIN23_BITMASK;
  1767. } else if (pin == 24) {
  1768. CORE_PIN24_PORTSET = CORE_PIN24_BITMASK;
  1769. } else if (pin == 25) {
  1770. CORE_PIN25_PORTSET = CORE_PIN25_BITMASK;
  1771. } else if (pin == 26) {
  1772. CORE_PIN26_PORTSET = CORE_PIN26_BITMASK;
  1773. } else if (pin == 27) {
  1774. CORE_PIN27_PORTSET = CORE_PIN27_BITMASK;
  1775. } else if (pin == 28) {
  1776. CORE_PIN28_PORTSET = CORE_PIN28_BITMASK;
  1777. } else if (pin == 29) {
  1778. CORE_PIN29_PORTSET = CORE_PIN29_BITMASK;
  1779. } else if (pin == 30) {
  1780. CORE_PIN30_PORTSET = CORE_PIN30_BITMASK;
  1781. } else if (pin == 31) {
  1782. CORE_PIN31_PORTSET = CORE_PIN31_BITMASK;
  1783. } else if (pin == 32) {
  1784. CORE_PIN32_PORTSET = CORE_PIN32_BITMASK;
  1785. } else if (pin == 33) {
  1786. CORE_PIN33_PORTSET = CORE_PIN33_BITMASK;
  1787. } else if (pin == 34) {
  1788. CORE_PIN34_PORTSET = CORE_PIN34_BITMASK;
  1789. } else if (pin == 35) {
  1790. CORE_PIN35_PORTSET = CORE_PIN35_BITMASK;
  1791. } else if (pin == 36) {
  1792. CORE_PIN36_PORTSET = CORE_PIN36_BITMASK;
  1793. } else if (pin == 37) {
  1794. CORE_PIN37_PORTSET = CORE_PIN37_BITMASK;
  1795. } else if (pin == 38) {
  1796. CORE_PIN38_PORTSET = CORE_PIN38_BITMASK;
  1797. } else if (pin == 39) {
  1798. CORE_PIN39_PORTSET = CORE_PIN39_BITMASK;
  1799. #if CORE_NUM_DIGITAL > 40
  1800. } else if (pin == 40) {
  1801. CORE_PIN40_PORTSET = CORE_PIN40_BITMASK;
  1802. } else if (pin == 41) {
  1803. CORE_PIN41_PORTSET = CORE_PIN41_BITMASK;
  1804. } else if (pin == 42) {
  1805. CORE_PIN42_PORTSET = CORE_PIN42_BITMASK;
  1806. } else if (pin == 43) {
  1807. CORE_PIN43_PORTSET = CORE_PIN43_BITMASK;
  1808. } else if (pin == 44) {
  1809. CORE_PIN44_PORTSET = CORE_PIN44_BITMASK;
  1810. } else if (pin == 45) {
  1811. CORE_PIN45_PORTSET = CORE_PIN45_BITMASK;
  1812. #endif
  1813. #if CORE_NUM_DIGITAL > 46
  1814. } else if (pin == 46) {
  1815. CORE_PIN46_PORTSET = CORE_PIN46_BITMASK;
  1816. } else if (pin == 47) {
  1817. CORE_PIN47_PORTSET = CORE_PIN47_BITMASK;
  1818. } else if (pin == 48) {
  1819. CORE_PIN48_PORTSET = CORE_PIN48_BITMASK;
  1820. } else if (pin == 49) {
  1821. CORE_PIN49_PORTSET = CORE_PIN49_BITMASK;
  1822. } else if (pin == 50) {
  1823. CORE_PIN50_PORTSET = CORE_PIN50_BITMASK;
  1824. } else if (pin == 51) {
  1825. CORE_PIN51_PORTSET = CORE_PIN51_BITMASK;
  1826. } else if (pin == 52) {
  1827. CORE_PIN52_PORTSET = CORE_PIN52_BITMASK;
  1828. } else if (pin == 53) {
  1829. CORE_PIN53_PORTSET = CORE_PIN53_BITMASK;
  1830. } else if (pin == 54) {
  1831. CORE_PIN54_PORTSET = CORE_PIN54_BITMASK;
  1832. #endif
  1833. }
  1834. } else {
  1835. if (pin == 0) {
  1836. CORE_PIN0_PORTCLEAR = CORE_PIN0_BITMASK;
  1837. } else if (pin == 1) {
  1838. CORE_PIN1_PORTCLEAR = CORE_PIN1_BITMASK;
  1839. } else if (pin == 2) {
  1840. CORE_PIN2_PORTCLEAR = CORE_PIN2_BITMASK;
  1841. } else if (pin == 3) {
  1842. CORE_PIN3_PORTCLEAR = CORE_PIN3_BITMASK;
  1843. } else if (pin == 4) {
  1844. CORE_PIN4_PORTCLEAR = CORE_PIN4_BITMASK;
  1845. } else if (pin == 5) {
  1846. CORE_PIN5_PORTCLEAR = CORE_PIN5_BITMASK;
  1847. } else if (pin == 6) {
  1848. CORE_PIN6_PORTCLEAR = CORE_PIN6_BITMASK;
  1849. } else if (pin == 7) {
  1850. CORE_PIN7_PORTCLEAR = CORE_PIN7_BITMASK;
  1851. } else if (pin == 8) {
  1852. CORE_PIN8_PORTCLEAR = CORE_PIN8_BITMASK;
  1853. } else if (pin == 9) {
  1854. CORE_PIN9_PORTCLEAR = CORE_PIN9_BITMASK;
  1855. } else if (pin == 10) {
  1856. CORE_PIN10_PORTCLEAR = CORE_PIN10_BITMASK;
  1857. } else if (pin == 11) {
  1858. CORE_PIN11_PORTCLEAR = CORE_PIN11_BITMASK;
  1859. } else if (pin == 12) {
  1860. CORE_PIN12_PORTCLEAR = CORE_PIN12_BITMASK;
  1861. } else if (pin == 13) {
  1862. CORE_PIN13_PORTCLEAR = CORE_PIN13_BITMASK;
  1863. } else if (pin == 14) {
  1864. CORE_PIN14_PORTCLEAR = CORE_PIN14_BITMASK;
  1865. } else if (pin == 15) {
  1866. CORE_PIN15_PORTCLEAR = CORE_PIN15_BITMASK;
  1867. } else if (pin == 16) {
  1868. CORE_PIN16_PORTCLEAR = CORE_PIN16_BITMASK;
  1869. } else if (pin == 17) {
  1870. CORE_PIN17_PORTCLEAR = CORE_PIN17_BITMASK;
  1871. } else if (pin == 18) {
  1872. CORE_PIN18_PORTCLEAR = CORE_PIN18_BITMASK;
  1873. } else if (pin == 19) {
  1874. CORE_PIN19_PORTCLEAR = CORE_PIN19_BITMASK;
  1875. } else if (pin == 20) {
  1876. CORE_PIN20_PORTCLEAR = CORE_PIN20_BITMASK;
  1877. } else if (pin == 21) {
  1878. CORE_PIN21_PORTCLEAR = CORE_PIN21_BITMASK;
  1879. } else if (pin == 22) {
  1880. CORE_PIN22_PORTCLEAR = CORE_PIN22_BITMASK;
  1881. } else if (pin == 23) {
  1882. CORE_PIN23_PORTCLEAR = CORE_PIN23_BITMASK;
  1883. } else if (pin == 24) {
  1884. CORE_PIN24_PORTCLEAR = CORE_PIN24_BITMASK;
  1885. } else if (pin == 25) {
  1886. CORE_PIN25_PORTCLEAR = CORE_PIN25_BITMASK;
  1887. } else if (pin == 26) {
  1888. CORE_PIN26_PORTCLEAR = CORE_PIN26_BITMASK;
  1889. } else if (pin == 27) {
  1890. CORE_PIN27_PORTCLEAR = CORE_PIN27_BITMASK;
  1891. } else if (pin == 28) {
  1892. CORE_PIN28_PORTCLEAR = CORE_PIN28_BITMASK;
  1893. } else if (pin == 29) {
  1894. CORE_PIN29_PORTCLEAR = CORE_PIN29_BITMASK;
  1895. } else if (pin == 30) {
  1896. CORE_PIN30_PORTCLEAR = CORE_PIN30_BITMASK;
  1897. } else if (pin == 31) {
  1898. CORE_PIN31_PORTCLEAR = CORE_PIN31_BITMASK;
  1899. } else if (pin == 32) {
  1900. CORE_PIN32_PORTCLEAR = CORE_PIN32_BITMASK;
  1901. } else if (pin == 33) {
  1902. CORE_PIN33_PORTCLEAR = CORE_PIN33_BITMASK;
  1903. } else if (pin == 34) {
  1904. CORE_PIN34_PORTCLEAR = CORE_PIN34_BITMASK;
  1905. } else if (pin == 35) {
  1906. CORE_PIN35_PORTCLEAR = CORE_PIN35_BITMASK;
  1907. } else if (pin == 36) {
  1908. CORE_PIN36_PORTCLEAR = CORE_PIN36_BITMASK;
  1909. } else if (pin == 37) {
  1910. CORE_PIN37_PORTCLEAR = CORE_PIN37_BITMASK;
  1911. } else if (pin == 38) {
  1912. CORE_PIN38_PORTCLEAR = CORE_PIN38_BITMASK;
  1913. } else if (pin == 39) {
  1914. CORE_PIN39_PORTCLEAR = CORE_PIN39_BITMASK;
  1915. #if CORE_NUM_DIGITAL > 40
  1916. } else if (pin == 40) {
  1917. CORE_PIN40_PORTCLEAR = CORE_PIN40_BITMASK;
  1918. } else if (pin == 41) {
  1919. CORE_PIN41_PORTCLEAR = CORE_PIN41_BITMASK;
  1920. } else if (pin == 42) {
  1921. CORE_PIN42_PORTCLEAR = CORE_PIN42_BITMASK;
  1922. } else if (pin == 43) {
  1923. CORE_PIN43_PORTCLEAR = CORE_PIN43_BITMASK;
  1924. } else if (pin == 44) {
  1925. CORE_PIN44_PORTCLEAR = CORE_PIN44_BITMASK;
  1926. } else if (pin == 45) {
  1927. CORE_PIN45_PORTCLEAR = CORE_PIN45_BITMASK;
  1928. #endif
  1929. #if CORE_NUM_DIGITAL > 46
  1930. } else if (pin == 46) {
  1931. CORE_PIN46_PORTCLEAR = CORE_PIN46_BITMASK;
  1932. } else if (pin == 47) {
  1933. CORE_PIN47_PORTCLEAR = CORE_PIN47_BITMASK;
  1934. } else if (pin == 48) {
  1935. CORE_PIN48_PORTCLEAR = CORE_PIN48_BITMASK;
  1936. } else if (pin == 49) {
  1937. CORE_PIN49_PORTCLEAR = CORE_PIN49_BITMASK;
  1938. } else if (pin == 50) {
  1939. CORE_PIN50_PORTCLEAR = CORE_PIN50_BITMASK;
  1940. } else if (pin == 51) {
  1941. CORE_PIN51_PORTCLEAR = CORE_PIN51_BITMASK;
  1942. } else if (pin == 52) {
  1943. CORE_PIN52_PORTCLEAR = CORE_PIN52_BITMASK;
  1944. } else if (pin == 53) {
  1945. CORE_PIN53_PORTCLEAR = CORE_PIN53_BITMASK;
  1946. } else if (pin == 54) {
  1947. CORE_PIN54_PORTCLEAR = CORE_PIN54_BITMASK;
  1948. #endif
  1949. }
  1950. }
  1951. } else {
  1952. if(val) *portSetRegister(pin) = digitalPinToBitMask(pin);
  1953. else *portClearRegister(pin) = digitalPinToBitMask(pin);
  1954. }
  1955. }
  1956. uint8_t digitalRead(uint8_t pin);
  1957. static inline uint8_t digitalReadFast(uint8_t pin) __attribute__((always_inline, unused));
  1958. static inline uint8_t digitalReadFast(uint8_t pin)
  1959. {
  1960. if (__builtin_constant_p(pin)) {
  1961. if (pin == 0) {
  1962. return (CORE_PIN0_PINREG & CORE_PIN0_BITMASK) ? 1 : 0;
  1963. } else if (pin == 1) {
  1964. return (CORE_PIN1_PINREG & CORE_PIN1_BITMASK) ? 1 : 0;
  1965. } else if (pin == 2) {
  1966. return (CORE_PIN2_PINREG & CORE_PIN2_BITMASK) ? 1 : 0;
  1967. } else if (pin == 3) {
  1968. return (CORE_PIN3_PINREG & CORE_PIN3_BITMASK) ? 1 : 0;
  1969. } else if (pin == 4) {
  1970. return (CORE_PIN4_PINREG & CORE_PIN4_BITMASK) ? 1 : 0;
  1971. } else if (pin == 5) {
  1972. return (CORE_PIN5_PINREG & CORE_PIN5_BITMASK) ? 1 : 0;
  1973. } else if (pin == 6) {
  1974. return (CORE_PIN6_PINREG & CORE_PIN6_BITMASK) ? 1 : 0;
  1975. } else if (pin == 7) {
  1976. return (CORE_PIN7_PINREG & CORE_PIN7_BITMASK) ? 1 : 0;
  1977. } else if (pin == 8) {
  1978. return (CORE_PIN8_PINREG & CORE_PIN8_BITMASK) ? 1 : 0;
  1979. } else if (pin == 9) {
  1980. return (CORE_PIN9_PINREG & CORE_PIN9_BITMASK) ? 1 : 0;
  1981. } else if (pin == 10) {
  1982. return (CORE_PIN10_PINREG & CORE_PIN10_BITMASK) ? 1 : 0;
  1983. } else if (pin == 11) {
  1984. return (CORE_PIN11_PINREG & CORE_PIN11_BITMASK) ? 1 : 0;
  1985. } else if (pin == 12) {
  1986. return (CORE_PIN12_PINREG & CORE_PIN12_BITMASK) ? 1 : 0;
  1987. } else if (pin == 13) {
  1988. return (CORE_PIN13_PINREG & CORE_PIN13_BITMASK) ? 1 : 0;
  1989. } else if (pin == 14) {
  1990. return (CORE_PIN14_PINREG & CORE_PIN14_BITMASK) ? 1 : 0;
  1991. } else if (pin == 15) {
  1992. return (CORE_PIN15_PINREG & CORE_PIN15_BITMASK) ? 1 : 0;
  1993. } else if (pin == 16) {
  1994. return (CORE_PIN16_PINREG & CORE_PIN16_BITMASK) ? 1 : 0;
  1995. } else if (pin == 17) {
  1996. return (CORE_PIN17_PINREG & CORE_PIN17_BITMASK) ? 1 : 0;
  1997. } else if (pin == 18) {
  1998. return (CORE_PIN18_PINREG & CORE_PIN18_BITMASK) ? 1 : 0;
  1999. } else if (pin == 19) {
  2000. return (CORE_PIN19_PINREG & CORE_PIN19_BITMASK) ? 1 : 0;
  2001. } else if (pin == 20) {
  2002. return (CORE_PIN20_PINREG & CORE_PIN20_BITMASK) ? 1 : 0;
  2003. } else if (pin == 21) {
  2004. return (CORE_PIN21_PINREG & CORE_PIN21_BITMASK) ? 1 : 0;
  2005. } else if (pin == 22) {
  2006. return (CORE_PIN22_PINREG & CORE_PIN22_BITMASK) ? 1 : 0;
  2007. } else if (pin == 23) {
  2008. return (CORE_PIN23_PINREG & CORE_PIN23_BITMASK) ? 1 : 0;
  2009. } else if (pin == 24) {
  2010. return (CORE_PIN24_PINREG & CORE_PIN24_BITMASK) ? 1 : 0;
  2011. } else if (pin == 25) {
  2012. return (CORE_PIN25_PINREG & CORE_PIN25_BITMASK) ? 1 : 0;
  2013. } else if (pin == 26) {
  2014. return (CORE_PIN26_PINREG & CORE_PIN26_BITMASK) ? 1 : 0;
  2015. } else if (pin == 27) {
  2016. return (CORE_PIN27_PINREG & CORE_PIN27_BITMASK) ? 1 : 0;
  2017. } else if (pin == 28) {
  2018. return (CORE_PIN28_PINREG & CORE_PIN28_BITMASK) ? 1 : 0;
  2019. } else if (pin == 29) {
  2020. return (CORE_PIN29_PINREG & CORE_PIN29_BITMASK) ? 1 : 0;
  2021. } else if (pin == 30) {
  2022. return (CORE_PIN30_PINREG & CORE_PIN30_BITMASK) ? 1 : 0;
  2023. } else if (pin == 31) {
  2024. return (CORE_PIN31_PINREG & CORE_PIN31_BITMASK) ? 1 : 0;
  2025. } else if (pin == 32) {
  2026. return (CORE_PIN32_PINREG & CORE_PIN32_BITMASK) ? 1 : 0;
  2027. } else if (pin == 33) {
  2028. return (CORE_PIN33_PINREG & CORE_PIN33_BITMASK) ? 1 : 0;
  2029. } else if (pin == 34) {
  2030. return (CORE_PIN34_PINREG & CORE_PIN34_BITMASK) ? 1 : 0;
  2031. } else if (pin == 35) {
  2032. return (CORE_PIN35_PINREG & CORE_PIN35_BITMASK) ? 1 : 0;
  2033. } else if (pin == 36) {
  2034. return (CORE_PIN36_PINREG & CORE_PIN36_BITMASK) ? 1 : 0;
  2035. } else if (pin == 37) {
  2036. return (CORE_PIN37_PINREG & CORE_PIN37_BITMASK) ? 1 : 0;
  2037. } else if (pin == 38) {
  2038. return (CORE_PIN38_PINREG & CORE_PIN38_BITMASK) ? 1 : 0;
  2039. } else if (pin == 39) {
  2040. return (CORE_PIN39_PINREG & CORE_PIN39_BITMASK) ? 1 : 0;
  2041. #if CORE_NUM_DIGITAL > 40
  2042. } else if (pin == 40) {
  2043. return (CORE_PIN40_PINREG & CORE_PIN40_BITMASK) ? 1 : 0;
  2044. } else if (pin == 41) {
  2045. return (CORE_PIN41_PINREG & CORE_PIN41_BITMASK) ? 1 : 0;
  2046. } else if (pin == 42) {
  2047. return (CORE_PIN42_PINREG & CORE_PIN42_BITMASK) ? 1 : 0;
  2048. } else if (pin == 43) {
  2049. return (CORE_PIN43_PINREG & CORE_PIN43_BITMASK) ? 1 : 0;
  2050. } else if (pin == 44) {
  2051. return (CORE_PIN44_PINREG & CORE_PIN44_BITMASK) ? 1 : 0;
  2052. } else if (pin == 45) {
  2053. return (CORE_PIN45_PINREG & CORE_PIN45_BITMASK) ? 1 : 0;
  2054. #endif
  2055. #if CORE_NUM_DIGITAL > 46
  2056. } else if (pin == 46) {
  2057. return (CORE_PIN46_PINREG & CORE_PIN46_BITMASK) ? 1 : 0;
  2058. } else if (pin == 47) {
  2059. return (CORE_PIN47_PINREG & CORE_PIN47_BITMASK) ? 1 : 0;
  2060. } else if (pin == 48) {
  2061. return (CORE_PIN48_PINREG & CORE_PIN48_BITMASK) ? 1 : 0;
  2062. } else if (pin == 49) {
  2063. return (CORE_PIN49_PINREG & CORE_PIN49_BITMASK) ? 1 : 0;
  2064. } else if (pin == 50) {
  2065. return (CORE_PIN50_PINREG & CORE_PIN50_BITMASK) ? 1 : 0;
  2066. } else if (pin == 51) {
  2067. return (CORE_PIN51_PINREG & CORE_PIN51_BITMASK) ? 1 : 0;
  2068. } else if (pin == 52) {
  2069. return (CORE_PIN52_PINREG & CORE_PIN52_BITMASK) ? 1 : 0;
  2070. } else if (pin == 53) {
  2071. return (CORE_PIN53_PINREG & CORE_PIN53_BITMASK) ? 1 : 0;
  2072. } else if (pin == 54) {
  2073. return (CORE_PIN54_PINREG & CORE_PIN54_BITMASK) ? 1 : 0;
  2074. #endif
  2075. } else {
  2076. return 0;
  2077. }
  2078. } else {
  2079. return (*portInputRegister(pin) & digitalPinToBitMask(pin)) ? 1 : 0;
  2080. }
  2081. }
  2082. void digitalToggle(uint8_t pin);
  2083. static inline void digitalToggleFast(uint8_t pin) __attribute__((always_inline, unused));
  2084. static inline void digitalToggleFast(uint8_t pin)
  2085. {
  2086. if (__builtin_constant_p(pin)) {
  2087. if (pin == 0) {
  2088. CORE_PIN0_PORTTOGGLE = CORE_PIN0_BITMASK;
  2089. } else if (pin == 1) {
  2090. CORE_PIN1_PORTTOGGLE = CORE_PIN1_BITMASK;
  2091. } else if (pin == 2) {
  2092. CORE_PIN2_PORTTOGGLE = CORE_PIN2_BITMASK;
  2093. } else if (pin == 3) {
  2094. CORE_PIN3_PORTTOGGLE = CORE_PIN3_BITMASK;
  2095. } else if (pin == 4) {
  2096. CORE_PIN4_PORTTOGGLE = CORE_PIN4_BITMASK;
  2097. } else if (pin == 5) {
  2098. CORE_PIN5_PORTTOGGLE = CORE_PIN5_BITMASK;
  2099. } else if (pin == 6) {
  2100. CORE_PIN6_PORTTOGGLE = CORE_PIN6_BITMASK;
  2101. } else if (pin == 7) {
  2102. CORE_PIN7_PORTTOGGLE = CORE_PIN7_BITMASK;
  2103. } else if (pin == 8) {
  2104. CORE_PIN8_PORTTOGGLE = CORE_PIN8_BITMASK;
  2105. } else if (pin == 9) {
  2106. CORE_PIN9_PORTTOGGLE = CORE_PIN9_BITMASK;
  2107. } else if (pin == 10) {
  2108. CORE_PIN10_PORTTOGGLE = CORE_PIN10_BITMASK;
  2109. } else if (pin == 11) {
  2110. CORE_PIN11_PORTTOGGLE = CORE_PIN11_BITMASK;
  2111. } else if (pin == 12) {
  2112. CORE_PIN12_PORTTOGGLE = CORE_PIN12_BITMASK;
  2113. } else if (pin == 13) {
  2114. CORE_PIN13_PORTTOGGLE = CORE_PIN13_BITMASK;
  2115. } else if (pin == 14) {
  2116. CORE_PIN14_PORTTOGGLE = CORE_PIN14_BITMASK;
  2117. } else if (pin == 15) {
  2118. CORE_PIN15_PORTTOGGLE = CORE_PIN15_BITMASK;
  2119. } else if (pin == 16) {
  2120. CORE_PIN16_PORTTOGGLE = CORE_PIN16_BITMASK;
  2121. } else if (pin == 17) {
  2122. CORE_PIN17_PORTTOGGLE = CORE_PIN17_BITMASK;
  2123. } else if (pin == 18) {
  2124. CORE_PIN18_PORTTOGGLE = CORE_PIN18_BITMASK;
  2125. } else if (pin == 19) {
  2126. CORE_PIN19_PORTTOGGLE = CORE_PIN19_BITMASK;
  2127. } else if (pin == 20) {
  2128. CORE_PIN20_PORTTOGGLE = CORE_PIN20_BITMASK;
  2129. } else if (pin == 21) {
  2130. CORE_PIN21_PORTTOGGLE = CORE_PIN21_BITMASK;
  2131. } else if (pin == 22) {
  2132. CORE_PIN22_PORTTOGGLE = CORE_PIN22_BITMASK;
  2133. } else if (pin == 23) {
  2134. CORE_PIN23_PORTTOGGLE = CORE_PIN23_BITMASK;
  2135. } else if (pin == 24) {
  2136. CORE_PIN24_PORTTOGGLE = CORE_PIN24_BITMASK;
  2137. } else if (pin == 25) {
  2138. CORE_PIN25_PORTTOGGLE = CORE_PIN25_BITMASK;
  2139. } else if (pin == 26) {
  2140. CORE_PIN26_PORTTOGGLE = CORE_PIN26_BITMASK;
  2141. } else if (pin == 27) {
  2142. CORE_PIN27_PORTTOGGLE = CORE_PIN27_BITMASK;
  2143. } else if (pin == 28) {
  2144. CORE_PIN28_PORTTOGGLE = CORE_PIN28_BITMASK;
  2145. } else if (pin == 29) {
  2146. CORE_PIN29_PORTTOGGLE = CORE_PIN29_BITMASK;
  2147. } else if (pin == 30) {
  2148. CORE_PIN30_PORTTOGGLE = CORE_PIN30_BITMASK;
  2149. } else if (pin == 31) {
  2150. CORE_PIN31_PORTTOGGLE = CORE_PIN31_BITMASK;
  2151. } else if (pin == 32) {
  2152. CORE_PIN32_PORTTOGGLE = CORE_PIN32_BITMASK;
  2153. } else if (pin == 33) {
  2154. CORE_PIN33_PORTTOGGLE = CORE_PIN33_BITMASK;
  2155. } else if (pin == 34) {
  2156. CORE_PIN34_PORTTOGGLE = CORE_PIN34_BITMASK;
  2157. } else if (pin == 35) {
  2158. CORE_PIN35_PORTTOGGLE = CORE_PIN35_BITMASK;
  2159. } else if (pin == 36) {
  2160. CORE_PIN36_PORTTOGGLE = CORE_PIN36_BITMASK;
  2161. } else if (pin == 37) {
  2162. CORE_PIN37_PORTTOGGLE = CORE_PIN37_BITMASK;
  2163. } else if (pin == 38) {
  2164. CORE_PIN38_PORTTOGGLE = CORE_PIN38_BITMASK;
  2165. } else if (pin == 39) {
  2166. CORE_PIN39_PORTTOGGLE = CORE_PIN39_BITMASK;
  2167. #if CORE_NUM_DIGITAL > 40
  2168. } else if (pin == 40) {
  2169. CORE_PIN40_PORTTOGGLE = CORE_PIN40_BITMASK;
  2170. } else if (pin == 41) {
  2171. CORE_PIN41_PORTTOGGLE = CORE_PIN41_BITMASK;
  2172. } else if (pin == 42) {
  2173. CORE_PIN42_PORTTOGGLE = CORE_PIN42_BITMASK;
  2174. } else if (pin == 43) {
  2175. CORE_PIN43_PORTTOGGLE = CORE_PIN43_BITMASK;
  2176. } else if (pin == 44) {
  2177. CORE_PIN44_PORTTOGGLE = CORE_PIN44_BITMASK;
  2178. } else if (pin == 45) {
  2179. CORE_PIN45_PORTTOGGLE = CORE_PIN45_BITMASK;
  2180. #endif
  2181. #if CORE_NUM_DIGITAL > 46
  2182. } else if (pin == 46) {
  2183. CORE_PIN46_PORTTOGGLE = CORE_PIN46_BITMASK;
  2184. } else if (pin == 47) {
  2185. CORE_PIN47_PORTTOGGLE = CORE_PIN47_BITMASK;
  2186. } else if (pin == 48) {
  2187. CORE_PIN48_PORTTOGGLE = CORE_PIN48_BITMASK;
  2188. } else if (pin == 49) {
  2189. CORE_PIN49_PORTTOGGLE = CORE_PIN49_BITMASK;
  2190. } else if (pin == 50) {
  2191. CORE_PIN50_PORTTOGGLE = CORE_PIN50_BITMASK;
  2192. } else if (pin == 51) {
  2193. CORE_PIN51_PORTTOGGLE = CORE_PIN51_BITMASK;
  2194. } else if (pin == 52) {
  2195. CORE_PIN52_PORTTOGGLE = CORE_PIN52_BITMASK;
  2196. } else if (pin == 53) {
  2197. CORE_PIN53_PORTTOGGLE = CORE_PIN53_BITMASK;
  2198. } else if (pin == 54) {
  2199. CORE_PIN54_PORTTOGGLE = CORE_PIN54_BITMASK;
  2200. #endif
  2201. }
  2202. } else {
  2203. digitalToggle(pin);
  2204. }
  2205. }
  2206. void pinMode(uint8_t pin, uint8_t mode);
  2207. void init_pins(void);
  2208. void analogWrite(uint8_t pin, int val);
  2209. uint32_t analogWriteRes(uint32_t bits);
  2210. static inline uint32_t analogWriteResolution(uint32_t bits) { return analogWriteRes(bits); }
  2211. void analogWriteFrequency(uint8_t pin, float frequency);
  2212. void attachInterrupt(uint8_t pin, void (*function)(void), int mode);
  2213. void detachInterrupt(uint8_t pin);
  2214. void _init_Teensyduino_internal_(void);
  2215. int analogRead(uint8_t pin);
  2216. void analogReference(uint8_t type);
  2217. void analogReadRes(unsigned int bits);
  2218. static inline void analogReadResolution(unsigned int bits) { analogReadRes(bits); }
  2219. void analogReadAveraging(unsigned int num);
  2220. void analog_init(void);
  2221. int touchRead(uint8_t pin);
  2222. static inline void shiftOut(uint8_t, uint8_t, uint8_t, uint8_t) __attribute__((always_inline, unused));
  2223. extern void _shiftOut(uint8_t dataPin, uint8_t clockPin, uint8_t bitOrder, uint8_t value) __attribute__((noinline));
  2224. extern void shiftOut_lsbFirst(uint8_t dataPin, uint8_t clockPin, uint8_t value) __attribute__((noinline));
  2225. extern void shiftOut_msbFirst(uint8_t dataPin, uint8_t clockPin, uint8_t value) __attribute__((noinline));
  2226. static inline void shiftOut(uint8_t dataPin, uint8_t clockPin, uint8_t bitOrder, uint8_t value)
  2227. {
  2228. if (__builtin_constant_p(bitOrder)) {
  2229. if (bitOrder == LSBFIRST) {
  2230. shiftOut_lsbFirst(dataPin, clockPin, value);
  2231. } else {
  2232. shiftOut_msbFirst(dataPin, clockPin, value);
  2233. }
  2234. } else {
  2235. _shiftOut(dataPin, clockPin, bitOrder, value);
  2236. }
  2237. }
  2238. static inline uint8_t shiftIn(uint8_t, uint8_t, uint8_t) __attribute__((always_inline, unused));
  2239. extern uint8_t _shiftIn(uint8_t dataPin, uint8_t clockPin, uint8_t bitOrder) __attribute__((noinline));
  2240. extern uint8_t shiftIn_lsbFirst(uint8_t dataPin, uint8_t clockPin) __attribute__((noinline));
  2241. extern uint8_t shiftIn_msbFirst(uint8_t dataPin, uint8_t clockPin) __attribute__((noinline));
  2242. static inline uint8_t shiftIn(uint8_t dataPin, uint8_t clockPin, uint8_t bitOrder)
  2243. {
  2244. if (__builtin_constant_p(bitOrder)) {
  2245. if (bitOrder == LSBFIRST) {
  2246. return shiftIn_lsbFirst(dataPin, clockPin);
  2247. } else {
  2248. return shiftIn_msbFirst(dataPin, clockPin);
  2249. }
  2250. } else {
  2251. return _shiftIn(dataPin, clockPin, bitOrder);
  2252. }
  2253. }
  2254. void _reboot_Teensyduino_(void) __attribute__((noreturn));
  2255. void _restart_Teensyduino_(void) __attribute__((noreturn));
  2256. // Define a set of flags to know which things yield should check when called.
  2257. extern uint8_t yield_active_check_flags;
  2258. #define YIELD_CHECK_USB_SERIAL 0x1 // check the USB for Serial.available()
  2259. #define YIELD_CHECK_HARDWARE_SERIAL 0x2 // check Hardware Serial ports available
  2260. #define YIELD_CHECK_EVENT_RESPONDER 0x4 // User has created eventResponders that use yield
  2261. #define YIELD_CHECK_USB_SERIALUSB1 0x8 // Check for SerialUSB1
  2262. #define YIELD_CHECK_USB_SERIALUSB2 0x10 // Check for SerialUSB2
  2263. void yield(void);
  2264. void delay(uint32_t msec);
  2265. extern volatile uint32_t F_CPU_ACTUAL;
  2266. extern volatile uint32_t F_BUS_ACTUAL;
  2267. extern volatile uint32_t scale_cpu_cycles_to_microseconds;
  2268. extern volatile uint32_t systick_millis_count;
  2269. static inline uint32_t millis(void) __attribute__((always_inline, unused));
  2270. static inline uint32_t millis(void)
  2271. {
  2272. return systick_millis_count;
  2273. }
  2274. uint32_t micros(void);
  2275. static inline void delayMicroseconds(uint32_t) __attribute__((always_inline, unused));
  2276. static inline void delayMicroseconds(uint32_t usec)
  2277. {
  2278. uint32_t begin = ARM_DWT_CYCCNT;
  2279. uint32_t cycles = F_CPU_ACTUAL / 1000000 * usec;
  2280. // TODO: check if cycles is large, do a wait with yield calls until it's smaller
  2281. while (ARM_DWT_CYCCNT - begin < cycles) ; // wait
  2282. }
  2283. static inline void delayNanoseconds(uint32_t) __attribute__((always_inline, unused));
  2284. static inline void delayNanoseconds(uint32_t nsec)
  2285. {
  2286. uint32_t begin = ARM_DWT_CYCCNT;
  2287. uint32_t cycles = ((F_CPU_ACTUAL>>16) * nsec) / (1000000000UL>>16);
  2288. while (ARM_DWT_CYCCNT - begin < cycles) ; // wait
  2289. }
  2290. unsigned long rtc_get(void);
  2291. void rtc_set(unsigned long t);
  2292. void rtc_compensate(int adjust);
  2293. void tempmon_init(void);
  2294. float tempmonGetTemp(void);
  2295. void tempmon_Start();
  2296. void tempmon_Stop();
  2297. void tempmon_PwrDwn();
  2298. #ifdef __cplusplus
  2299. }
  2300. class teensy3_clock_class
  2301. {
  2302. public:
  2303. static unsigned long get(void) __attribute__((always_inline)) { return rtc_get(); }
  2304. static void set(unsigned long t) __attribute__((always_inline)) { rtc_set(t); }
  2305. static void compensate(int adj) __attribute__((always_inline)) { rtc_compensate(adj); }
  2306. };
  2307. extern teensy3_clock_class Teensy3Clock;
  2308. #endif // __cplusplus