Teensy 4.1 core updated for C++20
Nevar pievienot vairāk kā 25 tēmas Tēmai ir jāsākas ar burtu vai ciparu, tā var saturēt domu zīmes ('-') un var būt līdz 35 simboliem gara.

pirms 9 gadiem
pirms 9 gadiem
pirms 9 gadiem
pirms 9 gadiem
pirms 9 gadiem
pirms 9 gadiem
pirms 9 gadiem
pirms 9 gadiem
pirms 9 gadiem
pirms 9 gadiem
pirms 9 gadiem
pirms 9 gadiem
pirms 9 gadiem
12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616
  1. /* Teensyduino Core Library
  2. * http://www.pjrc.com/teensy/
  3. * Copyright (c) 2013 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 LSBFIRST 0
  42. #define MSBFIRST 1
  43. #define _BV(n) (1<<(n))
  44. #define CHANGE 4
  45. #define FALLING 2
  46. #define RISING 3
  47. // Pin Arduino
  48. // 0 B16 RXD
  49. // 1 B17 TXD
  50. // 2 D0
  51. // 3 A12 FTM1_CH0
  52. // 4 A13 FTM1_CH1
  53. // 5 D7 FTM0_CH7 OC0B/T1
  54. // 6 D4 FTM0_CH4 OC0A
  55. // 7 D2
  56. // 8 D3 ICP1
  57. // 9 C3 FTM0_CH2 OC1A
  58. // 10 C4 FTM0_CH3 SS/OC1B
  59. // 11 C6 MOSI/OC2A
  60. // 12 C7 MISO
  61. // 13 C5 SCK
  62. // 14 D1
  63. // 15 C0
  64. // 16 B0 (FTM1_CH0)
  65. // 17 B1 (FTM1_CH1)
  66. // 18 B3 SDA
  67. // 19 B2 SCL
  68. // 20 D5 FTM0_CH5
  69. // 21 D6 FTM0_CH6
  70. // 22 C1 FTM0_CH0
  71. // 23 C2 FTM0_CH1
  72. // 24 A5 (FTM0_CH2)
  73. // 25 B19
  74. // 26 E1
  75. // 27 C9
  76. // 28 C8
  77. // 29 C10
  78. // 30 C11
  79. // 31 E0
  80. // 32 B18
  81. // 33 A4 (FTM0_CH1)
  82. // (34) analog only
  83. // (35) analog only
  84. // (36) analog only
  85. // (37) analog only
  86. // not available to user:
  87. // A0 FTM0_CH5 SWD Clock
  88. // A1 FTM0_CH6 USB ID
  89. // A2 FTM0_CH7 SWD Trace
  90. // A3 FTM0_CH0 SWD Data
  91. #if defined(__MK20DX128__)
  92. #define CORE_NUM_TOTAL_PINS 34
  93. #define CORE_NUM_DIGITAL 34
  94. #define CORE_NUM_INTERRUPT 34
  95. #define CORE_NUM_ANALOG 14
  96. #define CORE_NUM_PWM 10
  97. #elif defined(__MK20DX256__)
  98. #define CORE_NUM_TOTAL_PINS 34
  99. #define CORE_NUM_DIGITAL 34
  100. #define CORE_NUM_INTERRUPT 34
  101. #define CORE_NUM_ANALOG 21
  102. #define CORE_NUM_PWM 12
  103. #elif defined(__MKL26Z64__)
  104. #define CORE_NUM_TOTAL_PINS 27
  105. #define CORE_NUM_DIGITAL 27
  106. #define CORE_NUM_INTERRUPT 24 // really only 18, but 6 "holes"
  107. #define CORE_NUM_ANALOG 13
  108. #define CORE_NUM_PWM 10
  109. #elif defined(__MK64FX512__) || defined(__MK66FX1M0__)
  110. #define CORE_NUM_TOTAL_PINS 40
  111. #define CORE_NUM_DIGITAL 40
  112. #define CORE_NUM_INTERRUPT 40
  113. #define CORE_NUM_ANALOG 23
  114. #define CORE_NUM_PWM 20
  115. #endif
  116. #if defined(__MK20DX128__) || defined(__MK20DX256__)
  117. #define CORE_PIN0_BIT 16
  118. #define CORE_PIN1_BIT 17
  119. #define CORE_PIN2_BIT 0
  120. #define CORE_PIN3_BIT 12
  121. #define CORE_PIN4_BIT 13
  122. #define CORE_PIN5_BIT 7
  123. #define CORE_PIN6_BIT 4
  124. #define CORE_PIN7_BIT 2
  125. #define CORE_PIN8_BIT 3
  126. #define CORE_PIN9_BIT 3
  127. #define CORE_PIN10_BIT 4
  128. #define CORE_PIN11_BIT 6
  129. #define CORE_PIN12_BIT 7
  130. #define CORE_PIN13_BIT 5
  131. #define CORE_PIN14_BIT 1
  132. #define CORE_PIN15_BIT 0
  133. #define CORE_PIN16_BIT 0
  134. #define CORE_PIN17_BIT 1
  135. #define CORE_PIN18_BIT 3
  136. #define CORE_PIN19_BIT 2
  137. #define CORE_PIN20_BIT 5
  138. #define CORE_PIN21_BIT 6
  139. #define CORE_PIN22_BIT 1
  140. #define CORE_PIN23_BIT 2
  141. #define CORE_PIN24_BIT 5
  142. #define CORE_PIN25_BIT 19
  143. #define CORE_PIN26_BIT 1
  144. #define CORE_PIN27_BIT 9
  145. #define CORE_PIN28_BIT 8
  146. #define CORE_PIN29_BIT 10
  147. #define CORE_PIN30_BIT 11
  148. #define CORE_PIN31_BIT 0
  149. #define CORE_PIN32_BIT 18
  150. #define CORE_PIN33_BIT 4
  151. #define CORE_PIN0_BITMASK (1<<(CORE_PIN0_BIT))
  152. #define CORE_PIN1_BITMASK (1<<(CORE_PIN1_BIT))
  153. #define CORE_PIN2_BITMASK (1<<(CORE_PIN2_BIT))
  154. #define CORE_PIN3_BITMASK (1<<(CORE_PIN3_BIT))
  155. #define CORE_PIN4_BITMASK (1<<(CORE_PIN4_BIT))
  156. #define CORE_PIN5_BITMASK (1<<(CORE_PIN5_BIT))
  157. #define CORE_PIN6_BITMASK (1<<(CORE_PIN6_BIT))
  158. #define CORE_PIN7_BITMASK (1<<(CORE_PIN7_BIT))
  159. #define CORE_PIN8_BITMASK (1<<(CORE_PIN8_BIT))
  160. #define CORE_PIN9_BITMASK (1<<(CORE_PIN9_BIT))
  161. #define CORE_PIN10_BITMASK (1<<(CORE_PIN10_BIT))
  162. #define CORE_PIN11_BITMASK (1<<(CORE_PIN11_BIT))
  163. #define CORE_PIN12_BITMASK (1<<(CORE_PIN12_BIT))
  164. #define CORE_PIN13_BITMASK (1<<(CORE_PIN13_BIT))
  165. #define CORE_PIN14_BITMASK (1<<(CORE_PIN14_BIT))
  166. #define CORE_PIN15_BITMASK (1<<(CORE_PIN15_BIT))
  167. #define CORE_PIN16_BITMASK (1<<(CORE_PIN16_BIT))
  168. #define CORE_PIN17_BITMASK (1<<(CORE_PIN17_BIT))
  169. #define CORE_PIN18_BITMASK (1<<(CORE_PIN18_BIT))
  170. #define CORE_PIN19_BITMASK (1<<(CORE_PIN19_BIT))
  171. #define CORE_PIN20_BITMASK (1<<(CORE_PIN20_BIT))
  172. #define CORE_PIN21_BITMASK (1<<(CORE_PIN21_BIT))
  173. #define CORE_PIN22_BITMASK (1<<(CORE_PIN22_BIT))
  174. #define CORE_PIN23_BITMASK (1<<(CORE_PIN23_BIT))
  175. #define CORE_PIN24_BITMASK (1<<(CORE_PIN24_BIT))
  176. #define CORE_PIN25_BITMASK (1<<(CORE_PIN25_BIT))
  177. #define CORE_PIN26_BITMASK (1<<(CORE_PIN26_BIT))
  178. #define CORE_PIN27_BITMASK (1<<(CORE_PIN27_BIT))
  179. #define CORE_PIN28_BITMASK (1<<(CORE_PIN28_BIT))
  180. #define CORE_PIN29_BITMASK (1<<(CORE_PIN29_BIT))
  181. #define CORE_PIN30_BITMASK (1<<(CORE_PIN30_BIT))
  182. #define CORE_PIN31_BITMASK (1<<(CORE_PIN31_BIT))
  183. #define CORE_PIN32_BITMASK (1<<(CORE_PIN32_BIT))
  184. #define CORE_PIN33_BITMASK (1<<(CORE_PIN33_BIT))
  185. #define CORE_PIN0_PORTREG GPIOB_PDOR
  186. #define CORE_PIN1_PORTREG GPIOB_PDOR
  187. #define CORE_PIN2_PORTREG GPIOD_PDOR
  188. #define CORE_PIN3_PORTREG GPIOA_PDOR
  189. #define CORE_PIN4_PORTREG GPIOA_PDOR
  190. #define CORE_PIN5_PORTREG GPIOD_PDOR
  191. #define CORE_PIN6_PORTREG GPIOD_PDOR
  192. #define CORE_PIN7_PORTREG GPIOD_PDOR
  193. #define CORE_PIN8_PORTREG GPIOD_PDOR
  194. #define CORE_PIN9_PORTREG GPIOC_PDOR
  195. #define CORE_PIN10_PORTREG GPIOC_PDOR
  196. #define CORE_PIN11_PORTREG GPIOC_PDOR
  197. #define CORE_PIN12_PORTREG GPIOC_PDOR
  198. #define CORE_PIN13_PORTREG GPIOC_PDOR
  199. #define CORE_PIN14_PORTREG GPIOD_PDOR
  200. #define CORE_PIN15_PORTREG GPIOC_PDOR
  201. #define CORE_PIN16_PORTREG GPIOB_PDOR
  202. #define CORE_PIN17_PORTREG GPIOB_PDOR
  203. #define CORE_PIN18_PORTREG GPIOB_PDOR
  204. #define CORE_PIN19_PORTREG GPIOB_PDOR
  205. #define CORE_PIN20_PORTREG GPIOD_PDOR
  206. #define CORE_PIN21_PORTREG GPIOD_PDOR
  207. #define CORE_PIN22_PORTREG GPIOC_PDOR
  208. #define CORE_PIN23_PORTREG GPIOC_PDOR
  209. #define CORE_PIN24_PORTREG GPIOA_PDOR
  210. #define CORE_PIN25_PORTREG GPIOB_PDOR
  211. #define CORE_PIN26_PORTREG GPIOE_PDOR
  212. #define CORE_PIN27_PORTREG GPIOC_PDOR
  213. #define CORE_PIN28_PORTREG GPIOC_PDOR
  214. #define CORE_PIN29_PORTREG GPIOC_PDOR
  215. #define CORE_PIN30_PORTREG GPIOC_PDOR
  216. #define CORE_PIN31_PORTREG GPIOE_PDOR
  217. #define CORE_PIN32_PORTREG GPIOB_PDOR
  218. #define CORE_PIN33_PORTREG GPIOA_PDOR
  219. #define CORE_PIN0_PORTSET GPIOB_PSOR
  220. #define CORE_PIN1_PORTSET GPIOB_PSOR
  221. #define CORE_PIN2_PORTSET GPIOD_PSOR
  222. #define CORE_PIN3_PORTSET GPIOA_PSOR
  223. #define CORE_PIN4_PORTSET GPIOA_PSOR
  224. #define CORE_PIN5_PORTSET GPIOD_PSOR
  225. #define CORE_PIN6_PORTSET GPIOD_PSOR
  226. #define CORE_PIN7_PORTSET GPIOD_PSOR
  227. #define CORE_PIN8_PORTSET GPIOD_PSOR
  228. #define CORE_PIN9_PORTSET GPIOC_PSOR
  229. #define CORE_PIN10_PORTSET GPIOC_PSOR
  230. #define CORE_PIN11_PORTSET GPIOC_PSOR
  231. #define CORE_PIN12_PORTSET GPIOC_PSOR
  232. #define CORE_PIN13_PORTSET GPIOC_PSOR
  233. #define CORE_PIN14_PORTSET GPIOD_PSOR
  234. #define CORE_PIN15_PORTSET GPIOC_PSOR
  235. #define CORE_PIN16_PORTSET GPIOB_PSOR
  236. #define CORE_PIN17_PORTSET GPIOB_PSOR
  237. #define CORE_PIN18_PORTSET GPIOB_PSOR
  238. #define CORE_PIN19_PORTSET GPIOB_PSOR
  239. #define CORE_PIN20_PORTSET GPIOD_PSOR
  240. #define CORE_PIN21_PORTSET GPIOD_PSOR
  241. #define CORE_PIN22_PORTSET GPIOC_PSOR
  242. #define CORE_PIN23_PORTSET GPIOC_PSOR
  243. #define CORE_PIN24_PORTSET GPIOA_PSOR
  244. #define CORE_PIN25_PORTSET GPIOB_PSOR
  245. #define CORE_PIN26_PORTSET GPIOE_PSOR
  246. #define CORE_PIN27_PORTSET GPIOC_PSOR
  247. #define CORE_PIN28_PORTSET GPIOC_PSOR
  248. #define CORE_PIN29_PORTSET GPIOC_PSOR
  249. #define CORE_PIN30_PORTSET GPIOC_PSOR
  250. #define CORE_PIN31_PORTSET GPIOE_PSOR
  251. #define CORE_PIN32_PORTSET GPIOB_PSOR
  252. #define CORE_PIN33_PORTSET GPIOA_PSOR
  253. #define CORE_PIN0_PORTCLEAR GPIOB_PCOR
  254. #define CORE_PIN1_PORTCLEAR GPIOB_PCOR
  255. #define CORE_PIN2_PORTCLEAR GPIOD_PCOR
  256. #define CORE_PIN3_PORTCLEAR GPIOA_PCOR
  257. #define CORE_PIN4_PORTCLEAR GPIOA_PCOR
  258. #define CORE_PIN5_PORTCLEAR GPIOD_PCOR
  259. #define CORE_PIN6_PORTCLEAR GPIOD_PCOR
  260. #define CORE_PIN7_PORTCLEAR GPIOD_PCOR
  261. #define CORE_PIN8_PORTCLEAR GPIOD_PCOR
  262. #define CORE_PIN9_PORTCLEAR GPIOC_PCOR
  263. #define CORE_PIN10_PORTCLEAR GPIOC_PCOR
  264. #define CORE_PIN11_PORTCLEAR GPIOC_PCOR
  265. #define CORE_PIN12_PORTCLEAR GPIOC_PCOR
  266. #define CORE_PIN13_PORTCLEAR GPIOC_PCOR
  267. #define CORE_PIN14_PORTCLEAR GPIOD_PCOR
  268. #define CORE_PIN15_PORTCLEAR GPIOC_PCOR
  269. #define CORE_PIN16_PORTCLEAR GPIOB_PCOR
  270. #define CORE_PIN17_PORTCLEAR GPIOB_PCOR
  271. #define CORE_PIN18_PORTCLEAR GPIOB_PCOR
  272. #define CORE_PIN19_PORTCLEAR GPIOB_PCOR
  273. #define CORE_PIN20_PORTCLEAR GPIOD_PCOR
  274. #define CORE_PIN21_PORTCLEAR GPIOD_PCOR
  275. #define CORE_PIN22_PORTCLEAR GPIOC_PCOR
  276. #define CORE_PIN23_PORTCLEAR GPIOC_PCOR
  277. #define CORE_PIN24_PORTCLEAR GPIOA_PCOR
  278. #define CORE_PIN25_PORTCLEAR GPIOB_PCOR
  279. #define CORE_PIN26_PORTCLEAR GPIOE_PCOR
  280. #define CORE_PIN27_PORTCLEAR GPIOC_PCOR
  281. #define CORE_PIN28_PORTCLEAR GPIOC_PCOR
  282. #define CORE_PIN29_PORTCLEAR GPIOC_PCOR
  283. #define CORE_PIN30_PORTCLEAR GPIOC_PCOR
  284. #define CORE_PIN31_PORTCLEAR GPIOE_PCOR
  285. #define CORE_PIN32_PORTCLEAR GPIOB_PCOR
  286. #define CORE_PIN33_PORTCLEAR GPIOA_PCOR
  287. #define CORE_PIN0_DDRREG GPIOB_PDDR
  288. #define CORE_PIN1_DDRREG GPIOB_PDDR
  289. #define CORE_PIN2_DDRREG GPIOD_PDDR
  290. #define CORE_PIN3_DDRREG GPIOA_PDDR
  291. #define CORE_PIN4_DDRREG GPIOA_PDDR
  292. #define CORE_PIN5_DDRREG GPIOD_PDDR
  293. #define CORE_PIN6_DDRREG GPIOD_PDDR
  294. #define CORE_PIN7_DDRREG GPIOD_PDDR
  295. #define CORE_PIN8_DDRREG GPIOD_PDDR
  296. #define CORE_PIN9_DDRREG GPIOC_PDDR
  297. #define CORE_PIN10_DDRREG GPIOC_PDDR
  298. #define CORE_PIN11_DDRREG GPIOC_PDDR
  299. #define CORE_PIN12_DDRREG GPIOC_PDDR
  300. #define CORE_PIN13_DDRREG GPIOC_PDDR
  301. #define CORE_PIN14_DDRREG GPIOD_PDDR
  302. #define CORE_PIN15_DDRREG GPIOC_PDDR
  303. #define CORE_PIN16_DDRREG GPIOB_PDDR
  304. #define CORE_PIN17_DDRREG GPIOB_PDDR
  305. #define CORE_PIN18_DDRREG GPIOB_PDDR
  306. #define CORE_PIN19_DDRREG GPIOB_PDDR
  307. #define CORE_PIN20_DDRREG GPIOD_PDDR
  308. #define CORE_PIN21_DDRREG GPIOD_PDDR
  309. #define CORE_PIN22_DDRREG GPIOC_PDDR
  310. #define CORE_PIN23_DDRREG GPIOC_PDDR
  311. #define CORE_PIN24_DDRREG GPIOA_PDDR
  312. #define CORE_PIN25_DDRREG GPIOB_PDDR
  313. #define CORE_PIN26_DDRREG GPIOE_PDDR
  314. #define CORE_PIN27_DDRREG GPIOC_PDDR
  315. #define CORE_PIN28_DDRREG GPIOC_PDDR
  316. #define CORE_PIN29_DDRREG GPIOC_PDDR
  317. #define CORE_PIN30_DDRREG GPIOC_PDDR
  318. #define CORE_PIN31_DDRREG GPIOE_PDDR
  319. #define CORE_PIN32_DDRREG GPIOB_PDDR
  320. #define CORE_PIN33_DDRREG GPIOA_PDDR
  321. #define CORE_PIN0_PINREG GPIOB_PDIR
  322. #define CORE_PIN1_PINREG GPIOB_PDIR
  323. #define CORE_PIN2_PINREG GPIOD_PDIR
  324. #define CORE_PIN3_PINREG GPIOA_PDIR
  325. #define CORE_PIN4_PINREG GPIOA_PDIR
  326. #define CORE_PIN5_PINREG GPIOD_PDIR
  327. #define CORE_PIN6_PINREG GPIOD_PDIR
  328. #define CORE_PIN7_PINREG GPIOD_PDIR
  329. #define CORE_PIN8_PINREG GPIOD_PDIR
  330. #define CORE_PIN9_PINREG GPIOC_PDIR
  331. #define CORE_PIN10_PINREG GPIOC_PDIR
  332. #define CORE_PIN11_PINREG GPIOC_PDIR
  333. #define CORE_PIN12_PINREG GPIOC_PDIR
  334. #define CORE_PIN13_PINREG GPIOC_PDIR
  335. #define CORE_PIN14_PINREG GPIOD_PDIR
  336. #define CORE_PIN15_PINREG GPIOC_PDIR
  337. #define CORE_PIN16_PINREG GPIOB_PDIR
  338. #define CORE_PIN17_PINREG GPIOB_PDIR
  339. #define CORE_PIN18_PINREG GPIOB_PDIR
  340. #define CORE_PIN19_PINREG GPIOB_PDIR
  341. #define CORE_PIN20_PINREG GPIOD_PDIR
  342. #define CORE_PIN21_PINREG GPIOD_PDIR
  343. #define CORE_PIN22_PINREG GPIOC_PDIR
  344. #define CORE_PIN23_PINREG GPIOC_PDIR
  345. #define CORE_PIN24_PINREG GPIOA_PDIR
  346. #define CORE_PIN25_PINREG GPIOB_PDIR
  347. #define CORE_PIN26_PINREG GPIOE_PDIR
  348. #define CORE_PIN27_PINREG GPIOC_PDIR
  349. #define CORE_PIN28_PINREG GPIOC_PDIR
  350. #define CORE_PIN29_PINREG GPIOC_PDIR
  351. #define CORE_PIN30_PINREG GPIOC_PDIR
  352. #define CORE_PIN31_PINREG GPIOE_PDIR
  353. #define CORE_PIN32_PINREG GPIOB_PDIR
  354. #define CORE_PIN33_PINREG GPIOA_PDIR
  355. #define CORE_PIN0_CONFIG PORTB_PCR16
  356. #define CORE_PIN1_CONFIG PORTB_PCR17
  357. #define CORE_PIN2_CONFIG PORTD_PCR0
  358. #define CORE_PIN3_CONFIG PORTA_PCR12
  359. #define CORE_PIN4_CONFIG PORTA_PCR13
  360. #define CORE_PIN5_CONFIG PORTD_PCR7
  361. #define CORE_PIN6_CONFIG PORTD_PCR4
  362. #define CORE_PIN7_CONFIG PORTD_PCR2
  363. #define CORE_PIN8_CONFIG PORTD_PCR3
  364. #define CORE_PIN9_CONFIG PORTC_PCR3
  365. #define CORE_PIN10_CONFIG PORTC_PCR4
  366. #define CORE_PIN11_CONFIG PORTC_PCR6
  367. #define CORE_PIN12_CONFIG PORTC_PCR7
  368. #define CORE_PIN13_CONFIG PORTC_PCR5
  369. #define CORE_PIN14_CONFIG PORTD_PCR1
  370. #define CORE_PIN15_CONFIG PORTC_PCR0
  371. #define CORE_PIN16_CONFIG PORTB_PCR0
  372. #define CORE_PIN17_CONFIG PORTB_PCR1
  373. #define CORE_PIN18_CONFIG PORTB_PCR3
  374. #define CORE_PIN19_CONFIG PORTB_PCR2
  375. #define CORE_PIN20_CONFIG PORTD_PCR5
  376. #define CORE_PIN21_CONFIG PORTD_PCR6
  377. #define CORE_PIN22_CONFIG PORTC_PCR1
  378. #define CORE_PIN23_CONFIG PORTC_PCR2
  379. #define CORE_PIN24_CONFIG PORTA_PCR5
  380. #define CORE_PIN25_CONFIG PORTB_PCR19
  381. #define CORE_PIN26_CONFIG PORTE_PCR1
  382. #define CORE_PIN27_CONFIG PORTC_PCR9
  383. #define CORE_PIN28_CONFIG PORTC_PCR8
  384. #define CORE_PIN29_CONFIG PORTC_PCR10
  385. #define CORE_PIN30_CONFIG PORTC_PCR11
  386. #define CORE_PIN31_CONFIG PORTE_PCR0
  387. #define CORE_PIN32_CONFIG PORTB_PCR18
  388. #define CORE_PIN33_CONFIG PORTA_PCR4
  389. #define CORE_ADC0_PIN 14
  390. #define CORE_ADC1_PIN 15
  391. #define CORE_ADC2_PIN 16
  392. #define CORE_ADC3_PIN 17
  393. #define CORE_ADC4_PIN 18
  394. #define CORE_ADC5_PIN 19
  395. #define CORE_ADC6_PIN 20
  396. #define CORE_ADC7_PIN 21
  397. #define CORE_ADC8_PIN 22
  398. #define CORE_ADC9_PIN 23
  399. #define CORE_ADC10_PIN 34
  400. #define CORE_ADC11_PIN 35
  401. #define CORE_ADC12_PIN 36
  402. #define CORE_ADC13_PIN 37
  403. #define CORE_RXD0_PIN 0
  404. #define CORE_TXD0_PIN 1
  405. #define CORE_RXD1_PIN 9
  406. #define CORE_TXD1_PIN 10
  407. #define CORE_RXD2_PIN 7
  408. #define CORE_TXD2_PIN 8
  409. #define CORE_INT0_PIN 0
  410. #define CORE_INT1_PIN 1
  411. #define CORE_INT2_PIN 2
  412. #define CORE_INT3_PIN 3
  413. #define CORE_INT4_PIN 4
  414. #define CORE_INT5_PIN 5
  415. #define CORE_INT6_PIN 6
  416. #define CORE_INT7_PIN 7
  417. #define CORE_INT8_PIN 8
  418. #define CORE_INT9_PIN 9
  419. #define CORE_INT10_PIN 10
  420. #define CORE_INT11_PIN 11
  421. #define CORE_INT12_PIN 12
  422. #define CORE_INT13_PIN 13
  423. #define CORE_INT14_PIN 14
  424. #define CORE_INT15_PIN 15
  425. #define CORE_INT16_PIN 16
  426. #define CORE_INT17_PIN 17
  427. #define CORE_INT18_PIN 18
  428. #define CORE_INT19_PIN 19
  429. #define CORE_INT20_PIN 20
  430. #define CORE_INT21_PIN 21
  431. #define CORE_INT22_PIN 22
  432. #define CORE_INT23_PIN 23
  433. #define CORE_INT24_PIN 24
  434. #define CORE_INT25_PIN 25
  435. #define CORE_INT26_PIN 26
  436. #define CORE_INT27_PIN 27
  437. #define CORE_INT28_PIN 28
  438. #define CORE_INT29_PIN 29
  439. #define CORE_INT30_PIN 30
  440. #define CORE_INT31_PIN 31
  441. #define CORE_INT32_PIN 32
  442. #define CORE_INT33_PIN 33
  443. #define CORE_INT_EVERY_PIN 1
  444. #elif defined(__MKL26Z64__)
  445. #define CORE_PIN0_BIT 16
  446. #define CORE_PIN1_BIT 17
  447. #define CORE_PIN2_BIT 0
  448. #define CORE_PIN3_BIT 1
  449. #define CORE_PIN4_BIT 2
  450. #define CORE_PIN5_BIT 7
  451. #define CORE_PIN6_BIT 4
  452. #define CORE_PIN7_BIT 2
  453. #define CORE_PIN8_BIT 3
  454. #define CORE_PIN9_BIT 3
  455. #define CORE_PIN10_BIT 4
  456. #define CORE_PIN11_BIT 6
  457. #define CORE_PIN12_BIT 7
  458. #define CORE_PIN13_BIT 5
  459. #define CORE_PIN14_BIT 1
  460. #define CORE_PIN15_BIT 0
  461. #define CORE_PIN16_BIT 0
  462. #define CORE_PIN17_BIT 1
  463. #define CORE_PIN18_BIT 3
  464. #define CORE_PIN19_BIT 2
  465. #define CORE_PIN20_BIT 5
  466. #define CORE_PIN21_BIT 6
  467. #define CORE_PIN22_BIT 1
  468. #define CORE_PIN23_BIT 2
  469. #define CORE_PIN24_BIT 20
  470. #define CORE_PIN25_BIT 21
  471. #define CORE_PIN26_BIT 30
  472. #define CORE_PIN0_BITMASK (1<<(CORE_PIN0_BIT))
  473. #define CORE_PIN1_BITMASK (1<<(CORE_PIN1_BIT))
  474. #define CORE_PIN2_BITMASK (1<<(CORE_PIN2_BIT))
  475. #define CORE_PIN3_BITMASK (1<<(CORE_PIN3_BIT))
  476. #define CORE_PIN4_BITMASK (1<<(CORE_PIN4_BIT))
  477. #define CORE_PIN5_BITMASK (1<<(CORE_PIN5_BIT))
  478. #define CORE_PIN6_BITMASK (1<<(CORE_PIN6_BIT))
  479. #define CORE_PIN7_BITMASK (1<<(CORE_PIN7_BIT))
  480. #define CORE_PIN8_BITMASK (1<<(CORE_PIN8_BIT))
  481. #define CORE_PIN9_BITMASK (1<<(CORE_PIN9_BIT))
  482. #define CORE_PIN10_BITMASK (1<<(CORE_PIN10_BIT))
  483. #define CORE_PIN11_BITMASK (1<<(CORE_PIN11_BIT))
  484. #define CORE_PIN12_BITMASK (1<<(CORE_PIN12_BIT))
  485. #define CORE_PIN13_BITMASK (1<<(CORE_PIN13_BIT))
  486. #define CORE_PIN14_BITMASK (1<<(CORE_PIN14_BIT))
  487. #define CORE_PIN15_BITMASK (1<<(CORE_PIN15_BIT))
  488. #define CORE_PIN16_BITMASK (1<<(CORE_PIN16_BIT))
  489. #define CORE_PIN17_BITMASK (1<<(CORE_PIN17_BIT))
  490. #define CORE_PIN18_BITMASK (1<<(CORE_PIN18_BIT))
  491. #define CORE_PIN19_BITMASK (1<<(CORE_PIN19_BIT))
  492. #define CORE_PIN20_BITMASK (1<<(CORE_PIN20_BIT))
  493. #define CORE_PIN21_BITMASK (1<<(CORE_PIN21_BIT))
  494. #define CORE_PIN22_BITMASK (1<<(CORE_PIN22_BIT))
  495. #define CORE_PIN23_BITMASK (1<<(CORE_PIN23_BIT))
  496. #define CORE_PIN24_BITMASK (1<<(CORE_PIN24_BIT))
  497. #define CORE_PIN25_BITMASK (1<<(CORE_PIN25_BIT))
  498. #define CORE_PIN26_BITMASK (1<<(CORE_PIN26_BIT))
  499. #define CORE_PIN0_PORTREG FGPIOB_PDOR
  500. #define CORE_PIN1_PORTREG FGPIOB_PDOR
  501. #define CORE_PIN2_PORTREG FGPIOD_PDOR
  502. #define CORE_PIN3_PORTREG FGPIOA_PDOR
  503. #define CORE_PIN4_PORTREG FGPIOA_PDOR
  504. #define CORE_PIN5_PORTREG FGPIOD_PDOR
  505. #define CORE_PIN6_PORTREG FGPIOD_PDOR
  506. #define CORE_PIN7_PORTREG FGPIOD_PDOR
  507. #define CORE_PIN8_PORTREG FGPIOD_PDOR
  508. #define CORE_PIN9_PORTREG FGPIOC_PDOR
  509. #define CORE_PIN10_PORTREG FGPIOC_PDOR
  510. #define CORE_PIN11_PORTREG FGPIOC_PDOR
  511. #define CORE_PIN12_PORTREG FGPIOC_PDOR
  512. #define CORE_PIN13_PORTREG FGPIOC_PDOR
  513. #define CORE_PIN14_PORTREG FGPIOD_PDOR
  514. #define CORE_PIN15_PORTREG FGPIOC_PDOR
  515. #define CORE_PIN16_PORTREG FGPIOB_PDOR
  516. #define CORE_PIN17_PORTREG FGPIOB_PDOR
  517. #define CORE_PIN18_PORTREG FGPIOB_PDOR
  518. #define CORE_PIN19_PORTREG FGPIOB_PDOR
  519. #define CORE_PIN20_PORTREG FGPIOD_PDOR
  520. #define CORE_PIN21_PORTREG FGPIOD_PDOR
  521. #define CORE_PIN22_PORTREG FGPIOC_PDOR
  522. #define CORE_PIN23_PORTREG FGPIOC_PDOR
  523. #define CORE_PIN24_PORTREG FGPIOE_PDOR
  524. #define CORE_PIN25_PORTREG FGPIOE_PDOR
  525. #define CORE_PIN26_PORTREG FGPIOE_PDOR
  526. #define CORE_PIN0_PORTSET FGPIOB_PSOR
  527. #define CORE_PIN1_PORTSET FGPIOB_PSOR
  528. #define CORE_PIN2_PORTSET FGPIOD_PSOR
  529. #define CORE_PIN3_PORTSET FGPIOA_PSOR
  530. #define CORE_PIN4_PORTSET FGPIOA_PSOR
  531. #define CORE_PIN5_PORTSET FGPIOD_PSOR
  532. #define CORE_PIN6_PORTSET FGPIOD_PSOR
  533. #define CORE_PIN7_PORTSET FGPIOD_PSOR
  534. #define CORE_PIN8_PORTSET FGPIOD_PSOR
  535. #define CORE_PIN9_PORTSET FGPIOC_PSOR
  536. #define CORE_PIN10_PORTSET FGPIOC_PSOR
  537. #define CORE_PIN11_PORTSET FGPIOC_PSOR
  538. #define CORE_PIN12_PORTSET FGPIOC_PSOR
  539. #define CORE_PIN13_PORTSET FGPIOC_PSOR
  540. #define CORE_PIN14_PORTSET FGPIOD_PSOR
  541. #define CORE_PIN15_PORTSET FGPIOC_PSOR
  542. #define CORE_PIN16_PORTSET FGPIOB_PSOR
  543. #define CORE_PIN17_PORTSET FGPIOB_PSOR
  544. #define CORE_PIN18_PORTSET FGPIOB_PSOR
  545. #define CORE_PIN19_PORTSET FGPIOB_PSOR
  546. #define CORE_PIN20_PORTSET FGPIOD_PSOR
  547. #define CORE_PIN21_PORTSET FGPIOD_PSOR
  548. #define CORE_PIN22_PORTSET FGPIOC_PSOR
  549. #define CORE_PIN23_PORTSET FGPIOC_PSOR
  550. #define CORE_PIN24_PORTSET FGPIOE_PSOR
  551. #define CORE_PIN25_PORTSET FGPIOE_PSOR
  552. #define CORE_PIN26_PORTSET FGPIOE_PSOR
  553. #define CORE_PIN0_PORTCLEAR FGPIOB_PCOR
  554. #define CORE_PIN1_PORTCLEAR FGPIOB_PCOR
  555. #define CORE_PIN2_PORTCLEAR FGPIOD_PCOR
  556. #define CORE_PIN3_PORTCLEAR FGPIOA_PCOR
  557. #define CORE_PIN4_PORTCLEAR FGPIOA_PCOR
  558. #define CORE_PIN5_PORTCLEAR FGPIOD_PCOR
  559. #define CORE_PIN6_PORTCLEAR FGPIOD_PCOR
  560. #define CORE_PIN7_PORTCLEAR FGPIOD_PCOR
  561. #define CORE_PIN8_PORTCLEAR FGPIOD_PCOR
  562. #define CORE_PIN9_PORTCLEAR FGPIOC_PCOR
  563. #define CORE_PIN10_PORTCLEAR FGPIOC_PCOR
  564. #define CORE_PIN11_PORTCLEAR FGPIOC_PCOR
  565. #define CORE_PIN12_PORTCLEAR FGPIOC_PCOR
  566. #define CORE_PIN13_PORTCLEAR FGPIOC_PCOR
  567. #define CORE_PIN14_PORTCLEAR FGPIOD_PCOR
  568. #define CORE_PIN15_PORTCLEAR FGPIOC_PCOR
  569. #define CORE_PIN16_PORTCLEAR FGPIOB_PCOR
  570. #define CORE_PIN17_PORTCLEAR FGPIOB_PCOR
  571. #define CORE_PIN18_PORTCLEAR FGPIOB_PCOR
  572. #define CORE_PIN19_PORTCLEAR FGPIOB_PCOR
  573. #define CORE_PIN20_PORTCLEAR FGPIOD_PCOR
  574. #define CORE_PIN21_PORTCLEAR FGPIOD_PCOR
  575. #define CORE_PIN22_PORTCLEAR FGPIOC_PCOR
  576. #define CORE_PIN23_PORTCLEAR FGPIOC_PCOR
  577. #define CORE_PIN24_PORTCLEAR FGPIOE_PCOR
  578. #define CORE_PIN25_PORTCLEAR FGPIOE_PCOR
  579. #define CORE_PIN26_PORTCLEAR FGPIOE_PCOR
  580. #define CORE_PIN0_DDRREG FGPIOB_PDDR
  581. #define CORE_PIN1_DDRREG FGPIOB_PDDR
  582. #define CORE_PIN2_DDRREG FGPIOD_PDDR
  583. #define CORE_PIN3_DDRREG FGPIOA_PDDR
  584. #define CORE_PIN4_DDRREG FGPIOA_PDDR
  585. #define CORE_PIN5_DDRREG FGPIOD_PDDR
  586. #define CORE_PIN6_DDRREG FGPIOD_PDDR
  587. #define CORE_PIN7_DDRREG FGPIOD_PDDR
  588. #define CORE_PIN8_DDRREG FGPIOD_PDDR
  589. #define CORE_PIN9_DDRREG FGPIOC_PDDR
  590. #define CORE_PIN10_DDRREG FGPIOC_PDDR
  591. #define CORE_PIN11_DDRREG FGPIOC_PDDR
  592. #define CORE_PIN12_DDRREG FGPIOC_PDDR
  593. #define CORE_PIN13_DDRREG FGPIOC_PDDR
  594. #define CORE_PIN14_DDRREG FGPIOD_PDDR
  595. #define CORE_PIN15_DDRREG FGPIOC_PDDR
  596. #define CORE_PIN16_DDRREG FGPIOB_PDDR
  597. #define CORE_PIN17_DDRREG FGPIOB_PDDR
  598. #define CORE_PIN18_DDRREG FGPIOB_PDDR
  599. #define CORE_PIN19_DDRREG FGPIOB_PDDR
  600. #define CORE_PIN20_DDRREG FGPIOD_PDDR
  601. #define CORE_PIN21_DDRREG FGPIOD_PDDR
  602. #define CORE_PIN22_DDRREG FGPIOC_PDDR
  603. #define CORE_PIN23_DDRREG FGPIOC_PDDR
  604. #define CORE_PIN24_DDRREG FGPIOE_PDDR
  605. #define CORE_PIN25_DDRREG FGPIOE_PDDR
  606. #define CORE_PIN26_DDRREG FGPIOE_PDDR
  607. #define CORE_PIN0_PINREG FGPIOB_PDIR
  608. #define CORE_PIN1_PINREG FGPIOB_PDIR
  609. #define CORE_PIN2_PINREG FGPIOD_PDIR
  610. #define CORE_PIN3_PINREG FGPIOA_PDIR
  611. #define CORE_PIN4_PINREG FGPIOA_PDIR
  612. #define CORE_PIN5_PINREG FGPIOD_PDIR
  613. #define CORE_PIN6_PINREG FGPIOD_PDIR
  614. #define CORE_PIN7_PINREG FGPIOD_PDIR
  615. #define CORE_PIN8_PINREG FGPIOD_PDIR
  616. #define CORE_PIN9_PINREG FGPIOC_PDIR
  617. #define CORE_PIN10_PINREG FGPIOC_PDIR
  618. #define CORE_PIN11_PINREG FGPIOC_PDIR
  619. #define CORE_PIN12_PINREG FGPIOC_PDIR
  620. #define CORE_PIN13_PINREG FGPIOC_PDIR
  621. #define CORE_PIN14_PINREG FGPIOD_PDIR
  622. #define CORE_PIN15_PINREG FGPIOC_PDIR
  623. #define CORE_PIN16_PINREG FGPIOB_PDIR
  624. #define CORE_PIN17_PINREG FGPIOB_PDIR
  625. #define CORE_PIN18_PINREG FGPIOB_PDIR
  626. #define CORE_PIN19_PINREG FGPIOB_PDIR
  627. #define CORE_PIN20_PINREG FGPIOD_PDIR
  628. #define CORE_PIN21_PINREG FGPIOD_PDIR
  629. #define CORE_PIN22_PINREG FGPIOC_PDIR
  630. #define CORE_PIN23_PINREG FGPIOC_PDIR
  631. #define CORE_PIN24_PINREG FGPIOE_PDIR
  632. #define CORE_PIN25_PINREG FGPIOE_PDIR
  633. #define CORE_PIN26_PINREG FGPIOE_PDIR
  634. #define CORE_PIN0_CONFIG PORTB_PCR16
  635. #define CORE_PIN1_CONFIG PORTB_PCR17
  636. #define CORE_PIN2_CONFIG PORTD_PCR0
  637. #define CORE_PIN3_CONFIG PORTA_PCR1
  638. #define CORE_PIN4_CONFIG PORTA_PCR2
  639. #define CORE_PIN5_CONFIG PORTD_PCR7
  640. #define CORE_PIN6_CONFIG PORTD_PCR4
  641. #define CORE_PIN7_CONFIG PORTD_PCR2
  642. #define CORE_PIN8_CONFIG PORTD_PCR3
  643. #define CORE_PIN9_CONFIG PORTC_PCR3
  644. #define CORE_PIN10_CONFIG PORTC_PCR4
  645. #define CORE_PIN11_CONFIG PORTC_PCR6
  646. #define CORE_PIN12_CONFIG PORTC_PCR7
  647. #define CORE_PIN13_CONFIG PORTC_PCR5
  648. #define CORE_PIN14_CONFIG PORTD_PCR1
  649. #define CORE_PIN15_CONFIG PORTC_PCR0
  650. #define CORE_PIN16_CONFIG PORTB_PCR0
  651. #define CORE_PIN17_CONFIG PORTB_PCR1
  652. #define CORE_PIN18_CONFIG PORTB_PCR3
  653. #define CORE_PIN19_CONFIG PORTB_PCR2
  654. #define CORE_PIN20_CONFIG PORTD_PCR5
  655. #define CORE_PIN21_CONFIG PORTD_PCR6
  656. #define CORE_PIN22_CONFIG PORTC_PCR1
  657. #define CORE_PIN23_CONFIG PORTC_PCR2
  658. #define CORE_PIN24_CONFIG PORTE_PCR20
  659. #define CORE_PIN25_CONFIG PORTE_PCR21
  660. #define CORE_PIN26_CONFIG PORTE_PCR30
  661. #define CORE_ADC0_PIN 14
  662. #define CORE_ADC1_PIN 15
  663. #define CORE_ADC2_PIN 16
  664. #define CORE_ADC3_PIN 17
  665. #define CORE_ADC4_PIN 18
  666. #define CORE_ADC5_PIN 19
  667. #define CORE_ADC6_PIN 20
  668. #define CORE_ADC7_PIN 21
  669. #define CORE_ADC8_PIN 22
  670. #define CORE_ADC9_PIN 23
  671. #define CORE_ADC10_PIN 24
  672. #define CORE_ADC11_PIN 25
  673. #define CORE_ADC12_PIN 26
  674. #define CORE_RXD0_PIN 0
  675. #define CORE_TXD0_PIN 1
  676. #define CORE_RXD1_PIN 9
  677. #define CORE_TXD1_PIN 10
  678. #define CORE_RXD2_PIN 7
  679. #define CORE_TXD2_PIN 8
  680. #define CORE_INT2_PIN 2
  681. #define CORE_INT3_PIN 3
  682. #define CORE_INT4_PIN 4
  683. #define CORE_INT5_PIN 5
  684. #define CORE_INT6_PIN 6
  685. #define CORE_INT7_PIN 7
  686. #define CORE_INT8_PIN 8
  687. #define CORE_INT9_PIN 9
  688. #define CORE_INT10_PIN 10
  689. #define CORE_INT11_PIN 11
  690. #define CORE_INT12_PIN 12
  691. #define CORE_INT13_PIN 13
  692. #define CORE_INT14_PIN 14
  693. #define CORE_INT15_PIN 15
  694. #define CORE_INT20_PIN 20
  695. #define CORE_INT21_PIN 21
  696. #define CORE_INT22_PIN 22
  697. #define CORE_INT23_PIN 23
  698. #elif defined(__MK64FX512__) || defined(__MK66FX1M0__)
  699. #define CORE_PIN0_BIT 16
  700. #define CORE_PIN1_BIT 17
  701. #define CORE_PIN2_BIT 0
  702. #define CORE_PIN3_BIT 12
  703. #define CORE_PIN4_BIT 13
  704. #define CORE_PIN5_BIT 7
  705. #define CORE_PIN6_BIT 4
  706. #define CORE_PIN7_BIT 2
  707. #define CORE_PIN8_BIT 3
  708. #define CORE_PIN9_BIT 3
  709. #define CORE_PIN10_BIT 4
  710. #define CORE_PIN11_BIT 6
  711. #define CORE_PIN12_BIT 7
  712. #define CORE_PIN13_BIT 5
  713. #define CORE_PIN14_BIT 1
  714. #define CORE_PIN15_BIT 0
  715. #define CORE_PIN16_BIT 0
  716. #define CORE_PIN17_BIT 1
  717. #define CORE_PIN18_BIT 3
  718. #define CORE_PIN19_BIT 2
  719. #define CORE_PIN20_BIT 5
  720. #define CORE_PIN21_BIT 6
  721. #define CORE_PIN22_BIT 1
  722. #define CORE_PIN23_BIT 2
  723. #define CORE_PIN24_BIT 26
  724. #define CORE_PIN25_BIT 5
  725. #define CORE_PIN26_BIT 14
  726. #define CORE_PIN27_BIT 15
  727. #define CORE_PIN28_BIT 16
  728. #define CORE_PIN29_BIT 18
  729. #define CORE_PIN30_BIT 19
  730. #define CORE_PIN31_BIT 10
  731. #define CORE_PIN32_BIT 11
  732. #define CORE_PIN33_BIT 24
  733. #define CORE_PIN34_BIT 25
  734. #define CORE_PIN35_BIT 8
  735. #define CORE_PIN36_BIT 9
  736. #define CORE_PIN37_BIT 10
  737. #define CORE_PIN38_BIT 11
  738. #define CORE_PIN39_BIT 17
  739. #define CORE_PIN0_BITMASK (1<<(CORE_PIN0_BIT))
  740. #define CORE_PIN1_BITMASK (1<<(CORE_PIN1_BIT))
  741. #define CORE_PIN2_BITMASK (1<<(CORE_PIN2_BIT))
  742. #define CORE_PIN3_BITMASK (1<<(CORE_PIN3_BIT))
  743. #define CORE_PIN4_BITMASK (1<<(CORE_PIN4_BIT))
  744. #define CORE_PIN5_BITMASK (1<<(CORE_PIN5_BIT))
  745. #define CORE_PIN6_BITMASK (1<<(CORE_PIN6_BIT))
  746. #define CORE_PIN7_BITMASK (1<<(CORE_PIN7_BIT))
  747. #define CORE_PIN8_BITMASK (1<<(CORE_PIN8_BIT))
  748. #define CORE_PIN9_BITMASK (1<<(CORE_PIN9_BIT))
  749. #define CORE_PIN10_BITMASK (1<<(CORE_PIN10_BIT))
  750. #define CORE_PIN11_BITMASK (1<<(CORE_PIN11_BIT))
  751. #define CORE_PIN12_BITMASK (1<<(CORE_PIN12_BIT))
  752. #define CORE_PIN13_BITMASK (1<<(CORE_PIN13_BIT))
  753. #define CORE_PIN14_BITMASK (1<<(CORE_PIN14_BIT))
  754. #define CORE_PIN15_BITMASK (1<<(CORE_PIN15_BIT))
  755. #define CORE_PIN16_BITMASK (1<<(CORE_PIN16_BIT))
  756. #define CORE_PIN17_BITMASK (1<<(CORE_PIN17_BIT))
  757. #define CORE_PIN18_BITMASK (1<<(CORE_PIN18_BIT))
  758. #define CORE_PIN19_BITMASK (1<<(CORE_PIN19_BIT))
  759. #define CORE_PIN20_BITMASK (1<<(CORE_PIN20_BIT))
  760. #define CORE_PIN21_BITMASK (1<<(CORE_PIN21_BIT))
  761. #define CORE_PIN22_BITMASK (1<<(CORE_PIN22_BIT))
  762. #define CORE_PIN23_BITMASK (1<<(CORE_PIN23_BIT))
  763. #define CORE_PIN24_BITMASK (1<<(CORE_PIN24_BIT))
  764. #define CORE_PIN25_BITMASK (1<<(CORE_PIN25_BIT))
  765. #define CORE_PIN26_BITMASK (1<<(CORE_PIN26_BIT))
  766. #define CORE_PIN27_BITMASK (1<<(CORE_PIN27_BIT))
  767. #define CORE_PIN28_BITMASK (1<<(CORE_PIN28_BIT))
  768. #define CORE_PIN29_BITMASK (1<<(CORE_PIN29_BIT))
  769. #define CORE_PIN30_BITMASK (1<<(CORE_PIN30_BIT))
  770. #define CORE_PIN31_BITMASK (1<<(CORE_PIN31_BIT))
  771. #define CORE_PIN32_BITMASK (1<<(CORE_PIN32_BIT))
  772. #define CORE_PIN33_BITMASK (1<<(CORE_PIN33_BIT))
  773. #define CORE_PIN34_BITMASK (1<<(CORE_PIN34_BIT))
  774. #define CORE_PIN35_BITMASK (1<<(CORE_PIN35_BIT))
  775. #define CORE_PIN36_BITMASK (1<<(CORE_PIN36_BIT))
  776. #define CORE_PIN37_BITMASK (1<<(CORE_PIN37_BIT))
  777. #define CORE_PIN38_BITMASK (1<<(CORE_PIN38_BIT))
  778. #define CORE_PIN39_BITMASK (1<<(CORE_PIN39_BIT))
  779. #define CORE_PIN0_PORTREG GPIOB_PDOR
  780. #define CORE_PIN1_PORTREG GPIOB_PDOR
  781. #define CORE_PIN2_PORTREG GPIOD_PDOR
  782. #define CORE_PIN3_PORTREG GPIOA_PDOR
  783. #define CORE_PIN4_PORTREG GPIOA_PDOR
  784. #define CORE_PIN5_PORTREG GPIOD_PDOR
  785. #define CORE_PIN6_PORTREG GPIOD_PDOR
  786. #define CORE_PIN7_PORTREG GPIOD_PDOR
  787. #define CORE_PIN8_PORTREG GPIOD_PDOR
  788. #define CORE_PIN9_PORTREG GPIOC_PDOR
  789. #define CORE_PIN10_PORTREG GPIOC_PDOR
  790. #define CORE_PIN11_PORTREG GPIOC_PDOR
  791. #define CORE_PIN12_PORTREG GPIOC_PDOR
  792. #define CORE_PIN13_PORTREG GPIOC_PDOR
  793. #define CORE_PIN14_PORTREG GPIOD_PDOR
  794. #define CORE_PIN15_PORTREG GPIOC_PDOR
  795. #define CORE_PIN16_PORTREG GPIOB_PDOR
  796. #define CORE_PIN17_PORTREG GPIOB_PDOR
  797. #define CORE_PIN18_PORTREG GPIOB_PDOR
  798. #define CORE_PIN19_PORTREG GPIOB_PDOR
  799. #define CORE_PIN20_PORTREG GPIOD_PDOR
  800. #define CORE_PIN21_PORTREG GPIOD_PDOR
  801. #define CORE_PIN22_PORTREG GPIOC_PDOR
  802. #define CORE_PIN23_PORTREG GPIOC_PDOR
  803. #define CORE_PIN24_PORTREG GPIOE_PDOR
  804. #define CORE_PIN25_PORTREG GPIOA_PDOR
  805. #define CORE_PIN26_PORTREG GPIOA_PDOR
  806. #define CORE_PIN27_PORTREG GPIOA_PDOR
  807. #define CORE_PIN28_PORTREG GPIOA_PDOR
  808. #define CORE_PIN29_PORTREG GPIOB_PDOR
  809. #define CORE_PIN30_PORTREG GPIOB_PDOR
  810. #define CORE_PIN31_PORTREG GPIOB_PDOR
  811. #define CORE_PIN32_PORTREG GPIOB_PDOR
  812. #define CORE_PIN33_PORTREG GPIOE_PDOR
  813. #define CORE_PIN34_PORTREG GPIOE_PDOR
  814. #define CORE_PIN35_PORTREG GPIOC_PDOR
  815. #define CORE_PIN36_PORTREG GPIOC_PDOR
  816. #define CORE_PIN37_PORTREG GPIOC_PDOR
  817. #define CORE_PIN38_PORTREG GPIOC_PDOR
  818. #define CORE_PIN39_PORTREG GPIOA_PDOR
  819. #define CORE_PIN0_PORTSET GPIOB_PSOR
  820. #define CORE_PIN1_PORTSET GPIOB_PSOR
  821. #define CORE_PIN2_PORTSET GPIOD_PSOR
  822. #define CORE_PIN3_PORTSET GPIOA_PSOR
  823. #define CORE_PIN4_PORTSET GPIOA_PSOR
  824. #define CORE_PIN5_PORTSET GPIOD_PSOR
  825. #define CORE_PIN6_PORTSET GPIOD_PSOR
  826. #define CORE_PIN7_PORTSET GPIOD_PSOR
  827. #define CORE_PIN8_PORTSET GPIOD_PSOR
  828. #define CORE_PIN9_PORTSET GPIOC_PSOR
  829. #define CORE_PIN10_PORTSET GPIOC_PSOR
  830. #define CORE_PIN11_PORTSET GPIOC_PSOR
  831. #define CORE_PIN12_PORTSET GPIOC_PSOR
  832. #define CORE_PIN13_PORTSET GPIOC_PSOR
  833. #define CORE_PIN14_PORTSET GPIOD_PSOR
  834. #define CORE_PIN15_PORTSET GPIOC_PSOR
  835. #define CORE_PIN16_PORTSET GPIOB_PSOR
  836. #define CORE_PIN17_PORTSET GPIOB_PSOR
  837. #define CORE_PIN18_PORTSET GPIOB_PSOR
  838. #define CORE_PIN19_PORTSET GPIOB_PSOR
  839. #define CORE_PIN20_PORTSET GPIOD_PSOR
  840. #define CORE_PIN21_PORTSET GPIOD_PSOR
  841. #define CORE_PIN22_PORTSET GPIOC_PSOR
  842. #define CORE_PIN23_PORTSET GPIOC_PSOR
  843. #define CORE_PIN24_PORTSET GPIOE_PSOR
  844. #define CORE_PIN25_PORTSET GPIOA_PSOR
  845. #define CORE_PIN26_PORTSET GPIOA_PSOR
  846. #define CORE_PIN27_PORTSET GPIOA_PSOR
  847. #define CORE_PIN28_PORTSET GPIOA_PSOR
  848. #define CORE_PIN29_PORTSET GPIOB_PSOR
  849. #define CORE_PIN30_PORTSET GPIOB_PSOR
  850. #define CORE_PIN31_PORTSET GPIOB_PSOR
  851. #define CORE_PIN32_PORTSET GPIOB_PSOR
  852. #define CORE_PIN33_PORTSET GPIOE_PSOR
  853. #define CORE_PIN34_PORTSET GPIOE_PSOR
  854. #define CORE_PIN35_PORTSET GPIOC_PSOR
  855. #define CORE_PIN36_PORTSET GPIOC_PSOR
  856. #define CORE_PIN37_PORTSET GPIOC_PSOR
  857. #define CORE_PIN38_PORTSET GPIOC_PSOR
  858. #define CORE_PIN39_PORTSET GPIOA_PSOR
  859. #define CORE_PIN0_PORTCLEAR GPIOB_PCOR
  860. #define CORE_PIN1_PORTCLEAR GPIOB_PCOR
  861. #define CORE_PIN2_PORTCLEAR GPIOD_PCOR
  862. #define CORE_PIN3_PORTCLEAR GPIOA_PCOR
  863. #define CORE_PIN4_PORTCLEAR GPIOA_PCOR
  864. #define CORE_PIN5_PORTCLEAR GPIOD_PCOR
  865. #define CORE_PIN6_PORTCLEAR GPIOD_PCOR
  866. #define CORE_PIN7_PORTCLEAR GPIOD_PCOR
  867. #define CORE_PIN8_PORTCLEAR GPIOD_PCOR
  868. #define CORE_PIN9_PORTCLEAR GPIOC_PCOR
  869. #define CORE_PIN10_PORTCLEAR GPIOC_PCOR
  870. #define CORE_PIN11_PORTCLEAR GPIOC_PCOR
  871. #define CORE_PIN12_PORTCLEAR GPIOC_PCOR
  872. #define CORE_PIN13_PORTCLEAR GPIOC_PCOR
  873. #define CORE_PIN14_PORTCLEAR GPIOD_PCOR
  874. #define CORE_PIN15_PORTCLEAR GPIOC_PCOR
  875. #define CORE_PIN16_PORTCLEAR GPIOB_PCOR
  876. #define CORE_PIN17_PORTCLEAR GPIOB_PCOR
  877. #define CORE_PIN18_PORTCLEAR GPIOB_PCOR
  878. #define CORE_PIN19_PORTCLEAR GPIOB_PCOR
  879. #define CORE_PIN20_PORTCLEAR GPIOD_PCOR
  880. #define CORE_PIN21_PORTCLEAR GPIOD_PCOR
  881. #define CORE_PIN22_PORTCLEAR GPIOC_PCOR
  882. #define CORE_PIN23_PORTCLEAR GPIOC_PCOR
  883. #define CORE_PIN24_PORTCLEAR GPIOE_PCOR
  884. #define CORE_PIN25_PORTCLEAR GPIOA_PCOR
  885. #define CORE_PIN26_PORTCLEAR GPIOA_PCOR
  886. #define CORE_PIN27_PORTCLEAR GPIOA_PCOR
  887. #define CORE_PIN28_PORTCLEAR GPIOA_PCOR
  888. #define CORE_PIN29_PORTCLEAR GPIOB_PCOR
  889. #define CORE_PIN30_PORTCLEAR GPIOB_PCOR
  890. #define CORE_PIN31_PORTCLEAR GPIOB_PCOR
  891. #define CORE_PIN32_PORTCLEAR GPIOB_PCOR
  892. #define CORE_PIN33_PORTCLEAR GPIOE_PCOR
  893. #define CORE_PIN34_PORTCLEAR GPIOE_PCOR
  894. #define CORE_PIN35_PORTCLEAR GPIOC_PCOR
  895. #define CORE_PIN36_PORTCLEAR GPIOC_PCOR
  896. #define CORE_PIN37_PORTCLEAR GPIOC_PCOR
  897. #define CORE_PIN38_PORTCLEAR GPIOC_PCOR
  898. #define CORE_PIN39_PORTCLEAR GPIOA_PCOR
  899. #define CORE_PIN0_DDRREG GPIOB_PDDR
  900. #define CORE_PIN1_DDRREG GPIOB_PDDR
  901. #define CORE_PIN2_DDRREG GPIOD_PDDR
  902. #define CORE_PIN3_DDRREG GPIOA_PDDR
  903. #define CORE_PIN4_DDRREG GPIOA_PDDR
  904. #define CORE_PIN5_DDRREG GPIOD_PDDR
  905. #define CORE_PIN6_DDRREG GPIOD_PDDR
  906. #define CORE_PIN7_DDRREG GPIOD_PDDR
  907. #define CORE_PIN8_DDRREG GPIOD_PDDR
  908. #define CORE_PIN9_DDRREG GPIOC_PDDR
  909. #define CORE_PIN10_DDRREG GPIOC_PDDR
  910. #define CORE_PIN11_DDRREG GPIOC_PDDR
  911. #define CORE_PIN12_DDRREG GPIOC_PDDR
  912. #define CORE_PIN13_DDRREG GPIOC_PDDR
  913. #define CORE_PIN14_DDRREG GPIOD_PDDR
  914. #define CORE_PIN15_DDRREG GPIOC_PDDR
  915. #define CORE_PIN16_DDRREG GPIOB_PDDR
  916. #define CORE_PIN17_DDRREG GPIOB_PDDR
  917. #define CORE_PIN18_DDRREG GPIOB_PDDR
  918. #define CORE_PIN19_DDRREG GPIOB_PDDR
  919. #define CORE_PIN20_DDRREG GPIOD_PDDR
  920. #define CORE_PIN21_DDRREG GPIOD_PDDR
  921. #define CORE_PIN22_DDRREG GPIOC_PDDR
  922. #define CORE_PIN23_DDRREG GPIOC_PDDR
  923. #define CORE_PIN24_DDRREG GPIOE_PDDR
  924. #define CORE_PIN25_DDRREG GPIOA_PDDR
  925. #define CORE_PIN26_DDRREG GPIOA_PDDR
  926. #define CORE_PIN27_DDRREG GPIOA_PDDR
  927. #define CORE_PIN28_DDRREG GPIOA_PDDR
  928. #define CORE_PIN29_DDRREG GPIOB_PDDR
  929. #define CORE_PIN30_DDRREG GPIOB_PDDR
  930. #define CORE_PIN31_DDRREG GPIOB_PDDR
  931. #define CORE_PIN32_DDRREG GPIOB_PDDR
  932. #define CORE_PIN33_DDRREG GPIOE_PDDR
  933. #define CORE_PIN34_DDRREG GPIOE_PDDR
  934. #define CORE_PIN35_DDRREG GPIOC_PDDR
  935. #define CORE_PIN36_DDRREG GPIOC_PDDR
  936. #define CORE_PIN37_DDRREG GPIOC_PDDR
  937. #define CORE_PIN38_DDRREG GPIOC_PDDR
  938. #define CORE_PIN39_DDRREG GPIOA_PDDR
  939. #define CORE_PIN0_PINREG GPIOB_PDIR
  940. #define CORE_PIN1_PINREG GPIOB_PDIR
  941. #define CORE_PIN2_PINREG GPIOD_PDIR
  942. #define CORE_PIN3_PINREG GPIOA_PDIR
  943. #define CORE_PIN4_PINREG GPIOA_PDIR
  944. #define CORE_PIN5_PINREG GPIOD_PDIR
  945. #define CORE_PIN6_PINREG GPIOD_PDIR
  946. #define CORE_PIN7_PINREG GPIOD_PDIR
  947. #define CORE_PIN8_PINREG GPIOD_PDIR
  948. #define CORE_PIN9_PINREG GPIOC_PDIR
  949. #define CORE_PIN10_PINREG GPIOC_PDIR
  950. #define CORE_PIN11_PINREG GPIOC_PDIR
  951. #define CORE_PIN12_PINREG GPIOC_PDIR
  952. #define CORE_PIN13_PINREG GPIOC_PDIR
  953. #define CORE_PIN14_PINREG GPIOD_PDIR
  954. #define CORE_PIN15_PINREG GPIOC_PDIR
  955. #define CORE_PIN16_PINREG GPIOB_PDIR
  956. #define CORE_PIN17_PINREG GPIOB_PDIR
  957. #define CORE_PIN18_PINREG GPIOB_PDIR
  958. #define CORE_PIN19_PINREG GPIOB_PDIR
  959. #define CORE_PIN20_PINREG GPIOD_PDIR
  960. #define CORE_PIN21_PINREG GPIOD_PDIR
  961. #define CORE_PIN22_PINREG GPIOC_PDIR
  962. #define CORE_PIN23_PINREG GPIOC_PDIR
  963. #define CORE_PIN24_PINREG GPIOE_PDIR
  964. #define CORE_PIN25_PINREG GPIOA_PDIR
  965. #define CORE_PIN26_PINREG GPIOA_PDIR
  966. #define CORE_PIN27_PINREG GPIOA_PDIR
  967. #define CORE_PIN28_PINREG GPIOA_PDIR
  968. #define CORE_PIN29_PINREG GPIOB_PDIR
  969. #define CORE_PIN30_PINREG GPIOB_PDIR
  970. #define CORE_PIN31_PINREG GPIOB_PDIR
  971. #define CORE_PIN32_PINREG GPIOB_PDIR
  972. #define CORE_PIN33_PINREG GPIOE_PDIR
  973. #define CORE_PIN34_PINREG GPIOE_PDIR
  974. #define CORE_PIN35_PINREG GPIOC_PDIR
  975. #define CORE_PIN36_PINREG GPIOC_PDIR
  976. #define CORE_PIN37_PINREG GPIOC_PDIR
  977. #define CORE_PIN38_PINREG GPIOC_PDIR
  978. #define CORE_PIN39_PINREG GPIOA_PDIR
  979. #define CORE_PIN0_CONFIG PORTB_PCR16
  980. #define CORE_PIN1_CONFIG PORTB_PCR17
  981. #define CORE_PIN2_CONFIG PORTD_PCR0
  982. #define CORE_PIN3_CONFIG PORTA_PCR12
  983. #define CORE_PIN4_CONFIG PORTA_PCR13
  984. #define CORE_PIN5_CONFIG PORTD_PCR7
  985. #define CORE_PIN6_CONFIG PORTD_PCR4
  986. #define CORE_PIN7_CONFIG PORTD_PCR2
  987. #define CORE_PIN8_CONFIG PORTD_PCR3
  988. #define CORE_PIN9_CONFIG PORTC_PCR3
  989. #define CORE_PIN10_CONFIG PORTC_PCR4
  990. #define CORE_PIN11_CONFIG PORTC_PCR6
  991. #define CORE_PIN12_CONFIG PORTC_PCR7
  992. #define CORE_PIN13_CONFIG PORTC_PCR5
  993. #define CORE_PIN14_CONFIG PORTD_PCR1
  994. #define CORE_PIN15_CONFIG PORTC_PCR0
  995. #define CORE_PIN16_CONFIG PORTB_PCR0
  996. #define CORE_PIN17_CONFIG PORTB_PCR1
  997. #define CORE_PIN18_CONFIG PORTB_PCR3
  998. #define CORE_PIN19_CONFIG PORTB_PCR2
  999. #define CORE_PIN20_CONFIG PORTD_PCR5
  1000. #define CORE_PIN21_CONFIG PORTD_PCR6
  1001. #define CORE_PIN22_CONFIG PORTC_PCR1
  1002. #define CORE_PIN23_CONFIG PORTC_PCR2
  1003. #define CORE_PIN24_CONFIG PORTE_PCR26
  1004. #define CORE_PIN25_CONFIG PORTA_PCR5
  1005. #define CORE_PIN26_CONFIG PORTA_PCR14
  1006. #define CORE_PIN27_CONFIG PORTA_PCR15
  1007. #define CORE_PIN28_CONFIG PORTA_PCR16
  1008. #define CORE_PIN29_CONFIG PORTB_PCR18
  1009. #define CORE_PIN30_CONFIG PORTB_PCR19
  1010. #define CORE_PIN31_CONFIG PORTB_PCR10
  1011. #define CORE_PIN32_CONFIG PORTB_PCR11
  1012. #define CORE_PIN33_CONFIG PORTE_PCR24
  1013. #define CORE_PIN34_CONFIG PORTE_PCR25
  1014. #define CORE_PIN35_CONFIG PORTC_PCR8
  1015. #define CORE_PIN36_CONFIG PORTC_PCR9
  1016. #define CORE_PIN37_CONFIG PORTC_PCR10
  1017. #define CORE_PIN38_CONFIG PORTC_PCR11
  1018. #define CORE_PIN39_CONFIG PORTA_PCR17
  1019. #define CORE_ADC0_PIN 14
  1020. #define CORE_ADC1_PIN 15
  1021. #define CORE_ADC2_PIN 16
  1022. #define CORE_ADC3_PIN 17
  1023. #define CORE_ADC4_PIN 18
  1024. #define CORE_ADC5_PIN 19
  1025. #define CORE_ADC6_PIN 20
  1026. #define CORE_ADC7_PIN 21
  1027. #define CORE_ADC8_PIN 22
  1028. #define CORE_ADC9_PIN 23
  1029. #define CORE_ADC10_PIN 40
  1030. #define CORE_ADC11_PIN 41
  1031. #define CORE_ADC12_PIN 31
  1032. #define CORE_ADC13_PIN 32
  1033. #define CORE_ADC14_PIN 33
  1034. #define CORE_ADC15_PIN 34
  1035. #define CORE_ADC16_PIN 35
  1036. #define CORE_ADC17_PIN 36
  1037. #define CORE_ADC18_PIN 37
  1038. #define CORE_ADC19_PIN 38
  1039. #define CORE_ADC20_PIN 39
  1040. #define CORE_RXD0_PIN 0
  1041. #define CORE_TXD0_PIN 1
  1042. #define CORE_RXD1_PIN 9
  1043. #define CORE_TXD1_PIN 10
  1044. #define CORE_RXD2_PIN 7
  1045. #define CORE_TXD2_PIN 8
  1046. #define CORE_RXD3_PIN 31
  1047. #define CORE_TXD3_PIN 32
  1048. #define CORE_RXD4_PIN 34
  1049. #define CORE_TXD4_PIN 33
  1050. #define CORE_INT0_PIN 0
  1051. #define CORE_INT1_PIN 1
  1052. #define CORE_INT2_PIN 2
  1053. #define CORE_INT3_PIN 3
  1054. #define CORE_INT4_PIN 4
  1055. #define CORE_INT5_PIN 5
  1056. #define CORE_INT6_PIN 6
  1057. #define CORE_INT7_PIN 7
  1058. #define CORE_INT8_PIN 8
  1059. #define CORE_INT9_PIN 9
  1060. #define CORE_INT10_PIN 10
  1061. #define CORE_INT11_PIN 11
  1062. #define CORE_INT12_PIN 12
  1063. #define CORE_INT13_PIN 13
  1064. #define CORE_INT14_PIN 14
  1065. #define CORE_INT15_PIN 15
  1066. #define CORE_INT16_PIN 16
  1067. #define CORE_INT17_PIN 17
  1068. #define CORE_INT18_PIN 18
  1069. #define CORE_INT19_PIN 19
  1070. #define CORE_INT20_PIN 20
  1071. #define CORE_INT21_PIN 21
  1072. #define CORE_INT22_PIN 22
  1073. #define CORE_INT23_PIN 23
  1074. #define CORE_INT24_PIN 24
  1075. #define CORE_INT25_PIN 25
  1076. #define CORE_INT26_PIN 26
  1077. #define CORE_INT27_PIN 27
  1078. #define CORE_INT28_PIN 28
  1079. #define CORE_INT29_PIN 29
  1080. #define CORE_INT30_PIN 30
  1081. #define CORE_INT31_PIN 31
  1082. #define CORE_INT32_PIN 32
  1083. #define CORE_INT33_PIN 33
  1084. #define CORE_INT34_PIN 34
  1085. #define CORE_INT35_PIN 35
  1086. #define CORE_INT36_PIN 36
  1087. #define CORE_INT37_PIN 37
  1088. #define CORE_INT38_PIN 38
  1089. #define CORE_INT39_PIN 39
  1090. #define CORE_INT_EVERY_PIN 1
  1091. #endif
  1092. #ifdef __cplusplus
  1093. extern "C" {
  1094. #endif
  1095. void digitalWrite(uint8_t pin, uint8_t val);
  1096. static inline void digitalWriteFast(uint8_t pin, uint8_t val) __attribute__((always_inline, unused));
  1097. static inline void digitalWriteFast(uint8_t pin, uint8_t val)
  1098. {
  1099. if (__builtin_constant_p(pin)) {
  1100. if (val) {
  1101. if (pin == 0) {
  1102. CORE_PIN0_PORTSET = CORE_PIN0_BITMASK;
  1103. } else if (pin == 1) {
  1104. CORE_PIN1_PORTSET = CORE_PIN1_BITMASK;
  1105. } else if (pin == 2) {
  1106. CORE_PIN2_PORTSET = CORE_PIN2_BITMASK;
  1107. } else if (pin == 3) {
  1108. CORE_PIN3_PORTSET = CORE_PIN3_BITMASK;
  1109. } else if (pin == 4) {
  1110. CORE_PIN4_PORTSET = CORE_PIN4_BITMASK;
  1111. } else if (pin == 5) {
  1112. CORE_PIN5_PORTSET = CORE_PIN5_BITMASK;
  1113. } else if (pin == 6) {
  1114. CORE_PIN6_PORTSET = CORE_PIN6_BITMASK;
  1115. } else if (pin == 7) {
  1116. CORE_PIN7_PORTSET = CORE_PIN7_BITMASK;
  1117. } else if (pin == 8) {
  1118. CORE_PIN8_PORTSET = CORE_PIN8_BITMASK;
  1119. } else if (pin == 9) {
  1120. CORE_PIN9_PORTSET = CORE_PIN9_BITMASK;
  1121. } else if (pin == 10) {
  1122. CORE_PIN10_PORTSET = CORE_PIN10_BITMASK;
  1123. } else if (pin == 11) {
  1124. CORE_PIN11_PORTSET = CORE_PIN11_BITMASK;
  1125. } else if (pin == 12) {
  1126. CORE_PIN12_PORTSET = CORE_PIN12_BITMASK;
  1127. } else if (pin == 13) {
  1128. CORE_PIN13_PORTSET = CORE_PIN13_BITMASK;
  1129. } else if (pin == 14) {
  1130. CORE_PIN14_PORTSET = CORE_PIN14_BITMASK;
  1131. } else if (pin == 15) {
  1132. CORE_PIN15_PORTSET = CORE_PIN15_BITMASK;
  1133. } else if (pin == 16) {
  1134. CORE_PIN16_PORTSET = CORE_PIN16_BITMASK;
  1135. } else if (pin == 17) {
  1136. CORE_PIN17_PORTSET = CORE_PIN17_BITMASK;
  1137. } else if (pin == 18) {
  1138. CORE_PIN18_PORTSET = CORE_PIN18_BITMASK;
  1139. } else if (pin == 19) {
  1140. CORE_PIN19_PORTSET = CORE_PIN19_BITMASK;
  1141. } else if (pin == 20) {
  1142. CORE_PIN20_PORTSET = CORE_PIN20_BITMASK;
  1143. } else if (pin == 21) {
  1144. CORE_PIN21_PORTSET = CORE_PIN21_BITMASK;
  1145. } else if (pin == 22) {
  1146. CORE_PIN22_PORTSET = CORE_PIN22_BITMASK;
  1147. } else if (pin == 23) {
  1148. CORE_PIN23_PORTSET = CORE_PIN23_BITMASK;
  1149. } else if (pin == 24) {
  1150. CORE_PIN24_PORTSET = CORE_PIN24_BITMASK;
  1151. } else if (pin == 25) {
  1152. CORE_PIN25_PORTSET = CORE_PIN25_BITMASK;
  1153. } else if (pin == 26) {
  1154. CORE_PIN26_PORTSET = CORE_PIN26_BITMASK;
  1155. }
  1156. #if defined(CORE_PIN27_PORTSET)
  1157. else if (pin == 27) {
  1158. CORE_PIN27_PORTSET = CORE_PIN27_BITMASK;
  1159. } else if (pin == 28) {
  1160. CORE_PIN28_PORTSET = CORE_PIN28_BITMASK;
  1161. } else if (pin == 29) {
  1162. CORE_PIN29_PORTSET = CORE_PIN29_BITMASK;
  1163. } else if (pin == 30) {
  1164. CORE_PIN30_PORTSET = CORE_PIN30_BITMASK;
  1165. } else if (pin == 31) {
  1166. CORE_PIN31_PORTSET = CORE_PIN31_BITMASK;
  1167. } else if (pin == 32) {
  1168. CORE_PIN32_PORTSET = CORE_PIN32_BITMASK;
  1169. } else if (pin == 33) {
  1170. CORE_PIN33_PORTSET = CORE_PIN33_BITMASK;
  1171. }
  1172. #endif
  1173. #if defined(CORE_PIN34_PORTSET)
  1174. else if (pin == 34) {
  1175. CORE_PIN34_PORTSET = CORE_PIN34_BITMASK;
  1176. } else if (pin == 35) {
  1177. CORE_PIN35_PORTSET = CORE_PIN35_BITMASK;
  1178. } else if (pin == 36) {
  1179. CORE_PIN36_PORTSET = CORE_PIN36_BITMASK;
  1180. } else if (pin == 37) {
  1181. CORE_PIN37_PORTSET = CORE_PIN37_BITMASK;
  1182. } else if (pin == 38) {
  1183. CORE_PIN38_PORTSET = CORE_PIN38_BITMASK;
  1184. } else if (pin == 39) {
  1185. CORE_PIN39_PORTSET = CORE_PIN39_BITMASK;
  1186. }
  1187. #endif
  1188. } else {
  1189. if (pin == 0) {
  1190. CORE_PIN0_PORTCLEAR = CORE_PIN0_BITMASK;
  1191. } else if (pin == 1) {
  1192. CORE_PIN1_PORTCLEAR = CORE_PIN1_BITMASK;
  1193. } else if (pin == 2) {
  1194. CORE_PIN2_PORTCLEAR = CORE_PIN2_BITMASK;
  1195. } else if (pin == 3) {
  1196. CORE_PIN3_PORTCLEAR = CORE_PIN3_BITMASK;
  1197. } else if (pin == 4) {
  1198. CORE_PIN4_PORTCLEAR = CORE_PIN4_BITMASK;
  1199. } else if (pin == 5) {
  1200. CORE_PIN5_PORTCLEAR = CORE_PIN5_BITMASK;
  1201. } else if (pin == 6) {
  1202. CORE_PIN6_PORTCLEAR = CORE_PIN6_BITMASK;
  1203. } else if (pin == 7) {
  1204. CORE_PIN7_PORTCLEAR = CORE_PIN7_BITMASK;
  1205. } else if (pin == 8) {
  1206. CORE_PIN8_PORTCLEAR = CORE_PIN8_BITMASK;
  1207. } else if (pin == 9) {
  1208. CORE_PIN9_PORTCLEAR = CORE_PIN9_BITMASK;
  1209. } else if (pin == 10) {
  1210. CORE_PIN10_PORTCLEAR = CORE_PIN10_BITMASK;
  1211. } else if (pin == 11) {
  1212. CORE_PIN11_PORTCLEAR = CORE_PIN11_BITMASK;
  1213. } else if (pin == 12) {
  1214. CORE_PIN12_PORTCLEAR = CORE_PIN12_BITMASK;
  1215. } else if (pin == 13) {
  1216. CORE_PIN13_PORTCLEAR = CORE_PIN13_BITMASK;
  1217. } else if (pin == 14) {
  1218. CORE_PIN14_PORTCLEAR = CORE_PIN14_BITMASK;
  1219. } else if (pin == 15) {
  1220. CORE_PIN15_PORTCLEAR = CORE_PIN15_BITMASK;
  1221. } else if (pin == 16) {
  1222. CORE_PIN16_PORTCLEAR = CORE_PIN16_BITMASK;
  1223. } else if (pin == 17) {
  1224. CORE_PIN17_PORTCLEAR = CORE_PIN17_BITMASK;
  1225. } else if (pin == 18) {
  1226. CORE_PIN18_PORTCLEAR = CORE_PIN18_BITMASK;
  1227. } else if (pin == 19) {
  1228. CORE_PIN19_PORTCLEAR = CORE_PIN19_BITMASK;
  1229. } else if (pin == 20) {
  1230. CORE_PIN20_PORTCLEAR = CORE_PIN20_BITMASK;
  1231. } else if (pin == 21) {
  1232. CORE_PIN21_PORTCLEAR = CORE_PIN21_BITMASK;
  1233. } else if (pin == 22) {
  1234. CORE_PIN22_PORTCLEAR = CORE_PIN22_BITMASK;
  1235. } else if (pin == 23) {
  1236. CORE_PIN23_PORTCLEAR = CORE_PIN23_BITMASK;
  1237. } else if (pin == 24) {
  1238. CORE_PIN24_PORTCLEAR = CORE_PIN24_BITMASK;
  1239. } else if (pin == 25) {
  1240. CORE_PIN25_PORTCLEAR = CORE_PIN25_BITMASK;
  1241. } else if (pin == 26) {
  1242. CORE_PIN26_PORTCLEAR = CORE_PIN26_BITMASK;
  1243. }
  1244. #if defined(CORE_PIN27_PORTCLEAR)
  1245. else if (pin == 27) {
  1246. CORE_PIN27_PORTCLEAR = CORE_PIN27_BITMASK;
  1247. } else if (pin == 28) {
  1248. CORE_PIN28_PORTCLEAR = CORE_PIN28_BITMASK;
  1249. } else if (pin == 29) {
  1250. CORE_PIN29_PORTCLEAR = CORE_PIN29_BITMASK;
  1251. } else if (pin == 30) {
  1252. CORE_PIN30_PORTCLEAR = CORE_PIN30_BITMASK;
  1253. } else if (pin == 31) {
  1254. CORE_PIN31_PORTCLEAR = CORE_PIN31_BITMASK;
  1255. } else if (pin == 32) {
  1256. CORE_PIN32_PORTCLEAR = CORE_PIN32_BITMASK;
  1257. } else if (pin == 33) {
  1258. CORE_PIN33_PORTCLEAR = CORE_PIN33_BITMASK;
  1259. }
  1260. #endif
  1261. #if defined(CORE_PIN34_PORTCLEAR)
  1262. else if (pin == 34) {
  1263. CORE_PIN34_PORTCLEAR = CORE_PIN34_BITMASK;
  1264. } else if (pin == 35) {
  1265. CORE_PIN35_PORTCLEAR = CORE_PIN35_BITMASK;
  1266. } else if (pin == 36) {
  1267. CORE_PIN36_PORTCLEAR = CORE_PIN36_BITMASK;
  1268. } else if (pin == 37) {
  1269. CORE_PIN37_PORTCLEAR = CORE_PIN37_BITMASK;
  1270. } else if (pin == 38) {
  1271. CORE_PIN38_PORTCLEAR = CORE_PIN38_BITMASK;
  1272. } else if (pin == 39) {
  1273. CORE_PIN39_PORTCLEAR = CORE_PIN39_BITMASK;
  1274. }
  1275. #endif
  1276. }
  1277. } else {
  1278. if (val) {
  1279. *portSetRegister(pin) = digitalPinToBitMask(pin);
  1280. } else {
  1281. *portClearRegister(pin) = digitalPinToBitMask(pin);
  1282. }
  1283. }
  1284. }
  1285. uint8_t digitalRead(uint8_t pin);
  1286. static inline uint8_t digitalReadFast(uint8_t pin) __attribute__((always_inline, unused));
  1287. static inline uint8_t digitalReadFast(uint8_t pin)
  1288. {
  1289. if (__builtin_constant_p(pin)) {
  1290. if (pin == 0) {
  1291. return (CORE_PIN0_PINREG & CORE_PIN0_BITMASK) ? 1 : 0;
  1292. } else if (pin == 1) {
  1293. return (CORE_PIN1_PINREG & CORE_PIN1_BITMASK) ? 1 : 0;
  1294. } else if (pin == 2) {
  1295. return (CORE_PIN2_PINREG & CORE_PIN2_BITMASK) ? 1 : 0;
  1296. } else if (pin == 3) {
  1297. return (CORE_PIN3_PINREG & CORE_PIN3_BITMASK) ? 1 : 0;
  1298. } else if (pin == 4) {
  1299. return (CORE_PIN4_PINREG & CORE_PIN4_BITMASK) ? 1 : 0;
  1300. } else if (pin == 5) {
  1301. return (CORE_PIN5_PINREG & CORE_PIN5_BITMASK) ? 1 : 0;
  1302. } else if (pin == 6) {
  1303. return (CORE_PIN6_PINREG & CORE_PIN6_BITMASK) ? 1 : 0;
  1304. } else if (pin == 7) {
  1305. return (CORE_PIN7_PINREG & CORE_PIN7_BITMASK) ? 1 : 0;
  1306. } else if (pin == 8) {
  1307. return (CORE_PIN8_PINREG & CORE_PIN8_BITMASK) ? 1 : 0;
  1308. } else if (pin == 9) {
  1309. return (CORE_PIN9_PINREG & CORE_PIN9_BITMASK) ? 1 : 0;
  1310. } else if (pin == 10) {
  1311. return (CORE_PIN10_PINREG & CORE_PIN10_BITMASK) ? 1 : 0;
  1312. } else if (pin == 11) {
  1313. return (CORE_PIN11_PINREG & CORE_PIN11_BITMASK) ? 1 : 0;
  1314. } else if (pin == 12) {
  1315. return (CORE_PIN12_PINREG & CORE_PIN12_BITMASK) ? 1 : 0;
  1316. } else if (pin == 13) {
  1317. return (CORE_PIN13_PINREG & CORE_PIN13_BITMASK) ? 1 : 0;
  1318. } else if (pin == 14) {
  1319. return (CORE_PIN14_PINREG & CORE_PIN14_BITMASK) ? 1 : 0;
  1320. } else if (pin == 15) {
  1321. return (CORE_PIN15_PINREG & CORE_PIN15_BITMASK) ? 1 : 0;
  1322. } else if (pin == 16) {
  1323. return (CORE_PIN16_PINREG & CORE_PIN16_BITMASK) ? 1 : 0;
  1324. } else if (pin == 17) {
  1325. return (CORE_PIN17_PINREG & CORE_PIN17_BITMASK) ? 1 : 0;
  1326. } else if (pin == 18) {
  1327. return (CORE_PIN18_PINREG & CORE_PIN18_BITMASK) ? 1 : 0;
  1328. } else if (pin == 19) {
  1329. return (CORE_PIN19_PINREG & CORE_PIN19_BITMASK) ? 1 : 0;
  1330. } else if (pin == 20) {
  1331. return (CORE_PIN20_PINREG & CORE_PIN20_BITMASK) ? 1 : 0;
  1332. } else if (pin == 21) {
  1333. return (CORE_PIN21_PINREG & CORE_PIN21_BITMASK) ? 1 : 0;
  1334. } else if (pin == 22) {
  1335. return (CORE_PIN22_PINREG & CORE_PIN22_BITMASK) ? 1 : 0;
  1336. } else if (pin == 23) {
  1337. return (CORE_PIN23_PINREG & CORE_PIN23_BITMASK) ? 1 : 0;
  1338. } else if (pin == 24) {
  1339. return (CORE_PIN24_PINREG & CORE_PIN24_BITMASK) ? 1 : 0;
  1340. } else if (pin == 25) {
  1341. return (CORE_PIN25_PINREG & CORE_PIN25_BITMASK) ? 1 : 0;
  1342. } else if (pin == 26) {
  1343. return (CORE_PIN26_PINREG & CORE_PIN26_BITMASK) ? 1 : 0;
  1344. }
  1345. #if defined(CORE_PIN27_PINREG)
  1346. else if (pin == 27) {
  1347. return (CORE_PIN27_PINREG & CORE_PIN27_BITMASK) ? 1 : 0;
  1348. } else if (pin == 28) {
  1349. return (CORE_PIN28_PINREG & CORE_PIN28_BITMASK) ? 1 : 0;
  1350. } else if (pin == 29) {
  1351. return (CORE_PIN29_PINREG & CORE_PIN29_BITMASK) ? 1 : 0;
  1352. } else if (pin == 30) {
  1353. return (CORE_PIN30_PINREG & CORE_PIN30_BITMASK) ? 1 : 0;
  1354. } else if (pin == 31) {
  1355. return (CORE_PIN31_PINREG & CORE_PIN31_BITMASK) ? 1 : 0;
  1356. } else if (pin == 32) {
  1357. return (CORE_PIN32_PINREG & CORE_PIN32_BITMASK) ? 1 : 0;
  1358. } else if (pin == 33) {
  1359. return (CORE_PIN33_PINREG & CORE_PIN33_BITMASK) ? 1 : 0;
  1360. }
  1361. #endif
  1362. #if defined(CORE_PIN34_PINREG)
  1363. else if (pin == 34) {
  1364. return (CORE_PIN34_PINREG & CORE_PIN34_BITMASK) ? 1 : 0;
  1365. } else if (pin == 35) {
  1366. return (CORE_PIN35_PINREG & CORE_PIN35_BITMASK) ? 1 : 0;
  1367. } else if (pin == 36) {
  1368. return (CORE_PIN36_PINREG & CORE_PIN36_BITMASK) ? 1 : 0;
  1369. } else if (pin == 37) {
  1370. return (CORE_PIN37_PINREG & CORE_PIN37_BITMASK) ? 1 : 0;
  1371. } else if (pin == 38) {
  1372. return (CORE_PIN38_PINREG & CORE_PIN38_BITMASK) ? 1 : 0;
  1373. } else if (pin == 39) {
  1374. return (CORE_PIN39_PINREG & CORE_PIN39_BITMASK) ? 1 : 0;
  1375. }
  1376. #endif
  1377. else {
  1378. return 0;
  1379. }
  1380. } else {
  1381. #if defined(KINETISK)
  1382. return *portInputRegister(pin);
  1383. #else
  1384. return (*portInputRegister(pin) & digitalPinToBitMask(pin)) ? 1 : 0;
  1385. #endif
  1386. }
  1387. }
  1388. void pinMode(uint8_t pin, uint8_t mode);
  1389. void init_pins(void);
  1390. void analogWrite(uint8_t pin, int val);
  1391. void analogWriteRes(uint32_t bits);
  1392. static inline void analogWriteResolution(uint32_t bits) { analogWriteRes(bits); }
  1393. void analogWriteFrequency(uint8_t pin, float frequency);
  1394. void analogWriteDAC0(int val);
  1395. void analogWriteDAC1(int val);
  1396. #ifdef __cplusplus
  1397. void attachInterruptVector(IRQ_NUMBER_t irq, void (*function)(void));
  1398. #else
  1399. void attachInterruptVector(enum IRQ_NUMBER_t irq, void (*function)(void));
  1400. #endif
  1401. void attachInterrupt(uint8_t pin, void (*function)(void), int mode);
  1402. void detachInterrupt(uint8_t pin);
  1403. void _init_Teensyduino_internal_(void);
  1404. int analogRead(uint8_t pin);
  1405. void analogReference(uint8_t type);
  1406. void analogReadRes(unsigned int bits);
  1407. static inline void analogReadResolution(unsigned int bits) { analogReadRes(bits); }
  1408. void analogReadAveraging(unsigned int num);
  1409. void analog_init(void);
  1410. #if defined(__MK20DX128__) || defined(__MK20DX256__) || defined(__MK64FX512__) || defined(__MK66FX1M0__)
  1411. #define DEFAULT 0
  1412. #define INTERNAL 2
  1413. #define INTERNAL1V2 2
  1414. #define INTERNAL1V1 2
  1415. #define EXTERNAL 0
  1416. #elif defined(__MKL26Z64__)
  1417. #define DEFAULT 0
  1418. #define INTERNAL 0
  1419. #define EXTERNAL 1
  1420. #endif
  1421. int touchRead(uint8_t pin);
  1422. static inline void shiftOut(uint8_t, uint8_t, uint8_t, uint8_t) __attribute__((always_inline, unused));
  1423. extern void _shiftOut(uint8_t dataPin, uint8_t clockPin, uint8_t bitOrder, uint8_t value) __attribute__((noinline));
  1424. extern void shiftOut_lsbFirst(uint8_t dataPin, uint8_t clockPin, uint8_t value) __attribute__((noinline));
  1425. extern void shiftOut_msbFirst(uint8_t dataPin, uint8_t clockPin, uint8_t value) __attribute__((noinline));
  1426. static inline void shiftOut(uint8_t dataPin, uint8_t clockPin, uint8_t bitOrder, uint8_t value)
  1427. {
  1428. if (__builtin_constant_p(bitOrder)) {
  1429. if (bitOrder == LSBFIRST) {
  1430. shiftOut_lsbFirst(dataPin, clockPin, value);
  1431. } else {
  1432. shiftOut_msbFirst(dataPin, clockPin, value);
  1433. }
  1434. } else {
  1435. _shiftOut(dataPin, clockPin, bitOrder, value);
  1436. }
  1437. }
  1438. static inline uint8_t shiftIn(uint8_t, uint8_t, uint8_t) __attribute__((always_inline, unused));
  1439. extern uint8_t _shiftIn(uint8_t dataPin, uint8_t clockPin, uint8_t bitOrder) __attribute__((noinline));
  1440. extern uint8_t shiftIn_lsbFirst(uint8_t dataPin, uint8_t clockPin) __attribute__((noinline));
  1441. extern uint8_t shiftIn_msbFirst(uint8_t dataPin, uint8_t clockPin) __attribute__((noinline));
  1442. static inline uint8_t shiftIn(uint8_t dataPin, uint8_t clockPin, uint8_t bitOrder)
  1443. {
  1444. if (__builtin_constant_p(bitOrder)) {
  1445. if (bitOrder == LSBFIRST) {
  1446. return shiftIn_lsbFirst(dataPin, clockPin);
  1447. } else {
  1448. return shiftIn_msbFirst(dataPin, clockPin);
  1449. }
  1450. } else {
  1451. return _shiftIn(dataPin, clockPin, bitOrder);
  1452. }
  1453. }
  1454. void _reboot_Teensyduino_(void) __attribute__((noreturn));
  1455. void _restart_Teensyduino_(void) __attribute__((noreturn));
  1456. void yield(void);
  1457. void delay(uint32_t msec);
  1458. extern volatile uint32_t systick_millis_count;
  1459. static inline uint32_t millis(void) __attribute__((always_inline, unused));
  1460. static inline uint32_t millis(void)
  1461. {
  1462. return systick_millis_count; // single aligned 32 bit is atomic;
  1463. }
  1464. uint32_t micros(void);
  1465. static inline void delayMicroseconds(uint32_t) __attribute__((always_inline, unused));
  1466. static inline void delayMicroseconds(uint32_t usec)
  1467. {
  1468. #if F_CPU == 192000000
  1469. uint32_t n = usec * 64;
  1470. #elif F_CPU == 180000000
  1471. uint32_t n = usec * 60;
  1472. #elif F_CPU == 168000000
  1473. uint32_t n = usec * 56;
  1474. #elif F_CPU == 144000000
  1475. uint32_t n = usec * 48;
  1476. #elif F_CPU == 120000000
  1477. uint32_t n = usec * 40;
  1478. #elif F_CPU == 96000000
  1479. uint32_t n = usec << 5;
  1480. #elif F_CPU == 72000000
  1481. uint32_t n = usec * 24;
  1482. #elif F_CPU == 48000000
  1483. uint32_t n = usec << 4;
  1484. #elif F_CPU == 24000000
  1485. uint32_t n = usec << 3;
  1486. #elif F_CPU == 16000000
  1487. uint32_t n = usec << 2;
  1488. #elif F_CPU == 8000000
  1489. uint32_t n = usec << 1;
  1490. #elif F_CPU == 4000000
  1491. uint32_t n = usec;
  1492. #elif F_CPU == 2000000
  1493. uint32_t n = usec >> 1;
  1494. #endif
  1495. // changed because a delay of 1 micro Sec @ 2MHz will be 0
  1496. if (n == 0) return;
  1497. __asm__ volatile(
  1498. "L_%=_delayMicroseconds:" "\n\t"
  1499. #if F_CPU < 24000000
  1500. "nop" "\n\t"
  1501. #endif
  1502. #ifdef KINETISL
  1503. "sub %0, #1" "\n\t"
  1504. #else
  1505. "subs %0, #1" "\n\t"
  1506. #endif
  1507. "bne L_%=_delayMicroseconds" "\n"
  1508. : "+r" (n) :
  1509. );
  1510. }
  1511. #ifdef __cplusplus
  1512. }
  1513. #endif
  1514. #ifdef __cplusplus
  1515. extern "C" {
  1516. #endif
  1517. unsigned long rtc_get(void);
  1518. void rtc_set(unsigned long t);
  1519. void rtc_compensate(int adjust);
  1520. #ifdef __cplusplus
  1521. }
  1522. class teensy3_clock_class
  1523. {
  1524. public:
  1525. static unsigned long get(void) __attribute__((always_inline)) { return rtc_get(); }
  1526. static void set(unsigned long t) __attribute__((always_inline)) { rtc_set(t); }
  1527. static void compensate(int adj) __attribute__((always_inline)) { rtc_compensate(adj); }
  1528. };
  1529. extern teensy3_clock_class Teensy3Clock;
  1530. #endif
  1531. #endif