PlatformIO package of the Teensy core framework compatible with GCC 10 & C++20
選択できるのは25トピックまでです。 トピックは、先頭が英数字で、英数字とダッシュ('-')を使用した35文字以内のものにしてください。

core_pins.h 80KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455
  1. /* Teensyduino Core Library
  2. * http://www.pjrc.com/teensy/
  3. * Copyright (c) 2017 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. #ifndef _core_pins_h_
  31. #define _core_pins_h_
  32. #include "kinetis.h"
  33. #include "pins_arduino.h"
  34. #define HIGH 1
  35. #define LOW 0
  36. #define INPUT 0
  37. #define OUTPUT 1
  38. #define INPUT_PULLUP 2
  39. #define INPUT_PULLDOWN 3
  40. #define OUTPUT_OPENDRAIN 4
  41. #define INPUT_DISABLE 5
  42. #define LSBFIRST 0
  43. #define MSBFIRST 1
  44. #define _BV(n) (1<<(n))
  45. #define CHANGE 4
  46. #define FALLING 2
  47. #define RISING 3
  48. // Pin Arduino
  49. // 0 B16 RXD
  50. // 1 B17 TXD
  51. // 2 D0
  52. // 3 A12 FTM1_CH0
  53. // 4 A13 FTM1_CH1
  54. // 5 D7 FTM0_CH7 OC0B/T1
  55. // 6 D4 FTM0_CH4 OC0A
  56. // 7 D2
  57. // 8 D3 ICP1
  58. // 9 C3 FTM0_CH2 OC1A
  59. // 10 C4 FTM0_CH3 SS/OC1B
  60. // 11 C6 MOSI/OC2A
  61. // 12 C7 MISO
  62. // 13 C5 SCK
  63. // 14 D1
  64. // 15 C0
  65. // 16 B0 (FTM1_CH0)
  66. // 17 B1 (FTM1_CH1)
  67. // 18 B3 SDA
  68. // 19 B2 SCL
  69. // 20 D5 FTM0_CH5
  70. // 21 D6 FTM0_CH6
  71. // 22 C1 FTM0_CH0
  72. // 23 C2 FTM0_CH1
  73. // 24 A5 (FTM0_CH2)
  74. // 25 B19
  75. // 26 E1
  76. // 27 C9
  77. // 28 C8
  78. // 29 C10
  79. // 30 C11
  80. // 31 E0
  81. // 32 B18
  82. // 33 A4 (FTM0_CH1)
  83. // (34) analog only
  84. // (35) analog only
  85. // (36) analog only
  86. // (37) analog only
  87. // not available to user:
  88. // A0 FTM0_CH5 SWD Clock
  89. // A1 FTM0_CH6 USB ID
  90. // A2 FTM0_CH7 SWD Trace
  91. // A3 FTM0_CH0 SWD Data
  92. #if defined(__MK20DX128__)
  93. #define CORE_NUM_TOTAL_PINS 34
  94. #define CORE_NUM_DIGITAL 34
  95. #define CORE_NUM_INTERRUPT 34
  96. #define CORE_NUM_ANALOG 14
  97. #define CORE_NUM_PWM 10
  98. #elif defined(__MK20DX256__)
  99. #define CORE_NUM_TOTAL_PINS 34
  100. #define CORE_NUM_DIGITAL 34
  101. #define CORE_NUM_INTERRUPT 34
  102. #define CORE_NUM_ANALOG 21
  103. #define CORE_NUM_PWM 12
  104. #elif defined(__MKL26Z64__)
  105. #define CORE_NUM_TOTAL_PINS 27
  106. #define CORE_NUM_DIGITAL 27
  107. #define CORE_NUM_INTERRUPT 24 // really only 18, but 6 "holes"
  108. #define CORE_NUM_ANALOG 13
  109. #define CORE_NUM_PWM 10
  110. #elif defined(__MK64FX512__)
  111. #define CORE_NUM_TOTAL_PINS 64
  112. #define CORE_NUM_DIGITAL 64
  113. #define CORE_NUM_INTERRUPT 64
  114. #define CORE_NUM_ANALOG 27
  115. #define CORE_NUM_PWM 20
  116. #elif defined(__MK66FX1M0__)
  117. #define CORE_NUM_TOTAL_PINS 64
  118. #define CORE_NUM_DIGITAL 64
  119. #define CORE_NUM_INTERRUPT 64
  120. #define CORE_NUM_ANALOG 25
  121. #define CORE_NUM_PWM 22
  122. #endif
  123. // These MAX_PIN_PORTx values have the highest Kinetis pin index
  124. // that is used for a given port.
  125. #if defined(__MK20DX128__) || defined(__MK20DX256__)
  126. #define CORE_MAX_PIN_PORTA 13
  127. #define CORE_MAX_PIN_PORTB 19
  128. #define CORE_MAX_PIN_PORTC 11
  129. #define CORE_MAX_PIN_PORTD 7
  130. #define CORE_MAX_PIN_PORTE 1
  131. #elif defined(__MKL26Z64__)
  132. #define CORE_MAX_PIN_PORTA 2
  133. #define CORE_MAX_PIN_PORTB 17
  134. #define CORE_MAX_PIN_PORTC 7
  135. #define CORE_MAX_PIN_PORTD 7
  136. #define CORE_MAX_PIN_PORTE 30
  137. #elif defined(__MK64FX512__) || defined(__MK66FX1M0__)
  138. #define CORE_MAX_PIN_PORTA 29
  139. #define CORE_MAX_PIN_PORTB 23
  140. #define CORE_MAX_PIN_PORTC 11
  141. #define CORE_MAX_PIN_PORTD 15
  142. #define CORE_MAX_PIN_PORTE 26
  143. #endif
  144. #if defined(__MK20DX128__) || defined(__MK20DX256__)
  145. #define CORE_PIN0_BIT 16
  146. #define CORE_PIN1_BIT 17
  147. #define CORE_PIN2_BIT 0
  148. #define CORE_PIN3_BIT 12
  149. #define CORE_PIN4_BIT 13
  150. #define CORE_PIN5_BIT 7
  151. #define CORE_PIN6_BIT 4
  152. #define CORE_PIN7_BIT 2
  153. #define CORE_PIN8_BIT 3
  154. #define CORE_PIN9_BIT 3
  155. #define CORE_PIN10_BIT 4
  156. #define CORE_PIN11_BIT 6
  157. #define CORE_PIN12_BIT 7
  158. #define CORE_PIN13_BIT 5
  159. #define CORE_PIN14_BIT 1
  160. #define CORE_PIN15_BIT 0
  161. #define CORE_PIN16_BIT 0
  162. #define CORE_PIN17_BIT 1
  163. #define CORE_PIN18_BIT 3
  164. #define CORE_PIN19_BIT 2
  165. #define CORE_PIN20_BIT 5
  166. #define CORE_PIN21_BIT 6
  167. #define CORE_PIN22_BIT 1
  168. #define CORE_PIN23_BIT 2
  169. #define CORE_PIN24_BIT 5
  170. #define CORE_PIN25_BIT 19
  171. #define CORE_PIN26_BIT 1
  172. #define CORE_PIN27_BIT 9
  173. #define CORE_PIN28_BIT 8
  174. #define CORE_PIN29_BIT 10
  175. #define CORE_PIN30_BIT 11
  176. #define CORE_PIN31_BIT 0
  177. #define CORE_PIN32_BIT 18
  178. #define CORE_PIN33_BIT 4
  179. #define CORE_PIN0_BITMASK (1<<(CORE_PIN0_BIT))
  180. #define CORE_PIN1_BITMASK (1<<(CORE_PIN1_BIT))
  181. #define CORE_PIN2_BITMASK (1<<(CORE_PIN2_BIT))
  182. #define CORE_PIN3_BITMASK (1<<(CORE_PIN3_BIT))
  183. #define CORE_PIN4_BITMASK (1<<(CORE_PIN4_BIT))
  184. #define CORE_PIN5_BITMASK (1<<(CORE_PIN5_BIT))
  185. #define CORE_PIN6_BITMASK (1<<(CORE_PIN6_BIT))
  186. #define CORE_PIN7_BITMASK (1<<(CORE_PIN7_BIT))
  187. #define CORE_PIN8_BITMASK (1<<(CORE_PIN8_BIT))
  188. #define CORE_PIN9_BITMASK (1<<(CORE_PIN9_BIT))
  189. #define CORE_PIN10_BITMASK (1<<(CORE_PIN10_BIT))
  190. #define CORE_PIN11_BITMASK (1<<(CORE_PIN11_BIT))
  191. #define CORE_PIN12_BITMASK (1<<(CORE_PIN12_BIT))
  192. #define CORE_PIN13_BITMASK (1<<(CORE_PIN13_BIT))
  193. #define CORE_PIN14_BITMASK (1<<(CORE_PIN14_BIT))
  194. #define CORE_PIN15_BITMASK (1<<(CORE_PIN15_BIT))
  195. #define CORE_PIN16_BITMASK (1<<(CORE_PIN16_BIT))
  196. #define CORE_PIN17_BITMASK (1<<(CORE_PIN17_BIT))
  197. #define CORE_PIN18_BITMASK (1<<(CORE_PIN18_BIT))
  198. #define CORE_PIN19_BITMASK (1<<(CORE_PIN19_BIT))
  199. #define CORE_PIN20_BITMASK (1<<(CORE_PIN20_BIT))
  200. #define CORE_PIN21_BITMASK (1<<(CORE_PIN21_BIT))
  201. #define CORE_PIN22_BITMASK (1<<(CORE_PIN22_BIT))
  202. #define CORE_PIN23_BITMASK (1<<(CORE_PIN23_BIT))
  203. #define CORE_PIN24_BITMASK (1<<(CORE_PIN24_BIT))
  204. #define CORE_PIN25_BITMASK (1<<(CORE_PIN25_BIT))
  205. #define CORE_PIN26_BITMASK (1<<(CORE_PIN26_BIT))
  206. #define CORE_PIN27_BITMASK (1<<(CORE_PIN27_BIT))
  207. #define CORE_PIN28_BITMASK (1<<(CORE_PIN28_BIT))
  208. #define CORE_PIN29_BITMASK (1<<(CORE_PIN29_BIT))
  209. #define CORE_PIN30_BITMASK (1<<(CORE_PIN30_BIT))
  210. #define CORE_PIN31_BITMASK (1<<(CORE_PIN31_BIT))
  211. #define CORE_PIN32_BITMASK (1<<(CORE_PIN32_BIT))
  212. #define CORE_PIN33_BITMASK (1<<(CORE_PIN33_BIT))
  213. #define CORE_PIN0_PORTREG GPIOB_PDOR
  214. #define CORE_PIN1_PORTREG GPIOB_PDOR
  215. #define CORE_PIN2_PORTREG GPIOD_PDOR
  216. #define CORE_PIN3_PORTREG GPIOA_PDOR
  217. #define CORE_PIN4_PORTREG GPIOA_PDOR
  218. #define CORE_PIN5_PORTREG GPIOD_PDOR
  219. #define CORE_PIN6_PORTREG GPIOD_PDOR
  220. #define CORE_PIN7_PORTREG GPIOD_PDOR
  221. #define CORE_PIN8_PORTREG GPIOD_PDOR
  222. #define CORE_PIN9_PORTREG GPIOC_PDOR
  223. #define CORE_PIN10_PORTREG GPIOC_PDOR
  224. #define CORE_PIN11_PORTREG GPIOC_PDOR
  225. #define CORE_PIN12_PORTREG GPIOC_PDOR
  226. #define CORE_PIN13_PORTREG GPIOC_PDOR
  227. #define CORE_PIN14_PORTREG GPIOD_PDOR
  228. #define CORE_PIN15_PORTREG GPIOC_PDOR
  229. #define CORE_PIN16_PORTREG GPIOB_PDOR
  230. #define CORE_PIN17_PORTREG GPIOB_PDOR
  231. #define CORE_PIN18_PORTREG GPIOB_PDOR
  232. #define CORE_PIN19_PORTREG GPIOB_PDOR
  233. #define CORE_PIN20_PORTREG GPIOD_PDOR
  234. #define CORE_PIN21_PORTREG GPIOD_PDOR
  235. #define CORE_PIN22_PORTREG GPIOC_PDOR
  236. #define CORE_PIN23_PORTREG GPIOC_PDOR
  237. #define CORE_PIN24_PORTREG GPIOA_PDOR
  238. #define CORE_PIN25_PORTREG GPIOB_PDOR
  239. #define CORE_PIN26_PORTREG GPIOE_PDOR
  240. #define CORE_PIN27_PORTREG GPIOC_PDOR
  241. #define CORE_PIN28_PORTREG GPIOC_PDOR
  242. #define CORE_PIN29_PORTREG GPIOC_PDOR
  243. #define CORE_PIN30_PORTREG GPIOC_PDOR
  244. #define CORE_PIN31_PORTREG GPIOE_PDOR
  245. #define CORE_PIN32_PORTREG GPIOB_PDOR
  246. #define CORE_PIN33_PORTREG GPIOA_PDOR
  247. #define CORE_PIN0_PORTSET GPIOB_PSOR
  248. #define CORE_PIN1_PORTSET GPIOB_PSOR
  249. #define CORE_PIN2_PORTSET GPIOD_PSOR
  250. #define CORE_PIN3_PORTSET GPIOA_PSOR
  251. #define CORE_PIN4_PORTSET GPIOA_PSOR
  252. #define CORE_PIN5_PORTSET GPIOD_PSOR
  253. #define CORE_PIN6_PORTSET GPIOD_PSOR
  254. #define CORE_PIN7_PORTSET GPIOD_PSOR
  255. #define CORE_PIN8_PORTSET GPIOD_PSOR
  256. #define CORE_PIN9_PORTSET GPIOC_PSOR
  257. #define CORE_PIN10_PORTSET GPIOC_PSOR
  258. #define CORE_PIN11_PORTSET GPIOC_PSOR
  259. #define CORE_PIN12_PORTSET GPIOC_PSOR
  260. #define CORE_PIN13_PORTSET GPIOC_PSOR
  261. #define CORE_PIN14_PORTSET GPIOD_PSOR
  262. #define CORE_PIN15_PORTSET GPIOC_PSOR
  263. #define CORE_PIN16_PORTSET GPIOB_PSOR
  264. #define CORE_PIN17_PORTSET GPIOB_PSOR
  265. #define CORE_PIN18_PORTSET GPIOB_PSOR
  266. #define CORE_PIN19_PORTSET GPIOB_PSOR
  267. #define CORE_PIN20_PORTSET GPIOD_PSOR
  268. #define CORE_PIN21_PORTSET GPIOD_PSOR
  269. #define CORE_PIN22_PORTSET GPIOC_PSOR
  270. #define CORE_PIN23_PORTSET GPIOC_PSOR
  271. #define CORE_PIN24_PORTSET GPIOA_PSOR
  272. #define CORE_PIN25_PORTSET GPIOB_PSOR
  273. #define CORE_PIN26_PORTSET GPIOE_PSOR
  274. #define CORE_PIN27_PORTSET GPIOC_PSOR
  275. #define CORE_PIN28_PORTSET GPIOC_PSOR
  276. #define CORE_PIN29_PORTSET GPIOC_PSOR
  277. #define CORE_PIN30_PORTSET GPIOC_PSOR
  278. #define CORE_PIN31_PORTSET GPIOE_PSOR
  279. #define CORE_PIN32_PORTSET GPIOB_PSOR
  280. #define CORE_PIN33_PORTSET GPIOA_PSOR
  281. #define CORE_PIN0_PORTTOGGLE GPIOB_PTOR
  282. #define CORE_PIN1_PORTTOGGLE GPIOB_PTOR
  283. #define CORE_PIN2_PORTTOGGLE GPIOD_PTOR
  284. #define CORE_PIN3_PORTTOGGLE GPIOA_PTOR
  285. #define CORE_PIN4_PORTTOGGLE GPIOA_PTOR
  286. #define CORE_PIN5_PORTTOGGLE GPIOD_PTOR
  287. #define CORE_PIN6_PORTTOGGLE GPIOD_PTOR
  288. #define CORE_PIN7_PORTTOGGLE GPIOD_PTOR
  289. #define CORE_PIN8_PORTTOGGLE GPIOD_PTOR
  290. #define CORE_PIN9_PORTTOGGLE GPIOC_PTOR
  291. #define CORE_PIN10_PORTTOGGLE GPIOC_PTOR
  292. #define CORE_PIN11_PORTTOGGLE GPIOC_PTOR
  293. #define CORE_PIN12_PORTTOGGLE GPIOC_PTOR
  294. #define CORE_PIN13_PORTTOGGLE GPIOC_PTOR
  295. #define CORE_PIN14_PORTTOGGLE GPIOD_PTOR
  296. #define CORE_PIN15_PORTTOGGLE GPIOC_PTOR
  297. #define CORE_PIN16_PORTTOGGLE GPIOB_PTOR
  298. #define CORE_PIN17_PORTTOGGLE GPIOB_PTOR
  299. #define CORE_PIN18_PORTTOGGLE GPIOB_PTOR
  300. #define CORE_PIN19_PORTTOGGLE GPIOB_PTOR
  301. #define CORE_PIN20_PORTTOGGLE GPIOD_PTOR
  302. #define CORE_PIN21_PORTTOGGLE GPIOD_PTOR
  303. #define CORE_PIN22_PORTTOGGLE GPIOC_PTOR
  304. #define CORE_PIN23_PORTTOGGLE GPIOC_PTOR
  305. #define CORE_PIN24_PORTTOGGLE GPIOA_PTOR
  306. #define CORE_PIN25_PORTTOGGLE GPIOB_PTOR
  307. #define CORE_PIN26_PORTTOGGLE GPIOE_PTOR
  308. #define CORE_PIN27_PORTTOGGLE GPIOC_PTOR
  309. #define CORE_PIN28_PORTTOGGLE GPIOC_PTOR
  310. #define CORE_PIN29_PORTTOGGLE GPIOC_PTOR
  311. #define CORE_PIN30_PORTTOGGLE GPIOC_PTOR
  312. #define CORE_PIN31_PORTTOGGLE GPIOE_PTOR
  313. #define CORE_PIN32_PORTTOGGLE GPIOB_PTOR
  314. #define CORE_PIN33_PORTTOGGLE GPIOA_PTOR
  315. #define CORE_PIN0_PORTCLEAR GPIOB_PCOR
  316. #define CORE_PIN1_PORTCLEAR GPIOB_PCOR
  317. #define CORE_PIN2_PORTCLEAR GPIOD_PCOR
  318. #define CORE_PIN3_PORTCLEAR GPIOA_PCOR
  319. #define CORE_PIN4_PORTCLEAR GPIOA_PCOR
  320. #define CORE_PIN5_PORTCLEAR GPIOD_PCOR
  321. #define CORE_PIN6_PORTCLEAR GPIOD_PCOR
  322. #define CORE_PIN7_PORTCLEAR GPIOD_PCOR
  323. #define CORE_PIN8_PORTCLEAR GPIOD_PCOR
  324. #define CORE_PIN9_PORTCLEAR GPIOC_PCOR
  325. #define CORE_PIN10_PORTCLEAR GPIOC_PCOR
  326. #define CORE_PIN11_PORTCLEAR GPIOC_PCOR
  327. #define CORE_PIN12_PORTCLEAR GPIOC_PCOR
  328. #define CORE_PIN13_PORTCLEAR GPIOC_PCOR
  329. #define CORE_PIN14_PORTCLEAR GPIOD_PCOR
  330. #define CORE_PIN15_PORTCLEAR GPIOC_PCOR
  331. #define CORE_PIN16_PORTCLEAR GPIOB_PCOR
  332. #define CORE_PIN17_PORTCLEAR GPIOB_PCOR
  333. #define CORE_PIN18_PORTCLEAR GPIOB_PCOR
  334. #define CORE_PIN19_PORTCLEAR GPIOB_PCOR
  335. #define CORE_PIN20_PORTCLEAR GPIOD_PCOR
  336. #define CORE_PIN21_PORTCLEAR GPIOD_PCOR
  337. #define CORE_PIN22_PORTCLEAR GPIOC_PCOR
  338. #define CORE_PIN23_PORTCLEAR GPIOC_PCOR
  339. #define CORE_PIN24_PORTCLEAR GPIOA_PCOR
  340. #define CORE_PIN25_PORTCLEAR GPIOB_PCOR
  341. #define CORE_PIN26_PORTCLEAR GPIOE_PCOR
  342. #define CORE_PIN27_PORTCLEAR GPIOC_PCOR
  343. #define CORE_PIN28_PORTCLEAR GPIOC_PCOR
  344. #define CORE_PIN29_PORTCLEAR GPIOC_PCOR
  345. #define CORE_PIN30_PORTCLEAR GPIOC_PCOR
  346. #define CORE_PIN31_PORTCLEAR GPIOE_PCOR
  347. #define CORE_PIN32_PORTCLEAR GPIOB_PCOR
  348. #define CORE_PIN33_PORTCLEAR GPIOA_PCOR
  349. #define CORE_PIN0_DDRREG GPIOB_PDDR
  350. #define CORE_PIN1_DDRREG GPIOB_PDDR
  351. #define CORE_PIN2_DDRREG GPIOD_PDDR
  352. #define CORE_PIN3_DDRREG GPIOA_PDDR
  353. #define CORE_PIN4_DDRREG GPIOA_PDDR
  354. #define CORE_PIN5_DDRREG GPIOD_PDDR
  355. #define CORE_PIN6_DDRREG GPIOD_PDDR
  356. #define CORE_PIN7_DDRREG GPIOD_PDDR
  357. #define CORE_PIN8_DDRREG GPIOD_PDDR
  358. #define CORE_PIN9_DDRREG GPIOC_PDDR
  359. #define CORE_PIN10_DDRREG GPIOC_PDDR
  360. #define CORE_PIN11_DDRREG GPIOC_PDDR
  361. #define CORE_PIN12_DDRREG GPIOC_PDDR
  362. #define CORE_PIN13_DDRREG GPIOC_PDDR
  363. #define CORE_PIN14_DDRREG GPIOD_PDDR
  364. #define CORE_PIN15_DDRREG GPIOC_PDDR
  365. #define CORE_PIN16_DDRREG GPIOB_PDDR
  366. #define CORE_PIN17_DDRREG GPIOB_PDDR
  367. #define CORE_PIN18_DDRREG GPIOB_PDDR
  368. #define CORE_PIN19_DDRREG GPIOB_PDDR
  369. #define CORE_PIN20_DDRREG GPIOD_PDDR
  370. #define CORE_PIN21_DDRREG GPIOD_PDDR
  371. #define CORE_PIN22_DDRREG GPIOC_PDDR
  372. #define CORE_PIN23_DDRREG GPIOC_PDDR
  373. #define CORE_PIN24_DDRREG GPIOA_PDDR
  374. #define CORE_PIN25_DDRREG GPIOB_PDDR
  375. #define CORE_PIN26_DDRREG GPIOE_PDDR
  376. #define CORE_PIN27_DDRREG GPIOC_PDDR
  377. #define CORE_PIN28_DDRREG GPIOC_PDDR
  378. #define CORE_PIN29_DDRREG GPIOC_PDDR
  379. #define CORE_PIN30_DDRREG GPIOC_PDDR
  380. #define CORE_PIN31_DDRREG GPIOE_PDDR
  381. #define CORE_PIN32_DDRREG GPIOB_PDDR
  382. #define CORE_PIN33_DDRREG GPIOA_PDDR
  383. #define CORE_PIN0_PINREG GPIOB_PDIR
  384. #define CORE_PIN1_PINREG GPIOB_PDIR
  385. #define CORE_PIN2_PINREG GPIOD_PDIR
  386. #define CORE_PIN3_PINREG GPIOA_PDIR
  387. #define CORE_PIN4_PINREG GPIOA_PDIR
  388. #define CORE_PIN5_PINREG GPIOD_PDIR
  389. #define CORE_PIN6_PINREG GPIOD_PDIR
  390. #define CORE_PIN7_PINREG GPIOD_PDIR
  391. #define CORE_PIN8_PINREG GPIOD_PDIR
  392. #define CORE_PIN9_PINREG GPIOC_PDIR
  393. #define CORE_PIN10_PINREG GPIOC_PDIR
  394. #define CORE_PIN11_PINREG GPIOC_PDIR
  395. #define CORE_PIN12_PINREG GPIOC_PDIR
  396. #define CORE_PIN13_PINREG GPIOC_PDIR
  397. #define CORE_PIN14_PINREG GPIOD_PDIR
  398. #define CORE_PIN15_PINREG GPIOC_PDIR
  399. #define CORE_PIN16_PINREG GPIOB_PDIR
  400. #define CORE_PIN17_PINREG GPIOB_PDIR
  401. #define CORE_PIN18_PINREG GPIOB_PDIR
  402. #define CORE_PIN19_PINREG GPIOB_PDIR
  403. #define CORE_PIN20_PINREG GPIOD_PDIR
  404. #define CORE_PIN21_PINREG GPIOD_PDIR
  405. #define CORE_PIN22_PINREG GPIOC_PDIR
  406. #define CORE_PIN23_PINREG GPIOC_PDIR
  407. #define CORE_PIN24_PINREG GPIOA_PDIR
  408. #define CORE_PIN25_PINREG GPIOB_PDIR
  409. #define CORE_PIN26_PINREG GPIOE_PDIR
  410. #define CORE_PIN27_PINREG GPIOC_PDIR
  411. #define CORE_PIN28_PINREG GPIOC_PDIR
  412. #define CORE_PIN29_PINREG GPIOC_PDIR
  413. #define CORE_PIN30_PINREG GPIOC_PDIR
  414. #define CORE_PIN31_PINREG GPIOE_PDIR
  415. #define CORE_PIN32_PINREG GPIOB_PDIR
  416. #define CORE_PIN33_PINREG GPIOA_PDIR
  417. #define CORE_PIN0_CONFIG PORTB_PCR16
  418. #define CORE_PIN1_CONFIG PORTB_PCR17
  419. #define CORE_PIN2_CONFIG PORTD_PCR0
  420. #define CORE_PIN3_CONFIG PORTA_PCR12
  421. #define CORE_PIN4_CONFIG PORTA_PCR13
  422. #define CORE_PIN5_CONFIG PORTD_PCR7
  423. #define CORE_PIN6_CONFIG PORTD_PCR4
  424. #define CORE_PIN7_CONFIG PORTD_PCR2
  425. #define CORE_PIN8_CONFIG PORTD_PCR3
  426. #define CORE_PIN9_CONFIG PORTC_PCR3
  427. #define CORE_PIN10_CONFIG PORTC_PCR4
  428. #define CORE_PIN11_CONFIG PORTC_PCR6
  429. #define CORE_PIN12_CONFIG PORTC_PCR7
  430. #define CORE_PIN13_CONFIG PORTC_PCR5
  431. #define CORE_PIN14_CONFIG PORTD_PCR1
  432. #define CORE_PIN15_CONFIG PORTC_PCR0
  433. #define CORE_PIN16_CONFIG PORTB_PCR0
  434. #define CORE_PIN17_CONFIG PORTB_PCR1
  435. #define CORE_PIN18_CONFIG PORTB_PCR3
  436. #define CORE_PIN19_CONFIG PORTB_PCR2
  437. #define CORE_PIN20_CONFIG PORTD_PCR5
  438. #define CORE_PIN21_CONFIG PORTD_PCR6
  439. #define CORE_PIN22_CONFIG PORTC_PCR1
  440. #define CORE_PIN23_CONFIG PORTC_PCR2
  441. #define CORE_PIN24_CONFIG PORTA_PCR5
  442. #define CORE_PIN25_CONFIG PORTB_PCR19
  443. #define CORE_PIN26_CONFIG PORTE_PCR1
  444. #define CORE_PIN27_CONFIG PORTC_PCR9
  445. #define CORE_PIN28_CONFIG PORTC_PCR8
  446. #define CORE_PIN29_CONFIG PORTC_PCR10
  447. #define CORE_PIN30_CONFIG PORTC_PCR11
  448. #define CORE_PIN31_CONFIG PORTE_PCR0
  449. #define CORE_PIN32_CONFIG PORTB_PCR18
  450. #define CORE_PIN33_CONFIG PORTA_PCR4
  451. #define CORE_ADC0_PIN 14
  452. #define CORE_ADC1_PIN 15
  453. #define CORE_ADC2_PIN 16
  454. #define CORE_ADC3_PIN 17
  455. #define CORE_ADC4_PIN 18
  456. #define CORE_ADC5_PIN 19
  457. #define CORE_ADC6_PIN 20
  458. #define CORE_ADC7_PIN 21
  459. #define CORE_ADC8_PIN 22
  460. #define CORE_ADC9_PIN 23
  461. #define CORE_ADC10_PIN 34
  462. #define CORE_ADC11_PIN 35
  463. #define CORE_ADC12_PIN 36
  464. #define CORE_ADC13_PIN 37
  465. #define CORE_RXD0_PIN 0
  466. #define CORE_TXD0_PIN 1
  467. #define CORE_RXD1_PIN 9
  468. #define CORE_TXD1_PIN 10
  469. #define CORE_RXD2_PIN 7
  470. #define CORE_TXD2_PIN 8
  471. #define CORE_INT0_PIN 0
  472. #define CORE_INT1_PIN 1
  473. #define CORE_INT2_PIN 2
  474. #define CORE_INT3_PIN 3
  475. #define CORE_INT4_PIN 4
  476. #define CORE_INT5_PIN 5
  477. #define CORE_INT6_PIN 6
  478. #define CORE_INT7_PIN 7
  479. #define CORE_INT8_PIN 8
  480. #define CORE_INT9_PIN 9
  481. #define CORE_INT10_PIN 10
  482. #define CORE_INT11_PIN 11
  483. #define CORE_INT12_PIN 12
  484. #define CORE_INT13_PIN 13
  485. #define CORE_INT14_PIN 14
  486. #define CORE_INT15_PIN 15
  487. #define CORE_INT16_PIN 16
  488. #define CORE_INT17_PIN 17
  489. #define CORE_INT18_PIN 18
  490. #define CORE_INT19_PIN 19
  491. #define CORE_INT20_PIN 20
  492. #define CORE_INT21_PIN 21
  493. #define CORE_INT22_PIN 22
  494. #define CORE_INT23_PIN 23
  495. #define CORE_INT24_PIN 24
  496. #define CORE_INT25_PIN 25
  497. #define CORE_INT26_PIN 26
  498. #define CORE_INT27_PIN 27
  499. #define CORE_INT28_PIN 28
  500. #define CORE_INT29_PIN 29
  501. #define CORE_INT30_PIN 30
  502. #define CORE_INT31_PIN 31
  503. #define CORE_INT32_PIN 32
  504. #define CORE_INT33_PIN 33
  505. #define CORE_INT_EVERY_PIN 1
  506. #elif defined(__MKL26Z64__)
  507. #define CORE_PIN0_BIT 16
  508. #define CORE_PIN1_BIT 17
  509. #define CORE_PIN2_BIT 0
  510. #define CORE_PIN3_BIT 1
  511. #define CORE_PIN4_BIT 2
  512. #define CORE_PIN5_BIT 7
  513. #define CORE_PIN6_BIT 4
  514. #define CORE_PIN7_BIT 2
  515. #define CORE_PIN8_BIT 3
  516. #define CORE_PIN9_BIT 3
  517. #define CORE_PIN10_BIT 4
  518. #define CORE_PIN11_BIT 6
  519. #define CORE_PIN12_BIT 7
  520. #define CORE_PIN13_BIT 5
  521. #define CORE_PIN14_BIT 1
  522. #define CORE_PIN15_BIT 0
  523. #define CORE_PIN16_BIT 0
  524. #define CORE_PIN17_BIT 1
  525. #define CORE_PIN18_BIT 3
  526. #define CORE_PIN19_BIT 2
  527. #define CORE_PIN20_BIT 5
  528. #define CORE_PIN21_BIT 6
  529. #define CORE_PIN22_BIT 1
  530. #define CORE_PIN23_BIT 2
  531. #define CORE_PIN24_BIT 20
  532. #define CORE_PIN25_BIT 21
  533. #define CORE_PIN26_BIT 30
  534. #define CORE_PIN0_BITMASK (1<<(CORE_PIN0_BIT))
  535. #define CORE_PIN1_BITMASK (1<<(CORE_PIN1_BIT))
  536. #define CORE_PIN2_BITMASK (1<<(CORE_PIN2_BIT))
  537. #define CORE_PIN3_BITMASK (1<<(CORE_PIN3_BIT))
  538. #define CORE_PIN4_BITMASK (1<<(CORE_PIN4_BIT))
  539. #define CORE_PIN5_BITMASK (1<<(CORE_PIN5_BIT))
  540. #define CORE_PIN6_BITMASK (1<<(CORE_PIN6_BIT))
  541. #define CORE_PIN7_BITMASK (1<<(CORE_PIN7_BIT))
  542. #define CORE_PIN8_BITMASK (1<<(CORE_PIN8_BIT))
  543. #define CORE_PIN9_BITMASK (1<<(CORE_PIN9_BIT))
  544. #define CORE_PIN10_BITMASK (1<<(CORE_PIN10_BIT))
  545. #define CORE_PIN11_BITMASK (1<<(CORE_PIN11_BIT))
  546. #define CORE_PIN12_BITMASK (1<<(CORE_PIN12_BIT))
  547. #define CORE_PIN13_BITMASK (1<<(CORE_PIN13_BIT))
  548. #define CORE_PIN14_BITMASK (1<<(CORE_PIN14_BIT))
  549. #define CORE_PIN15_BITMASK (1<<(CORE_PIN15_BIT))
  550. #define CORE_PIN16_BITMASK (1<<(CORE_PIN16_BIT))
  551. #define CORE_PIN17_BITMASK (1<<(CORE_PIN17_BIT))
  552. #define CORE_PIN18_BITMASK (1<<(CORE_PIN18_BIT))
  553. #define CORE_PIN19_BITMASK (1<<(CORE_PIN19_BIT))
  554. #define CORE_PIN20_BITMASK (1<<(CORE_PIN20_BIT))
  555. #define CORE_PIN21_BITMASK (1<<(CORE_PIN21_BIT))
  556. #define CORE_PIN22_BITMASK (1<<(CORE_PIN22_BIT))
  557. #define CORE_PIN23_BITMASK (1<<(CORE_PIN23_BIT))
  558. #define CORE_PIN24_BITMASK (1<<(CORE_PIN24_BIT))
  559. #define CORE_PIN25_BITMASK (1<<(CORE_PIN25_BIT))
  560. #define CORE_PIN26_BITMASK (1<<(CORE_PIN26_BIT))
  561. #define CORE_PIN0_PORTREG FGPIOB_PDOR
  562. #define CORE_PIN1_PORTREG FGPIOB_PDOR
  563. #define CORE_PIN2_PORTREG FGPIOD_PDOR
  564. #define CORE_PIN3_PORTREG FGPIOA_PDOR
  565. #define CORE_PIN4_PORTREG FGPIOA_PDOR
  566. #define CORE_PIN5_PORTREG FGPIOD_PDOR
  567. #define CORE_PIN6_PORTREG FGPIOD_PDOR
  568. #define CORE_PIN7_PORTREG FGPIOD_PDOR
  569. #define CORE_PIN8_PORTREG FGPIOD_PDOR
  570. #define CORE_PIN9_PORTREG FGPIOC_PDOR
  571. #define CORE_PIN10_PORTREG FGPIOC_PDOR
  572. #define CORE_PIN11_PORTREG FGPIOC_PDOR
  573. #define CORE_PIN12_PORTREG FGPIOC_PDOR
  574. #define CORE_PIN13_PORTREG FGPIOC_PDOR
  575. #define CORE_PIN14_PORTREG FGPIOD_PDOR
  576. #define CORE_PIN15_PORTREG FGPIOC_PDOR
  577. #define CORE_PIN16_PORTREG FGPIOB_PDOR
  578. #define CORE_PIN17_PORTREG FGPIOB_PDOR
  579. #define CORE_PIN18_PORTREG FGPIOB_PDOR
  580. #define CORE_PIN19_PORTREG FGPIOB_PDOR
  581. #define CORE_PIN20_PORTREG FGPIOD_PDOR
  582. #define CORE_PIN21_PORTREG FGPIOD_PDOR
  583. #define CORE_PIN22_PORTREG FGPIOC_PDOR
  584. #define CORE_PIN23_PORTREG FGPIOC_PDOR
  585. #define CORE_PIN24_PORTREG FGPIOE_PDOR
  586. #define CORE_PIN25_PORTREG FGPIOE_PDOR
  587. #define CORE_PIN26_PORTREG FGPIOE_PDOR
  588. #define CORE_PIN0_PORTSET FGPIOB_PSOR
  589. #define CORE_PIN1_PORTSET FGPIOB_PSOR
  590. #define CORE_PIN2_PORTSET FGPIOD_PSOR
  591. #define CORE_PIN3_PORTSET FGPIOA_PSOR
  592. #define CORE_PIN4_PORTSET FGPIOA_PSOR
  593. #define CORE_PIN5_PORTSET FGPIOD_PSOR
  594. #define CORE_PIN6_PORTSET FGPIOD_PSOR
  595. #define CORE_PIN7_PORTSET FGPIOD_PSOR
  596. #define CORE_PIN8_PORTSET FGPIOD_PSOR
  597. #define CORE_PIN9_PORTSET FGPIOC_PSOR
  598. #define CORE_PIN10_PORTSET FGPIOC_PSOR
  599. #define CORE_PIN11_PORTSET FGPIOC_PSOR
  600. #define CORE_PIN12_PORTSET FGPIOC_PSOR
  601. #define CORE_PIN13_PORTSET FGPIOC_PSOR
  602. #define CORE_PIN14_PORTSET FGPIOD_PSOR
  603. #define CORE_PIN15_PORTSET FGPIOC_PSOR
  604. #define CORE_PIN16_PORTSET FGPIOB_PSOR
  605. #define CORE_PIN17_PORTSET FGPIOB_PSOR
  606. #define CORE_PIN18_PORTSET FGPIOB_PSOR
  607. #define CORE_PIN19_PORTSET FGPIOB_PSOR
  608. #define CORE_PIN20_PORTSET FGPIOD_PSOR
  609. #define CORE_PIN21_PORTSET FGPIOD_PSOR
  610. #define CORE_PIN22_PORTSET FGPIOC_PSOR
  611. #define CORE_PIN23_PORTSET FGPIOC_PSOR
  612. #define CORE_PIN24_PORTSET FGPIOE_PSOR
  613. #define CORE_PIN25_PORTSET FGPIOE_PSOR
  614. #define CORE_PIN26_PORTSET FGPIOE_PSOR
  615. #define CORE_PIN0_PORTTOGGLE FGPIOB_PTOR
  616. #define CORE_PIN1_PORTTOGGLE FGPIOB_PTOR
  617. #define CORE_PIN2_PORTTOGGLE FGPIOD_PTOR
  618. #define CORE_PIN3_PORTTOGGLE FGPIOA_PTOR
  619. #define CORE_PIN4_PORTTOGGLE FGPIOA_PTOR
  620. #define CORE_PIN5_PORTTOGGLE FGPIOD_PTOR
  621. #define CORE_PIN6_PORTTOGGLE FGPIOD_PTOR
  622. #define CORE_PIN7_PORTTOGGLE FGPIOD_PTOR
  623. #define CORE_PIN8_PORTTOGGLE FGPIOD_PTOR
  624. #define CORE_PIN9_PORTTOGGLE FGPIOC_PTOR
  625. #define CORE_PIN10_PORTTOGGLE FGPIOC_PTOR
  626. #define CORE_PIN11_PORTTOGGLE FGPIOC_PTOR
  627. #define CORE_PIN12_PORTTOGGLE FGPIOC_PTOR
  628. #define CORE_PIN13_PORTTOGGLE FGPIOC_PTOR
  629. #define CORE_PIN14_PORTTOGGLE FGPIOD_PTOR
  630. #define CORE_PIN15_PORTTOGGLE FGPIOC_PTOR
  631. #define CORE_PIN16_PORTTOGGLE FGPIOB_PTOR
  632. #define CORE_PIN17_PORTTOGGLE FGPIOB_PTOR
  633. #define CORE_PIN18_PORTTOGGLE FGPIOB_PTOR
  634. #define CORE_PIN19_PORTTOGGLE FGPIOB_PTOR
  635. #define CORE_PIN20_PORTTOGGLE FGPIOD_PTOR
  636. #define CORE_PIN21_PORTTOGGLE FGPIOD_PTOR
  637. #define CORE_PIN22_PORTTOGGLE FGPIOC_PTOR
  638. #define CORE_PIN23_PORTTOGGLE FGPIOC_PTOR
  639. #define CORE_PIN24_PORTTOGGLE FGPIOE_PTOR
  640. #define CORE_PIN25_PORTTOGGLE FGPIOE_PTOR
  641. #define CORE_PIN26_PORTTOGGLE FGPIOE_PTOR
  642. #define CORE_PIN0_PORTCLEAR FGPIOB_PCOR
  643. #define CORE_PIN1_PORTCLEAR FGPIOB_PCOR
  644. #define CORE_PIN2_PORTCLEAR FGPIOD_PCOR
  645. #define CORE_PIN3_PORTCLEAR FGPIOA_PCOR
  646. #define CORE_PIN4_PORTCLEAR FGPIOA_PCOR
  647. #define CORE_PIN5_PORTCLEAR FGPIOD_PCOR
  648. #define CORE_PIN6_PORTCLEAR FGPIOD_PCOR
  649. #define CORE_PIN7_PORTCLEAR FGPIOD_PCOR
  650. #define CORE_PIN8_PORTCLEAR FGPIOD_PCOR
  651. #define CORE_PIN9_PORTCLEAR FGPIOC_PCOR
  652. #define CORE_PIN10_PORTCLEAR FGPIOC_PCOR
  653. #define CORE_PIN11_PORTCLEAR FGPIOC_PCOR
  654. #define CORE_PIN12_PORTCLEAR FGPIOC_PCOR
  655. #define CORE_PIN13_PORTCLEAR FGPIOC_PCOR
  656. #define CORE_PIN14_PORTCLEAR FGPIOD_PCOR
  657. #define CORE_PIN15_PORTCLEAR FGPIOC_PCOR
  658. #define CORE_PIN16_PORTCLEAR FGPIOB_PCOR
  659. #define CORE_PIN17_PORTCLEAR FGPIOB_PCOR
  660. #define CORE_PIN18_PORTCLEAR FGPIOB_PCOR
  661. #define CORE_PIN19_PORTCLEAR FGPIOB_PCOR
  662. #define CORE_PIN20_PORTCLEAR FGPIOD_PCOR
  663. #define CORE_PIN21_PORTCLEAR FGPIOD_PCOR
  664. #define CORE_PIN22_PORTCLEAR FGPIOC_PCOR
  665. #define CORE_PIN23_PORTCLEAR FGPIOC_PCOR
  666. #define CORE_PIN24_PORTCLEAR FGPIOE_PCOR
  667. #define CORE_PIN25_PORTCLEAR FGPIOE_PCOR
  668. #define CORE_PIN26_PORTCLEAR FGPIOE_PCOR
  669. #define CORE_PIN0_DDRREG FGPIOB_PDDR
  670. #define CORE_PIN1_DDRREG FGPIOB_PDDR
  671. #define CORE_PIN2_DDRREG FGPIOD_PDDR
  672. #define CORE_PIN3_DDRREG FGPIOA_PDDR
  673. #define CORE_PIN4_DDRREG FGPIOA_PDDR
  674. #define CORE_PIN5_DDRREG FGPIOD_PDDR
  675. #define CORE_PIN6_DDRREG FGPIOD_PDDR
  676. #define CORE_PIN7_DDRREG FGPIOD_PDDR
  677. #define CORE_PIN8_DDRREG FGPIOD_PDDR
  678. #define CORE_PIN9_DDRREG FGPIOC_PDDR
  679. #define CORE_PIN10_DDRREG FGPIOC_PDDR
  680. #define CORE_PIN11_DDRREG FGPIOC_PDDR
  681. #define CORE_PIN12_DDRREG FGPIOC_PDDR
  682. #define CORE_PIN13_DDRREG FGPIOC_PDDR
  683. #define CORE_PIN14_DDRREG FGPIOD_PDDR
  684. #define CORE_PIN15_DDRREG FGPIOC_PDDR
  685. #define CORE_PIN16_DDRREG FGPIOB_PDDR
  686. #define CORE_PIN17_DDRREG FGPIOB_PDDR
  687. #define CORE_PIN18_DDRREG FGPIOB_PDDR
  688. #define CORE_PIN19_DDRREG FGPIOB_PDDR
  689. #define CORE_PIN20_DDRREG FGPIOD_PDDR
  690. #define CORE_PIN21_DDRREG FGPIOD_PDDR
  691. #define CORE_PIN22_DDRREG FGPIOC_PDDR
  692. #define CORE_PIN23_DDRREG FGPIOC_PDDR
  693. #define CORE_PIN24_DDRREG FGPIOE_PDDR
  694. #define CORE_PIN25_DDRREG FGPIOE_PDDR
  695. #define CORE_PIN26_DDRREG FGPIOE_PDDR
  696. #define CORE_PIN0_PINREG FGPIOB_PDIR
  697. #define CORE_PIN1_PINREG FGPIOB_PDIR
  698. #define CORE_PIN2_PINREG FGPIOD_PDIR
  699. #define CORE_PIN3_PINREG FGPIOA_PDIR
  700. #define CORE_PIN4_PINREG FGPIOA_PDIR
  701. #define CORE_PIN5_PINREG FGPIOD_PDIR
  702. #define CORE_PIN6_PINREG FGPIOD_PDIR
  703. #define CORE_PIN7_PINREG FGPIOD_PDIR
  704. #define CORE_PIN8_PINREG FGPIOD_PDIR
  705. #define CORE_PIN9_PINREG FGPIOC_PDIR
  706. #define CORE_PIN10_PINREG FGPIOC_PDIR
  707. #define CORE_PIN11_PINREG FGPIOC_PDIR
  708. #define CORE_PIN12_PINREG FGPIOC_PDIR
  709. #define CORE_PIN13_PINREG FGPIOC_PDIR
  710. #define CORE_PIN14_PINREG FGPIOD_PDIR
  711. #define CORE_PIN15_PINREG FGPIOC_PDIR
  712. #define CORE_PIN16_PINREG FGPIOB_PDIR
  713. #define CORE_PIN17_PINREG FGPIOB_PDIR
  714. #define CORE_PIN18_PINREG FGPIOB_PDIR
  715. #define CORE_PIN19_PINREG FGPIOB_PDIR
  716. #define CORE_PIN20_PINREG FGPIOD_PDIR
  717. #define CORE_PIN21_PINREG FGPIOD_PDIR
  718. #define CORE_PIN22_PINREG FGPIOC_PDIR
  719. #define CORE_PIN23_PINREG FGPIOC_PDIR
  720. #define CORE_PIN24_PINREG FGPIOE_PDIR
  721. #define CORE_PIN25_PINREG FGPIOE_PDIR
  722. #define CORE_PIN26_PINREG FGPIOE_PDIR
  723. #define CORE_PIN0_CONFIG PORTB_PCR16
  724. #define CORE_PIN1_CONFIG PORTB_PCR17
  725. #define CORE_PIN2_CONFIG PORTD_PCR0
  726. #define CORE_PIN3_CONFIG PORTA_PCR1
  727. #define CORE_PIN4_CONFIG PORTA_PCR2
  728. #define CORE_PIN5_CONFIG PORTD_PCR7
  729. #define CORE_PIN6_CONFIG PORTD_PCR4
  730. #define CORE_PIN7_CONFIG PORTD_PCR2
  731. #define CORE_PIN8_CONFIG PORTD_PCR3
  732. #define CORE_PIN9_CONFIG PORTC_PCR3
  733. #define CORE_PIN10_CONFIG PORTC_PCR4
  734. #define CORE_PIN11_CONFIG PORTC_PCR6
  735. #define CORE_PIN12_CONFIG PORTC_PCR7
  736. #define CORE_PIN13_CONFIG PORTC_PCR5
  737. #define CORE_PIN14_CONFIG PORTD_PCR1
  738. #define CORE_PIN15_CONFIG PORTC_PCR0
  739. #define CORE_PIN16_CONFIG PORTB_PCR0
  740. #define CORE_PIN17_CONFIG PORTB_PCR1
  741. #define CORE_PIN18_CONFIG PORTB_PCR3
  742. #define CORE_PIN19_CONFIG PORTB_PCR2
  743. #define CORE_PIN20_CONFIG PORTD_PCR5
  744. #define CORE_PIN21_CONFIG PORTD_PCR6
  745. #define CORE_PIN22_CONFIG PORTC_PCR1
  746. #define CORE_PIN23_CONFIG PORTC_PCR2
  747. #define CORE_PIN24_CONFIG PORTE_PCR20
  748. #define CORE_PIN25_CONFIG PORTE_PCR21
  749. #define CORE_PIN26_CONFIG PORTE_PCR30
  750. #define CORE_ADC0_PIN 14
  751. #define CORE_ADC1_PIN 15
  752. #define CORE_ADC2_PIN 16
  753. #define CORE_ADC3_PIN 17
  754. #define CORE_ADC4_PIN 18
  755. #define CORE_ADC5_PIN 19
  756. #define CORE_ADC6_PIN 20
  757. #define CORE_ADC7_PIN 21
  758. #define CORE_ADC8_PIN 22
  759. #define CORE_ADC9_PIN 23
  760. #define CORE_ADC10_PIN 24
  761. #define CORE_ADC11_PIN 25
  762. #define CORE_ADC12_PIN 26
  763. #define CORE_RXD0_PIN 0
  764. #define CORE_TXD0_PIN 1
  765. #define CORE_RXD1_PIN 9
  766. #define CORE_TXD1_PIN 10
  767. #define CORE_RXD2_PIN 7
  768. #define CORE_TXD2_PIN 8
  769. #define CORE_INT2_PIN 2
  770. #define CORE_INT3_PIN 3
  771. #define CORE_INT4_PIN 4
  772. #define CORE_INT5_PIN 5
  773. #define CORE_INT6_PIN 6
  774. #define CORE_INT7_PIN 7
  775. #define CORE_INT8_PIN 8
  776. #define CORE_INT9_PIN 9
  777. #define CORE_INT10_PIN 10
  778. #define CORE_INT11_PIN 11
  779. #define CORE_INT12_PIN 12
  780. #define CORE_INT13_PIN 13
  781. #define CORE_INT14_PIN 14
  782. #define CORE_INT15_PIN 15
  783. #define CORE_INT20_PIN 20
  784. #define CORE_INT21_PIN 21
  785. #define CORE_INT22_PIN 22
  786. #define CORE_INT23_PIN 23
  787. #elif defined(__MK64FX512__) || defined(__MK66FX1M0__)
  788. #define CORE_PIN0_BIT 16
  789. #define CORE_PIN1_BIT 17
  790. #define CORE_PIN2_BIT 0
  791. #define CORE_PIN3_BIT 12
  792. #define CORE_PIN4_BIT 13
  793. #define CORE_PIN5_BIT 7
  794. #define CORE_PIN6_BIT 4
  795. #define CORE_PIN7_BIT 2
  796. #define CORE_PIN8_BIT 3
  797. #define CORE_PIN9_BIT 3
  798. #define CORE_PIN10_BIT 4
  799. #define CORE_PIN11_BIT 6
  800. #define CORE_PIN12_BIT 7
  801. #define CORE_PIN13_BIT 5
  802. #define CORE_PIN14_BIT 1
  803. #define CORE_PIN15_BIT 0
  804. #define CORE_PIN16_BIT 0
  805. #define CORE_PIN17_BIT 1
  806. #define CORE_PIN18_BIT 3
  807. #define CORE_PIN19_BIT 2
  808. #define CORE_PIN20_BIT 5
  809. #define CORE_PIN21_BIT 6
  810. #define CORE_PIN22_BIT 1
  811. #define CORE_PIN23_BIT 2
  812. #define CORE_PIN24_BIT 26
  813. #define CORE_PIN25_BIT 5
  814. #define CORE_PIN26_BIT 14
  815. #define CORE_PIN27_BIT 15
  816. #define CORE_PIN28_BIT 16
  817. #define CORE_PIN29_BIT 18
  818. #define CORE_PIN30_BIT 19
  819. #define CORE_PIN31_BIT 10
  820. #define CORE_PIN32_BIT 11
  821. #define CORE_PIN33_BIT 24
  822. #define CORE_PIN34_BIT 25
  823. #define CORE_PIN35_BIT 8
  824. #define CORE_PIN36_BIT 9
  825. #define CORE_PIN37_BIT 10
  826. #define CORE_PIN38_BIT 11
  827. #define CORE_PIN39_BIT 17
  828. #define CORE_PIN40_BIT 28
  829. #define CORE_PIN41_BIT 29
  830. #define CORE_PIN42_BIT 26
  831. #define CORE_PIN43_BIT 20
  832. #define CORE_PIN44_BIT 22
  833. #define CORE_PIN45_BIT 23
  834. #define CORE_PIN46_BIT 21
  835. #define CORE_PIN47_BIT 8
  836. #define CORE_PIN48_BIT 9
  837. #define CORE_PIN49_BIT 4
  838. #define CORE_PIN50_BIT 5
  839. #define CORE_PIN51_BIT 14
  840. #define CORE_PIN52_BIT 13
  841. #define CORE_PIN53_BIT 12
  842. #define CORE_PIN54_BIT 15
  843. #define CORE_PIN55_BIT 11
  844. #define CORE_PIN56_BIT 10
  845. #define CORE_PIN57_BIT 11
  846. #define CORE_PIN58_BIT 0
  847. #define CORE_PIN59_BIT 1
  848. #define CORE_PIN60_BIT 2
  849. #define CORE_PIN61_BIT 3
  850. #define CORE_PIN62_BIT 4
  851. #define CORE_PIN63_BIT 5
  852. #define CORE_PIN0_BITMASK (1<<(CORE_PIN0_BIT))
  853. #define CORE_PIN1_BITMASK (1<<(CORE_PIN1_BIT))
  854. #define CORE_PIN2_BITMASK (1<<(CORE_PIN2_BIT))
  855. #define CORE_PIN3_BITMASK (1<<(CORE_PIN3_BIT))
  856. #define CORE_PIN4_BITMASK (1<<(CORE_PIN4_BIT))
  857. #define CORE_PIN5_BITMASK (1<<(CORE_PIN5_BIT))
  858. #define CORE_PIN6_BITMASK (1<<(CORE_PIN6_BIT))
  859. #define CORE_PIN7_BITMASK (1<<(CORE_PIN7_BIT))
  860. #define CORE_PIN8_BITMASK (1<<(CORE_PIN8_BIT))
  861. #define CORE_PIN9_BITMASK (1<<(CORE_PIN9_BIT))
  862. #define CORE_PIN10_BITMASK (1<<(CORE_PIN10_BIT))
  863. #define CORE_PIN11_BITMASK (1<<(CORE_PIN11_BIT))
  864. #define CORE_PIN12_BITMASK (1<<(CORE_PIN12_BIT))
  865. #define CORE_PIN13_BITMASK (1<<(CORE_PIN13_BIT))
  866. #define CORE_PIN14_BITMASK (1<<(CORE_PIN14_BIT))
  867. #define CORE_PIN15_BITMASK (1<<(CORE_PIN15_BIT))
  868. #define CORE_PIN16_BITMASK (1<<(CORE_PIN16_BIT))
  869. #define CORE_PIN17_BITMASK (1<<(CORE_PIN17_BIT))
  870. #define CORE_PIN18_BITMASK (1<<(CORE_PIN18_BIT))
  871. #define CORE_PIN19_BITMASK (1<<(CORE_PIN19_BIT))
  872. #define CORE_PIN20_BITMASK (1<<(CORE_PIN20_BIT))
  873. #define CORE_PIN21_BITMASK (1<<(CORE_PIN21_BIT))
  874. #define CORE_PIN22_BITMASK (1<<(CORE_PIN22_BIT))
  875. #define CORE_PIN23_BITMASK (1<<(CORE_PIN23_BIT))
  876. #define CORE_PIN24_BITMASK (1<<(CORE_PIN24_BIT))
  877. #define CORE_PIN25_BITMASK (1<<(CORE_PIN25_BIT))
  878. #define CORE_PIN26_BITMASK (1<<(CORE_PIN26_BIT))
  879. #define CORE_PIN27_BITMASK (1<<(CORE_PIN27_BIT))
  880. #define CORE_PIN28_BITMASK (1<<(CORE_PIN28_BIT))
  881. #define CORE_PIN29_BITMASK (1<<(CORE_PIN29_BIT))
  882. #define CORE_PIN30_BITMASK (1<<(CORE_PIN30_BIT))
  883. #define CORE_PIN31_BITMASK (1<<(CORE_PIN31_BIT))
  884. #define CORE_PIN32_BITMASK (1<<(CORE_PIN32_BIT))
  885. #define CORE_PIN33_BITMASK (1<<(CORE_PIN33_BIT))
  886. #define CORE_PIN34_BITMASK (1<<(CORE_PIN34_BIT))
  887. #define CORE_PIN35_BITMASK (1<<(CORE_PIN35_BIT))
  888. #define CORE_PIN36_BITMASK (1<<(CORE_PIN36_BIT))
  889. #define CORE_PIN37_BITMASK (1<<(CORE_PIN37_BIT))
  890. #define CORE_PIN38_BITMASK (1<<(CORE_PIN38_BIT))
  891. #define CORE_PIN39_BITMASK (1<<(CORE_PIN39_BIT))
  892. #define CORE_PIN40_BITMASK (1<<(CORE_PIN40_BIT))
  893. #define CORE_PIN41_BITMASK (1<<(CORE_PIN41_BIT))
  894. #define CORE_PIN42_BITMASK (1<<(CORE_PIN42_BIT))
  895. #define CORE_PIN43_BITMASK (1<<(CORE_PIN43_BIT))
  896. #define CORE_PIN44_BITMASK (1<<(CORE_PIN44_BIT))
  897. #define CORE_PIN45_BITMASK (1<<(CORE_PIN45_BIT))
  898. #define CORE_PIN46_BITMASK (1<<(CORE_PIN46_BIT))
  899. #define CORE_PIN47_BITMASK (1<<(CORE_PIN47_BIT))
  900. #define CORE_PIN48_BITMASK (1<<(CORE_PIN48_BIT))
  901. #define CORE_PIN49_BITMASK (1<<(CORE_PIN49_BIT))
  902. #define CORE_PIN50_BITMASK (1<<(CORE_PIN50_BIT))
  903. #define CORE_PIN51_BITMASK (1<<(CORE_PIN51_BIT))
  904. #define CORE_PIN52_BITMASK (1<<(CORE_PIN52_BIT))
  905. #define CORE_PIN53_BITMASK (1<<(CORE_PIN53_BIT))
  906. #define CORE_PIN54_BITMASK (1<<(CORE_PIN54_BIT))
  907. #define CORE_PIN55_BITMASK (1<<(CORE_PIN55_BIT))
  908. #define CORE_PIN56_BITMASK (1<<(CORE_PIN56_BIT))
  909. #define CORE_PIN57_BITMASK (1<<(CORE_PIN57_BIT))
  910. #define CORE_PIN58_BITMASK (1<<(CORE_PIN58_BIT))
  911. #define CORE_PIN59_BITMASK (1<<(CORE_PIN59_BIT))
  912. #define CORE_PIN60_BITMASK (1<<(CORE_PIN60_BIT))
  913. #define CORE_PIN61_BITMASK (1<<(CORE_PIN61_BIT))
  914. #define CORE_PIN62_BITMASK (1<<(CORE_PIN62_BIT))
  915. #define CORE_PIN63_BITMASK (1<<(CORE_PIN63_BIT))
  916. #define CORE_PIN0_PORTREG GPIOB_PDOR
  917. #define CORE_PIN1_PORTREG GPIOB_PDOR
  918. #define CORE_PIN2_PORTREG GPIOD_PDOR
  919. #define CORE_PIN3_PORTREG GPIOA_PDOR
  920. #define CORE_PIN4_PORTREG GPIOA_PDOR
  921. #define CORE_PIN5_PORTREG GPIOD_PDOR
  922. #define CORE_PIN6_PORTREG GPIOD_PDOR
  923. #define CORE_PIN7_PORTREG GPIOD_PDOR
  924. #define CORE_PIN8_PORTREG GPIOD_PDOR
  925. #define CORE_PIN9_PORTREG GPIOC_PDOR
  926. #define CORE_PIN10_PORTREG GPIOC_PDOR
  927. #define CORE_PIN11_PORTREG GPIOC_PDOR
  928. #define CORE_PIN12_PORTREG GPIOC_PDOR
  929. #define CORE_PIN13_PORTREG GPIOC_PDOR
  930. #define CORE_PIN14_PORTREG GPIOD_PDOR
  931. #define CORE_PIN15_PORTREG GPIOC_PDOR
  932. #define CORE_PIN16_PORTREG GPIOB_PDOR
  933. #define CORE_PIN17_PORTREG GPIOB_PDOR
  934. #define CORE_PIN18_PORTREG GPIOB_PDOR
  935. #define CORE_PIN19_PORTREG GPIOB_PDOR
  936. #define CORE_PIN20_PORTREG GPIOD_PDOR
  937. #define CORE_PIN21_PORTREG GPIOD_PDOR
  938. #define CORE_PIN22_PORTREG GPIOC_PDOR
  939. #define CORE_PIN23_PORTREG GPIOC_PDOR
  940. #define CORE_PIN24_PORTREG GPIOE_PDOR
  941. #define CORE_PIN25_PORTREG GPIOA_PDOR
  942. #define CORE_PIN26_PORTREG GPIOA_PDOR
  943. #define CORE_PIN27_PORTREG GPIOA_PDOR
  944. #define CORE_PIN28_PORTREG GPIOA_PDOR
  945. #define CORE_PIN29_PORTREG GPIOB_PDOR
  946. #define CORE_PIN30_PORTREG GPIOB_PDOR
  947. #define CORE_PIN31_PORTREG GPIOB_PDOR
  948. #define CORE_PIN32_PORTREG GPIOB_PDOR
  949. #define CORE_PIN33_PORTREG GPIOE_PDOR
  950. #define CORE_PIN34_PORTREG GPIOE_PDOR
  951. #define CORE_PIN35_PORTREG GPIOC_PDOR
  952. #define CORE_PIN36_PORTREG GPIOC_PDOR
  953. #define CORE_PIN37_PORTREG GPIOC_PDOR
  954. #define CORE_PIN38_PORTREG GPIOC_PDOR
  955. #define CORE_PIN39_PORTREG GPIOA_PDOR
  956. #define CORE_PIN40_PORTREG GPIOA_PDOR
  957. #define CORE_PIN41_PORTREG GPIOA_PDOR
  958. #define CORE_PIN42_PORTREG GPIOA_PDOR
  959. #define CORE_PIN43_PORTREG GPIOB_PDOR
  960. #define CORE_PIN44_PORTREG GPIOB_PDOR
  961. #define CORE_PIN45_PORTREG GPIOB_PDOR
  962. #define CORE_PIN46_PORTREG GPIOB_PDOR
  963. #define CORE_PIN47_PORTREG GPIOD_PDOR
  964. #define CORE_PIN48_PORTREG GPIOD_PDOR
  965. #define CORE_PIN49_PORTREG GPIOB_PDOR
  966. #define CORE_PIN50_PORTREG GPIOB_PDOR
  967. #define CORE_PIN51_PORTREG GPIOD_PDOR
  968. #define CORE_PIN52_PORTREG GPIOD_PDOR
  969. #define CORE_PIN53_PORTREG GPIOD_PDOR
  970. #define CORE_PIN54_PORTREG GPIOD_PDOR
  971. #define CORE_PIN55_PORTREG GPIOD_PDOR
  972. #define CORE_PIN56_PORTREG GPIOE_PDOR
  973. #define CORE_PIN57_PORTREG GPIOE_PDOR
  974. #define CORE_PIN58_PORTREG GPIOE_PDOR
  975. #define CORE_PIN59_PORTREG GPIOE_PDOR
  976. #define CORE_PIN60_PORTREG GPIOE_PDOR
  977. #define CORE_PIN61_PORTREG GPIOE_PDOR
  978. #define CORE_PIN62_PORTREG GPIOE_PDOR
  979. #define CORE_PIN63_PORTREG GPIOE_PDOR
  980. #define CORE_PIN0_PORTSET GPIOB_PSOR
  981. #define CORE_PIN1_PORTSET GPIOB_PSOR
  982. #define CORE_PIN2_PORTSET GPIOD_PSOR
  983. #define CORE_PIN3_PORTSET GPIOA_PSOR
  984. #define CORE_PIN4_PORTSET GPIOA_PSOR
  985. #define CORE_PIN5_PORTSET GPIOD_PSOR
  986. #define CORE_PIN6_PORTSET GPIOD_PSOR
  987. #define CORE_PIN7_PORTSET GPIOD_PSOR
  988. #define CORE_PIN8_PORTSET GPIOD_PSOR
  989. #define CORE_PIN9_PORTSET GPIOC_PSOR
  990. #define CORE_PIN10_PORTSET GPIOC_PSOR
  991. #define CORE_PIN11_PORTSET GPIOC_PSOR
  992. #define CORE_PIN12_PORTSET GPIOC_PSOR
  993. #define CORE_PIN13_PORTSET GPIOC_PSOR
  994. #define CORE_PIN14_PORTSET GPIOD_PSOR
  995. #define CORE_PIN15_PORTSET GPIOC_PSOR
  996. #define CORE_PIN16_PORTSET GPIOB_PSOR
  997. #define CORE_PIN17_PORTSET GPIOB_PSOR
  998. #define CORE_PIN18_PORTSET GPIOB_PSOR
  999. #define CORE_PIN19_PORTSET GPIOB_PSOR
  1000. #define CORE_PIN20_PORTSET GPIOD_PSOR
  1001. #define CORE_PIN21_PORTSET GPIOD_PSOR
  1002. #define CORE_PIN22_PORTSET GPIOC_PSOR
  1003. #define CORE_PIN23_PORTSET GPIOC_PSOR
  1004. #define CORE_PIN24_PORTSET GPIOE_PSOR
  1005. #define CORE_PIN25_PORTSET GPIOA_PSOR
  1006. #define CORE_PIN26_PORTSET GPIOA_PSOR
  1007. #define CORE_PIN27_PORTSET GPIOA_PSOR
  1008. #define CORE_PIN28_PORTSET GPIOA_PSOR
  1009. #define CORE_PIN29_PORTSET GPIOB_PSOR
  1010. #define CORE_PIN30_PORTSET GPIOB_PSOR
  1011. #define CORE_PIN31_PORTSET GPIOB_PSOR
  1012. #define CORE_PIN32_PORTSET GPIOB_PSOR
  1013. #define CORE_PIN33_PORTSET GPIOE_PSOR
  1014. #define CORE_PIN34_PORTSET GPIOE_PSOR
  1015. #define CORE_PIN35_PORTSET GPIOC_PSOR
  1016. #define CORE_PIN36_PORTSET GPIOC_PSOR
  1017. #define CORE_PIN37_PORTSET GPIOC_PSOR
  1018. #define CORE_PIN38_PORTSET GPIOC_PSOR
  1019. #define CORE_PIN39_PORTSET GPIOA_PSOR
  1020. #define CORE_PIN40_PORTSET GPIOA_PSOR
  1021. #define CORE_PIN41_PORTSET GPIOA_PSOR
  1022. #define CORE_PIN42_PORTSET GPIOA_PSOR
  1023. #define CORE_PIN43_PORTSET GPIOB_PSOR
  1024. #define CORE_PIN44_PORTSET GPIOB_PSOR
  1025. #define CORE_PIN45_PORTSET GPIOB_PSOR
  1026. #define CORE_PIN46_PORTSET GPIOB_PSOR
  1027. #define CORE_PIN47_PORTSET GPIOD_PSOR
  1028. #define CORE_PIN48_PORTSET GPIOD_PSOR
  1029. #define CORE_PIN49_PORTSET GPIOB_PSOR
  1030. #define CORE_PIN50_PORTSET GPIOB_PSOR
  1031. #define CORE_PIN51_PORTSET GPIOD_PSOR
  1032. #define CORE_PIN52_PORTSET GPIOD_PSOR
  1033. #define CORE_PIN53_PORTSET GPIOD_PSOR
  1034. #define CORE_PIN54_PORTSET GPIOD_PSOR
  1035. #define CORE_PIN55_PORTSET GPIOD_PSOR
  1036. #define CORE_PIN56_PORTSET GPIOE_PSOR
  1037. #define CORE_PIN57_PORTSET GPIOE_PSOR
  1038. #define CORE_PIN58_PORTSET GPIOE_PSOR
  1039. #define CORE_PIN59_PORTSET GPIOE_PSOR
  1040. #define CORE_PIN60_PORTSET GPIOE_PSOR
  1041. #define CORE_PIN61_PORTSET GPIOE_PSOR
  1042. #define CORE_PIN62_PORTSET GPIOE_PSOR
  1043. #define CORE_PIN63_PORTSET GPIOE_PSOR
  1044. #define CORE_PIN0_PORTTOGGLE GPIOB_PTOR
  1045. #define CORE_PIN1_PORTTOGGLE GPIOB_PTOR
  1046. #define CORE_PIN2_PORTTOGGLE GPIOD_PTOR
  1047. #define CORE_PIN3_PORTTOGGLE GPIOA_PTOR
  1048. #define CORE_PIN4_PORTTOGGLE GPIOA_PTOR
  1049. #define CORE_PIN5_PORTTOGGLE GPIOD_PTOR
  1050. #define CORE_PIN6_PORTTOGGLE GPIOD_PTOR
  1051. #define CORE_PIN7_PORTTOGGLE GPIOD_PTOR
  1052. #define CORE_PIN8_PORTTOGGLE GPIOD_PTOR
  1053. #define CORE_PIN9_PORTTOGGLE GPIOC_PTOR
  1054. #define CORE_PIN10_PORTTOGGLE GPIOC_PTOR
  1055. #define CORE_PIN11_PORTTOGGLE GPIOC_PTOR
  1056. #define CORE_PIN12_PORTTOGGLE GPIOC_PTOR
  1057. #define CORE_PIN13_PORTTOGGLE GPIOC_PTOR
  1058. #define CORE_PIN14_PORTTOGGLE GPIOD_PTOR
  1059. #define CORE_PIN15_PORTTOGGLE GPIOC_PTOR
  1060. #define CORE_PIN16_PORTTOGGLE GPIOB_PTOR
  1061. #define CORE_PIN17_PORTTOGGLE GPIOB_PTOR
  1062. #define CORE_PIN18_PORTTOGGLE GPIOB_PTOR
  1063. #define CORE_PIN19_PORTTOGGLE GPIOB_PTOR
  1064. #define CORE_PIN20_PORTTOGGLE GPIOD_PTOR
  1065. #define CORE_PIN21_PORTTOGGLE GPIOD_PTOR
  1066. #define CORE_PIN22_PORTTOGGLE GPIOC_PTOR
  1067. #define CORE_PIN23_PORTTOGGLE GPIOC_PTOR
  1068. #define CORE_PIN24_PORTTOGGLE GPIOE_PTOR
  1069. #define CORE_PIN25_PORTTOGGLE GPIOA_PTOR
  1070. #define CORE_PIN26_PORTTOGGLE GPIOA_PTOR
  1071. #define CORE_PIN27_PORTTOGGLE GPIOA_PTOR
  1072. #define CORE_PIN28_PORTTOGGLE GPIOA_PTOR
  1073. #define CORE_PIN29_PORTTOGGLE GPIOB_PTOR
  1074. #define CORE_PIN30_PORTTOGGLE GPIOB_PTOR
  1075. #define CORE_PIN31_PORTTOGGLE GPIOB_PTOR
  1076. #define CORE_PIN32_PORTTOGGLE GPIOB_PTOR
  1077. #define CORE_PIN33_PORTTOGGLE GPIOE_PTOR
  1078. #define CORE_PIN34_PORTTOGGLE GPIOE_PTOR
  1079. #define CORE_PIN35_PORTTOGGLE GPIOC_PTOR
  1080. #define CORE_PIN36_PORTTOGGLE GPIOC_PTOR
  1081. #define CORE_PIN37_PORTTOGGLE GPIOC_PTOR
  1082. #define CORE_PIN38_PORTTOGGLE GPIOC_PTOR
  1083. #define CORE_PIN39_PORTTOGGLE GPIOA_PTOR
  1084. #define CORE_PIN40_PORTTOGGLE GPIOA_PTOR
  1085. #define CORE_PIN41_PORTTOGGLE GPIOA_PTOR
  1086. #define CORE_PIN42_PORTTOGGLE GPIOA_PTOR
  1087. #define CORE_PIN43_PORTTOGGLE GPIOB_PTOR
  1088. #define CORE_PIN44_PORTTOGGLE GPIOB_PTOR
  1089. #define CORE_PIN45_PORTTOGGLE GPIOB_PTOR
  1090. #define CORE_PIN46_PORTTOGGLE GPIOB_PTOR
  1091. #define CORE_PIN47_PORTTOGGLE GPIOD_PTOR
  1092. #define CORE_PIN48_PORTTOGGLE GPIOD_PTOR
  1093. #define CORE_PIN49_PORTTOGGLE GPIOB_PTOR
  1094. #define CORE_PIN50_PORTTOGGLE GPIOB_PTOR
  1095. #define CORE_PIN51_PORTTOGGLE GPIOD_PTOR
  1096. #define CORE_PIN52_PORTTOGGLE GPIOD_PTOR
  1097. #define CORE_PIN53_PORTTOGGLE GPIOD_PTOR
  1098. #define CORE_PIN54_PORTTOGGLE GPIOD_PTOR
  1099. #define CORE_PIN55_PORTTOGGLE GPIOD_PTOR
  1100. #define CORE_PIN56_PORTTOGGLE GPIOE_PTOR
  1101. #define CORE_PIN57_PORTTOGGLE GPIOE_PTOR
  1102. #define CORE_PIN58_PORTTOGGLE GPIOE_PTOR
  1103. #define CORE_PIN59_PORTTOGGLE GPIOE_PTOR
  1104. #define CORE_PIN60_PORTTOGGLE GPIOE_PTOR
  1105. #define CORE_PIN61_PORTTOGGLE GPIOE_PTOR
  1106. #define CORE_PIN62_PORTTOGGLE GPIOE_PTOR
  1107. #define CORE_PIN63_PORTTOGGLE GPIOE_PTOR
  1108. #define CORE_PIN0_PORTCLEAR GPIOB_PCOR
  1109. #define CORE_PIN1_PORTCLEAR GPIOB_PCOR
  1110. #define CORE_PIN2_PORTCLEAR GPIOD_PCOR
  1111. #define CORE_PIN3_PORTCLEAR GPIOA_PCOR
  1112. #define CORE_PIN4_PORTCLEAR GPIOA_PCOR
  1113. #define CORE_PIN5_PORTCLEAR GPIOD_PCOR
  1114. #define CORE_PIN6_PORTCLEAR GPIOD_PCOR
  1115. #define CORE_PIN7_PORTCLEAR GPIOD_PCOR
  1116. #define CORE_PIN8_PORTCLEAR GPIOD_PCOR
  1117. #define CORE_PIN9_PORTCLEAR GPIOC_PCOR
  1118. #define CORE_PIN10_PORTCLEAR GPIOC_PCOR
  1119. #define CORE_PIN11_PORTCLEAR GPIOC_PCOR
  1120. #define CORE_PIN12_PORTCLEAR GPIOC_PCOR
  1121. #define CORE_PIN13_PORTCLEAR GPIOC_PCOR
  1122. #define CORE_PIN14_PORTCLEAR GPIOD_PCOR
  1123. #define CORE_PIN15_PORTCLEAR GPIOC_PCOR
  1124. #define CORE_PIN16_PORTCLEAR GPIOB_PCOR
  1125. #define CORE_PIN17_PORTCLEAR GPIOB_PCOR
  1126. #define CORE_PIN18_PORTCLEAR GPIOB_PCOR
  1127. #define CORE_PIN19_PORTCLEAR GPIOB_PCOR
  1128. #define CORE_PIN20_PORTCLEAR GPIOD_PCOR
  1129. #define CORE_PIN21_PORTCLEAR GPIOD_PCOR
  1130. #define CORE_PIN22_PORTCLEAR GPIOC_PCOR
  1131. #define CORE_PIN23_PORTCLEAR GPIOC_PCOR
  1132. #define CORE_PIN24_PORTCLEAR GPIOE_PCOR
  1133. #define CORE_PIN25_PORTCLEAR GPIOA_PCOR
  1134. #define CORE_PIN26_PORTCLEAR GPIOA_PCOR
  1135. #define CORE_PIN27_PORTCLEAR GPIOA_PCOR
  1136. #define CORE_PIN28_PORTCLEAR GPIOA_PCOR
  1137. #define CORE_PIN29_PORTCLEAR GPIOB_PCOR
  1138. #define CORE_PIN30_PORTCLEAR GPIOB_PCOR
  1139. #define CORE_PIN31_PORTCLEAR GPIOB_PCOR
  1140. #define CORE_PIN32_PORTCLEAR GPIOB_PCOR
  1141. #define CORE_PIN33_PORTCLEAR GPIOE_PCOR
  1142. #define CORE_PIN34_PORTCLEAR GPIOE_PCOR
  1143. #define CORE_PIN35_PORTCLEAR GPIOC_PCOR
  1144. #define CORE_PIN36_PORTCLEAR GPIOC_PCOR
  1145. #define CORE_PIN37_PORTCLEAR GPIOC_PCOR
  1146. #define CORE_PIN38_PORTCLEAR GPIOC_PCOR
  1147. #define CORE_PIN39_PORTCLEAR GPIOA_PCOR
  1148. #define CORE_PIN40_PORTCLEAR GPIOA_PCOR
  1149. #define CORE_PIN41_PORTCLEAR GPIOA_PCOR
  1150. #define CORE_PIN42_PORTCLEAR GPIOA_PCOR
  1151. #define CORE_PIN43_PORTCLEAR GPIOB_PCOR
  1152. #define CORE_PIN44_PORTCLEAR GPIOB_PCOR
  1153. #define CORE_PIN45_PORTCLEAR GPIOB_PCOR
  1154. #define CORE_PIN46_PORTCLEAR GPIOB_PCOR
  1155. #define CORE_PIN47_PORTCLEAR GPIOD_PCOR
  1156. #define CORE_PIN48_PORTCLEAR GPIOD_PCOR
  1157. #define CORE_PIN49_PORTCLEAR GPIOB_PCOR
  1158. #define CORE_PIN50_PORTCLEAR GPIOB_PCOR
  1159. #define CORE_PIN51_PORTCLEAR GPIOD_PCOR
  1160. #define CORE_PIN52_PORTCLEAR GPIOD_PCOR
  1161. #define CORE_PIN53_PORTCLEAR GPIOD_PCOR
  1162. #define CORE_PIN54_PORTCLEAR GPIOD_PCOR
  1163. #define CORE_PIN55_PORTCLEAR GPIOD_PCOR
  1164. #define CORE_PIN56_PORTCLEAR GPIOE_PCOR
  1165. #define CORE_PIN57_PORTCLEAR GPIOE_PCOR
  1166. #define CORE_PIN58_PORTCLEAR GPIOE_PCOR
  1167. #define CORE_PIN59_PORTCLEAR GPIOE_PCOR
  1168. #define CORE_PIN60_PORTCLEAR GPIOE_PCOR
  1169. #define CORE_PIN61_PORTCLEAR GPIOE_PCOR
  1170. #define CORE_PIN62_PORTCLEAR GPIOE_PCOR
  1171. #define CORE_PIN63_PORTCLEAR GPIOE_PCOR
  1172. #define CORE_PIN0_DDRREG GPIOB_PDDR
  1173. #define CORE_PIN1_DDRREG GPIOB_PDDR
  1174. #define CORE_PIN2_DDRREG GPIOD_PDDR
  1175. #define CORE_PIN3_DDRREG GPIOA_PDDR
  1176. #define CORE_PIN4_DDRREG GPIOA_PDDR
  1177. #define CORE_PIN5_DDRREG GPIOD_PDDR
  1178. #define CORE_PIN6_DDRREG GPIOD_PDDR
  1179. #define CORE_PIN7_DDRREG GPIOD_PDDR
  1180. #define CORE_PIN8_DDRREG GPIOD_PDDR
  1181. #define CORE_PIN9_DDRREG GPIOC_PDDR
  1182. #define CORE_PIN10_DDRREG GPIOC_PDDR
  1183. #define CORE_PIN11_DDRREG GPIOC_PDDR
  1184. #define CORE_PIN12_DDRREG GPIOC_PDDR
  1185. #define CORE_PIN13_DDRREG GPIOC_PDDR
  1186. #define CORE_PIN14_DDRREG GPIOD_PDDR
  1187. #define CORE_PIN15_DDRREG GPIOC_PDDR
  1188. #define CORE_PIN16_DDRREG GPIOB_PDDR
  1189. #define CORE_PIN17_DDRREG GPIOB_PDDR
  1190. #define CORE_PIN18_DDRREG GPIOB_PDDR
  1191. #define CORE_PIN19_DDRREG GPIOB_PDDR
  1192. #define CORE_PIN20_DDRREG GPIOD_PDDR
  1193. #define CORE_PIN21_DDRREG GPIOD_PDDR
  1194. #define CORE_PIN22_DDRREG GPIOC_PDDR
  1195. #define CORE_PIN23_DDRREG GPIOC_PDDR
  1196. #define CORE_PIN24_DDRREG GPIOE_PDDR
  1197. #define CORE_PIN25_DDRREG GPIOA_PDDR
  1198. #define CORE_PIN26_DDRREG GPIOA_PDDR
  1199. #define CORE_PIN27_DDRREG GPIOA_PDDR
  1200. #define CORE_PIN28_DDRREG GPIOA_PDDR
  1201. #define CORE_PIN29_DDRREG GPIOB_PDDR
  1202. #define CORE_PIN30_DDRREG GPIOB_PDDR
  1203. #define CORE_PIN31_DDRREG GPIOB_PDDR
  1204. #define CORE_PIN32_DDRREG GPIOB_PDDR
  1205. #define CORE_PIN33_DDRREG GPIOE_PDDR
  1206. #define CORE_PIN34_DDRREG GPIOE_PDDR
  1207. #define CORE_PIN35_DDRREG GPIOC_PDDR
  1208. #define CORE_PIN36_DDRREG GPIOC_PDDR
  1209. #define CORE_PIN37_DDRREG GPIOC_PDDR
  1210. #define CORE_PIN38_DDRREG GPIOC_PDDR
  1211. #define CORE_PIN39_DDRREG GPIOA_PDDR
  1212. #define CORE_PIN40_DDRREG GPIOA_PDDR
  1213. #define CORE_PIN41_DDRREG GPIOA_PDDR
  1214. #define CORE_PIN42_DDRREG GPIOA_PDDR
  1215. #define CORE_PIN43_DDRREG GPIOB_PDDR
  1216. #define CORE_PIN44_DDRREG GPIOB_PDDR
  1217. #define CORE_PIN45_DDRREG GPIOB_PDDR
  1218. #define CORE_PIN46_DDRREG GPIOB_PDDR
  1219. #define CORE_PIN47_DDRREG GPIOD_PDDR
  1220. #define CORE_PIN48_DDRREG GPIOD_PDDR
  1221. #define CORE_PIN49_DDRREG GPIOB_PDDR
  1222. #define CORE_PIN50_DDRREG GPIOB_PDDR
  1223. #define CORE_PIN51_DDRREG GPIOD_PDDR
  1224. #define CORE_PIN52_DDRREG GPIOD_PDDR
  1225. #define CORE_PIN53_DDRREG GPIOD_PDDR
  1226. #define CORE_PIN54_DDRREG GPIOD_PDDR
  1227. #define CORE_PIN55_DDRREG GPIOD_PDDR
  1228. #define CORE_PIN56_DDRREG GPIOE_PDDR
  1229. #define CORE_PIN57_DDRREG GPIOE_PDDR
  1230. #define CORE_PIN58_DDRREG GPIOE_PDDR
  1231. #define CORE_PIN59_DDRREG GPIOE_PDDR
  1232. #define CORE_PIN60_DDRREG GPIOE_PDDR
  1233. #define CORE_PIN61_DDRREG GPIOE_PDDR
  1234. #define CORE_PIN62_DDRREG GPIOE_PDDR
  1235. #define CORE_PIN63_DDRREG GPIOE_PDDR
  1236. #define CORE_PIN0_PINREG GPIOB_PDIR
  1237. #define CORE_PIN1_PINREG GPIOB_PDIR
  1238. #define CORE_PIN2_PINREG GPIOD_PDIR
  1239. #define CORE_PIN3_PINREG GPIOA_PDIR
  1240. #define CORE_PIN4_PINREG GPIOA_PDIR
  1241. #define CORE_PIN5_PINREG GPIOD_PDIR
  1242. #define CORE_PIN6_PINREG GPIOD_PDIR
  1243. #define CORE_PIN7_PINREG GPIOD_PDIR
  1244. #define CORE_PIN8_PINREG GPIOD_PDIR
  1245. #define CORE_PIN9_PINREG GPIOC_PDIR
  1246. #define CORE_PIN10_PINREG GPIOC_PDIR
  1247. #define CORE_PIN11_PINREG GPIOC_PDIR
  1248. #define CORE_PIN12_PINREG GPIOC_PDIR
  1249. #define CORE_PIN13_PINREG GPIOC_PDIR
  1250. #define CORE_PIN14_PINREG GPIOD_PDIR
  1251. #define CORE_PIN15_PINREG GPIOC_PDIR
  1252. #define CORE_PIN16_PINREG GPIOB_PDIR
  1253. #define CORE_PIN17_PINREG GPIOB_PDIR
  1254. #define CORE_PIN18_PINREG GPIOB_PDIR
  1255. #define CORE_PIN19_PINREG GPIOB_PDIR
  1256. #define CORE_PIN20_PINREG GPIOD_PDIR
  1257. #define CORE_PIN21_PINREG GPIOD_PDIR
  1258. #define CORE_PIN22_PINREG GPIOC_PDIR
  1259. #define CORE_PIN23_PINREG GPIOC_PDIR
  1260. #define CORE_PIN24_PINREG GPIOE_PDIR
  1261. #define CORE_PIN25_PINREG GPIOA_PDIR
  1262. #define CORE_PIN26_PINREG GPIOA_PDIR
  1263. #define CORE_PIN27_PINREG GPIOA_PDIR
  1264. #define CORE_PIN28_PINREG GPIOA_PDIR
  1265. #define CORE_PIN29_PINREG GPIOB_PDIR
  1266. #define CORE_PIN30_PINREG GPIOB_PDIR
  1267. #define CORE_PIN31_PINREG GPIOB_PDIR
  1268. #define CORE_PIN32_PINREG GPIOB_PDIR
  1269. #define CORE_PIN33_PINREG GPIOE_PDIR
  1270. #define CORE_PIN34_PINREG GPIOE_PDIR
  1271. #define CORE_PIN35_PINREG GPIOC_PDIR
  1272. #define CORE_PIN36_PINREG GPIOC_PDIR
  1273. #define CORE_PIN37_PINREG GPIOC_PDIR
  1274. #define CORE_PIN38_PINREG GPIOC_PDIR
  1275. #define CORE_PIN39_PINREG GPIOA_PDIR
  1276. #define CORE_PIN40_PINREG GPIOA_PDIR
  1277. #define CORE_PIN41_PINREG GPIOA_PDIR
  1278. #define CORE_PIN42_PINREG GPIOA_PDIR
  1279. #define CORE_PIN43_PINREG GPIOB_PDIR
  1280. #define CORE_PIN44_PINREG GPIOB_PDIR
  1281. #define CORE_PIN45_PINREG GPIOB_PDIR
  1282. #define CORE_PIN46_PINREG GPIOB_PDIR
  1283. #define CORE_PIN47_PINREG GPIOD_PDIR
  1284. #define CORE_PIN48_PINREG GPIOD_PDIR
  1285. #define CORE_PIN49_PINREG GPIOB_PDIR
  1286. #define CORE_PIN50_PINREG GPIOB_PDIR
  1287. #define CORE_PIN51_PINREG GPIOD_PDIR
  1288. #define CORE_PIN52_PINREG GPIOD_PDIR
  1289. #define CORE_PIN53_PINREG GPIOD_PDIR
  1290. #define CORE_PIN54_PINREG GPIOD_PDIR
  1291. #define CORE_PIN55_PINREG GPIOD_PDIR
  1292. #define CORE_PIN56_PINREG GPIOE_PDIR
  1293. #define CORE_PIN57_PINREG GPIOE_PDIR
  1294. #define CORE_PIN58_PINREG GPIOE_PDIR
  1295. #define CORE_PIN59_PINREG GPIOE_PDIR
  1296. #define CORE_PIN60_PINREG GPIOE_PDIR
  1297. #define CORE_PIN61_PINREG GPIOE_PDIR
  1298. #define CORE_PIN62_PINREG GPIOE_PDIR
  1299. #define CORE_PIN63_PINREG GPIOE_PDIR
  1300. #define CORE_PIN0_CONFIG PORTB_PCR16
  1301. #define CORE_PIN1_CONFIG PORTB_PCR17
  1302. #define CORE_PIN2_CONFIG PORTD_PCR0
  1303. #define CORE_PIN3_CONFIG PORTA_PCR12
  1304. #define CORE_PIN4_CONFIG PORTA_PCR13
  1305. #define CORE_PIN5_CONFIG PORTD_PCR7
  1306. #define CORE_PIN6_CONFIG PORTD_PCR4
  1307. #define CORE_PIN7_CONFIG PORTD_PCR2
  1308. #define CORE_PIN8_CONFIG PORTD_PCR3
  1309. #define CORE_PIN9_CONFIG PORTC_PCR3
  1310. #define CORE_PIN10_CONFIG PORTC_PCR4
  1311. #define CORE_PIN11_CONFIG PORTC_PCR6
  1312. #define CORE_PIN12_CONFIG PORTC_PCR7
  1313. #define CORE_PIN13_CONFIG PORTC_PCR5
  1314. #define CORE_PIN14_CONFIG PORTD_PCR1
  1315. #define CORE_PIN15_CONFIG PORTC_PCR0
  1316. #define CORE_PIN16_CONFIG PORTB_PCR0
  1317. #define CORE_PIN17_CONFIG PORTB_PCR1
  1318. #define CORE_PIN18_CONFIG PORTB_PCR3
  1319. #define CORE_PIN19_CONFIG PORTB_PCR2
  1320. #define CORE_PIN20_CONFIG PORTD_PCR5
  1321. #define CORE_PIN21_CONFIG PORTD_PCR6
  1322. #define CORE_PIN22_CONFIG PORTC_PCR1
  1323. #define CORE_PIN23_CONFIG PORTC_PCR2
  1324. #define CORE_PIN24_CONFIG PORTE_PCR26
  1325. #define CORE_PIN25_CONFIG PORTA_PCR5
  1326. #define CORE_PIN26_CONFIG PORTA_PCR14
  1327. #define CORE_PIN27_CONFIG PORTA_PCR15
  1328. #define CORE_PIN28_CONFIG PORTA_PCR16
  1329. #define CORE_PIN29_CONFIG PORTB_PCR18
  1330. #define CORE_PIN30_CONFIG PORTB_PCR19
  1331. #define CORE_PIN31_CONFIG PORTB_PCR10
  1332. #define CORE_PIN32_CONFIG PORTB_PCR11
  1333. #define CORE_PIN33_CONFIG PORTE_PCR24
  1334. #define CORE_PIN34_CONFIG PORTE_PCR25
  1335. #define CORE_PIN35_CONFIG PORTC_PCR8
  1336. #define CORE_PIN36_CONFIG PORTC_PCR9
  1337. #define CORE_PIN37_CONFIG PORTC_PCR10
  1338. #define CORE_PIN38_CONFIG PORTC_PCR11
  1339. #define CORE_PIN39_CONFIG PORTA_PCR17
  1340. #define CORE_PIN40_CONFIG PORTA_PCR28
  1341. #define CORE_PIN41_CONFIG PORTA_PCR29
  1342. #define CORE_PIN42_CONFIG PORTA_PCR26
  1343. #define CORE_PIN43_CONFIG PORTB_PCR20
  1344. #define CORE_PIN44_CONFIG PORTB_PCR22
  1345. #define CORE_PIN45_CONFIG PORTB_PCR23
  1346. #define CORE_PIN46_CONFIG PORTB_PCR21
  1347. #define CORE_PIN47_CONFIG PORTD_PCR8
  1348. #define CORE_PIN48_CONFIG PORTD_PCR9
  1349. #define CORE_PIN49_CONFIG PORTB_PCR4
  1350. #define CORE_PIN50_CONFIG PORTB_PCR5
  1351. #define CORE_PIN51_CONFIG PORTD_PCR14
  1352. #define CORE_PIN52_CONFIG PORTD_PCR13
  1353. #define CORE_PIN53_CONFIG PORTD_PCR12
  1354. #define CORE_PIN54_CONFIG PORTD_PCR15
  1355. #define CORE_PIN55_CONFIG PORTD_PCR11
  1356. #define CORE_PIN56_CONFIG PORTE_PCR10
  1357. #define CORE_PIN57_CONFIG PORTE_PCR11
  1358. #define CORE_PIN58_CONFIG PORTE_PCR0
  1359. #define CORE_PIN59_CONFIG PORTE_PCR1
  1360. #define CORE_PIN60_CONFIG PORTE_PCR2
  1361. #define CORE_PIN61_CONFIG PORTE_PCR3
  1362. #define CORE_PIN62_CONFIG PORTE_PCR4
  1363. #define CORE_PIN63_CONFIG PORTE_PCR5
  1364. #define CORE_ADC0_PIN 14
  1365. #define CORE_ADC1_PIN 15
  1366. #define CORE_ADC2_PIN 16
  1367. #define CORE_ADC3_PIN 17
  1368. #define CORE_ADC4_PIN 18
  1369. #define CORE_ADC5_PIN 19
  1370. #define CORE_ADC6_PIN 20
  1371. #define CORE_ADC7_PIN 21
  1372. #define CORE_ADC8_PIN 22
  1373. #define CORE_ADC9_PIN 23
  1374. #define CORE_ADC10_PIN 64
  1375. #define CORE_ADC11_PIN 65
  1376. #define CORE_ADC12_PIN 31
  1377. #define CORE_ADC13_PIN 32
  1378. #define CORE_ADC14_PIN 33
  1379. #define CORE_ADC15_PIN 34
  1380. #define CORE_ADC16_PIN 35
  1381. #define CORE_ADC17_PIN 36
  1382. #define CORE_ADC18_PIN 37
  1383. #define CORE_ADC19_PIN 38
  1384. #define CORE_ADC20_PIN 39
  1385. #define CORE_ADC21_PIN 66
  1386. #define CORE_ADC22_PIN 67
  1387. #define CORE_ADC23_PIN 49
  1388. #define CORE_ADC24_PIN 50
  1389. #define CORE_ADC25_PIN 68
  1390. #define CORE_ADC26_PIN 69
  1391. #define CORE_RXD0_PIN 0
  1392. #define CORE_TXD0_PIN 1
  1393. #define CORE_RXD1_PIN 9
  1394. #define CORE_TXD1_PIN 10
  1395. #define CORE_RXD2_PIN 7
  1396. #define CORE_TXD2_PIN 8
  1397. #define CORE_RXD3_PIN 31
  1398. #define CORE_TXD3_PIN 32
  1399. #define CORE_RXD4_PIN 34
  1400. #define CORE_TXD4_PIN 33
  1401. #define CORE_INT0_PIN 0
  1402. #define CORE_INT1_PIN 1
  1403. #define CORE_INT2_PIN 2
  1404. #define CORE_INT3_PIN 3
  1405. #define CORE_INT4_PIN 4
  1406. #define CORE_INT5_PIN 5
  1407. #define CORE_INT6_PIN 6
  1408. #define CORE_INT7_PIN 7
  1409. #define CORE_INT8_PIN 8
  1410. #define CORE_INT9_PIN 9
  1411. #define CORE_INT10_PIN 10
  1412. #define CORE_INT11_PIN 11
  1413. #define CORE_INT12_PIN 12
  1414. #define CORE_INT13_PIN 13
  1415. #define CORE_INT14_PIN 14
  1416. #define CORE_INT15_PIN 15
  1417. #define CORE_INT16_PIN 16
  1418. #define CORE_INT17_PIN 17
  1419. #define CORE_INT18_PIN 18
  1420. #define CORE_INT19_PIN 19
  1421. #define CORE_INT20_PIN 20
  1422. #define CORE_INT21_PIN 21
  1423. #define CORE_INT22_PIN 22
  1424. #define CORE_INT23_PIN 23
  1425. #define CORE_INT24_PIN 24
  1426. #define CORE_INT25_PIN 25
  1427. #define CORE_INT26_PIN 26
  1428. #define CORE_INT27_PIN 27
  1429. #define CORE_INT28_PIN 28
  1430. #define CORE_INT29_PIN 29
  1431. #define CORE_INT30_PIN 30
  1432. #define CORE_INT31_PIN 31
  1433. #define CORE_INT32_PIN 32
  1434. #define CORE_INT33_PIN 33
  1435. #define CORE_INT34_PIN 34
  1436. #define CORE_INT35_PIN 35
  1437. #define CORE_INT36_PIN 36
  1438. #define CORE_INT37_PIN 37
  1439. #define CORE_INT38_PIN 38
  1440. #define CORE_INT39_PIN 39
  1441. #define CORE_INT40_PIN 40
  1442. #define CORE_INT41_PIN 41
  1443. #define CORE_INT42_PIN 42
  1444. #define CORE_INT43_PIN 43
  1445. #define CORE_INT44_PIN 44
  1446. #define CORE_INT45_PIN 45
  1447. #define CORE_INT46_PIN 46
  1448. #define CORE_INT47_PIN 47
  1449. #define CORE_INT48_PIN 48
  1450. #define CORE_INT49_PIN 49
  1451. #define CORE_INT50_PIN 50
  1452. #define CORE_INT51_PIN 51
  1453. #define CORE_INT52_PIN 52
  1454. #define CORE_INT53_PIN 53
  1455. #define CORE_INT54_PIN 54
  1456. #define CORE_INT55_PIN 55
  1457. #define CORE_INT56_PIN 56
  1458. #define CORE_INT57_PIN 57
  1459. #define CORE_INT58_PIN 58
  1460. #define CORE_INT59_PIN 59
  1461. #define CORE_INT60_PIN 60
  1462. #define CORE_INT61_PIN 61
  1463. #define CORE_INT62_PIN 62
  1464. #define CORE_INT63_PIN 63
  1465. #define CORE_INT_EVERY_PIN 1
  1466. #endif
  1467. #if defined(__MK20DX128__)
  1468. #define CORE_FTM0_CH0_PIN 22
  1469. #define CORE_FTM0_CH1_PIN 23
  1470. #define CORE_FTM0_CH2_PIN 9
  1471. #define CORE_FTM0_CH3_PIN 10
  1472. #define CORE_FTM0_CH4_PIN 6
  1473. #define CORE_FTM0_CH5_PIN 20
  1474. #define CORE_FTM0_CH6_PIN 21
  1475. #define CORE_FTM0_CH7_PIN 5
  1476. #define CORE_FTM1_CH0_PIN 3
  1477. #define CORE_FTM1_CH1_PIN 4
  1478. #elif defined(__MK20DX256__)
  1479. #define CORE_FTM0_CH0_PIN 22
  1480. #define CORE_FTM0_CH1_PIN 23
  1481. #define CORE_FTM0_CH2_PIN 9
  1482. #define CORE_FTM0_CH3_PIN 10
  1483. #define CORE_FTM0_CH4_PIN 6
  1484. #define CORE_FTM0_CH5_PIN 20
  1485. #define CORE_FTM0_CH6_PIN 21
  1486. #define CORE_FTM0_CH7_PIN 5
  1487. #define CORE_FTM1_CH0_PIN 3
  1488. #define CORE_FTM1_CH1_PIN 4
  1489. #define CORE_FTM2_CH0_PIN 32
  1490. #define CORE_FTM2_CH1_PIN 25
  1491. #elif defined(__MKL26Z64__)
  1492. #define CORE_TPM0_CH0_PIN 22
  1493. #define CORE_TPM0_CH1_PIN 23
  1494. #define CORE_TPM0_CH2_PIN 9
  1495. #define CORE_TPM0_CH3_PIN 10
  1496. #define CORE_TPM0_CH4_PIN 6
  1497. #define CORE_TPM0_CH5_PIN 20
  1498. #define CORE_TPM1_CH0_PIN 16
  1499. #define CORE_TPM1_CH1_PIN 17
  1500. #define CORE_TPM2_CH0_PIN 3
  1501. #define CORE_TPM2_CH1_PIN 4
  1502. #elif defined(__MK64FX512__)
  1503. #define CORE_FTM0_CH0_PIN 22
  1504. #define CORE_FTM0_CH1_PIN 23
  1505. #define CORE_FTM0_CH2_PIN 9
  1506. #define CORE_FTM0_CH3_PIN 10
  1507. #define CORE_FTM0_CH4_PIN 6
  1508. #define CORE_FTM0_CH5_PIN 20
  1509. #define CORE_FTM0_CH6_PIN 21
  1510. #define CORE_FTM0_CH7_PIN 5
  1511. #define CORE_FTM1_CH0_PIN 3
  1512. #define CORE_FTM1_CH1_PIN 4
  1513. #define CORE_FTM2_CH0_PIN 29
  1514. #define CORE_FTM2_CH1_PIN 30
  1515. #define CORE_FTM3_CH0_PIN 2
  1516. #define CORE_FTM3_CH1_PIN 14
  1517. #define CORE_FTM3_CH2_PIN 7
  1518. #define CORE_FTM3_CH3_PIN 8
  1519. #define CORE_FTM3_CH4_PIN 35
  1520. #define CORE_FTM3_CH5_PIN 36
  1521. #define CORE_FTM3_CH6_PIN 37
  1522. #define CORE_FTM3_CH7_PIN 38
  1523. #elif defined(__MK66FX1M0__)
  1524. #define CORE_FTM0_CH0_PIN 22
  1525. #define CORE_FTM0_CH1_PIN 23
  1526. #define CORE_FTM0_CH2_PIN 9
  1527. #define CORE_FTM0_CH3_PIN 10
  1528. #define CORE_FTM0_CH4_PIN 6
  1529. #define CORE_FTM0_CH5_PIN 20
  1530. #define CORE_FTM0_CH6_PIN 21
  1531. #define CORE_FTM0_CH7_PIN 5
  1532. #define CORE_FTM1_CH0_PIN 3
  1533. #define CORE_FTM1_CH1_PIN 4
  1534. #define CORE_FTM2_CH0_PIN 29
  1535. #define CORE_FTM2_CH1_PIN 30
  1536. #define CORE_FTM3_CH0_PIN 2
  1537. #define CORE_FTM3_CH1_PIN 14
  1538. #define CORE_FTM3_CH2_PIN 7
  1539. #define CORE_FTM3_CH3_PIN 8
  1540. #define CORE_FTM3_CH4_PIN 35
  1541. #define CORE_FTM3_CH5_PIN 36
  1542. #define CORE_FTM3_CH6_PIN 37
  1543. #define CORE_FTM3_CH7_PIN 38
  1544. #define CORE_TPM1_CH0_PIN 16
  1545. #define CORE_TPM1_CH1_PIN 17
  1546. #endif
  1547. #ifdef __cplusplus
  1548. extern "C" {
  1549. #endif
  1550. void digitalWrite(uint8_t pin, uint8_t val);
  1551. static inline void digitalWriteFast(uint8_t pin, uint8_t val) __attribute__((always_inline, unused));
  1552. static inline void digitalWriteFast(uint8_t pin, uint8_t val)
  1553. {
  1554. if (__builtin_constant_p(pin)) {
  1555. if (val) {
  1556. if (pin == 0) {
  1557. CORE_PIN0_PORTSET = CORE_PIN0_BITMASK;
  1558. } else if (pin == 1) {
  1559. CORE_PIN1_PORTSET = CORE_PIN1_BITMASK;
  1560. } else if (pin == 2) {
  1561. CORE_PIN2_PORTSET = CORE_PIN2_BITMASK;
  1562. } else if (pin == 3) {
  1563. CORE_PIN3_PORTSET = CORE_PIN3_BITMASK;
  1564. } else if (pin == 4) {
  1565. CORE_PIN4_PORTSET = CORE_PIN4_BITMASK;
  1566. } else if (pin == 5) {
  1567. CORE_PIN5_PORTSET = CORE_PIN5_BITMASK;
  1568. } else if (pin == 6) {
  1569. CORE_PIN6_PORTSET = CORE_PIN6_BITMASK;
  1570. } else if (pin == 7) {
  1571. CORE_PIN7_PORTSET = CORE_PIN7_BITMASK;
  1572. } else if (pin == 8) {
  1573. CORE_PIN8_PORTSET = CORE_PIN8_BITMASK;
  1574. } else if (pin == 9) {
  1575. CORE_PIN9_PORTSET = CORE_PIN9_BITMASK;
  1576. } else if (pin == 10) {
  1577. CORE_PIN10_PORTSET = CORE_PIN10_BITMASK;
  1578. } else if (pin == 11) {
  1579. CORE_PIN11_PORTSET = CORE_PIN11_BITMASK;
  1580. } else if (pin == 12) {
  1581. CORE_PIN12_PORTSET = CORE_PIN12_BITMASK;
  1582. } else if (pin == 13) {
  1583. CORE_PIN13_PORTSET = CORE_PIN13_BITMASK;
  1584. } else if (pin == 14) {
  1585. CORE_PIN14_PORTSET = CORE_PIN14_BITMASK;
  1586. } else if (pin == 15) {
  1587. CORE_PIN15_PORTSET = CORE_PIN15_BITMASK;
  1588. } else if (pin == 16) {
  1589. CORE_PIN16_PORTSET = CORE_PIN16_BITMASK;
  1590. } else if (pin == 17) {
  1591. CORE_PIN17_PORTSET = CORE_PIN17_BITMASK;
  1592. } else if (pin == 18) {
  1593. CORE_PIN18_PORTSET = CORE_PIN18_BITMASK;
  1594. } else if (pin == 19) {
  1595. CORE_PIN19_PORTSET = CORE_PIN19_BITMASK;
  1596. } else if (pin == 20) {
  1597. CORE_PIN20_PORTSET = CORE_PIN20_BITMASK;
  1598. } else if (pin == 21) {
  1599. CORE_PIN21_PORTSET = CORE_PIN21_BITMASK;
  1600. } else if (pin == 22) {
  1601. CORE_PIN22_PORTSET = CORE_PIN22_BITMASK;
  1602. } else if (pin == 23) {
  1603. CORE_PIN23_PORTSET = CORE_PIN23_BITMASK;
  1604. } else if (pin == 24) {
  1605. CORE_PIN24_PORTSET = CORE_PIN24_BITMASK;
  1606. } else if (pin == 25) {
  1607. CORE_PIN25_PORTSET = CORE_PIN25_BITMASK;
  1608. } else if (pin == 26) {
  1609. CORE_PIN26_PORTSET = CORE_PIN26_BITMASK;
  1610. }
  1611. #if defined(CORE_PIN27_PORTSET)
  1612. else if (pin == 27) {
  1613. CORE_PIN27_PORTSET = CORE_PIN27_BITMASK;
  1614. } else if (pin == 28) {
  1615. CORE_PIN28_PORTSET = CORE_PIN28_BITMASK;
  1616. } else if (pin == 29) {
  1617. CORE_PIN29_PORTSET = CORE_PIN29_BITMASK;
  1618. } else if (pin == 30) {
  1619. CORE_PIN30_PORTSET = CORE_PIN30_BITMASK;
  1620. } else if (pin == 31) {
  1621. CORE_PIN31_PORTSET = CORE_PIN31_BITMASK;
  1622. } else if (pin == 32) {
  1623. CORE_PIN32_PORTSET = CORE_PIN32_BITMASK;
  1624. } else if (pin == 33) {
  1625. CORE_PIN33_PORTSET = CORE_PIN33_BITMASK;
  1626. }
  1627. #endif
  1628. #if defined(CORE_PIN34_PORTSET)
  1629. else if (pin == 34) {
  1630. CORE_PIN34_PORTSET = CORE_PIN34_BITMASK;
  1631. } else if (pin == 35) {
  1632. CORE_PIN35_PORTSET = CORE_PIN35_BITMASK;
  1633. } else if (pin == 36) {
  1634. CORE_PIN36_PORTSET = CORE_PIN36_BITMASK;
  1635. } else if (pin == 37) {
  1636. CORE_PIN37_PORTSET = CORE_PIN37_BITMASK;
  1637. } else if (pin == 38) {
  1638. CORE_PIN38_PORTSET = CORE_PIN38_BITMASK;
  1639. } else if (pin == 39) {
  1640. CORE_PIN39_PORTSET = CORE_PIN39_BITMASK;
  1641. } else if (pin == 40) {
  1642. CORE_PIN40_PORTSET = CORE_PIN40_BITMASK;
  1643. } else if (pin == 41) {
  1644. CORE_PIN41_PORTSET = CORE_PIN41_BITMASK;
  1645. } else if (pin == 42) {
  1646. CORE_PIN42_PORTSET = CORE_PIN42_BITMASK;
  1647. } else if (pin == 43) {
  1648. CORE_PIN43_PORTSET = CORE_PIN43_BITMASK;
  1649. } else if (pin == 44) {
  1650. CORE_PIN44_PORTSET = CORE_PIN44_BITMASK;
  1651. } else if (pin == 45) {
  1652. CORE_PIN45_PORTSET = CORE_PIN45_BITMASK;
  1653. } else if (pin == 46) {
  1654. CORE_PIN46_PORTSET = CORE_PIN46_BITMASK;
  1655. } else if (pin == 47) {
  1656. CORE_PIN47_PORTSET = CORE_PIN47_BITMASK;
  1657. } else if (pin == 48) {
  1658. CORE_PIN48_PORTSET = CORE_PIN48_BITMASK;
  1659. } else if (pin == 49) {
  1660. CORE_PIN49_PORTSET = CORE_PIN49_BITMASK;
  1661. } else if (pin == 50) {
  1662. CORE_PIN50_PORTSET = CORE_PIN50_BITMASK;
  1663. } else if (pin == 51) {
  1664. CORE_PIN51_PORTSET = CORE_PIN51_BITMASK;
  1665. } else if (pin == 52) {
  1666. CORE_PIN52_PORTSET = CORE_PIN52_BITMASK;
  1667. } else if (pin == 53) {
  1668. CORE_PIN53_PORTSET = CORE_PIN53_BITMASK;
  1669. } else if (pin == 54) {
  1670. CORE_PIN54_PORTSET = CORE_PIN54_BITMASK;
  1671. } else if (pin == 55) {
  1672. CORE_PIN55_PORTSET = CORE_PIN55_BITMASK;
  1673. } else if (pin == 56) {
  1674. CORE_PIN56_PORTSET = CORE_PIN56_BITMASK;
  1675. } else if (pin == 57) {
  1676. CORE_PIN57_PORTSET = CORE_PIN57_BITMASK;
  1677. } else if (pin == 58) {
  1678. CORE_PIN58_PORTSET = CORE_PIN58_BITMASK;
  1679. } else if (pin == 59) {
  1680. CORE_PIN59_PORTSET = CORE_PIN59_BITMASK;
  1681. } else if (pin == 60) {
  1682. CORE_PIN60_PORTSET = CORE_PIN60_BITMASK;
  1683. } else if (pin == 61) {
  1684. CORE_PIN61_PORTSET = CORE_PIN61_BITMASK;
  1685. } else if (pin == 62) {
  1686. CORE_PIN62_PORTSET = CORE_PIN62_BITMASK;
  1687. } else if (pin == 63) {
  1688. CORE_PIN63_PORTSET = CORE_PIN63_BITMASK;
  1689. }
  1690. #endif
  1691. } else {
  1692. if (pin == 0) {
  1693. CORE_PIN0_PORTCLEAR = CORE_PIN0_BITMASK;
  1694. } else if (pin == 1) {
  1695. CORE_PIN1_PORTCLEAR = CORE_PIN1_BITMASK;
  1696. } else if (pin == 2) {
  1697. CORE_PIN2_PORTCLEAR = CORE_PIN2_BITMASK;
  1698. } else if (pin == 3) {
  1699. CORE_PIN3_PORTCLEAR = CORE_PIN3_BITMASK;
  1700. } else if (pin == 4) {
  1701. CORE_PIN4_PORTCLEAR = CORE_PIN4_BITMASK;
  1702. } else if (pin == 5) {
  1703. CORE_PIN5_PORTCLEAR = CORE_PIN5_BITMASK;
  1704. } else if (pin == 6) {
  1705. CORE_PIN6_PORTCLEAR = CORE_PIN6_BITMASK;
  1706. } else if (pin == 7) {
  1707. CORE_PIN7_PORTCLEAR = CORE_PIN7_BITMASK;
  1708. } else if (pin == 8) {
  1709. CORE_PIN8_PORTCLEAR = CORE_PIN8_BITMASK;
  1710. } else if (pin == 9) {
  1711. CORE_PIN9_PORTCLEAR = CORE_PIN9_BITMASK;
  1712. } else if (pin == 10) {
  1713. CORE_PIN10_PORTCLEAR = CORE_PIN10_BITMASK;
  1714. } else if (pin == 11) {
  1715. CORE_PIN11_PORTCLEAR = CORE_PIN11_BITMASK;
  1716. } else if (pin == 12) {
  1717. CORE_PIN12_PORTCLEAR = CORE_PIN12_BITMASK;
  1718. } else if (pin == 13) {
  1719. CORE_PIN13_PORTCLEAR = CORE_PIN13_BITMASK;
  1720. } else if (pin == 14) {
  1721. CORE_PIN14_PORTCLEAR = CORE_PIN14_BITMASK;
  1722. } else if (pin == 15) {
  1723. CORE_PIN15_PORTCLEAR = CORE_PIN15_BITMASK;
  1724. } else if (pin == 16) {
  1725. CORE_PIN16_PORTCLEAR = CORE_PIN16_BITMASK;
  1726. } else if (pin == 17) {
  1727. CORE_PIN17_PORTCLEAR = CORE_PIN17_BITMASK;
  1728. } else if (pin == 18) {
  1729. CORE_PIN18_PORTCLEAR = CORE_PIN18_BITMASK;
  1730. } else if (pin == 19) {
  1731. CORE_PIN19_PORTCLEAR = CORE_PIN19_BITMASK;
  1732. } else if (pin == 20) {
  1733. CORE_PIN20_PORTCLEAR = CORE_PIN20_BITMASK;
  1734. } else if (pin == 21) {
  1735. CORE_PIN21_PORTCLEAR = CORE_PIN21_BITMASK;
  1736. } else if (pin == 22) {
  1737. CORE_PIN22_PORTCLEAR = CORE_PIN22_BITMASK;
  1738. } else if (pin == 23) {
  1739. CORE_PIN23_PORTCLEAR = CORE_PIN23_BITMASK;
  1740. } else if (pin == 24) {
  1741. CORE_PIN24_PORTCLEAR = CORE_PIN24_BITMASK;
  1742. } else if (pin == 25) {
  1743. CORE_PIN25_PORTCLEAR = CORE_PIN25_BITMASK;
  1744. } else if (pin == 26) {
  1745. CORE_PIN26_PORTCLEAR = CORE_PIN26_BITMASK;
  1746. }
  1747. #if defined(CORE_PIN27_PORTCLEAR)
  1748. else if (pin == 27) {
  1749. CORE_PIN27_PORTCLEAR = CORE_PIN27_BITMASK;
  1750. } else if (pin == 28) {
  1751. CORE_PIN28_PORTCLEAR = CORE_PIN28_BITMASK;
  1752. } else if (pin == 29) {
  1753. CORE_PIN29_PORTCLEAR = CORE_PIN29_BITMASK;
  1754. } else if (pin == 30) {
  1755. CORE_PIN30_PORTCLEAR = CORE_PIN30_BITMASK;
  1756. } else if (pin == 31) {
  1757. CORE_PIN31_PORTCLEAR = CORE_PIN31_BITMASK;
  1758. } else if (pin == 32) {
  1759. CORE_PIN32_PORTCLEAR = CORE_PIN32_BITMASK;
  1760. } else if (pin == 33) {
  1761. CORE_PIN33_PORTCLEAR = CORE_PIN33_BITMASK;
  1762. }
  1763. #endif
  1764. #if defined(CORE_PIN34_PORTCLEAR)
  1765. else if (pin == 34) {
  1766. CORE_PIN34_PORTCLEAR = CORE_PIN34_BITMASK;
  1767. } else if (pin == 35) {
  1768. CORE_PIN35_PORTCLEAR = CORE_PIN35_BITMASK;
  1769. } else if (pin == 36) {
  1770. CORE_PIN36_PORTCLEAR = CORE_PIN36_BITMASK;
  1771. } else if (pin == 37) {
  1772. CORE_PIN37_PORTCLEAR = CORE_PIN37_BITMASK;
  1773. } else if (pin == 38) {
  1774. CORE_PIN38_PORTCLEAR = CORE_PIN38_BITMASK;
  1775. } else if (pin == 39) {
  1776. CORE_PIN39_PORTCLEAR = CORE_PIN39_BITMASK;
  1777. } else if (pin == 40) {
  1778. CORE_PIN40_PORTCLEAR = CORE_PIN40_BITMASK;
  1779. } else if (pin == 41) {
  1780. CORE_PIN41_PORTCLEAR = CORE_PIN41_BITMASK;
  1781. } else if (pin == 42) {
  1782. CORE_PIN42_PORTCLEAR = CORE_PIN42_BITMASK;
  1783. } else if (pin == 43) {
  1784. CORE_PIN43_PORTCLEAR = CORE_PIN43_BITMASK;
  1785. } else if (pin == 44) {
  1786. CORE_PIN44_PORTCLEAR = CORE_PIN44_BITMASK;
  1787. } else if (pin == 45) {
  1788. CORE_PIN45_PORTCLEAR = CORE_PIN45_BITMASK;
  1789. } else if (pin == 46) {
  1790. CORE_PIN46_PORTCLEAR = CORE_PIN46_BITMASK;
  1791. } else if (pin == 47) {
  1792. CORE_PIN47_PORTCLEAR = CORE_PIN47_BITMASK;
  1793. } else if (pin == 48) {
  1794. CORE_PIN48_PORTCLEAR = CORE_PIN48_BITMASK;
  1795. } else if (pin == 49) {
  1796. CORE_PIN49_PORTCLEAR = CORE_PIN49_BITMASK;
  1797. } else if (pin == 50) {
  1798. CORE_PIN50_PORTCLEAR = CORE_PIN50_BITMASK;
  1799. } else if (pin == 51) {
  1800. CORE_PIN51_PORTCLEAR = CORE_PIN51_BITMASK;
  1801. } else if (pin == 52) {
  1802. CORE_PIN52_PORTCLEAR = CORE_PIN52_BITMASK;
  1803. } else if (pin == 53) {
  1804. CORE_PIN53_PORTCLEAR = CORE_PIN53_BITMASK;
  1805. } else if (pin == 54) {
  1806. CORE_PIN54_PORTCLEAR = CORE_PIN54_BITMASK;
  1807. } else if (pin == 55) {
  1808. CORE_PIN55_PORTCLEAR = CORE_PIN55_BITMASK;
  1809. } else if (pin == 56) {
  1810. CORE_PIN56_PORTCLEAR = CORE_PIN56_BITMASK;
  1811. } else if (pin == 57) {
  1812. CORE_PIN57_PORTCLEAR = CORE_PIN57_BITMASK;
  1813. } else if (pin == 58) {
  1814. CORE_PIN58_PORTCLEAR = CORE_PIN58_BITMASK;
  1815. } else if (pin == 59) {
  1816. CORE_PIN59_PORTCLEAR = CORE_PIN59_BITMASK;
  1817. } else if (pin == 60) {
  1818. CORE_PIN60_PORTCLEAR = CORE_PIN60_BITMASK;
  1819. } else if (pin == 61) {
  1820. CORE_PIN61_PORTCLEAR = CORE_PIN61_BITMASK;
  1821. } else if (pin == 62) {
  1822. CORE_PIN62_PORTCLEAR = CORE_PIN62_BITMASK;
  1823. } else if (pin == 63) {
  1824. CORE_PIN63_PORTCLEAR = CORE_PIN63_BITMASK;
  1825. }
  1826. #endif
  1827. }
  1828. } else {
  1829. if (val) {
  1830. *portSetRegister(pin) = digitalPinToBitMask(pin);
  1831. } else {
  1832. *portClearRegister(pin) = digitalPinToBitMask(pin);
  1833. }
  1834. }
  1835. }
  1836. void digitalToggle(uint8_t pin);
  1837. static inline void digitalToggleFast(uint8_t pin) __attribute__((always_inline, unused));
  1838. static inline void digitalToggleFast(uint8_t pin)
  1839. {
  1840. if (__builtin_constant_p(pin)) {
  1841. if (pin == 0) {
  1842. CORE_PIN0_PORTTOGGLE = CORE_PIN0_BITMASK;
  1843. }
  1844. else if (pin == 1) {
  1845. CORE_PIN1_PORTTOGGLE = CORE_PIN1_BITMASK;
  1846. }
  1847. else if (pin == 2) {
  1848. CORE_PIN2_PORTTOGGLE = CORE_PIN2_BITMASK;
  1849. }
  1850. else if (pin == 3) {
  1851. CORE_PIN3_PORTTOGGLE = CORE_PIN3_BITMASK;
  1852. }
  1853. else if (pin == 4) {
  1854. CORE_PIN4_PORTTOGGLE = CORE_PIN4_BITMASK;
  1855. }
  1856. else if (pin == 5) {
  1857. CORE_PIN5_PORTTOGGLE = CORE_PIN5_BITMASK;
  1858. }
  1859. else if (pin == 6) {
  1860. CORE_PIN6_PORTTOGGLE = CORE_PIN6_BITMASK;
  1861. }
  1862. else if (pin == 7) {
  1863. CORE_PIN7_PORTTOGGLE = CORE_PIN7_BITMASK;
  1864. }
  1865. else if (pin == 8) {
  1866. CORE_PIN8_PORTTOGGLE = CORE_PIN8_BITMASK;
  1867. }
  1868. else if (pin == 9) {
  1869. CORE_PIN9_PORTTOGGLE = CORE_PIN9_BITMASK;
  1870. }
  1871. else if (pin == 10) {
  1872. CORE_PIN10_PORTTOGGLE = CORE_PIN10_BITMASK;
  1873. }
  1874. else if (pin == 11) {
  1875. CORE_PIN11_PORTTOGGLE = CORE_PIN11_BITMASK;
  1876. }
  1877. else if (pin == 12) {
  1878. CORE_PIN12_PORTTOGGLE = CORE_PIN12_BITMASK;
  1879. }
  1880. else if (pin == 13) {
  1881. CORE_PIN13_PORTTOGGLE = CORE_PIN13_BITMASK;
  1882. }
  1883. else if (pin == 14) {
  1884. CORE_PIN14_PORTTOGGLE = CORE_PIN14_BITMASK;
  1885. }
  1886. else if (pin == 15) {
  1887. CORE_PIN15_PORTTOGGLE = CORE_PIN15_BITMASK;
  1888. }
  1889. else if (pin == 16) {
  1890. CORE_PIN16_PORTTOGGLE = CORE_PIN16_BITMASK;
  1891. }
  1892. else if (pin == 17) {
  1893. CORE_PIN17_PORTTOGGLE = CORE_PIN17_BITMASK;
  1894. }
  1895. else if (pin == 18) {
  1896. CORE_PIN18_PORTTOGGLE = CORE_PIN18_BITMASK;
  1897. }
  1898. else if (pin == 19) {
  1899. CORE_PIN19_PORTTOGGLE = CORE_PIN19_BITMASK;
  1900. }
  1901. else if (pin == 20) {
  1902. CORE_PIN20_PORTTOGGLE = CORE_PIN20_BITMASK;
  1903. }
  1904. else if (pin == 21) {
  1905. CORE_PIN21_PORTTOGGLE = CORE_PIN21_BITMASK;
  1906. }
  1907. else if (pin == 22) {
  1908. CORE_PIN22_PORTTOGGLE = CORE_PIN22_BITMASK;
  1909. }
  1910. else if (pin == 23) {
  1911. CORE_PIN23_PORTTOGGLE = CORE_PIN23_BITMASK;
  1912. }
  1913. else if (pin == 24) {
  1914. CORE_PIN24_PORTTOGGLE = CORE_PIN24_BITMASK;
  1915. }
  1916. else if (pin == 25) {
  1917. CORE_PIN25_PORTTOGGLE = CORE_PIN25_BITMASK;
  1918. }
  1919. else if (pin == 26) {
  1920. CORE_PIN26_PORTTOGGLE = CORE_PIN26_BITMASK;
  1921. }
  1922. #if defined(CORE_PIN27_PORTTOGGLE)
  1923. else if (pin == 27) {
  1924. CORE_PIN27_PORTTOGGLE = CORE_PIN27_BITMASK;
  1925. }
  1926. else if (pin == 28) {
  1927. CORE_PIN28_PORTTOGGLE = CORE_PIN28_BITMASK;
  1928. }
  1929. else if (pin == 29) {
  1930. CORE_PIN29_PORTTOGGLE = CORE_PIN29_BITMASK;
  1931. }
  1932. else if (pin == 30) {
  1933. CORE_PIN30_PORTTOGGLE = CORE_PIN30_BITMASK;
  1934. }
  1935. else if (pin == 31) {
  1936. CORE_PIN31_PORTTOGGLE = CORE_PIN31_BITMASK;
  1937. }
  1938. else if (pin == 32) {
  1939. CORE_PIN32_PORTTOGGLE = CORE_PIN32_BITMASK;
  1940. }
  1941. else if (pin == 33) {
  1942. CORE_PIN33_PORTTOGGLE = CORE_PIN33_BITMASK;
  1943. }
  1944. #endif
  1945. #if defined(CORE_PIN34_PORTSET)
  1946. else if (pin == 34) {
  1947. CORE_PIN34_PORTTOGGLE = CORE_PIN34_BITMASK;
  1948. }
  1949. else if (pin == 35) {
  1950. CORE_PIN35_PORTTOGGLE = CORE_PIN35_BITMASK;
  1951. }
  1952. else if (pin == 36) {
  1953. CORE_PIN36_PORTTOGGLE = CORE_PIN36_BITMASK;
  1954. }
  1955. else if (pin == 37) {
  1956. CORE_PIN37_PORTTOGGLE = CORE_PIN37_BITMASK;
  1957. }
  1958. else if (pin == 38) {
  1959. CORE_PIN38_PORTTOGGLE = CORE_PIN38_BITMASK;
  1960. }
  1961. else if (pin == 39) {
  1962. CORE_PIN39_PORTTOGGLE = CORE_PIN39_BITMASK;
  1963. }
  1964. else if (pin == 40) {
  1965. CORE_PIN40_PORTTOGGLE = CORE_PIN40_BITMASK;
  1966. }
  1967. else if (pin == 41) {
  1968. CORE_PIN41_PORTTOGGLE = CORE_PIN41_BITMASK;
  1969. }
  1970. else if (pin == 42) {
  1971. CORE_PIN42_PORTTOGGLE = CORE_PIN42_BITMASK;
  1972. }
  1973. else if (pin == 43) {
  1974. CORE_PIN43_PORTTOGGLE = CORE_PIN43_BITMASK;
  1975. }
  1976. else if (pin == 44) {
  1977. CORE_PIN44_PORTTOGGLE = CORE_PIN44_BITMASK;
  1978. }
  1979. else if (pin == 45) {
  1980. CORE_PIN45_PORTTOGGLE = CORE_PIN45_BITMASK;
  1981. }
  1982. else if (pin == 46) {
  1983. CORE_PIN46_PORTTOGGLE = CORE_PIN46_BITMASK;
  1984. }
  1985. else if (pin == 47) {
  1986. CORE_PIN47_PORTTOGGLE = CORE_PIN47_BITMASK;
  1987. }
  1988. else if (pin == 48) {
  1989. CORE_PIN48_PORTTOGGLE = CORE_PIN48_BITMASK;
  1990. }
  1991. else if (pin == 49) {
  1992. CORE_PIN49_PORTTOGGLE = CORE_PIN49_BITMASK;
  1993. }
  1994. else if (pin == 50) {
  1995. CORE_PIN50_PORTTOGGLE = CORE_PIN50_BITMASK;
  1996. }
  1997. else if (pin == 51) {
  1998. CORE_PIN51_PORTTOGGLE = CORE_PIN51_BITMASK;
  1999. }
  2000. else if (pin == 52) {
  2001. CORE_PIN52_PORTTOGGLE = CORE_PIN52_BITMASK;
  2002. }
  2003. else if (pin == 53) {
  2004. CORE_PIN53_PORTTOGGLE = CORE_PIN53_BITMASK;
  2005. }
  2006. else if (pin == 54) {
  2007. CORE_PIN54_PORTTOGGLE = CORE_PIN54_BITMASK;
  2008. }
  2009. else if (pin == 55) {
  2010. CORE_PIN55_PORTTOGGLE = CORE_PIN55_BITMASK;
  2011. }
  2012. else if (pin == 56) {
  2013. CORE_PIN56_PORTTOGGLE = CORE_PIN56_BITMASK;
  2014. }
  2015. else if (pin == 57) {
  2016. CORE_PIN57_PORTTOGGLE = CORE_PIN57_BITMASK;
  2017. }
  2018. else if (pin == 58) {
  2019. CORE_PIN58_PORTTOGGLE = CORE_PIN58_BITMASK;
  2020. }
  2021. else if (pin == 59) {
  2022. CORE_PIN59_PORTTOGGLE = CORE_PIN59_BITMASK;
  2023. }
  2024. else if (pin == 60) {
  2025. CORE_PIN60_PORTTOGGLE = CORE_PIN60_BITMASK;
  2026. }
  2027. else if (pin == 61) {
  2028. CORE_PIN61_PORTTOGGLE = CORE_PIN61_BITMASK;
  2029. }
  2030. else if (pin == 62) {
  2031. CORE_PIN62_PORTTOGGLE = CORE_PIN62_BITMASK;
  2032. }
  2033. else if (pin == 63) {
  2034. CORE_PIN63_PORTTOGGLE = CORE_PIN63_BITMASK;
  2035. }
  2036. #endif
  2037. }
  2038. else {
  2039. *portToggleRegister(pin) = digitalPinToBitMask(pin);
  2040. }
  2041. }
  2042. uint8_t digitalRead(uint8_t pin);
  2043. static inline uint8_t digitalReadFast(uint8_t pin) __attribute__((always_inline, unused));
  2044. static inline uint8_t digitalReadFast(uint8_t pin)
  2045. {
  2046. if (__builtin_constant_p(pin)) {
  2047. if (pin == 0) {
  2048. return (CORE_PIN0_PINREG & CORE_PIN0_BITMASK) ? 1 : 0;
  2049. } else if (pin == 1) {
  2050. return (CORE_PIN1_PINREG & CORE_PIN1_BITMASK) ? 1 : 0;
  2051. } else if (pin == 2) {
  2052. return (CORE_PIN2_PINREG & CORE_PIN2_BITMASK) ? 1 : 0;
  2053. } else if (pin == 3) {
  2054. return (CORE_PIN3_PINREG & CORE_PIN3_BITMASK) ? 1 : 0;
  2055. } else if (pin == 4) {
  2056. return (CORE_PIN4_PINREG & CORE_PIN4_BITMASK) ? 1 : 0;
  2057. } else if (pin == 5) {
  2058. return (CORE_PIN5_PINREG & CORE_PIN5_BITMASK) ? 1 : 0;
  2059. } else if (pin == 6) {
  2060. return (CORE_PIN6_PINREG & CORE_PIN6_BITMASK) ? 1 : 0;
  2061. } else if (pin == 7) {
  2062. return (CORE_PIN7_PINREG & CORE_PIN7_BITMASK) ? 1 : 0;
  2063. } else if (pin == 8) {
  2064. return (CORE_PIN8_PINREG & CORE_PIN8_BITMASK) ? 1 : 0;
  2065. } else if (pin == 9) {
  2066. return (CORE_PIN9_PINREG & CORE_PIN9_BITMASK) ? 1 : 0;
  2067. } else if (pin == 10) {
  2068. return (CORE_PIN10_PINREG & CORE_PIN10_BITMASK) ? 1 : 0;
  2069. } else if (pin == 11) {
  2070. return (CORE_PIN11_PINREG & CORE_PIN11_BITMASK) ? 1 : 0;
  2071. } else if (pin == 12) {
  2072. return (CORE_PIN12_PINREG & CORE_PIN12_BITMASK) ? 1 : 0;
  2073. } else if (pin == 13) {
  2074. return (CORE_PIN13_PINREG & CORE_PIN13_BITMASK) ? 1 : 0;
  2075. } else if (pin == 14) {
  2076. return (CORE_PIN14_PINREG & CORE_PIN14_BITMASK) ? 1 : 0;
  2077. } else if (pin == 15) {
  2078. return (CORE_PIN15_PINREG & CORE_PIN15_BITMASK) ? 1 : 0;
  2079. } else if (pin == 16) {
  2080. return (CORE_PIN16_PINREG & CORE_PIN16_BITMASK) ? 1 : 0;
  2081. } else if (pin == 17) {
  2082. return (CORE_PIN17_PINREG & CORE_PIN17_BITMASK) ? 1 : 0;
  2083. } else if (pin == 18) {
  2084. return (CORE_PIN18_PINREG & CORE_PIN18_BITMASK) ? 1 : 0;
  2085. } else if (pin == 19) {
  2086. return (CORE_PIN19_PINREG & CORE_PIN19_BITMASK) ? 1 : 0;
  2087. } else if (pin == 20) {
  2088. return (CORE_PIN20_PINREG & CORE_PIN20_BITMASK) ? 1 : 0;
  2089. } else if (pin == 21) {
  2090. return (CORE_PIN21_PINREG & CORE_PIN21_BITMASK) ? 1 : 0;
  2091. } else if (pin == 22) {
  2092. return (CORE_PIN22_PINREG & CORE_PIN22_BITMASK) ? 1 : 0;
  2093. } else if (pin == 23) {
  2094. return (CORE_PIN23_PINREG & CORE_PIN23_BITMASK) ? 1 : 0;
  2095. } else if (pin == 24) {
  2096. return (CORE_PIN24_PINREG & CORE_PIN24_BITMASK) ? 1 : 0;
  2097. } else if (pin == 25) {
  2098. return (CORE_PIN25_PINREG & CORE_PIN25_BITMASK) ? 1 : 0;
  2099. } else if (pin == 26) {
  2100. return (CORE_PIN26_PINREG & CORE_PIN26_BITMASK) ? 1 : 0;
  2101. }
  2102. #if defined(CORE_PIN27_PINREG)
  2103. else if (pin == 27) {
  2104. return (CORE_PIN27_PINREG & CORE_PIN27_BITMASK) ? 1 : 0;
  2105. } else if (pin == 28) {
  2106. return (CORE_PIN28_PINREG & CORE_PIN28_BITMASK) ? 1 : 0;
  2107. } else if (pin == 29) {
  2108. return (CORE_PIN29_PINREG & CORE_PIN29_BITMASK) ? 1 : 0;
  2109. } else if (pin == 30) {
  2110. return (CORE_PIN30_PINREG & CORE_PIN30_BITMASK) ? 1 : 0;
  2111. } else if (pin == 31) {
  2112. return (CORE_PIN31_PINREG & CORE_PIN31_BITMASK) ? 1 : 0;
  2113. } else if (pin == 32) {
  2114. return (CORE_PIN32_PINREG & CORE_PIN32_BITMASK) ? 1 : 0;
  2115. } else if (pin == 33) {
  2116. return (CORE_PIN33_PINREG & CORE_PIN33_BITMASK) ? 1 : 0;
  2117. }
  2118. #endif
  2119. #if defined(CORE_PIN34_PINREG)
  2120. else if (pin == 34) {
  2121. return (CORE_PIN34_PINREG & CORE_PIN34_BITMASK) ? 1 : 0;
  2122. } else if (pin == 35) {
  2123. return (CORE_PIN35_PINREG & CORE_PIN35_BITMASK) ? 1 : 0;
  2124. } else if (pin == 36) {
  2125. return (CORE_PIN36_PINREG & CORE_PIN36_BITMASK) ? 1 : 0;
  2126. } else if (pin == 37) {
  2127. return (CORE_PIN37_PINREG & CORE_PIN37_BITMASK) ? 1 : 0;
  2128. } else if (pin == 38) {
  2129. return (CORE_PIN38_PINREG & CORE_PIN38_BITMASK) ? 1 : 0;
  2130. } else if (pin == 39) {
  2131. return (CORE_PIN39_PINREG & CORE_PIN39_BITMASK) ? 1 : 0;
  2132. } else if (pin == 40) {
  2133. return (CORE_PIN40_PINREG & CORE_PIN40_BITMASK) ? 1 : 0;
  2134. } else if (pin == 41) {
  2135. return (CORE_PIN41_PINREG & CORE_PIN41_BITMASK) ? 1 : 0;
  2136. } else if (pin == 42) {
  2137. return (CORE_PIN42_PINREG & CORE_PIN42_BITMASK) ? 1 : 0;
  2138. } else if (pin == 43) {
  2139. return (CORE_PIN43_PINREG & CORE_PIN43_BITMASK) ? 1 : 0;
  2140. } else if (pin == 44) {
  2141. return (CORE_PIN44_PINREG & CORE_PIN44_BITMASK) ? 1 : 0;
  2142. } else if (pin == 45) {
  2143. return (CORE_PIN45_PINREG & CORE_PIN45_BITMASK) ? 1 : 0;
  2144. } else if (pin == 46) {
  2145. return (CORE_PIN46_PINREG & CORE_PIN46_BITMASK) ? 1 : 0;
  2146. } else if (pin == 47) {
  2147. return (CORE_PIN47_PINREG & CORE_PIN47_BITMASK) ? 1 : 0;
  2148. } else if (pin == 48) {
  2149. return (CORE_PIN48_PINREG & CORE_PIN48_BITMASK) ? 1 : 0;
  2150. } else if (pin == 49) {
  2151. return (CORE_PIN49_PINREG & CORE_PIN49_BITMASK) ? 1 : 0;
  2152. } else if (pin == 50) {
  2153. return (CORE_PIN50_PINREG & CORE_PIN50_BITMASK) ? 1 : 0;
  2154. } else if (pin == 51) {
  2155. return (CORE_PIN51_PINREG & CORE_PIN51_BITMASK) ? 1 : 0;
  2156. } else if (pin == 52) {
  2157. return (CORE_PIN52_PINREG & CORE_PIN52_BITMASK) ? 1 : 0;
  2158. } else if (pin == 53) {
  2159. return (CORE_PIN53_PINREG & CORE_PIN53_BITMASK) ? 1 : 0;
  2160. } else if (pin == 54) {
  2161. return (CORE_PIN54_PINREG & CORE_PIN54_BITMASK) ? 1 : 0;
  2162. } else if (pin == 55) {
  2163. return (CORE_PIN55_PINREG & CORE_PIN55_BITMASK) ? 1 : 0;
  2164. } else if (pin == 56) {
  2165. return (CORE_PIN56_PINREG & CORE_PIN56_BITMASK) ? 1 : 0;
  2166. } else if (pin == 57) {
  2167. return (CORE_PIN57_PINREG & CORE_PIN57_BITMASK) ? 1 : 0;
  2168. } else if (pin == 58) {
  2169. return (CORE_PIN58_PINREG & CORE_PIN58_BITMASK) ? 1 : 0;
  2170. } else if (pin == 59) {
  2171. return (CORE_PIN59_PINREG & CORE_PIN59_BITMASK) ? 1 : 0;
  2172. } else if (pin == 60) {
  2173. return (CORE_PIN60_PINREG & CORE_PIN60_BITMASK) ? 1 : 0;
  2174. } else if (pin == 61) {
  2175. return (CORE_PIN61_PINREG & CORE_PIN61_BITMASK) ? 1 : 0;
  2176. } else if (pin == 62) {
  2177. return (CORE_PIN62_PINREG & CORE_PIN62_BITMASK) ? 1 : 0;
  2178. } else if (pin == 63) {
  2179. return (CORE_PIN63_PINREG & CORE_PIN63_BITMASK) ? 1 : 0;
  2180. }
  2181. #endif
  2182. else {
  2183. return 0;
  2184. }
  2185. } else {
  2186. #if defined(KINETISK)
  2187. return *portInputRegister(pin);
  2188. #else
  2189. return (*portInputRegister(pin) & digitalPinToBitMask(pin)) ? 1 : 0;
  2190. #endif
  2191. }
  2192. }
  2193. void pinMode(uint8_t pin, uint8_t mode);
  2194. void init_pins(void);
  2195. void analogWrite(uint8_t pin, int val);
  2196. uint32_t analogWriteRes(uint32_t bits);
  2197. static inline uint32_t analogWriteResolution(uint32_t bits) { return analogWriteRes(bits); }
  2198. void analogWriteFrequency(uint8_t pin, float frequency);
  2199. void analogWriteDAC0(int val);
  2200. void analogWriteDAC1(int val);
  2201. #ifdef __cplusplus
  2202. void attachInterruptVector(IRQ_NUMBER_t irq, void (*function)(void));
  2203. #else
  2204. void attachInterruptVector(enum IRQ_NUMBER_t irq, void (*function)(void));
  2205. #endif
  2206. void attachInterrupt(uint8_t pin, void (*function)(void), int mode);
  2207. void detachInterrupt(uint8_t pin);
  2208. void _init_Teensyduino_internal_(void);
  2209. int analogRead(uint8_t pin);
  2210. void analogReference(uint8_t type);
  2211. void analogReadRes(unsigned int bits);
  2212. static inline void analogReadResolution(unsigned int bits) { analogReadRes(bits); }
  2213. void analogReadAveraging(unsigned int num);
  2214. void analog_init(void);
  2215. #if defined(__MK20DX128__) || defined(__MK20DX256__) || defined(__MK64FX512__) || defined(__MK66FX1M0__)
  2216. #define DEFAULT 0
  2217. #define INTERNAL 2
  2218. #define INTERNAL1V2 2
  2219. #define INTERNAL1V1 2
  2220. #define EXTERNAL 0
  2221. #elif defined(__MKL26Z64__)
  2222. #define DEFAULT 0
  2223. #define INTERNAL 0
  2224. #define EXTERNAL 1
  2225. #endif
  2226. int touchRead(uint8_t pin);
  2227. static inline void shiftOut(uint8_t, uint8_t, uint8_t, uint8_t) __attribute__((always_inline, unused));
  2228. extern void _shiftOut(uint8_t dataPin, uint8_t clockPin, uint8_t bitOrder, uint8_t value) __attribute__((noinline));
  2229. extern void shiftOut_lsbFirst(uint8_t dataPin, uint8_t clockPin, uint8_t value) __attribute__((noinline));
  2230. extern void shiftOut_msbFirst(uint8_t dataPin, uint8_t clockPin, uint8_t value) __attribute__((noinline));
  2231. static inline void shiftOut(uint8_t dataPin, uint8_t clockPin, uint8_t bitOrder, uint8_t value)
  2232. {
  2233. if (__builtin_constant_p(bitOrder)) {
  2234. if (bitOrder == LSBFIRST) {
  2235. shiftOut_lsbFirst(dataPin, clockPin, value);
  2236. } else {
  2237. shiftOut_msbFirst(dataPin, clockPin, value);
  2238. }
  2239. } else {
  2240. _shiftOut(dataPin, clockPin, bitOrder, value);
  2241. }
  2242. }
  2243. static inline uint8_t shiftIn(uint8_t, uint8_t, uint8_t) __attribute__((always_inline, unused));
  2244. extern uint8_t _shiftIn(uint8_t dataPin, uint8_t clockPin, uint8_t bitOrder) __attribute__((noinline));
  2245. extern uint8_t shiftIn_lsbFirst(uint8_t dataPin, uint8_t clockPin) __attribute__((noinline));
  2246. extern uint8_t shiftIn_msbFirst(uint8_t dataPin, uint8_t clockPin) __attribute__((noinline));
  2247. static inline uint8_t shiftIn(uint8_t dataPin, uint8_t clockPin, uint8_t bitOrder)
  2248. {
  2249. if (__builtin_constant_p(bitOrder)) {
  2250. if (bitOrder == LSBFIRST) {
  2251. return shiftIn_lsbFirst(dataPin, clockPin);
  2252. } else {
  2253. return shiftIn_msbFirst(dataPin, clockPin);
  2254. }
  2255. } else {
  2256. return _shiftIn(dataPin, clockPin, bitOrder);
  2257. }
  2258. }
  2259. void _reboot_Teensyduino_(void) __attribute__((noreturn));
  2260. void _restart_Teensyduino_(void) __attribute__((noreturn));
  2261. // Define a set of flags to know which things yield should check when called.
  2262. // Probably should be in a better spot.
  2263. extern uint8_t yield_active_check_flags;
  2264. #define YIELD_CHECK_USB_SERIAL 0x1 // check the USB for Serial.available()
  2265. #define YIELD_CHECK_HARDWARE_SERIAL 0x2 // check Hardware Serial ports available
  2266. #define YIELD_CHECK_EVENT_RESPONDER 0x4 // User has created eventResponders that use yield
  2267. #define YIELD_CHECK_USB_SERIALUSB1 0x8 // Check for SerialUSB1
  2268. #define YIELD_CHECK_USB_SERIALUSB2 0x10 // Check for SerialUSB2
  2269. void yield(void);
  2270. void delay(uint32_t msec);
  2271. extern volatile uint32_t systick_millis_count;
  2272. static inline uint32_t millis(void) __attribute__((always_inline, unused));
  2273. static inline uint32_t millis(void)
  2274. {
  2275. // Reading a volatile variable to another volatile
  2276. // seems redundant, but isn't for some cases.
  2277. // Eventually this should probably be replaced by a
  2278. // proper memory barrier or other technique. Please
  2279. // do not remove this "redundant" code without
  2280. // carefully verifying the case mentioned here:
  2281. //
  2282. // https://forum.pjrc.com/threads/17469-millis%28%29-on-teensy-3?p=104924&viewfull=1#post104924
  2283. //
  2284. volatile uint32_t ret = systick_millis_count; // single aligned 32 bit is atomic
  2285. return ret;
  2286. }
  2287. uint32_t micros(void);
  2288. static inline void delayMicroseconds(uint32_t) __attribute__((always_inline, unused));
  2289. static inline void delayMicroseconds(uint32_t usec)
  2290. {
  2291. #if F_CPU == 256000000
  2292. uint32_t n = usec * 85;
  2293. #elif F_CPU == 240000000
  2294. uint32_t n = usec * 80;
  2295. #elif F_CPU == 216000000
  2296. uint32_t n = usec * 72;
  2297. #elif F_CPU == 192000000
  2298. uint32_t n = usec * 64;
  2299. #elif F_CPU == 180000000
  2300. uint32_t n = usec * 60;
  2301. #elif F_CPU == 168000000
  2302. uint32_t n = usec * 56;
  2303. #elif F_CPU == 144000000
  2304. uint32_t n = usec * 48;
  2305. #elif F_CPU == 120000000
  2306. uint32_t n = usec * 40;
  2307. #elif F_CPU == 96000000
  2308. uint32_t n = usec << 5;
  2309. #elif F_CPU == 72000000
  2310. uint32_t n = usec * 24;
  2311. #elif F_CPU == 48000000
  2312. uint32_t n = usec << 4;
  2313. #elif F_CPU == 24000000
  2314. uint32_t n = usec << 3;
  2315. #elif F_CPU == 16000000
  2316. uint32_t n = usec << 2;
  2317. #elif F_CPU == 8000000
  2318. uint32_t n = usec << 1;
  2319. #elif F_CPU == 4000000
  2320. uint32_t n = usec;
  2321. #elif F_CPU == 2000000
  2322. uint32_t n = usec >> 1;
  2323. #endif
  2324. // changed because a delay of 1 micro Sec @ 2MHz will be 0
  2325. if (n == 0) return;
  2326. __asm__ volatile(
  2327. "L_%=_delayMicroseconds:" "\n\t"
  2328. #if F_CPU < 24000000
  2329. "nop" "\n\t"
  2330. #endif
  2331. #ifdef KINETISL
  2332. "sub %0, #1" "\n\t"
  2333. "bne L_%=_delayMicroseconds" "\n"
  2334. : "+l" (n) :
  2335. #else
  2336. "subs %0, #1" "\n\t"
  2337. "bne L_%=_delayMicroseconds" "\n"
  2338. : "+r" (n) :
  2339. #endif
  2340. );
  2341. }
  2342. #ifdef __cplusplus
  2343. }
  2344. #endif
  2345. #ifdef __cplusplus
  2346. extern "C" {
  2347. #endif
  2348. unsigned long rtc_get(void);
  2349. void rtc_set(unsigned long t);
  2350. void rtc_compensate(int adjust);
  2351. #ifdef __cplusplus
  2352. }
  2353. class teensy3_clock_class
  2354. {
  2355. public:
  2356. static unsigned long get(void) __attribute__((always_inline)) { return rtc_get(); }
  2357. static void set(unsigned long t) __attribute__((always_inline)) { rtc_set(t); }
  2358. static void compensate(int adj) __attribute__((always_inline)) { rtc_compensate(adj); }
  2359. };
  2360. extern teensy3_clock_class Teensy3Clock;
  2361. #endif
  2362. #endif