board.h 108 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743
  1. /*
  2. ChibiOS - Copyright (C) 2006..2017 Giovanni Di Sirio
  3. Licensed under the Apache License, Version 2.0 (the "License");
  4. you may not use this file except in compliance with the License.
  5. You may obtain a copy of the License at
  6. http://www.apache.org/licenses/LICENSE-2.0
  7. Unless required by applicable law or agreed to in writing, software
  8. distributed under the License is distributed on an "AS IS" BASIS,
  9. WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  10. See the License for the specific language governing permissions and
  11. limitations under the License.
  12. */
  13. /*
  14. * This file has been automatically generated using ChibiStudio board
  15. * generator plugin. Do not edit manually.
  16. */
  17. #ifndef BOARD_H
  18. #define BOARD_H
  19. /*===========================================================================*/
  20. /* Driver constants. */
  21. /*===========================================================================*/
  22. /*
  23. * Setup for STMicroelectronics STM32F469I-Discovery board.
  24. */
  25. /*
  26. * Board identifier.
  27. */
  28. #define BOARD_ST_STM32F469I_DISCOVERY
  29. #define BOARD_NAME "STMicroelectronics STM32F469I-Discovery"
  30. /*
  31. * Board oscillators-related settings.
  32. */
  33. #if !defined(STM32_LSECLK)
  34. #define STM32_LSECLK 32768U
  35. #endif
  36. #if !defined(STM32_HSECLK)
  37. #define STM32_HSECLK 8000000U
  38. #endif
  39. /*
  40. * Board voltages.
  41. * Required for performance limits calculation.
  42. */
  43. #define STM32_VDD 300U
  44. /*
  45. * MCU type as defined in the ST header.
  46. */
  47. #define STM32F469xx
  48. /*
  49. * IO pins assignments.
  50. */
  51. #define GPIOA_BUTTON 0U
  52. #define GPIOA_ARD_D3 1U
  53. #define GPIOA_TIM5_CH2 1U
  54. #define GPIOA_ARD_D5 2U
  55. #define GPIOA_TIM5_CH3 2U
  56. #define GPIOA_LCD_BL_CTRL 3U
  57. #define GPIOA_TIM5_CH4 3U
  58. #define GPIOA_ARD_A5 4U
  59. #define GPIOA_EXT_7 5U
  60. #define GPIOA_SPI1_SCK 5U
  61. #define GPIOA_ARD_D6 6U
  62. #define GPIOA_TIM3_CH1 6U
  63. #define GPIOA_ARD_D9 7U
  64. #define GPIOA_TIM3_CH2 7U
  65. #define GPIOA_EXT_3 8U
  66. #define GPIOA_MCO1 8U
  67. #define GPIOA_VBUS_FS1 9U
  68. #define GPIOA_USB_FS1_ID 10U
  69. #define GPIOA_USB_FS1_N 11U
  70. #define GPIOA_USB_FS1_P 12U
  71. #define GPIOA_SWDIO 13U
  72. #define GPIOA_SWCLK 14U
  73. #define GPIOA_EXT_11 15U
  74. #define GPIOA_SPI1_NSS 15U
  75. #define GPIOB_EXT_RESET 0U
  76. #define GPIOB_ARD_A0 1U
  77. #define GPIOB_OTG_FS1_POWERSWITCHON 2U
  78. #define GPIOB_I2S3_CK 3U
  79. #define GPIOB_SPI3_SCK 3U
  80. #define GPIOB_EXT_5 4U
  81. #define GPIOB_SPI1_MISO 4U
  82. #define GPIOB_EXT_9 5U
  83. #define GPIOB_SPI1_MOSI 5U
  84. #define GPIOB_QSPI_BK1_NCS 6U
  85. #define GPIOB_QSPI_FS1_OVERCURRENT 7U
  86. #define GPIOB_I2C1_SCL 8U
  87. #define GPIOB_I2C1_SDA 9U
  88. #define GPIOB_STLK_RX 10U
  89. #define GPIOB_STLK_TX 11U
  90. #define GPIOB_EXT_12 12U
  91. #define GPIOB_CAN2_RX 12U
  92. #define GPIOB_EXT_10 13U
  93. #define GPIOB_CAN2_TX 13U
  94. #define GPIOB_ARD_D12 14U
  95. #define GPIOB_SPI2_MISO 14U
  96. #define GPIOB_ARD_D11 15U
  97. #define GPIOB_SPI2_MOSI 15U
  98. #define GPIOC_SDNWE 0U
  99. #define GPIOC_EXT_14 1U
  100. #define GPIOC_ADC123_IN11 1U
  101. #define GPIOC_ARD_A1 2U
  102. #define GPIOC_ARD_A2 3U
  103. #define GPIOC_ARD_A3 4U
  104. #define GPIOC_ARD_A4 5U
  105. #define GPIOC_EXT_6 6U
  106. #define GPIOC_USART6_TX 6U
  107. #define GPIOC_EXT_8 7U
  108. #define GPIOC_USART6_RX 7U
  109. #define GPIOC_USD_D0 8U
  110. #define GPIOC_SDIO_D0 8U
  111. #define GPIOC_USD_D1 9U
  112. #define GPIOC_SDIO_D1 9U
  113. #define GPIOC_USD_D2 10U
  114. #define GPIOC_SDIO_D2 10U
  115. #define GPIOC_USD_D3 11U
  116. #define GPIOC_SDIO_D3 11U
  117. #define GPIOC_USD_CLK 12U
  118. #define GPIOC_SDIO_CK 12U
  119. #define GPIOC_EXT_13 13U
  120. #define GPIOC_ANTI_TAMP1 13U
  121. #define GPIOC_OSC32_IN 14U
  122. #define GPIOC_OSC32_OUT 15U
  123. #define GPIOD_PIN0 0U
  124. #define GPIOD_PIN1 1U
  125. #define GPIOD_USD_CMD 2U
  126. #define GPIOD_SDIO_CMD 2U
  127. #define GPIOD_ARD_D13 3U
  128. #define GPIOD_SPI2_SCK 3U
  129. #define GPIOD_LED2 4U
  130. #define GPIOD_LED3 5U
  131. #define GPIOD_MIC_DATA 6U
  132. #define GPIOD_SAI1_SD_A 6U
  133. #define GPIOD_PIN7 7U
  134. #define GPIOD_PIN8 8U
  135. #define GPIOD_PIN9 9U
  136. #define GPIOD_PIN10 10U
  137. #define GPIOD_PIN11 11U
  138. #define GPIOD_PIN12 12U
  139. #define GPIOD_MIC_CK 13U
  140. #define GPIOD_TIM4_CH2 13U
  141. #define GPIOD_PIN14 14U
  142. #define GPIOD_PIN15 15U
  143. #define GPIOE_FMC_NBL0 0U
  144. #define GPIOE_FMC_NBL1 1U
  145. #define GPIOE_AUDIO_RST 2U
  146. #define GPIOE_SPKR_HP 3U
  147. #define GPIOE_SAI1_FSA 4U
  148. #define GPIOE_SAI1_SCKA 5U
  149. #define GPIOE_SAI1_SDA 6U
  150. #define GPIOE_PIN7 7U
  151. #define GPIOE_PIN8 8U
  152. #define GPIOE_PIN9 9U
  153. #define GPIOE_PIN10 10U
  154. #define GPIOE_PIN11 11U
  155. #define GPIOE_PIN12 12U
  156. #define GPIOE_PIN13 13U
  157. #define GPIOE_PIN14 14U
  158. #define GPIOE_PIN15 15U
  159. #define GPIOF_PIN0 0U
  160. #define GPIOF_PIN1 1U
  161. #define GPIOF_PIN2 2U
  162. #define GPIOF_PIN3 3U
  163. #define GPIOF_PIN4 4U
  164. #define GPIOF_PIN5 5U
  165. #define GPIOF_QSPI_BK1_IO3 6U
  166. #define GPIOF_QSPI_BK1_IO2 7U
  167. #define GPIOF_QSPI_BK1_IO0 8U
  168. #define GPIOF_QSPI_BK1_IO1 9U
  169. #define GPIOF_QSPI_CLK 10U
  170. #define GPIOF_SDNRAS 11U
  171. #define GPIOF_PIN12 12U
  172. #define GPIOF_PIN13 13U
  173. #define GPIOF_PIN14 14U
  174. #define GPIOF_PIN15 15U
  175. #define GPIOG_PIN0 0U
  176. #define GPIOG_PIN1 1U
  177. #define GPIOG_USD_DETECT 2U
  178. #define GPIOG_PIN3 3U
  179. #define GPIOG_PIN4 4U
  180. #define GPIOG_PIN5 5U
  181. #define GPIOG_LED1 6U
  182. #define GPIOG_SAI1_MCLKA 7U
  183. #define GPIOG_SDCLK 8U
  184. #define GPIOG_ARD_D0 9U
  185. #define GPIOG_ARD_D8 10U
  186. #define GPIOG_ARD_D7 11U
  187. #define GPIOG_ARD_D4 12U
  188. #define GPIOG_ARD_D2 13U
  189. #define GPIOG_ARD_D1 14U
  190. #define GPIOG_SDNCAS 15U
  191. #define GPIOH_OSC_IN 0U
  192. #define GPIOH_OSC_OUT 1U
  193. #define GPIOH_SDCKE0 2U
  194. #define GPIOH_SDNE0 3U
  195. #define GPIOH_I2C2_SCL 4U
  196. #define GPIOH_I2C2_SDA 5U
  197. #define GPIOH_ARD_D10 6U
  198. #define GPIOH_SPI2_NSS 6U
  199. #define GPIOH_LCD_RESET 7U
  200. #define GPIOH_PIN8 8U
  201. #define GPIOH_PIN9 9U
  202. #define GPIOH_PIN10 10U
  203. #define GPIOH_PIN11 11U
  204. #define GPIOH_PIN12 12U
  205. #define GPIOH_PIN13 13U
  206. #define GPIOH_PIN14 14U
  207. #define GPIOH_PIN15 15U
  208. #define GPIOI_PIN0 0U
  209. #define GPIOI_PIN1 1U
  210. #define GPIOI_PIN2 2U
  211. #define GPIOI_PIN3 3U
  212. #define GPIOI_FMC_NBL2 4U
  213. #define GPIOI_FMC_NBL3 5U
  214. #define GPIOI_PIN6 6U
  215. #define GPIOI_PIN7 7U
  216. #define GPIOI_PIN8 8U
  217. #define GPIOI_PIN9 9U
  218. #define GPIOI_PIN10 10U
  219. #define GPIOI_PIN11 11U
  220. #define GPIOI_PIN12 12U
  221. #define GPIOI_PIN13 13U
  222. #define GPIOI_PIN14 14U
  223. #define GPIOI_PIN15 15U
  224. #define GPIOJ_PIN0 0U
  225. #define GPIOJ_PIN1 1U
  226. #define GPIOJ_DSI_TE 2U
  227. #define GPIOJ_PIN3 3U
  228. #define GPIOJ_PIN4 4U
  229. #define GPIOJ_LCD_INT 5U
  230. #define GPIOJ_PIN6 6U
  231. #define GPIOJ_PIN7 7U
  232. #define GPIOJ_PIN8 8U
  233. #define GPIOJ_PIN9 9U
  234. #define GPIOJ_PIN10 10U
  235. #define GPIOJ_PIN11 11U
  236. #define GPIOJ_PIN12 12U
  237. #define GPIOJ_PIN13 13U
  238. #define GPIOJ_PIN14 14U
  239. #define GPIOJ_PIN15 15U
  240. #define GPIOK_PIN0 0U
  241. #define GPIOK_PIN1 1U
  242. #define GPIOK_PIN2 2U
  243. #define GPIOK_LED4 3U
  244. #define GPIOK_PIN4 4U
  245. #define GPIOK_PIN5 5U
  246. #define GPIOK_PIN6 6U
  247. #define GPIOK_PIN7 7U
  248. #define GPIOK_PIN8 8U
  249. #define GPIOK_PIN9 9U
  250. #define GPIOK_PIN10 10U
  251. #define GPIOK_PIN11 11U
  252. #define GPIOK_PIN12 12U
  253. #define GPIOK_PIN13 13U
  254. #define GPIOK_PIN14 14U
  255. #define GPIOK_PIN15 15U
  256. /*
  257. * IO lines assignments.
  258. */
  259. #define LINE_BUTTON PAL_LINE(GPIOA, 0U)
  260. #define LINE_ARD_D3 PAL_LINE(GPIOA, 1U)
  261. #define LINE_TIM5_CH2 PAL_LINE(GPIOA, 1U)
  262. #define LINE_ARD_D5 PAL_LINE(GPIOA, 2U)
  263. #define LINE_TIM5_CH3 PAL_LINE(GPIOA, 2U)
  264. #define LINE_LCD_BL_CTRL PAL_LINE(GPIOA, 3U)
  265. #define LINE_TIM5_CH4 PAL_LINE(GPIOA, 3U)
  266. #define LINE_ARD_A5 PAL_LINE(GPIOA, 4U)
  267. #define LINE_EXT_7 PAL_LINE(GPIOA, 5U)
  268. #define LINE_SPI1_SCK PAL_LINE(GPIOA, 5U)
  269. #define LINE_ARD_D6 PAL_LINE(GPIOA, 6U)
  270. #define LINE_TIM3_CH1 PAL_LINE(GPIOA, 6U)
  271. #define LINE_ARD_D9 PAL_LINE(GPIOA, 7U)
  272. #define LINE_TIM3_CH2 PAL_LINE(GPIOA, 7U)
  273. #define LINE_EXT_3 PAL_LINE(GPIOA, 8U)
  274. #define LINE_MCO1 PAL_LINE(GPIOA, 8U)
  275. #define LINE_VBUS_FS1 PAL_LINE(GPIOA, 9U)
  276. #define LINE_USB_FS1_ID PAL_LINE(GPIOA, 10U)
  277. #define LINE_USB_FS1_N PAL_LINE(GPIOA, 11U)
  278. #define LINE_USB_FS1_P PAL_LINE(GPIOA, 12U)
  279. #define LINE_SWDIO PAL_LINE(GPIOA, 13U)
  280. #define LINE_SWCLK PAL_LINE(GPIOA, 14U)
  281. #define LINE_EXT_11 PAL_LINE(GPIOA, 15U)
  282. #define LINE_SPI1_NSS PAL_LINE(GPIOA, 15U)
  283. #define LINE_EXT_RESET PAL_LINE(GPIOB, 0U)
  284. #define LINE_ARD_A0 PAL_LINE(GPIOB, 1U)
  285. #define LINE_OTG_FS1_POWERSWITCHON PAL_LINE(GPIOB, 2U)
  286. #define LINE_I2S3_CK PAL_LINE(GPIOB, 3U)
  287. #define LINE_SPI3_SCK PAL_LINE(GPIOB, 3U)
  288. #define LINE_EXT_5 PAL_LINE(GPIOB, 4U)
  289. #define LINE_SPI1_MISO PAL_LINE(GPIOB, 4U)
  290. #define LINE_EXT_9 PAL_LINE(GPIOB, 5U)
  291. #define LINE_SPI1_MOSI PAL_LINE(GPIOB, 5U)
  292. #define LINE_QSPI_BK1_NCS PAL_LINE(GPIOB, 6U)
  293. #define LINE_QSPI_FS1_OVERCURRENT PAL_LINE(GPIOB, 7U)
  294. #define LINE_I2C1_SCL PAL_LINE(GPIOB, 8U)
  295. #define LINE_I2C1_SDA PAL_LINE(GPIOB, 9U)
  296. #define LINE_STLK_RX PAL_LINE(GPIOB, 10U)
  297. #define LINE_STLK_TX PAL_LINE(GPIOB, 11U)
  298. #define LINE_EXT_12 PAL_LINE(GPIOB, 12U)
  299. #define LINE_CAN2_RX PAL_LINE(GPIOB, 12U)
  300. #define LINE_EXT_10 PAL_LINE(GPIOB, 13U)
  301. #define LINE_CAN2_TX PAL_LINE(GPIOB, 13U)
  302. #define LINE_ARD_D12 PAL_LINE(GPIOB, 14U)
  303. #define LINE_SPI2_MISO PAL_LINE(GPIOB, 14U)
  304. #define LINE_ARD_D11 PAL_LINE(GPIOB, 15U)
  305. #define LINE_SPI2_MOSI PAL_LINE(GPIOB, 15U)
  306. #define LINE_SDNWE PAL_LINE(GPIOC, 0U)
  307. #define LINE_EXT_14 PAL_LINE(GPIOC, 1U)
  308. #define LINE_ADC123_IN11 PAL_LINE(GPIOC, 1U)
  309. #define LINE_ARD_A1 PAL_LINE(GPIOC, 2U)
  310. #define LINE_ARD_A2 PAL_LINE(GPIOC, 3U)
  311. #define LINE_ARD_A3 PAL_LINE(GPIOC, 4U)
  312. #define LINE_ARD_A4 PAL_LINE(GPIOC, 5U)
  313. #define LINE_EXT_6 PAL_LINE(GPIOC, 6U)
  314. #define LINE_USART6_TX PAL_LINE(GPIOC, 6U)
  315. #define LINE_EXT_8 PAL_LINE(GPIOC, 7U)
  316. #define LINE_USART6_RX PAL_LINE(GPIOC, 7U)
  317. #define LINE_USD_D0 PAL_LINE(GPIOC, 8U)
  318. #define LINE_SDIO_D0 PAL_LINE(GPIOC, 8U)
  319. #define LINE_USD_D1 PAL_LINE(GPIOC, 9U)
  320. #define LINE_SDIO_D1 PAL_LINE(GPIOC, 9U)
  321. #define LINE_USD_D2 PAL_LINE(GPIOC, 10U)
  322. #define LINE_SDIO_D2 PAL_LINE(GPIOC, 10U)
  323. #define LINE_USD_D3 PAL_LINE(GPIOC, 11U)
  324. #define LINE_SDIO_D3 PAL_LINE(GPIOC, 11U)
  325. #define LINE_USD_CLK PAL_LINE(GPIOC, 12U)
  326. #define LINE_SDIO_CK PAL_LINE(GPIOC, 12U)
  327. #define LINE_EXT_13 PAL_LINE(GPIOC, 13U)
  328. #define LINE_ANTI_TAMP1 PAL_LINE(GPIOC, 13U)
  329. #define LINE_OSC32_IN PAL_LINE(GPIOC, 14U)
  330. #define LINE_OSC32_OUT PAL_LINE(GPIOC, 15U)
  331. #define LINE_USD_CMD PAL_LINE(GPIOD, 2U)
  332. #define LINE_SDIO_CMD PAL_LINE(GPIOD, 2U)
  333. #define LINE_ARD_D13 PAL_LINE(GPIOD, 3U)
  334. #define LINE_SPI2_SCK PAL_LINE(GPIOD, 3U)
  335. #define LINE_LED2 PAL_LINE(GPIOD, 4U)
  336. #define LINE_LED3 PAL_LINE(GPIOD, 5U)
  337. #define LINE_MIC_DATA PAL_LINE(GPIOD, 6U)
  338. #define LINE_SAI1_SD_A PAL_LINE(GPIOD, 6U)
  339. #define LINE_MIC_CK PAL_LINE(GPIOD, 13U)
  340. #define LINE_TIM4_CH2 PAL_LINE(GPIOD, 13U)
  341. #define LINE_FMC_NBL0 PAL_LINE(GPIOE, 0U)
  342. #define LINE_FMC_NBL1 PAL_LINE(GPIOE, 1U)
  343. #define LINE_AUDIO_RST PAL_LINE(GPIOE, 2U)
  344. #define LINE_SPKR_HP PAL_LINE(GPIOE, 3U)
  345. #define LINE_SAI1_FSA PAL_LINE(GPIOE, 4U)
  346. #define LINE_SAI1_SCKA PAL_LINE(GPIOE, 5U)
  347. #define LINE_SAI1_SDA PAL_LINE(GPIOE, 6U)
  348. #define LINE_QSPI_BK1_IO3 PAL_LINE(GPIOF, 6U)
  349. #define LINE_QSPI_BK1_IO2 PAL_LINE(GPIOF, 7U)
  350. #define LINE_QSPI_BK1_IO0 PAL_LINE(GPIOF, 8U)
  351. #define LINE_QSPI_BK1_IO1 PAL_LINE(GPIOF, 9U)
  352. #define LINE_QSPI_CLK PAL_LINE(GPIOF, 10U)
  353. #define LINE_SDNRAS PAL_LINE(GPIOF, 11U)
  354. #define LINE_USD_DETECT PAL_LINE(GPIOG, 2U)
  355. #define LINE_LED1 PAL_LINE(GPIOG, 6U)
  356. #define LINE_SAI1_MCLKA PAL_LINE(GPIOG, 7U)
  357. #define LINE_SDCLK PAL_LINE(GPIOG, 8U)
  358. #define LINE_ARD_D0 PAL_LINE(GPIOG, 9U)
  359. #define LINE_ARD_D8 PAL_LINE(GPIOG, 10U)
  360. #define LINE_ARD_D7 PAL_LINE(GPIOG, 11U)
  361. #define LINE_ARD_D4 PAL_LINE(GPIOG, 12U)
  362. #define LINE_ARD_D2 PAL_LINE(GPIOG, 13U)
  363. #define LINE_ARD_D1 PAL_LINE(GPIOG, 14U)
  364. #define LINE_SDNCAS PAL_LINE(GPIOG, 15U)
  365. #define LINE_OSC_IN PAL_LINE(GPIOH, 0U)
  366. #define LINE_OSC_OUT PAL_LINE(GPIOH, 1U)
  367. #define LINE_SDCKE0 PAL_LINE(GPIOH, 2U)
  368. #define LINE_SDNE0 PAL_LINE(GPIOH, 3U)
  369. #define LINE_I2C2_SCL PAL_LINE(GPIOH, 4U)
  370. #define LINE_I2C2_SDA PAL_LINE(GPIOH, 5U)
  371. #define LINE_ARD_D10 PAL_LINE(GPIOH, 6U)
  372. #define LINE_SPI2_NSS PAL_LINE(GPIOH, 6U)
  373. #define LINE_LCD_RESET PAL_LINE(GPIOH, 7U)
  374. #define LINE_FMC_NBL2 PAL_LINE(GPIOI, 4U)
  375. #define LINE_FMC_NBL3 PAL_LINE(GPIOI, 5U)
  376. #define LINE_DSI_TE PAL_LINE(GPIOJ, 2U)
  377. #define LINE_LCD_INT PAL_LINE(GPIOJ, 5U)
  378. #define LINE_LED4 PAL_LINE(GPIOK, 3U)
  379. /*===========================================================================*/
  380. /* Driver pre-compile time settings. */
  381. /*===========================================================================*/
  382. /*===========================================================================*/
  383. /* Derived constants and error checks. */
  384. /*===========================================================================*/
  385. /*===========================================================================*/
  386. /* Driver data structures and types. */
  387. /*===========================================================================*/
  388. /*===========================================================================*/
  389. /* Driver macros. */
  390. /*===========================================================================*/
  391. /*
  392. * I/O ports initial setup, this configuration is established soon after reset
  393. * in the initialization code.
  394. * Please refer to the STM32 Reference Manual for details.
  395. */
  396. #define PIN_MODE_INPUT(n) (0U << ((n) * 2U))
  397. #define PIN_MODE_OUTPUT(n) (1U << ((n) * 2U))
  398. #define PIN_MODE_ALTERNATE(n) (2U << ((n) * 2U))
  399. #define PIN_MODE_ANALOG(n) (3U << ((n) * 2U))
  400. #define PIN_ODR_LOW(n) (0U << (n))
  401. #define PIN_ODR_HIGH(n) (1U << (n))
  402. #define PIN_OTYPE_PUSHPULL(n) (0U << (n))
  403. #define PIN_OTYPE_OPENDRAIN(n) (1U << (n))
  404. #define PIN_OSPEED_VERYLOW(n) (0U << ((n) * 2U))
  405. #define PIN_OSPEED_LOW(n) (1U << ((n) * 2U))
  406. #define PIN_OSPEED_MEDIUM(n) (2U << ((n) * 2U))
  407. #define PIN_OSPEED_HIGH(n) (3U << ((n) * 2U))
  408. #define PIN_PUPDR_FLOATING(n) (0U << ((n) * 2U))
  409. #define PIN_PUPDR_PULLUP(n) (1U << ((n) * 2U))
  410. #define PIN_PUPDR_PULLDOWN(n) (2U << ((n) * 2U))
  411. #define PIN_AFIO_AF(n, v) ((v) << (((n) % 8U) * 4U))
  412. /*
  413. * GPIOA setup:
  414. *
  415. * PA0 - BUTTON (input floating).
  416. * PA1 - ARD_D3 TIM5_CH2 (alternate 2).
  417. * PA2 - ARD_D5 TIM5_CH3 (alternate 2).
  418. * PA3 - LCD_BL_CTRL TIM5_CH4 (alternate 2).
  419. * PA4 - ARD_A5 (analog).
  420. * PA5 - EXT_7 SPI1_SCK (alternate 5).
  421. * PA6 - ARD_D6 TIM3_CH1 (alternate 2).
  422. * PA7 - ARD_D9 TIM3_CH2 (alternate 2).
  423. * PA8 - EXT_3 MCO1 (alternate 0).
  424. * PA9 - VBUS_FS1 (analog).
  425. * PA10 - USB_FS1_ID (alternate 10).
  426. * PA11 - USB_FS1_N (alternate 10).
  427. * PA12 - USB_FS1_P (alternate 10).
  428. * PA13 - SWDIO (alternate 0).
  429. * PA14 - SWCLK (alternate 0).
  430. * PA15 - EXT_11 SPI1_NSS (output pushpull maximum).
  431. */
  432. #define VAL_GPIOA_MODER (PIN_MODE_INPUT(GPIOA_BUTTON) | \
  433. PIN_MODE_ALTERNATE(GPIOA_ARD_D3) | \
  434. PIN_MODE_ALTERNATE(GPIOA_ARD_D5) | \
  435. PIN_MODE_ALTERNATE(GPIOA_LCD_BL_CTRL) |\
  436. PIN_MODE_ANALOG(GPIOA_ARD_A5) | \
  437. PIN_MODE_ALTERNATE(GPIOA_EXT_7) | \
  438. PIN_MODE_ALTERNATE(GPIOA_ARD_D6) | \
  439. PIN_MODE_ALTERNATE(GPIOA_ARD_D9) | \
  440. PIN_MODE_ALTERNATE(GPIOA_EXT_3) | \
  441. PIN_MODE_ANALOG(GPIOA_VBUS_FS1) | \
  442. PIN_MODE_ALTERNATE(GPIOA_USB_FS1_ID) | \
  443. PIN_MODE_ALTERNATE(GPIOA_USB_FS1_N) | \
  444. PIN_MODE_ALTERNATE(GPIOA_USB_FS1_P) | \
  445. PIN_MODE_ALTERNATE(GPIOA_SWDIO) | \
  446. PIN_MODE_ALTERNATE(GPIOA_SWCLK) | \
  447. PIN_MODE_OUTPUT(GPIOA_EXT_11))
  448. #define VAL_GPIOA_OTYPER (PIN_OTYPE_PUSHPULL(GPIOA_BUTTON) | \
  449. PIN_OTYPE_PUSHPULL(GPIOA_ARD_D3) | \
  450. PIN_OTYPE_PUSHPULL(GPIOA_ARD_D5) | \
  451. PIN_OTYPE_PUSHPULL(GPIOA_LCD_BL_CTRL) |\
  452. PIN_OTYPE_PUSHPULL(GPIOA_ARD_A5) | \
  453. PIN_OTYPE_PUSHPULL(GPIOA_EXT_7) | \
  454. PIN_OTYPE_PUSHPULL(GPIOA_ARD_D6) | \
  455. PIN_OTYPE_PUSHPULL(GPIOA_ARD_D9) | \
  456. PIN_OTYPE_PUSHPULL(GPIOA_EXT_3) | \
  457. PIN_OTYPE_PUSHPULL(GPIOA_VBUS_FS1) | \
  458. PIN_OTYPE_PUSHPULL(GPIOA_USB_FS1_ID) | \
  459. PIN_OTYPE_PUSHPULL(GPIOA_USB_FS1_N) | \
  460. PIN_OTYPE_PUSHPULL(GPIOA_USB_FS1_P) | \
  461. PIN_OTYPE_PUSHPULL(GPIOA_SWDIO) | \
  462. PIN_OTYPE_PUSHPULL(GPIOA_SWCLK) | \
  463. PIN_OTYPE_PUSHPULL(GPIOA_EXT_11))
  464. #define VAL_GPIOA_OSPEEDR (PIN_OSPEED_HIGH(GPIOA_BUTTON) | \
  465. PIN_OSPEED_HIGH(GPIOA_ARD_D3) | \
  466. PIN_OSPEED_HIGH(GPIOA_ARD_D5) | \
  467. PIN_OSPEED_HIGH(GPIOA_LCD_BL_CTRL) | \
  468. PIN_OSPEED_HIGH(GPIOA_ARD_A5) | \
  469. PIN_OSPEED_HIGH(GPIOA_EXT_7) | \
  470. PIN_OSPEED_HIGH(GPIOA_ARD_D6) | \
  471. PIN_OSPEED_HIGH(GPIOA_ARD_D9) | \
  472. PIN_OSPEED_HIGH(GPIOA_EXT_3) | \
  473. PIN_OSPEED_HIGH(GPIOA_VBUS_FS1) | \
  474. PIN_OSPEED_HIGH(GPIOA_USB_FS1_ID) | \
  475. PIN_OSPEED_HIGH(GPIOA_USB_FS1_N) | \
  476. PIN_OSPEED_HIGH(GPIOA_USB_FS1_P) | \
  477. PIN_OSPEED_HIGH(GPIOA_SWDIO) | \
  478. PIN_OSPEED_HIGH(GPIOA_SWCLK) | \
  479. PIN_OSPEED_HIGH(GPIOA_EXT_11))
  480. #define VAL_GPIOA_PUPDR (PIN_PUPDR_FLOATING(GPIOA_BUTTON) | \
  481. PIN_PUPDR_FLOATING(GPIOA_ARD_D3) | \
  482. PIN_PUPDR_FLOATING(GPIOA_ARD_D5) | \
  483. PIN_PUPDR_FLOATING(GPIOA_LCD_BL_CTRL) |\
  484. PIN_PUPDR_FLOATING(GPIOA_ARD_A5) | \
  485. PIN_PUPDR_PULLUP(GPIOA_EXT_7) | \
  486. PIN_PUPDR_FLOATING(GPIOA_ARD_D6) | \
  487. PIN_PUPDR_FLOATING(GPIOA_ARD_D9) | \
  488. PIN_PUPDR_FLOATING(GPIOA_EXT_3) | \
  489. PIN_PUPDR_FLOATING(GPIOA_VBUS_FS1) | \
  490. PIN_PUPDR_FLOATING(GPIOA_USB_FS1_ID) | \
  491. PIN_PUPDR_FLOATING(GPIOA_USB_FS1_N) | \
  492. PIN_PUPDR_FLOATING(GPIOA_USB_FS1_P) | \
  493. PIN_PUPDR_PULLUP(GPIOA_SWDIO) | \
  494. PIN_PUPDR_PULLDOWN(GPIOA_SWCLK) | \
  495. PIN_PUPDR_PULLUP(GPIOA_EXT_11))
  496. #define VAL_GPIOA_ODR (PIN_ODR_HIGH(GPIOA_BUTTON) | \
  497. PIN_ODR_HIGH(GPIOA_ARD_D3) | \
  498. PIN_ODR_HIGH(GPIOA_ARD_D5) | \
  499. PIN_ODR_HIGH(GPIOA_LCD_BL_CTRL) | \
  500. PIN_ODR_HIGH(GPIOA_ARD_A5) | \
  501. PIN_ODR_HIGH(GPIOA_EXT_7) | \
  502. PIN_ODR_HIGH(GPIOA_ARD_D6) | \
  503. PIN_ODR_HIGH(GPIOA_ARD_D9) | \
  504. PIN_ODR_HIGH(GPIOA_EXT_3) | \
  505. PIN_ODR_HIGH(GPIOA_VBUS_FS1) | \
  506. PIN_ODR_HIGH(GPIOA_USB_FS1_ID) | \
  507. PIN_ODR_HIGH(GPIOA_USB_FS1_N) | \
  508. PIN_ODR_HIGH(GPIOA_USB_FS1_P) | \
  509. PIN_ODR_HIGH(GPIOA_SWDIO) | \
  510. PIN_ODR_HIGH(GPIOA_SWCLK) | \
  511. PIN_ODR_HIGH(GPIOA_EXT_11))
  512. #define VAL_GPIOA_AFRL (PIN_AFIO_AF(GPIOA_BUTTON, 0U) | \
  513. PIN_AFIO_AF(GPIOA_ARD_D3, 2U) | \
  514. PIN_AFIO_AF(GPIOA_ARD_D5, 2U) | \
  515. PIN_AFIO_AF(GPIOA_LCD_BL_CTRL, 2U) | \
  516. PIN_AFIO_AF(GPIOA_ARD_A5, 0U) | \
  517. PIN_AFIO_AF(GPIOA_EXT_7, 5U) | \
  518. PIN_AFIO_AF(GPIOA_ARD_D6, 2U) | \
  519. PIN_AFIO_AF(GPIOA_ARD_D9, 2U))
  520. #define VAL_GPIOA_AFRH (PIN_AFIO_AF(GPIOA_EXT_3, 0U) | \
  521. PIN_AFIO_AF(GPIOA_VBUS_FS1, 0U) | \
  522. PIN_AFIO_AF(GPIOA_USB_FS1_ID, 10U) | \
  523. PIN_AFIO_AF(GPIOA_USB_FS1_N, 10U) | \
  524. PIN_AFIO_AF(GPIOA_USB_FS1_P, 10U) | \
  525. PIN_AFIO_AF(GPIOA_SWDIO, 0U) | \
  526. PIN_AFIO_AF(GPIOA_SWCLK, 0U) | \
  527. PIN_AFIO_AF(GPIOA_EXT_11, 0U))
  528. /*
  529. * GPIOB setup:
  530. *
  531. * PB0 - EXT_RESET (output pushpull maximum).
  532. * PB1 - ARD_A0 (analog).
  533. * PB2 - OTG_FS1_POWERSWITCHON (output pushpull maximum).
  534. * PB3 - I2S3_CK SPI3_SCK (alternate 6).
  535. * PB4 - EXT_5 SPI1_MISO (alternate 5).
  536. * PB5 - EXT_9 SPI1_MOSI (alternate 5).
  537. * PB6 - QSPI_BK1_NCS (alternate 10).
  538. * PB7 - QSPI_FS1_OVERCURRENT (input floating).
  539. * PB8 - I2C1_SCL (alternate 4).
  540. * PB9 - I2C1_SDA (alternate 4).
  541. * PB10 - STLK_RX (alternate 7).
  542. * PB11 - STLK_TX (alternate 7).
  543. * PB12 - EXT_12 CAN2_RX (alternate 9).
  544. * PB13 - EXT_10 CAN2_TX (alternate 9).
  545. * PB14 - ARD_D12 SPI2_MISO (alternate 5).
  546. * PB15 - ARD_D11 SPI2_MOSI (alternate 5).
  547. */
  548. #define VAL_GPIOB_MODER (PIN_MODE_OUTPUT(GPIOB_EXT_RESET) | \
  549. PIN_MODE_ANALOG(GPIOB_ARD_A0) | \
  550. PIN_MODE_OUTPUT(GPIOB_OTG_FS1_POWERSWITCHON) |\
  551. PIN_MODE_ALTERNATE(GPIOB_I2S3_CK) | \
  552. PIN_MODE_ALTERNATE(GPIOB_EXT_5) | \
  553. PIN_MODE_ALTERNATE(GPIOB_EXT_9) | \
  554. PIN_MODE_ALTERNATE(GPIOB_QSPI_BK1_NCS) |\
  555. PIN_MODE_INPUT(GPIOB_QSPI_FS1_OVERCURRENT) |\
  556. PIN_MODE_ALTERNATE(GPIOB_I2C1_SCL) | \
  557. PIN_MODE_ALTERNATE(GPIOB_I2C1_SDA) | \
  558. PIN_MODE_ALTERNATE(GPIOB_STLK_RX) | \
  559. PIN_MODE_ALTERNATE(GPIOB_STLK_TX) | \
  560. PIN_MODE_ALTERNATE(GPIOB_EXT_12) | \
  561. PIN_MODE_ALTERNATE(GPIOB_EXT_10) | \
  562. PIN_MODE_ALTERNATE(GPIOB_ARD_D12) | \
  563. PIN_MODE_ALTERNATE(GPIOB_ARD_D11))
  564. #define VAL_GPIOB_OTYPER (PIN_OTYPE_PUSHPULL(GPIOB_EXT_RESET) | \
  565. PIN_OTYPE_PUSHPULL(GPIOB_ARD_A0) | \
  566. PIN_OTYPE_PUSHPULL(GPIOB_OTG_FS1_POWERSWITCHON) |\
  567. PIN_OTYPE_PUSHPULL(GPIOB_I2S3_CK) | \
  568. PIN_OTYPE_PUSHPULL(GPIOB_EXT_5) | \
  569. PIN_OTYPE_PUSHPULL(GPIOB_EXT_9) | \
  570. PIN_OTYPE_PUSHPULL(GPIOB_QSPI_BK1_NCS) |\
  571. PIN_OTYPE_PUSHPULL(GPIOB_QSPI_FS1_OVERCURRENT) |\
  572. PIN_OTYPE_PUSHPULL(GPIOB_I2C1_SCL) | \
  573. PIN_OTYPE_PUSHPULL(GPIOB_I2C1_SDA) | \
  574. PIN_OTYPE_PUSHPULL(GPIOB_STLK_RX) | \
  575. PIN_OTYPE_PUSHPULL(GPIOB_STLK_TX) | \
  576. PIN_OTYPE_PUSHPULL(GPIOB_EXT_12) | \
  577. PIN_OTYPE_PUSHPULL(GPIOB_EXT_10) | \
  578. PIN_OTYPE_PUSHPULL(GPIOB_ARD_D12) | \
  579. PIN_OTYPE_PUSHPULL(GPIOB_ARD_D11))
  580. #define VAL_GPIOB_OSPEEDR (PIN_OSPEED_HIGH(GPIOB_EXT_RESET) | \
  581. PIN_OSPEED_HIGH(GPIOB_ARD_A0) | \
  582. PIN_OSPEED_HIGH(GPIOB_OTG_FS1_POWERSWITCHON) |\
  583. PIN_OSPEED_HIGH(GPIOB_I2S3_CK) | \
  584. PIN_OSPEED_HIGH(GPIOB_EXT_5) | \
  585. PIN_OSPEED_HIGH(GPIOB_EXT_9) | \
  586. PIN_OSPEED_HIGH(GPIOB_QSPI_BK1_NCS) | \
  587. PIN_OSPEED_HIGH(GPIOB_QSPI_FS1_OVERCURRENT) |\
  588. PIN_OSPEED_HIGH(GPIOB_I2C1_SCL) | \
  589. PIN_OSPEED_HIGH(GPIOB_I2C1_SDA) | \
  590. PIN_OSPEED_HIGH(GPIOB_STLK_RX) | \
  591. PIN_OSPEED_HIGH(GPIOB_STLK_TX) | \
  592. PIN_OSPEED_HIGH(GPIOB_EXT_12) | \
  593. PIN_OSPEED_HIGH(GPIOB_EXT_10) | \
  594. PIN_OSPEED_HIGH(GPIOB_ARD_D12) | \
  595. PIN_OSPEED_HIGH(GPIOB_ARD_D11))
  596. #define VAL_GPIOB_PUPDR (PIN_PUPDR_PULLUP(GPIOB_EXT_RESET) | \
  597. PIN_PUPDR_FLOATING(GPIOB_ARD_A0) | \
  598. PIN_PUPDR_PULLUP(GPIOB_OTG_FS1_POWERSWITCHON) |\
  599. PIN_PUPDR_FLOATING(GPIOB_I2S3_CK) | \
  600. PIN_PUPDR_FLOATING(GPIOB_EXT_5) | \
  601. PIN_PUPDR_FLOATING(GPIOB_EXT_9) | \
  602. PIN_PUPDR_FLOATING(GPIOB_QSPI_BK1_NCS) |\
  603. PIN_PUPDR_FLOATING(GPIOB_QSPI_FS1_OVERCURRENT) |\
  604. PIN_PUPDR_FLOATING(GPIOB_I2C1_SCL) | \
  605. PIN_PUPDR_FLOATING(GPIOB_I2C1_SDA) | \
  606. PIN_PUPDR_FLOATING(GPIOB_STLK_RX) | \
  607. PIN_PUPDR_FLOATING(GPIOB_STLK_TX) | \
  608. PIN_PUPDR_FLOATING(GPIOB_EXT_12) | \
  609. PIN_PUPDR_FLOATING(GPIOB_EXT_10) | \
  610. PIN_PUPDR_FLOATING(GPIOB_ARD_D12) | \
  611. PIN_PUPDR_FLOATING(GPIOB_ARD_D11))
  612. #define VAL_GPIOB_ODR (PIN_ODR_HIGH(GPIOB_EXT_RESET) | \
  613. PIN_ODR_HIGH(GPIOB_ARD_A0) | \
  614. PIN_ODR_HIGH(GPIOB_OTG_FS1_POWERSWITCHON) |\
  615. PIN_ODR_HIGH(GPIOB_I2S3_CK) | \
  616. PIN_ODR_HIGH(GPIOB_EXT_5) | \
  617. PIN_ODR_HIGH(GPIOB_EXT_9) | \
  618. PIN_ODR_HIGH(GPIOB_QSPI_BK1_NCS) | \
  619. PIN_ODR_HIGH(GPIOB_QSPI_FS1_OVERCURRENT) |\
  620. PIN_ODR_HIGH(GPIOB_I2C1_SCL) | \
  621. PIN_ODR_HIGH(GPIOB_I2C1_SDA) | \
  622. PIN_ODR_HIGH(GPIOB_STLK_RX) | \
  623. PIN_ODR_HIGH(GPIOB_STLK_TX) | \
  624. PIN_ODR_HIGH(GPIOB_EXT_12) | \
  625. PIN_ODR_HIGH(GPIOB_EXT_10) | \
  626. PIN_ODR_HIGH(GPIOB_ARD_D12) | \
  627. PIN_ODR_HIGH(GPIOB_ARD_D11))
  628. #define VAL_GPIOB_AFRL (PIN_AFIO_AF(GPIOB_EXT_RESET, 0U) | \
  629. PIN_AFIO_AF(GPIOB_ARD_A0, 0U) | \
  630. PIN_AFIO_AF(GPIOB_OTG_FS1_POWERSWITCHON, 0U) |\
  631. PIN_AFIO_AF(GPIOB_I2S3_CK, 6U) | \
  632. PIN_AFIO_AF(GPIOB_EXT_5, 5U) | \
  633. PIN_AFIO_AF(GPIOB_EXT_9, 5U) | \
  634. PIN_AFIO_AF(GPIOB_QSPI_BK1_NCS, 10U) | \
  635. PIN_AFIO_AF(GPIOB_QSPI_FS1_OVERCURRENT, 0U))
  636. #define VAL_GPIOB_AFRH (PIN_AFIO_AF(GPIOB_I2C1_SCL, 4U) | \
  637. PIN_AFIO_AF(GPIOB_I2C1_SDA, 4U) | \
  638. PIN_AFIO_AF(GPIOB_STLK_RX, 7U) | \
  639. PIN_AFIO_AF(GPIOB_STLK_TX, 7U) | \
  640. PIN_AFIO_AF(GPIOB_EXT_12, 9U) | \
  641. PIN_AFIO_AF(GPIOB_EXT_10, 9U) | \
  642. PIN_AFIO_AF(GPIOB_ARD_D12, 5U) | \
  643. PIN_AFIO_AF(GPIOB_ARD_D11, 5U))
  644. /*
  645. * GPIOC setup:
  646. *
  647. * PC0 - SDNWE (alternate 12).
  648. * PC1 - EXT_14 ADC123_IN11 (analog).
  649. * PC2 - ARD_A1 (analog).
  650. * PC3 - ARD_A2 (analog).
  651. * PC4 - ARD_A3 (analog).
  652. * PC5 - ARD_A4 (analog).
  653. * PC6 - EXT_6 USART6_TX (alternate 8).
  654. * PC7 - EXT_8 USART6_RX (alternate 8).
  655. * PC8 - USD_D0 SDIO_D0 (alternate 12).
  656. * PC9 - USD_D1 SDIO_D1 (alternate 12).
  657. * PC10 - USD_D2 SDIO_D2 (alternate 12).
  658. * PC11 - USD_D3 SDIO_D3 (alternate 12).
  659. * PC12 - USD_CLK SDIO_CK (alternate 12).
  660. * PC13 - EXT_13 ANTI_TAMP1 (input pullup).
  661. * PC14 - OSC32_IN (input floating).
  662. * PC15 - OSC32_OUT (input floating).
  663. */
  664. #define VAL_GPIOC_MODER (PIN_MODE_ALTERNATE(GPIOC_SDNWE) | \
  665. PIN_MODE_ANALOG(GPIOC_EXT_14) | \
  666. PIN_MODE_ANALOG(GPIOC_ARD_A1) | \
  667. PIN_MODE_ANALOG(GPIOC_ARD_A2) | \
  668. PIN_MODE_ANALOG(GPIOC_ARD_A3) | \
  669. PIN_MODE_ANALOG(GPIOC_ARD_A4) | \
  670. PIN_MODE_ALTERNATE(GPIOC_EXT_6) | \
  671. PIN_MODE_ALTERNATE(GPIOC_EXT_8) | \
  672. PIN_MODE_ALTERNATE(GPIOC_USD_D0) | \
  673. PIN_MODE_ALTERNATE(GPIOC_USD_D1) | \
  674. PIN_MODE_ALTERNATE(GPIOC_USD_D2) | \
  675. PIN_MODE_ALTERNATE(GPIOC_USD_D3) | \
  676. PIN_MODE_ALTERNATE(GPIOC_USD_CLK) | \
  677. PIN_MODE_INPUT(GPIOC_EXT_13) | \
  678. PIN_MODE_INPUT(GPIOC_OSC32_IN) | \
  679. PIN_MODE_INPUT(GPIOC_OSC32_OUT))
  680. #define VAL_GPIOC_OTYPER (PIN_OTYPE_PUSHPULL(GPIOC_SDNWE) | \
  681. PIN_OTYPE_PUSHPULL(GPIOC_EXT_14) | \
  682. PIN_OTYPE_PUSHPULL(GPIOC_ARD_A1) | \
  683. PIN_OTYPE_PUSHPULL(GPIOC_ARD_A2) | \
  684. PIN_OTYPE_PUSHPULL(GPIOC_ARD_A3) | \
  685. PIN_OTYPE_PUSHPULL(GPIOC_ARD_A4) | \
  686. PIN_OTYPE_PUSHPULL(GPIOC_EXT_6) | \
  687. PIN_OTYPE_PUSHPULL(GPIOC_EXT_8) | \
  688. PIN_OTYPE_PUSHPULL(GPIOC_USD_D0) | \
  689. PIN_OTYPE_PUSHPULL(GPIOC_USD_D1) | \
  690. PIN_OTYPE_PUSHPULL(GPIOC_USD_D2) | \
  691. PIN_OTYPE_PUSHPULL(GPIOC_USD_D3) | \
  692. PIN_OTYPE_PUSHPULL(GPIOC_USD_CLK) | \
  693. PIN_OTYPE_PUSHPULL(GPIOC_EXT_13) | \
  694. PIN_OTYPE_PUSHPULL(GPIOC_OSC32_IN) | \
  695. PIN_OTYPE_PUSHPULL(GPIOC_OSC32_OUT))
  696. #define VAL_GPIOC_OSPEEDR (PIN_OSPEED_HIGH(GPIOC_SDNWE) | \
  697. PIN_OSPEED_HIGH(GPIOC_EXT_14) | \
  698. PIN_OSPEED_HIGH(GPIOC_ARD_A1) | \
  699. PIN_OSPEED_HIGH(GPIOC_ARD_A2) | \
  700. PIN_OSPEED_HIGH(GPIOC_ARD_A3) | \
  701. PIN_OSPEED_HIGH(GPIOC_ARD_A4) | \
  702. PIN_OSPEED_HIGH(GPIOC_EXT_6) | \
  703. PIN_OSPEED_HIGH(GPIOC_EXT_8) | \
  704. PIN_OSPEED_HIGH(GPIOC_USD_D0) | \
  705. PIN_OSPEED_HIGH(GPIOC_USD_D1) | \
  706. PIN_OSPEED_HIGH(GPIOC_USD_D2) | \
  707. PIN_OSPEED_HIGH(GPIOC_USD_D3) | \
  708. PIN_OSPEED_HIGH(GPIOC_USD_CLK) | \
  709. PIN_OSPEED_HIGH(GPIOC_EXT_13) | \
  710. PIN_OSPEED_HIGH(GPIOC_OSC32_IN) | \
  711. PIN_OSPEED_HIGH(GPIOC_OSC32_OUT))
  712. #define VAL_GPIOC_PUPDR (PIN_PUPDR_FLOATING(GPIOC_SDNWE) | \
  713. PIN_PUPDR_FLOATING(GPIOC_EXT_14) | \
  714. PIN_PUPDR_FLOATING(GPIOC_ARD_A1) | \
  715. PIN_PUPDR_FLOATING(GPIOC_ARD_A2) | \
  716. PIN_PUPDR_FLOATING(GPIOC_ARD_A3) | \
  717. PIN_PUPDR_FLOATING(GPIOC_ARD_A4) | \
  718. PIN_PUPDR_FLOATING(GPIOC_EXT_6) | \
  719. PIN_PUPDR_FLOATING(GPIOC_EXT_8) | \
  720. PIN_PUPDR_FLOATING(GPIOC_USD_D0) | \
  721. PIN_PUPDR_FLOATING(GPIOC_USD_D1) | \
  722. PIN_PUPDR_FLOATING(GPIOC_USD_D2) | \
  723. PIN_PUPDR_FLOATING(GPIOC_USD_D3) | \
  724. PIN_PUPDR_FLOATING(GPIOC_USD_CLK) | \
  725. PIN_PUPDR_PULLUP(GPIOC_EXT_13) | \
  726. PIN_PUPDR_FLOATING(GPIOC_OSC32_IN) | \
  727. PIN_PUPDR_FLOATING(GPIOC_OSC32_OUT))
  728. #define VAL_GPIOC_ODR (PIN_ODR_HIGH(GPIOC_SDNWE) | \
  729. PIN_ODR_HIGH(GPIOC_EXT_14) | \
  730. PIN_ODR_HIGH(GPIOC_ARD_A1) | \
  731. PIN_ODR_HIGH(GPIOC_ARD_A2) | \
  732. PIN_ODR_HIGH(GPIOC_ARD_A3) | \
  733. PIN_ODR_HIGH(GPIOC_ARD_A4) | \
  734. PIN_ODR_HIGH(GPIOC_EXT_6) | \
  735. PIN_ODR_HIGH(GPIOC_EXT_8) | \
  736. PIN_ODR_HIGH(GPIOC_USD_D0) | \
  737. PIN_ODR_HIGH(GPIOC_USD_D1) | \
  738. PIN_ODR_HIGH(GPIOC_USD_D2) | \
  739. PIN_ODR_HIGH(GPIOC_USD_D3) | \
  740. PIN_ODR_HIGH(GPIOC_USD_CLK) | \
  741. PIN_ODR_HIGH(GPIOC_EXT_13) | \
  742. PIN_ODR_HIGH(GPIOC_OSC32_IN) | \
  743. PIN_ODR_HIGH(GPIOC_OSC32_OUT))
  744. #define VAL_GPIOC_AFRL (PIN_AFIO_AF(GPIOC_SDNWE, 12U) | \
  745. PIN_AFIO_AF(GPIOC_EXT_14, 0U) | \
  746. PIN_AFIO_AF(GPIOC_ARD_A1, 0U) | \
  747. PIN_AFIO_AF(GPIOC_ARD_A2, 0U) | \
  748. PIN_AFIO_AF(GPIOC_ARD_A3, 0U) | \
  749. PIN_AFIO_AF(GPIOC_ARD_A4, 0U) | \
  750. PIN_AFIO_AF(GPIOC_EXT_6, 8U) | \
  751. PIN_AFIO_AF(GPIOC_EXT_8, 8U))
  752. #define VAL_GPIOC_AFRH (PIN_AFIO_AF(GPIOC_USD_D0, 12U) | \
  753. PIN_AFIO_AF(GPIOC_USD_D1, 12U) | \
  754. PIN_AFIO_AF(GPIOC_USD_D2, 12U) | \
  755. PIN_AFIO_AF(GPIOC_USD_D3, 12U) | \
  756. PIN_AFIO_AF(GPIOC_USD_CLK, 12U) | \
  757. PIN_AFIO_AF(GPIOC_EXT_13, 0U) | \
  758. PIN_AFIO_AF(GPIOC_OSC32_IN, 0U) | \
  759. PIN_AFIO_AF(GPIOC_OSC32_OUT, 0U))
  760. /*
  761. * GPIOD setup:
  762. *
  763. * PD0 - PIN0 (input pullup).
  764. * PD1 - PIN1 (input pullup).
  765. * PD2 - USD_CMD SDIO_CMD (alternate 12).
  766. * PD3 - ARD_D13 SPI2_SCK (alternate 5).
  767. * PD4 - LED2 (output pushpull maximum).
  768. * PD5 - LED3 (output pushpull maximum).
  769. * PD6 - MIC_DATA SAI1_SD_A (alternate 6).
  770. * PD7 - PIN7 (input pullup).
  771. * PD8 - PIN8 (input pullup).
  772. * PD9 - PIN9 (input pullup).
  773. * PD10 - PIN10 (input pullup).
  774. * PD11 - PIN11 (input pullup).
  775. * PD12 - PIN12 (input pullup).
  776. * PD13 - MIC_CK TIM4_CH2 (alternate 2).
  777. * PD14 - PIN14 (input pullup).
  778. * PD15 - PIN15 (input pullup).
  779. */
  780. #define VAL_GPIOD_MODER (PIN_MODE_INPUT(GPIOD_PIN0) | \
  781. PIN_MODE_INPUT(GPIOD_PIN1) | \
  782. PIN_MODE_ALTERNATE(GPIOD_USD_CMD) | \
  783. PIN_MODE_ALTERNATE(GPIOD_ARD_D13) | \
  784. PIN_MODE_OUTPUT(GPIOD_LED2) | \
  785. PIN_MODE_OUTPUT(GPIOD_LED3) | \
  786. PIN_MODE_ALTERNATE(GPIOD_MIC_DATA) | \
  787. PIN_MODE_INPUT(GPIOD_PIN7) | \
  788. PIN_MODE_INPUT(GPIOD_PIN8) | \
  789. PIN_MODE_INPUT(GPIOD_PIN9) | \
  790. PIN_MODE_INPUT(GPIOD_PIN10) | \
  791. PIN_MODE_INPUT(GPIOD_PIN11) | \
  792. PIN_MODE_INPUT(GPIOD_PIN12) | \
  793. PIN_MODE_ALTERNATE(GPIOD_MIC_CK) | \
  794. PIN_MODE_INPUT(GPIOD_PIN14) | \
  795. PIN_MODE_INPUT(GPIOD_PIN15))
  796. #define VAL_GPIOD_OTYPER (PIN_OTYPE_PUSHPULL(GPIOD_PIN0) | \
  797. PIN_OTYPE_PUSHPULL(GPIOD_PIN1) | \
  798. PIN_OTYPE_PUSHPULL(GPIOD_USD_CMD) | \
  799. PIN_OTYPE_PUSHPULL(GPIOD_ARD_D13) | \
  800. PIN_OTYPE_PUSHPULL(GPIOD_LED2) | \
  801. PIN_OTYPE_PUSHPULL(GPIOD_LED3) | \
  802. PIN_OTYPE_PUSHPULL(GPIOD_MIC_DATA) | \
  803. PIN_OTYPE_PUSHPULL(GPIOD_PIN7) | \
  804. PIN_OTYPE_PUSHPULL(GPIOD_PIN8) | \
  805. PIN_OTYPE_PUSHPULL(GPIOD_PIN9) | \
  806. PIN_OTYPE_PUSHPULL(GPIOD_PIN10) | \
  807. PIN_OTYPE_PUSHPULL(GPIOD_PIN11) | \
  808. PIN_OTYPE_PUSHPULL(GPIOD_PIN12) | \
  809. PIN_OTYPE_PUSHPULL(GPIOD_MIC_CK) | \
  810. PIN_OTYPE_PUSHPULL(GPIOD_PIN14) | \
  811. PIN_OTYPE_PUSHPULL(GPIOD_PIN15))
  812. #define VAL_GPIOD_OSPEEDR (PIN_OSPEED_VERYLOW(GPIOD_PIN0) | \
  813. PIN_OSPEED_VERYLOW(GPIOD_PIN1) | \
  814. PIN_OSPEED_HIGH(GPIOD_USD_CMD) | \
  815. PIN_OSPEED_HIGH(GPIOD_ARD_D13) | \
  816. PIN_OSPEED_HIGH(GPIOD_LED2) | \
  817. PIN_OSPEED_HIGH(GPIOD_LED3) | \
  818. PIN_OSPEED_HIGH(GPIOD_MIC_DATA) | \
  819. PIN_OSPEED_VERYLOW(GPIOD_PIN7) | \
  820. PIN_OSPEED_VERYLOW(GPIOD_PIN8) | \
  821. PIN_OSPEED_VERYLOW(GPIOD_PIN9) | \
  822. PIN_OSPEED_VERYLOW(GPIOD_PIN10) | \
  823. PIN_OSPEED_VERYLOW(GPIOD_PIN11) | \
  824. PIN_OSPEED_VERYLOW(GPIOD_PIN12) | \
  825. PIN_OSPEED_HIGH(GPIOD_MIC_CK) | \
  826. PIN_OSPEED_VERYLOW(GPIOD_PIN14) | \
  827. PIN_OSPEED_VERYLOW(GPIOD_PIN15))
  828. #define VAL_GPIOD_PUPDR (PIN_PUPDR_PULLUP(GPIOD_PIN0) | \
  829. PIN_PUPDR_PULLUP(GPIOD_PIN1) | \
  830. PIN_PUPDR_FLOATING(GPIOD_USD_CMD) | \
  831. PIN_PUPDR_FLOATING(GPIOD_ARD_D13) | \
  832. PIN_PUPDR_FLOATING(GPIOD_LED2) | \
  833. PIN_PUPDR_FLOATING(GPIOD_LED3) | \
  834. PIN_PUPDR_FLOATING(GPIOD_MIC_DATA) | \
  835. PIN_PUPDR_PULLUP(GPIOD_PIN7) | \
  836. PIN_PUPDR_PULLUP(GPIOD_PIN8) | \
  837. PIN_PUPDR_PULLUP(GPIOD_PIN9) | \
  838. PIN_PUPDR_PULLUP(GPIOD_PIN10) | \
  839. PIN_PUPDR_PULLUP(GPIOD_PIN11) | \
  840. PIN_PUPDR_PULLUP(GPIOD_PIN12) | \
  841. PIN_PUPDR_FLOATING(GPIOD_MIC_CK) | \
  842. PIN_PUPDR_PULLUP(GPIOD_PIN14) | \
  843. PIN_PUPDR_PULLUP(GPIOD_PIN15))
  844. #define VAL_GPIOD_ODR (PIN_ODR_HIGH(GPIOD_PIN0) | \
  845. PIN_ODR_HIGH(GPIOD_PIN1) | \
  846. PIN_ODR_HIGH(GPIOD_USD_CMD) | \
  847. PIN_ODR_HIGH(GPIOD_ARD_D13) | \
  848. PIN_ODR_HIGH(GPIOD_LED2) | \
  849. PIN_ODR_HIGH(GPIOD_LED3) | \
  850. PIN_ODR_HIGH(GPIOD_MIC_DATA) | \
  851. PIN_ODR_HIGH(GPIOD_PIN7) | \
  852. PIN_ODR_HIGH(GPIOD_PIN8) | \
  853. PIN_ODR_HIGH(GPIOD_PIN9) | \
  854. PIN_ODR_HIGH(GPIOD_PIN10) | \
  855. PIN_ODR_HIGH(GPIOD_PIN11) | \
  856. PIN_ODR_HIGH(GPIOD_PIN12) | \
  857. PIN_ODR_HIGH(GPIOD_MIC_CK) | \
  858. PIN_ODR_HIGH(GPIOD_PIN14) | \
  859. PIN_ODR_HIGH(GPIOD_PIN15))
  860. #define VAL_GPIOD_AFRL (PIN_AFIO_AF(GPIOD_PIN0, 0U) | \
  861. PIN_AFIO_AF(GPIOD_PIN1, 0U) | \
  862. PIN_AFIO_AF(GPIOD_USD_CMD, 12U) | \
  863. PIN_AFIO_AF(GPIOD_ARD_D13, 5U) | \
  864. PIN_AFIO_AF(GPIOD_LED2, 0U) | \
  865. PIN_AFIO_AF(GPIOD_LED3, 0U) | \
  866. PIN_AFIO_AF(GPIOD_MIC_DATA, 6U) | \
  867. PIN_AFIO_AF(GPIOD_PIN7, 0U))
  868. #define VAL_GPIOD_AFRH (PIN_AFIO_AF(GPIOD_PIN8, 0U) | \
  869. PIN_AFIO_AF(GPIOD_PIN9, 0U) | \
  870. PIN_AFIO_AF(GPIOD_PIN10, 0U) | \
  871. PIN_AFIO_AF(GPIOD_PIN11, 0U) | \
  872. PIN_AFIO_AF(GPIOD_PIN12, 0U) | \
  873. PIN_AFIO_AF(GPIOD_MIC_CK, 2U) | \
  874. PIN_AFIO_AF(GPIOD_PIN14, 0U) | \
  875. PIN_AFIO_AF(GPIOD_PIN15, 0U))
  876. /*
  877. * GPIOE setup:
  878. *
  879. * PE0 - FMC_NBL0 (alternate 12).
  880. * PE1 - FMC_NBL1 (alternate 12).
  881. * PE2 - AUDIO_RST (alternate 6).
  882. * PE3 - SPKR_HP (alternate 6).
  883. * PE4 - SAI1_FSA (alternate 6).
  884. * PE5 - SAI1_SCKA (alternate 6).
  885. * PE6 - SAI1_SDA (alternate 6).
  886. * PE7 - PIN7 (input pullup).
  887. * PE8 - PIN8 (input pullup).
  888. * PE9 - PIN9 (input pullup).
  889. * PE10 - PIN10 (input pullup).
  890. * PE11 - PIN11 (input pullup).
  891. * PE12 - PIN12 (input pullup).
  892. * PE13 - PIN13 (input pullup).
  893. * PE14 - PIN14 (input pullup).
  894. * PE15 - PIN15 (input pullup).
  895. */
  896. #define VAL_GPIOE_MODER (PIN_MODE_ALTERNATE(GPIOE_FMC_NBL0) | \
  897. PIN_MODE_ALTERNATE(GPIOE_FMC_NBL1) | \
  898. PIN_MODE_ALTERNATE(GPIOE_AUDIO_RST) | \
  899. PIN_MODE_ALTERNATE(GPIOE_SPKR_HP) | \
  900. PIN_MODE_ALTERNATE(GPIOE_SAI1_FSA) | \
  901. PIN_MODE_ALTERNATE(GPIOE_SAI1_SCKA) | \
  902. PIN_MODE_ALTERNATE(GPIOE_SAI1_SDA) | \
  903. PIN_MODE_INPUT(GPIOE_PIN7) | \
  904. PIN_MODE_INPUT(GPIOE_PIN8) | \
  905. PIN_MODE_INPUT(GPIOE_PIN9) | \
  906. PIN_MODE_INPUT(GPIOE_PIN10) | \
  907. PIN_MODE_INPUT(GPIOE_PIN11) | \
  908. PIN_MODE_INPUT(GPIOE_PIN12) | \
  909. PIN_MODE_INPUT(GPIOE_PIN13) | \
  910. PIN_MODE_INPUT(GPIOE_PIN14) | \
  911. PIN_MODE_INPUT(GPIOE_PIN15))
  912. #define VAL_GPIOE_OTYPER (PIN_OTYPE_PUSHPULL(GPIOE_FMC_NBL0) | \
  913. PIN_OTYPE_PUSHPULL(GPIOE_FMC_NBL1) | \
  914. PIN_OTYPE_PUSHPULL(GPIOE_AUDIO_RST) | \
  915. PIN_OTYPE_PUSHPULL(GPIOE_SPKR_HP) | \
  916. PIN_OTYPE_PUSHPULL(GPIOE_SAI1_FSA) | \
  917. PIN_OTYPE_PUSHPULL(GPIOE_SAI1_SCKA) | \
  918. PIN_OTYPE_PUSHPULL(GPIOE_SAI1_SDA) | \
  919. PIN_OTYPE_PUSHPULL(GPIOE_PIN7) | \
  920. PIN_OTYPE_PUSHPULL(GPIOE_PIN8) | \
  921. PIN_OTYPE_PUSHPULL(GPIOE_PIN9) | \
  922. PIN_OTYPE_PUSHPULL(GPIOE_PIN10) | \
  923. PIN_OTYPE_PUSHPULL(GPIOE_PIN11) | \
  924. PIN_OTYPE_PUSHPULL(GPIOE_PIN12) | \
  925. PIN_OTYPE_PUSHPULL(GPIOE_PIN13) | \
  926. PIN_OTYPE_PUSHPULL(GPIOE_PIN14) | \
  927. PIN_OTYPE_PUSHPULL(GPIOE_PIN15))
  928. #define VAL_GPIOE_OSPEEDR (PIN_OSPEED_HIGH(GPIOE_FMC_NBL0) | \
  929. PIN_OSPEED_HIGH(GPIOE_FMC_NBL1) | \
  930. PIN_OSPEED_HIGH(GPIOE_AUDIO_RST) | \
  931. PIN_OSPEED_HIGH(GPIOE_SPKR_HP) | \
  932. PIN_OSPEED_HIGH(GPIOE_SAI1_FSA) | \
  933. PIN_OSPEED_HIGH(GPIOE_SAI1_SCKA) | \
  934. PIN_OSPEED_HIGH(GPIOE_SAI1_SDA) | \
  935. PIN_OSPEED_VERYLOW(GPIOE_PIN7) | \
  936. PIN_OSPEED_VERYLOW(GPIOE_PIN8) | \
  937. PIN_OSPEED_VERYLOW(GPIOE_PIN9) | \
  938. PIN_OSPEED_VERYLOW(GPIOE_PIN10) | \
  939. PIN_OSPEED_VERYLOW(GPIOE_PIN11) | \
  940. PIN_OSPEED_VERYLOW(GPIOE_PIN12) | \
  941. PIN_OSPEED_VERYLOW(GPIOE_PIN13) | \
  942. PIN_OSPEED_VERYLOW(GPIOE_PIN14) | \
  943. PIN_OSPEED_VERYLOW(GPIOE_PIN15))
  944. #define VAL_GPIOE_PUPDR (PIN_PUPDR_FLOATING(GPIOE_FMC_NBL0) | \
  945. PIN_PUPDR_FLOATING(GPIOE_FMC_NBL1) | \
  946. PIN_PUPDR_FLOATING(GPIOE_AUDIO_RST) | \
  947. PIN_PUPDR_FLOATING(GPIOE_SPKR_HP) | \
  948. PIN_PUPDR_FLOATING(GPIOE_SAI1_FSA) | \
  949. PIN_PUPDR_FLOATING(GPIOE_SAI1_SCKA) | \
  950. PIN_PUPDR_FLOATING(GPIOE_SAI1_SDA) | \
  951. PIN_PUPDR_PULLUP(GPIOE_PIN7) | \
  952. PIN_PUPDR_PULLUP(GPIOE_PIN8) | \
  953. PIN_PUPDR_PULLUP(GPIOE_PIN9) | \
  954. PIN_PUPDR_PULLUP(GPIOE_PIN10) | \
  955. PIN_PUPDR_PULLUP(GPIOE_PIN11) | \
  956. PIN_PUPDR_PULLUP(GPIOE_PIN12) | \
  957. PIN_PUPDR_PULLUP(GPIOE_PIN13) | \
  958. PIN_PUPDR_PULLUP(GPIOE_PIN14) | \
  959. PIN_PUPDR_PULLUP(GPIOE_PIN15))
  960. #define VAL_GPIOE_ODR (PIN_ODR_HIGH(GPIOE_FMC_NBL0) | \
  961. PIN_ODR_HIGH(GPIOE_FMC_NBL1) | \
  962. PIN_ODR_HIGH(GPIOE_AUDIO_RST) | \
  963. PIN_ODR_HIGH(GPIOE_SPKR_HP) | \
  964. PIN_ODR_HIGH(GPIOE_SAI1_FSA) | \
  965. PIN_ODR_HIGH(GPIOE_SAI1_SCKA) | \
  966. PIN_ODR_HIGH(GPIOE_SAI1_SDA) | \
  967. PIN_ODR_HIGH(GPIOE_PIN7) | \
  968. PIN_ODR_HIGH(GPIOE_PIN8) | \
  969. PIN_ODR_HIGH(GPIOE_PIN9) | \
  970. PIN_ODR_HIGH(GPIOE_PIN10) | \
  971. PIN_ODR_HIGH(GPIOE_PIN11) | \
  972. PIN_ODR_HIGH(GPIOE_PIN12) | \
  973. PIN_ODR_HIGH(GPIOE_PIN13) | \
  974. PIN_ODR_HIGH(GPIOE_PIN14) | \
  975. PIN_ODR_HIGH(GPIOE_PIN15))
  976. #define VAL_GPIOE_AFRL (PIN_AFIO_AF(GPIOE_FMC_NBL0, 12U) | \
  977. PIN_AFIO_AF(GPIOE_FMC_NBL1, 12U) | \
  978. PIN_AFIO_AF(GPIOE_AUDIO_RST, 6U) | \
  979. PIN_AFIO_AF(GPIOE_SPKR_HP, 6U) | \
  980. PIN_AFIO_AF(GPIOE_SAI1_FSA, 6U) | \
  981. PIN_AFIO_AF(GPIOE_SAI1_SCKA, 6U) | \
  982. PIN_AFIO_AF(GPIOE_SAI1_SDA, 6U) | \
  983. PIN_AFIO_AF(GPIOE_PIN7, 0U))
  984. #define VAL_GPIOE_AFRH (PIN_AFIO_AF(GPIOE_PIN8, 0U) | \
  985. PIN_AFIO_AF(GPIOE_PIN9, 0U) | \
  986. PIN_AFIO_AF(GPIOE_PIN10, 0U) | \
  987. PIN_AFIO_AF(GPIOE_PIN11, 0U) | \
  988. PIN_AFIO_AF(GPIOE_PIN12, 0U) | \
  989. PIN_AFIO_AF(GPIOE_PIN13, 0U) | \
  990. PIN_AFIO_AF(GPIOE_PIN14, 0U) | \
  991. PIN_AFIO_AF(GPIOE_PIN15, 0U))
  992. /*
  993. * GPIOF setup:
  994. *
  995. * PF0 - PIN0 (input pullup).
  996. * PF1 - PIN1 (input pullup).
  997. * PF2 - PIN2 (input pullup).
  998. * PF3 - PIN3 (input pullup).
  999. * PF4 - PIN4 (input pullup).
  1000. * PF5 - PIN5 (input pullup).
  1001. * PF6 - QSPI_BK1_IO3 (alternate 9).
  1002. * PF7 - QSPI_BK1_IO2 (alternate 9).
  1003. * PF8 - QSPI_BK1_IO0 (alternate 9).
  1004. * PF9 - QSPI_BK1_IO1 (alternate 9).
  1005. * PF10 - QSPI_CLK (alternate 9).
  1006. * PF11 - SDNRAS (alternate 12).
  1007. * PF12 - PIN12 (input pullup).
  1008. * PF13 - PIN13 (input pullup).
  1009. * PF14 - PIN14 (input pullup).
  1010. * PF15 - PIN15 (input pullup).
  1011. */
  1012. #define VAL_GPIOF_MODER (PIN_MODE_INPUT(GPIOF_PIN0) | \
  1013. PIN_MODE_INPUT(GPIOF_PIN1) | \
  1014. PIN_MODE_INPUT(GPIOF_PIN2) | \
  1015. PIN_MODE_INPUT(GPIOF_PIN3) | \
  1016. PIN_MODE_INPUT(GPIOF_PIN4) | \
  1017. PIN_MODE_INPUT(GPIOF_PIN5) | \
  1018. PIN_MODE_ALTERNATE(GPIOF_QSPI_BK1_IO3) |\
  1019. PIN_MODE_ALTERNATE(GPIOF_QSPI_BK1_IO2) |\
  1020. PIN_MODE_ALTERNATE(GPIOF_QSPI_BK1_IO0) |\
  1021. PIN_MODE_ALTERNATE(GPIOF_QSPI_BK1_IO1) |\
  1022. PIN_MODE_ALTERNATE(GPIOF_QSPI_CLK) | \
  1023. PIN_MODE_ALTERNATE(GPIOF_SDNRAS) | \
  1024. PIN_MODE_INPUT(GPIOF_PIN12) | \
  1025. PIN_MODE_INPUT(GPIOF_PIN13) | \
  1026. PIN_MODE_INPUT(GPIOF_PIN14) | \
  1027. PIN_MODE_INPUT(GPIOF_PIN15))
  1028. #define VAL_GPIOF_OTYPER (PIN_OTYPE_PUSHPULL(GPIOF_PIN0) | \
  1029. PIN_OTYPE_PUSHPULL(GPIOF_PIN1) | \
  1030. PIN_OTYPE_PUSHPULL(GPIOF_PIN2) | \
  1031. PIN_OTYPE_PUSHPULL(GPIOF_PIN3) | \
  1032. PIN_OTYPE_PUSHPULL(GPIOF_PIN4) | \
  1033. PIN_OTYPE_PUSHPULL(GPIOF_PIN5) | \
  1034. PIN_OTYPE_PUSHPULL(GPIOF_QSPI_BK1_IO3) |\
  1035. PIN_OTYPE_PUSHPULL(GPIOF_QSPI_BK1_IO2) |\
  1036. PIN_OTYPE_PUSHPULL(GPIOF_QSPI_BK1_IO0) |\
  1037. PIN_OTYPE_PUSHPULL(GPIOF_QSPI_BK1_IO1) |\
  1038. PIN_OTYPE_PUSHPULL(GPIOF_QSPI_CLK) | \
  1039. PIN_OTYPE_PUSHPULL(GPIOF_SDNRAS) | \
  1040. PIN_OTYPE_PUSHPULL(GPIOF_PIN12) | \
  1041. PIN_OTYPE_PUSHPULL(GPIOF_PIN13) | \
  1042. PIN_OTYPE_PUSHPULL(GPIOF_PIN14) | \
  1043. PIN_OTYPE_PUSHPULL(GPIOF_PIN15))
  1044. #define VAL_GPIOF_OSPEEDR (PIN_OSPEED_VERYLOW(GPIOF_PIN0) | \
  1045. PIN_OSPEED_VERYLOW(GPIOF_PIN1) | \
  1046. PIN_OSPEED_VERYLOW(GPIOF_PIN2) | \
  1047. PIN_OSPEED_VERYLOW(GPIOF_PIN3) | \
  1048. PIN_OSPEED_VERYLOW(GPIOF_PIN4) | \
  1049. PIN_OSPEED_VERYLOW(GPIOF_PIN5) | \
  1050. PIN_OSPEED_HIGH(GPIOF_QSPI_BK1_IO3) | \
  1051. PIN_OSPEED_HIGH(GPIOF_QSPI_BK1_IO2) | \
  1052. PIN_OSPEED_HIGH(GPIOF_QSPI_BK1_IO0) | \
  1053. PIN_OSPEED_HIGH(GPIOF_QSPI_BK1_IO1) | \
  1054. PIN_OSPEED_HIGH(GPIOF_QSPI_CLK) | \
  1055. PIN_OSPEED_HIGH(GPIOF_SDNRAS) | \
  1056. PIN_OSPEED_VERYLOW(GPIOF_PIN12) | \
  1057. PIN_OSPEED_VERYLOW(GPIOF_PIN13) | \
  1058. PIN_OSPEED_VERYLOW(GPIOF_PIN14) | \
  1059. PIN_OSPEED_VERYLOW(GPIOF_PIN15))
  1060. #define VAL_GPIOF_PUPDR (PIN_PUPDR_PULLUP(GPIOF_PIN0) | \
  1061. PIN_PUPDR_PULLUP(GPIOF_PIN1) | \
  1062. PIN_PUPDR_PULLUP(GPIOF_PIN2) | \
  1063. PIN_PUPDR_PULLUP(GPIOF_PIN3) | \
  1064. PIN_PUPDR_PULLUP(GPIOF_PIN4) | \
  1065. PIN_PUPDR_PULLUP(GPIOF_PIN5) | \
  1066. PIN_PUPDR_FLOATING(GPIOF_QSPI_BK1_IO3) |\
  1067. PIN_PUPDR_FLOATING(GPIOF_QSPI_BK1_IO2) |\
  1068. PIN_PUPDR_FLOATING(GPIOF_QSPI_BK1_IO0) |\
  1069. PIN_PUPDR_FLOATING(GPIOF_QSPI_BK1_IO1) |\
  1070. PIN_PUPDR_FLOATING(GPIOF_QSPI_CLK) | \
  1071. PIN_PUPDR_FLOATING(GPIOF_SDNRAS) | \
  1072. PIN_PUPDR_PULLUP(GPIOF_PIN12) | \
  1073. PIN_PUPDR_PULLUP(GPIOF_PIN13) | \
  1074. PIN_PUPDR_PULLUP(GPIOF_PIN14) | \
  1075. PIN_PUPDR_PULLUP(GPIOF_PIN15))
  1076. #define VAL_GPIOF_ODR (PIN_ODR_HIGH(GPIOF_PIN0) | \
  1077. PIN_ODR_HIGH(GPIOF_PIN1) | \
  1078. PIN_ODR_HIGH(GPIOF_PIN2) | \
  1079. PIN_ODR_HIGH(GPIOF_PIN3) | \
  1080. PIN_ODR_HIGH(GPIOF_PIN4) | \
  1081. PIN_ODR_HIGH(GPIOF_PIN5) | \
  1082. PIN_ODR_HIGH(GPIOF_QSPI_BK1_IO3) | \
  1083. PIN_ODR_HIGH(GPIOF_QSPI_BK1_IO2) | \
  1084. PIN_ODR_HIGH(GPIOF_QSPI_BK1_IO0) | \
  1085. PIN_ODR_HIGH(GPIOF_QSPI_BK1_IO1) | \
  1086. PIN_ODR_HIGH(GPIOF_QSPI_CLK) | \
  1087. PIN_ODR_HIGH(GPIOF_SDNRAS) | \
  1088. PIN_ODR_HIGH(GPIOF_PIN12) | \
  1089. PIN_ODR_HIGH(GPIOF_PIN13) | \
  1090. PIN_ODR_HIGH(GPIOF_PIN14) | \
  1091. PIN_ODR_HIGH(GPIOF_PIN15))
  1092. #define VAL_GPIOF_AFRL (PIN_AFIO_AF(GPIOF_PIN0, 0U) | \
  1093. PIN_AFIO_AF(GPIOF_PIN1, 0U) | \
  1094. PIN_AFIO_AF(GPIOF_PIN2, 0U) | \
  1095. PIN_AFIO_AF(GPIOF_PIN3, 0U) | \
  1096. PIN_AFIO_AF(GPIOF_PIN4, 0U) | \
  1097. PIN_AFIO_AF(GPIOF_PIN5, 0U) | \
  1098. PIN_AFIO_AF(GPIOF_QSPI_BK1_IO3, 9U) | \
  1099. PIN_AFIO_AF(GPIOF_QSPI_BK1_IO2, 9U))
  1100. #define VAL_GPIOF_AFRH (PIN_AFIO_AF(GPIOF_QSPI_BK1_IO0, 9U) | \
  1101. PIN_AFIO_AF(GPIOF_QSPI_BK1_IO1, 9U) | \
  1102. PIN_AFIO_AF(GPIOF_QSPI_CLK, 9U) | \
  1103. PIN_AFIO_AF(GPIOF_SDNRAS, 12U) | \
  1104. PIN_AFIO_AF(GPIOF_PIN12, 0U) | \
  1105. PIN_AFIO_AF(GPIOF_PIN13, 0U) | \
  1106. PIN_AFIO_AF(GPIOF_PIN14, 0U) | \
  1107. PIN_AFIO_AF(GPIOF_PIN15, 0U))
  1108. /*
  1109. * GPIOG setup:
  1110. *
  1111. * PG0 - PIN0 (input pullup).
  1112. * PG1 - PIN1 (input pullup).
  1113. * PG2 - USD_DETECT (input pullup).
  1114. * PG3 - PIN3 (input pullup).
  1115. * PG4 - PIN4 (input pullup).
  1116. * PG5 - PIN5 (input pullup).
  1117. * PG6 - LED1 (output pushpull maximum).
  1118. * PG7 - SAI1_MCLKA (alternate 6).
  1119. * PG8 - SDCLK (alternate 12).
  1120. * PG9 - ARD_D0 (input pullup).
  1121. * PG10 - ARD_D8 (input pullup).
  1122. * PG11 - ARD_D7 (input pullup).
  1123. * PG12 - ARD_D4 (input pullup).
  1124. * PG13 - ARD_D2 (input pullup).
  1125. * PG14 - ARD_D1 (input pullup).
  1126. * PG15 - SDNCAS (alternate 12).
  1127. */
  1128. #define VAL_GPIOG_MODER (PIN_MODE_INPUT(GPIOG_PIN0) | \
  1129. PIN_MODE_INPUT(GPIOG_PIN1) | \
  1130. PIN_MODE_INPUT(GPIOG_USD_DETECT) | \
  1131. PIN_MODE_INPUT(GPIOG_PIN3) | \
  1132. PIN_MODE_INPUT(GPIOG_PIN4) | \
  1133. PIN_MODE_INPUT(GPIOG_PIN5) | \
  1134. PIN_MODE_OUTPUT(GPIOG_LED1) | \
  1135. PIN_MODE_ALTERNATE(GPIOG_SAI1_MCLKA) | \
  1136. PIN_MODE_ALTERNATE(GPIOG_SDCLK) | \
  1137. PIN_MODE_INPUT(GPIOG_ARD_D0) | \
  1138. PIN_MODE_INPUT(GPIOG_ARD_D8) | \
  1139. PIN_MODE_INPUT(GPIOG_ARD_D7) | \
  1140. PIN_MODE_INPUT(GPIOG_ARD_D4) | \
  1141. PIN_MODE_INPUT(GPIOG_ARD_D2) | \
  1142. PIN_MODE_INPUT(GPIOG_ARD_D1) | \
  1143. PIN_MODE_ALTERNATE(GPIOG_SDNCAS))
  1144. #define VAL_GPIOG_OTYPER (PIN_OTYPE_PUSHPULL(GPIOG_PIN0) | \
  1145. PIN_OTYPE_PUSHPULL(GPIOG_PIN1) | \
  1146. PIN_OTYPE_PUSHPULL(GPIOG_USD_DETECT) | \
  1147. PIN_OTYPE_PUSHPULL(GPIOG_PIN3) | \
  1148. PIN_OTYPE_PUSHPULL(GPIOG_PIN4) | \
  1149. PIN_OTYPE_PUSHPULL(GPIOG_PIN5) | \
  1150. PIN_OTYPE_PUSHPULL(GPIOG_LED1) | \
  1151. PIN_OTYPE_PUSHPULL(GPIOG_SAI1_MCLKA) | \
  1152. PIN_OTYPE_PUSHPULL(GPIOG_SDCLK) | \
  1153. PIN_OTYPE_PUSHPULL(GPIOG_ARD_D0) | \
  1154. PIN_OTYPE_PUSHPULL(GPIOG_ARD_D8) | \
  1155. PIN_OTYPE_PUSHPULL(GPIOG_ARD_D7) | \
  1156. PIN_OTYPE_PUSHPULL(GPIOG_ARD_D4) | \
  1157. PIN_OTYPE_PUSHPULL(GPIOG_ARD_D2) | \
  1158. PIN_OTYPE_PUSHPULL(GPIOG_ARD_D1) | \
  1159. PIN_OTYPE_PUSHPULL(GPIOG_SDNCAS))
  1160. #define VAL_GPIOG_OSPEEDR (PIN_OSPEED_VERYLOW(GPIOG_PIN0) | \
  1161. PIN_OSPEED_VERYLOW(GPIOG_PIN1) | \
  1162. PIN_OSPEED_HIGH(GPIOG_USD_DETECT) | \
  1163. PIN_OSPEED_VERYLOW(GPIOG_PIN3) | \
  1164. PIN_OSPEED_VERYLOW(GPIOG_PIN4) | \
  1165. PIN_OSPEED_VERYLOW(GPIOG_PIN5) | \
  1166. PIN_OSPEED_HIGH(GPIOG_LED1) | \
  1167. PIN_OSPEED_HIGH(GPIOG_SAI1_MCLKA) | \
  1168. PIN_OSPEED_HIGH(GPIOG_SDCLK) | \
  1169. PIN_OSPEED_VERYLOW(GPIOG_ARD_D0) | \
  1170. PIN_OSPEED_VERYLOW(GPIOG_ARD_D8) | \
  1171. PIN_OSPEED_VERYLOW(GPIOG_ARD_D7) | \
  1172. PIN_OSPEED_VERYLOW(GPIOG_ARD_D4) | \
  1173. PIN_OSPEED_VERYLOW(GPIOG_ARD_D2) | \
  1174. PIN_OSPEED_VERYLOW(GPIOG_ARD_D1) | \
  1175. PIN_OSPEED_HIGH(GPIOG_SDNCAS))
  1176. #define VAL_GPIOG_PUPDR (PIN_PUPDR_PULLUP(GPIOG_PIN0) | \
  1177. PIN_PUPDR_PULLUP(GPIOG_PIN1) | \
  1178. PIN_PUPDR_PULLUP(GPIOG_USD_DETECT) | \
  1179. PIN_PUPDR_PULLUP(GPIOG_PIN3) | \
  1180. PIN_PUPDR_PULLUP(GPIOG_PIN4) | \
  1181. PIN_PUPDR_PULLUP(GPIOG_PIN5) | \
  1182. PIN_PUPDR_FLOATING(GPIOG_LED1) | \
  1183. PIN_PUPDR_FLOATING(GPIOG_SAI1_MCLKA) | \
  1184. PIN_PUPDR_FLOATING(GPIOG_SDCLK) | \
  1185. PIN_PUPDR_PULLUP(GPIOG_ARD_D0) | \
  1186. PIN_PUPDR_PULLUP(GPIOG_ARD_D8) | \
  1187. PIN_PUPDR_PULLUP(GPIOG_ARD_D7) | \
  1188. PIN_PUPDR_PULLUP(GPIOG_ARD_D4) | \
  1189. PIN_PUPDR_PULLUP(GPIOG_ARD_D2) | \
  1190. PIN_PUPDR_PULLUP(GPIOG_ARD_D1) | \
  1191. PIN_PUPDR_FLOATING(GPIOG_SDNCAS))
  1192. #define VAL_GPIOG_ODR (PIN_ODR_HIGH(GPIOG_PIN0) | \
  1193. PIN_ODR_HIGH(GPIOG_PIN1) | \
  1194. PIN_ODR_HIGH(GPIOG_USD_DETECT) | \
  1195. PIN_ODR_HIGH(GPIOG_PIN3) | \
  1196. PIN_ODR_HIGH(GPIOG_PIN4) | \
  1197. PIN_ODR_HIGH(GPIOG_PIN5) | \
  1198. PIN_ODR_HIGH(GPIOG_LED1) | \
  1199. PIN_ODR_HIGH(GPIOG_SAI1_MCLKA) | \
  1200. PIN_ODR_HIGH(GPIOG_SDCLK) | \
  1201. PIN_ODR_HIGH(GPIOG_ARD_D0) | \
  1202. PIN_ODR_HIGH(GPIOG_ARD_D8) | \
  1203. PIN_ODR_HIGH(GPIOG_ARD_D7) | \
  1204. PIN_ODR_HIGH(GPIOG_ARD_D4) | \
  1205. PIN_ODR_HIGH(GPIOG_ARD_D2) | \
  1206. PIN_ODR_HIGH(GPIOG_ARD_D1) | \
  1207. PIN_ODR_HIGH(GPIOG_SDNCAS))
  1208. #define VAL_GPIOG_AFRL (PIN_AFIO_AF(GPIOG_PIN0, 0U) | \
  1209. PIN_AFIO_AF(GPIOG_PIN1, 0U) | \
  1210. PIN_AFIO_AF(GPIOG_USD_DETECT, 0U) | \
  1211. PIN_AFIO_AF(GPIOG_PIN3, 0U) | \
  1212. PIN_AFIO_AF(GPIOG_PIN4, 0U) | \
  1213. PIN_AFIO_AF(GPIOG_PIN5, 0U) | \
  1214. PIN_AFIO_AF(GPIOG_LED1, 0U) | \
  1215. PIN_AFIO_AF(GPIOG_SAI1_MCLKA, 6U))
  1216. #define VAL_GPIOG_AFRH (PIN_AFIO_AF(GPIOG_SDCLK, 12U) | \
  1217. PIN_AFIO_AF(GPIOG_ARD_D0, 0U) | \
  1218. PIN_AFIO_AF(GPIOG_ARD_D8, 0U) | \
  1219. PIN_AFIO_AF(GPIOG_ARD_D7, 0U) | \
  1220. PIN_AFIO_AF(GPIOG_ARD_D4, 0U) | \
  1221. PIN_AFIO_AF(GPIOG_ARD_D2, 0U) | \
  1222. PIN_AFIO_AF(GPIOG_ARD_D1, 0U) | \
  1223. PIN_AFIO_AF(GPIOG_SDNCAS, 12U))
  1224. /*
  1225. * GPIOH setup:
  1226. *
  1227. * PH0 - OSC_IN (input floating).
  1228. * PH1 - OSC_OUT (input floating).
  1229. * PH2 - SDCKE0 (alternate 12).
  1230. * PH3 - SDNE0 (alternate 12).
  1231. * PH4 - I2C2_SCL (alternate 4).
  1232. * PH5 - I2C2_SDA (alternate 4).
  1233. * PH6 - ARD_D10 SPI2_NSS (output pushpull maximum).
  1234. * PH7 - LCD_RESET (output pushpull minimum).
  1235. * PH8 - PIN8 (input pullup).
  1236. * PH9 - PIN9 (input pullup).
  1237. * PH10 - PIN10 (input pullup).
  1238. * PH11 - PIN11 (input pullup).
  1239. * PH12 - PIN12 (input pullup).
  1240. * PH13 - PIN13 (input pullup).
  1241. * PH14 - PIN14 (input pullup).
  1242. * PH15 - PIN15 (input pullup).
  1243. */
  1244. #define VAL_GPIOH_MODER (PIN_MODE_INPUT(GPIOH_OSC_IN) | \
  1245. PIN_MODE_INPUT(GPIOH_OSC_OUT) | \
  1246. PIN_MODE_ALTERNATE(GPIOH_SDCKE0) | \
  1247. PIN_MODE_ALTERNATE(GPIOH_SDNE0) | \
  1248. PIN_MODE_ALTERNATE(GPIOH_I2C2_SCL) | \
  1249. PIN_MODE_ALTERNATE(GPIOH_I2C2_SDA) | \
  1250. PIN_MODE_OUTPUT(GPIOH_ARD_D10) | \
  1251. PIN_MODE_OUTPUT(GPIOH_LCD_RESET) | \
  1252. PIN_MODE_INPUT(GPIOH_PIN8) | \
  1253. PIN_MODE_INPUT(GPIOH_PIN9) | \
  1254. PIN_MODE_INPUT(GPIOH_PIN10) | \
  1255. PIN_MODE_INPUT(GPIOH_PIN11) | \
  1256. PIN_MODE_INPUT(GPIOH_PIN12) | \
  1257. PIN_MODE_INPUT(GPIOH_PIN13) | \
  1258. PIN_MODE_INPUT(GPIOH_PIN14) | \
  1259. PIN_MODE_INPUT(GPIOH_PIN15))
  1260. #define VAL_GPIOH_OTYPER (PIN_OTYPE_PUSHPULL(GPIOH_OSC_IN) | \
  1261. PIN_OTYPE_PUSHPULL(GPIOH_OSC_OUT) | \
  1262. PIN_OTYPE_PUSHPULL(GPIOH_SDCKE0) | \
  1263. PIN_OTYPE_PUSHPULL(GPIOH_SDNE0) | \
  1264. PIN_OTYPE_PUSHPULL(GPIOH_I2C2_SCL) | \
  1265. PIN_OTYPE_PUSHPULL(GPIOH_I2C2_SDA) | \
  1266. PIN_OTYPE_PUSHPULL(GPIOH_ARD_D10) | \
  1267. PIN_OTYPE_PUSHPULL(GPIOH_LCD_RESET) | \
  1268. PIN_OTYPE_PUSHPULL(GPIOH_PIN8) | \
  1269. PIN_OTYPE_PUSHPULL(GPIOH_PIN9) | \
  1270. PIN_OTYPE_PUSHPULL(GPIOH_PIN10) | \
  1271. PIN_OTYPE_PUSHPULL(GPIOH_PIN11) | \
  1272. PIN_OTYPE_PUSHPULL(GPIOH_PIN12) | \
  1273. PIN_OTYPE_PUSHPULL(GPIOH_PIN13) | \
  1274. PIN_OTYPE_PUSHPULL(GPIOH_PIN14) | \
  1275. PIN_OTYPE_PUSHPULL(GPIOH_PIN15))
  1276. #define VAL_GPIOH_OSPEEDR (PIN_OSPEED_HIGH(GPIOH_OSC_IN) | \
  1277. PIN_OSPEED_HIGH(GPIOH_OSC_OUT) | \
  1278. PIN_OSPEED_HIGH(GPIOH_SDCKE0) | \
  1279. PIN_OSPEED_HIGH(GPIOH_SDNE0) | \
  1280. PIN_OSPEED_HIGH(GPIOH_I2C2_SCL) | \
  1281. PIN_OSPEED_HIGH(GPIOH_I2C2_SDA) | \
  1282. PIN_OSPEED_HIGH(GPIOH_ARD_D10) | \
  1283. PIN_OSPEED_VERYLOW(GPIOH_LCD_RESET) | \
  1284. PIN_OSPEED_VERYLOW(GPIOH_PIN8) | \
  1285. PIN_OSPEED_VERYLOW(GPIOH_PIN9) | \
  1286. PIN_OSPEED_VERYLOW(GPIOH_PIN10) | \
  1287. PIN_OSPEED_VERYLOW(GPIOH_PIN11) | \
  1288. PIN_OSPEED_VERYLOW(GPIOH_PIN12) | \
  1289. PIN_OSPEED_VERYLOW(GPIOH_PIN13) | \
  1290. PIN_OSPEED_VERYLOW(GPIOH_PIN14) | \
  1291. PIN_OSPEED_VERYLOW(GPIOH_PIN15))
  1292. #define VAL_GPIOH_PUPDR (PIN_PUPDR_FLOATING(GPIOH_OSC_IN) | \
  1293. PIN_PUPDR_FLOATING(GPIOH_OSC_OUT) | \
  1294. PIN_PUPDR_FLOATING(GPIOH_SDCKE0) | \
  1295. PIN_PUPDR_FLOATING(GPIOH_SDNE0) | \
  1296. PIN_PUPDR_FLOATING(GPIOH_I2C2_SCL) | \
  1297. PIN_PUPDR_FLOATING(GPIOH_I2C2_SDA) | \
  1298. PIN_PUPDR_PULLUP(GPIOH_ARD_D10) | \
  1299. PIN_PUPDR_PULLUP(GPIOH_LCD_RESET) | \
  1300. PIN_PUPDR_PULLUP(GPIOH_PIN8) | \
  1301. PIN_PUPDR_PULLUP(GPIOH_PIN9) | \
  1302. PIN_PUPDR_PULLUP(GPIOH_PIN10) | \
  1303. PIN_PUPDR_PULLUP(GPIOH_PIN11) | \
  1304. PIN_PUPDR_PULLUP(GPIOH_PIN12) | \
  1305. PIN_PUPDR_PULLUP(GPIOH_PIN13) | \
  1306. PIN_PUPDR_PULLUP(GPIOH_PIN14) | \
  1307. PIN_PUPDR_PULLUP(GPIOH_PIN15))
  1308. #define VAL_GPIOH_ODR (PIN_ODR_HIGH(GPIOH_OSC_IN) | \
  1309. PIN_ODR_HIGH(GPIOH_OSC_OUT) | \
  1310. PIN_ODR_HIGH(GPIOH_SDCKE0) | \
  1311. PIN_ODR_HIGH(GPIOH_SDNE0) | \
  1312. PIN_ODR_HIGH(GPIOH_I2C2_SCL) | \
  1313. PIN_ODR_HIGH(GPIOH_I2C2_SDA) | \
  1314. PIN_ODR_HIGH(GPIOH_ARD_D10) | \
  1315. PIN_ODR_HIGH(GPIOH_LCD_RESET) | \
  1316. PIN_ODR_HIGH(GPIOH_PIN8) | \
  1317. PIN_ODR_HIGH(GPIOH_PIN9) | \
  1318. PIN_ODR_HIGH(GPIOH_PIN10) | \
  1319. PIN_ODR_HIGH(GPIOH_PIN11) | \
  1320. PIN_ODR_HIGH(GPIOH_PIN12) | \
  1321. PIN_ODR_HIGH(GPIOH_PIN13) | \
  1322. PIN_ODR_HIGH(GPIOH_PIN14) | \
  1323. PIN_ODR_HIGH(GPIOH_PIN15))
  1324. #define VAL_GPIOH_AFRL (PIN_AFIO_AF(GPIOH_OSC_IN, 0U) | \
  1325. PIN_AFIO_AF(GPIOH_OSC_OUT, 0U) | \
  1326. PIN_AFIO_AF(GPIOH_SDCKE0, 12U) | \
  1327. PIN_AFIO_AF(GPIOH_SDNE0, 12U) | \
  1328. PIN_AFIO_AF(GPIOH_I2C2_SCL, 4U) | \
  1329. PIN_AFIO_AF(GPIOH_I2C2_SDA, 4U) | \
  1330. PIN_AFIO_AF(GPIOH_ARD_D10, 0U) | \
  1331. PIN_AFIO_AF(GPIOH_LCD_RESET, 0U))
  1332. #define VAL_GPIOH_AFRH (PIN_AFIO_AF(GPIOH_PIN8, 0U) | \
  1333. PIN_AFIO_AF(GPIOH_PIN9, 0U) | \
  1334. PIN_AFIO_AF(GPIOH_PIN10, 0U) | \
  1335. PIN_AFIO_AF(GPIOH_PIN11, 0U) | \
  1336. PIN_AFIO_AF(GPIOH_PIN12, 0U) | \
  1337. PIN_AFIO_AF(GPIOH_PIN13, 0U) | \
  1338. PIN_AFIO_AF(GPIOH_PIN14, 0U) | \
  1339. PIN_AFIO_AF(GPIOH_PIN15, 0U))
  1340. /*
  1341. * GPIOI setup:
  1342. *
  1343. * PI0 - PIN0 (input pullup).
  1344. * PI1 - PIN1 (input pullup).
  1345. * PI2 - PIN2 (input pullup).
  1346. * PI3 - PIN3 (input pullup).
  1347. * PI4 - FMC_NBL2 (alternate 12).
  1348. * PI5 - FMC_NBL3 (alternate 12).
  1349. * PI6 - PIN6 (input pullup).
  1350. * PI7 - PIN7 (input pullup).
  1351. * PI8 - PIN8 (input pullup).
  1352. * PI9 - PIN9 (input pullup).
  1353. * PI10 - PIN10 (input pullup).
  1354. * PI11 - PIN11 (input pullup).
  1355. * PI12 - PIN12 (input pullup).
  1356. * PI13 - PIN13 (input pullup).
  1357. * PI14 - PIN14 (input pullup).
  1358. * PI15 - PIN15 (input pullup).
  1359. */
  1360. #define VAL_GPIOI_MODER (PIN_MODE_INPUT(GPIOI_PIN0) | \
  1361. PIN_MODE_INPUT(GPIOI_PIN1) | \
  1362. PIN_MODE_INPUT(GPIOI_PIN2) | \
  1363. PIN_MODE_INPUT(GPIOI_PIN3) | \
  1364. PIN_MODE_ALTERNATE(GPIOI_FMC_NBL2) | \
  1365. PIN_MODE_ALTERNATE(GPIOI_FMC_NBL3) | \
  1366. PIN_MODE_INPUT(GPIOI_PIN6) | \
  1367. PIN_MODE_INPUT(GPIOI_PIN7) | \
  1368. PIN_MODE_INPUT(GPIOI_PIN8) | \
  1369. PIN_MODE_INPUT(GPIOI_PIN9) | \
  1370. PIN_MODE_INPUT(GPIOI_PIN10) | \
  1371. PIN_MODE_INPUT(GPIOI_PIN11) | \
  1372. PIN_MODE_INPUT(GPIOI_PIN12) | \
  1373. PIN_MODE_INPUT(GPIOI_PIN13) | \
  1374. PIN_MODE_INPUT(GPIOI_PIN14) | \
  1375. PIN_MODE_INPUT(GPIOI_PIN15))
  1376. #define VAL_GPIOI_OTYPER (PIN_OTYPE_PUSHPULL(GPIOI_PIN0) | \
  1377. PIN_OTYPE_PUSHPULL(GPIOI_PIN1) | \
  1378. PIN_OTYPE_PUSHPULL(GPIOI_PIN2) | \
  1379. PIN_OTYPE_PUSHPULL(GPIOI_PIN3) | \
  1380. PIN_OTYPE_PUSHPULL(GPIOI_FMC_NBL2) | \
  1381. PIN_OTYPE_PUSHPULL(GPIOI_FMC_NBL3) | \
  1382. PIN_OTYPE_PUSHPULL(GPIOI_PIN6) | \
  1383. PIN_OTYPE_PUSHPULL(GPIOI_PIN7) | \
  1384. PIN_OTYPE_PUSHPULL(GPIOI_PIN8) | \
  1385. PIN_OTYPE_PUSHPULL(GPIOI_PIN9) | \
  1386. PIN_OTYPE_PUSHPULL(GPIOI_PIN10) | \
  1387. PIN_OTYPE_PUSHPULL(GPIOI_PIN11) | \
  1388. PIN_OTYPE_PUSHPULL(GPIOI_PIN12) | \
  1389. PIN_OTYPE_PUSHPULL(GPIOI_PIN13) | \
  1390. PIN_OTYPE_PUSHPULL(GPIOI_PIN14) | \
  1391. PIN_OTYPE_PUSHPULL(GPIOI_PIN15))
  1392. #define VAL_GPIOI_OSPEEDR (PIN_OSPEED_VERYLOW(GPIOI_PIN0) | \
  1393. PIN_OSPEED_VERYLOW(GPIOI_PIN1) | \
  1394. PIN_OSPEED_VERYLOW(GPIOI_PIN2) | \
  1395. PIN_OSPEED_VERYLOW(GPIOI_PIN3) | \
  1396. PIN_OSPEED_HIGH(GPIOI_FMC_NBL2) | \
  1397. PIN_OSPEED_HIGH(GPIOI_FMC_NBL3) | \
  1398. PIN_OSPEED_VERYLOW(GPIOI_PIN6) | \
  1399. PIN_OSPEED_VERYLOW(GPIOI_PIN7) | \
  1400. PIN_OSPEED_VERYLOW(GPIOI_PIN8) | \
  1401. PIN_OSPEED_VERYLOW(GPIOI_PIN9) | \
  1402. PIN_OSPEED_VERYLOW(GPIOI_PIN10) | \
  1403. PIN_OSPEED_VERYLOW(GPIOI_PIN11) | \
  1404. PIN_OSPEED_VERYLOW(GPIOI_PIN12) | \
  1405. PIN_OSPEED_VERYLOW(GPIOI_PIN13) | \
  1406. PIN_OSPEED_VERYLOW(GPIOI_PIN14) | \
  1407. PIN_OSPEED_VERYLOW(GPIOI_PIN15))
  1408. #define VAL_GPIOI_PUPDR (PIN_PUPDR_PULLUP(GPIOI_PIN0) | \
  1409. PIN_PUPDR_PULLUP(GPIOI_PIN1) | \
  1410. PIN_PUPDR_PULLUP(GPIOI_PIN2) | \
  1411. PIN_PUPDR_PULLUP(GPIOI_PIN3) | \
  1412. PIN_PUPDR_FLOATING(GPIOI_FMC_NBL2) | \
  1413. PIN_PUPDR_FLOATING(GPIOI_FMC_NBL3) | \
  1414. PIN_PUPDR_PULLUP(GPIOI_PIN6) | \
  1415. PIN_PUPDR_PULLUP(GPIOI_PIN7) | \
  1416. PIN_PUPDR_PULLUP(GPIOI_PIN8) | \
  1417. PIN_PUPDR_PULLUP(GPIOI_PIN9) | \
  1418. PIN_PUPDR_PULLUP(GPIOI_PIN10) | \
  1419. PIN_PUPDR_PULLUP(GPIOI_PIN11) | \
  1420. PIN_PUPDR_PULLUP(GPIOI_PIN12) | \
  1421. PIN_PUPDR_PULLUP(GPIOI_PIN13) | \
  1422. PIN_PUPDR_PULLUP(GPIOI_PIN14) | \
  1423. PIN_PUPDR_PULLUP(GPIOI_PIN15))
  1424. #define VAL_GPIOI_ODR (PIN_ODR_HIGH(GPIOI_PIN0) | \
  1425. PIN_ODR_HIGH(GPIOI_PIN1) | \
  1426. PIN_ODR_HIGH(GPIOI_PIN2) | \
  1427. PIN_ODR_HIGH(GPIOI_PIN3) | \
  1428. PIN_ODR_HIGH(GPIOI_FMC_NBL2) | \
  1429. PIN_ODR_HIGH(GPIOI_FMC_NBL3) | \
  1430. PIN_ODR_HIGH(GPIOI_PIN6) | \
  1431. PIN_ODR_HIGH(GPIOI_PIN7) | \
  1432. PIN_ODR_HIGH(GPIOI_PIN8) | \
  1433. PIN_ODR_HIGH(GPIOI_PIN9) | \
  1434. PIN_ODR_HIGH(GPIOI_PIN10) | \
  1435. PIN_ODR_HIGH(GPIOI_PIN11) | \
  1436. PIN_ODR_HIGH(GPIOI_PIN12) | \
  1437. PIN_ODR_HIGH(GPIOI_PIN13) | \
  1438. PIN_ODR_HIGH(GPIOI_PIN14) | \
  1439. PIN_ODR_HIGH(GPIOI_PIN15))
  1440. #define VAL_GPIOI_AFRL (PIN_AFIO_AF(GPIOI_PIN0, 0U) | \
  1441. PIN_AFIO_AF(GPIOI_PIN1, 0U) | \
  1442. PIN_AFIO_AF(GPIOI_PIN2, 0U) | \
  1443. PIN_AFIO_AF(GPIOI_PIN3, 0U) | \
  1444. PIN_AFIO_AF(GPIOI_FMC_NBL2, 12U) | \
  1445. PIN_AFIO_AF(GPIOI_FMC_NBL3, 12U) | \
  1446. PIN_AFIO_AF(GPIOI_PIN6, 0U) | \
  1447. PIN_AFIO_AF(GPIOI_PIN7, 0U))
  1448. #define VAL_GPIOI_AFRH (PIN_AFIO_AF(GPIOI_PIN8, 0U) | \
  1449. PIN_AFIO_AF(GPIOI_PIN9, 0U) | \
  1450. PIN_AFIO_AF(GPIOI_PIN10, 0U) | \
  1451. PIN_AFIO_AF(GPIOI_PIN11, 0U) | \
  1452. PIN_AFIO_AF(GPIOI_PIN12, 0U) | \
  1453. PIN_AFIO_AF(GPIOI_PIN13, 0U) | \
  1454. PIN_AFIO_AF(GPIOI_PIN14, 0U) | \
  1455. PIN_AFIO_AF(GPIOI_PIN15, 0U))
  1456. /*
  1457. * GPIOJ setup:
  1458. *
  1459. * PJ0 - PIN0 (input pullup).
  1460. * PJ1 - PIN1 (input pullup).
  1461. * PJ2 - DSI_TE (alternate 13).
  1462. * PJ3 - PIN3 (input pullup).
  1463. * PJ4 - PIN4 (input pullup).
  1464. * PJ5 - LCD_INT (input pullup).
  1465. * PJ6 - PIN6 (input pullup).
  1466. * PJ7 - PIN7 (input pullup).
  1467. * PJ8 - PIN8 (input pullup).
  1468. * PJ9 - PIN9 (input pullup).
  1469. * PJ10 - PIN10 (input pullup).
  1470. * PJ11 - PIN11 (input pullup).
  1471. * PJ12 - PIN12 (input pullup).
  1472. * PJ13 - PIN13 (input pullup).
  1473. * PJ14 - PIN14 (input pullup).
  1474. * PJ15 - PIN15 (input pullup).
  1475. */
  1476. #define VAL_GPIOJ_MODER (PIN_MODE_INPUT(GPIOJ_PIN0) | \
  1477. PIN_MODE_INPUT(GPIOJ_PIN1) | \
  1478. PIN_MODE_ALTERNATE(GPIOJ_DSI_TE) | \
  1479. PIN_MODE_INPUT(GPIOJ_PIN3) | \
  1480. PIN_MODE_INPUT(GPIOJ_PIN4) | \
  1481. PIN_MODE_INPUT(GPIOJ_LCD_INT) | \
  1482. PIN_MODE_INPUT(GPIOJ_PIN6) | \
  1483. PIN_MODE_INPUT(GPIOJ_PIN7) | \
  1484. PIN_MODE_INPUT(GPIOJ_PIN8) | \
  1485. PIN_MODE_INPUT(GPIOJ_PIN9) | \
  1486. PIN_MODE_INPUT(GPIOJ_PIN10) | \
  1487. PIN_MODE_INPUT(GPIOJ_PIN11) | \
  1488. PIN_MODE_INPUT(GPIOJ_PIN12) | \
  1489. PIN_MODE_INPUT(GPIOJ_PIN13) | \
  1490. PIN_MODE_INPUT(GPIOJ_PIN14) | \
  1491. PIN_MODE_INPUT(GPIOJ_PIN15))
  1492. #define VAL_GPIOJ_OTYPER (PIN_OTYPE_PUSHPULL(GPIOJ_PIN0) | \
  1493. PIN_OTYPE_PUSHPULL(GPIOJ_PIN1) | \
  1494. PIN_OTYPE_PUSHPULL(GPIOJ_DSI_TE) | \
  1495. PIN_OTYPE_PUSHPULL(GPIOJ_PIN3) | \
  1496. PIN_OTYPE_PUSHPULL(GPIOJ_PIN4) | \
  1497. PIN_OTYPE_PUSHPULL(GPIOJ_LCD_INT) | \
  1498. PIN_OTYPE_PUSHPULL(GPIOJ_PIN6) | \
  1499. PIN_OTYPE_PUSHPULL(GPIOJ_PIN7) | \
  1500. PIN_OTYPE_PUSHPULL(GPIOJ_PIN8) | \
  1501. PIN_OTYPE_PUSHPULL(GPIOJ_PIN9) | \
  1502. PIN_OTYPE_PUSHPULL(GPIOJ_PIN10) | \
  1503. PIN_OTYPE_PUSHPULL(GPIOJ_PIN11) | \
  1504. PIN_OTYPE_PUSHPULL(GPIOJ_PIN12) | \
  1505. PIN_OTYPE_PUSHPULL(GPIOJ_PIN13) | \
  1506. PIN_OTYPE_PUSHPULL(GPIOJ_PIN14) | \
  1507. PIN_OTYPE_PUSHPULL(GPIOJ_PIN15))
  1508. #define VAL_GPIOJ_OSPEEDR (PIN_OSPEED_VERYLOW(GPIOJ_PIN0) | \
  1509. PIN_OSPEED_VERYLOW(GPIOJ_PIN1) | \
  1510. PIN_OSPEED_HIGH(GPIOJ_DSI_TE) | \
  1511. PIN_OSPEED_VERYLOW(GPIOJ_PIN3) | \
  1512. PIN_OSPEED_VERYLOW(GPIOJ_PIN4) | \
  1513. PIN_OSPEED_VERYLOW(GPIOJ_LCD_INT) | \
  1514. PIN_OSPEED_VERYLOW(GPIOJ_PIN6) | \
  1515. PIN_OSPEED_VERYLOW(GPIOJ_PIN7) | \
  1516. PIN_OSPEED_VERYLOW(GPIOJ_PIN8) | \
  1517. PIN_OSPEED_VERYLOW(GPIOJ_PIN9) | \
  1518. PIN_OSPEED_VERYLOW(GPIOJ_PIN10) | \
  1519. PIN_OSPEED_VERYLOW(GPIOJ_PIN11) | \
  1520. PIN_OSPEED_VERYLOW(GPIOJ_PIN12) | \
  1521. PIN_OSPEED_VERYLOW(GPIOJ_PIN13) | \
  1522. PIN_OSPEED_VERYLOW(GPIOJ_PIN14) | \
  1523. PIN_OSPEED_VERYLOW(GPIOJ_PIN15))
  1524. #define VAL_GPIOJ_PUPDR (PIN_PUPDR_PULLUP(GPIOJ_PIN0) | \
  1525. PIN_PUPDR_PULLUP(GPIOJ_PIN1) | \
  1526. PIN_PUPDR_FLOATING(GPIOJ_DSI_TE) | \
  1527. PIN_PUPDR_PULLUP(GPIOJ_PIN3) | \
  1528. PIN_PUPDR_PULLUP(GPIOJ_PIN4) | \
  1529. PIN_PUPDR_PULLUP(GPIOJ_LCD_INT) | \
  1530. PIN_PUPDR_PULLUP(GPIOJ_PIN6) | \
  1531. PIN_PUPDR_PULLUP(GPIOJ_PIN7) | \
  1532. PIN_PUPDR_PULLUP(GPIOJ_PIN8) | \
  1533. PIN_PUPDR_PULLUP(GPIOJ_PIN9) | \
  1534. PIN_PUPDR_PULLUP(GPIOJ_PIN10) | \
  1535. PIN_PUPDR_PULLUP(GPIOJ_PIN11) | \
  1536. PIN_PUPDR_PULLUP(GPIOJ_PIN12) | \
  1537. PIN_PUPDR_PULLUP(GPIOJ_PIN13) | \
  1538. PIN_PUPDR_PULLUP(GPIOJ_PIN14) | \
  1539. PIN_PUPDR_PULLUP(GPIOJ_PIN15))
  1540. #define VAL_GPIOJ_ODR (PIN_ODR_HIGH(GPIOJ_PIN0) | \
  1541. PIN_ODR_HIGH(GPIOJ_PIN1) | \
  1542. PIN_ODR_HIGH(GPIOJ_DSI_TE) | \
  1543. PIN_ODR_HIGH(GPIOJ_PIN3) | \
  1544. PIN_ODR_HIGH(GPIOJ_PIN4) | \
  1545. PIN_ODR_HIGH(GPIOJ_LCD_INT) | \
  1546. PIN_ODR_HIGH(GPIOJ_PIN6) | \
  1547. PIN_ODR_HIGH(GPIOJ_PIN7) | \
  1548. PIN_ODR_HIGH(GPIOJ_PIN8) | \
  1549. PIN_ODR_HIGH(GPIOJ_PIN9) | \
  1550. PIN_ODR_HIGH(GPIOJ_PIN10) | \
  1551. PIN_ODR_HIGH(GPIOJ_PIN11) | \
  1552. PIN_ODR_HIGH(GPIOJ_PIN12) | \
  1553. PIN_ODR_HIGH(GPIOJ_PIN13) | \
  1554. PIN_ODR_HIGH(GPIOJ_PIN14) | \
  1555. PIN_ODR_HIGH(GPIOJ_PIN15))
  1556. #define VAL_GPIOJ_AFRL (PIN_AFIO_AF(GPIOJ_PIN0, 0U) | \
  1557. PIN_AFIO_AF(GPIOJ_PIN1, 0U) | \
  1558. PIN_AFIO_AF(GPIOJ_DSI_TE, 13U) | \
  1559. PIN_AFIO_AF(GPIOJ_PIN3, 0U) | \
  1560. PIN_AFIO_AF(GPIOJ_PIN4, 0U) | \
  1561. PIN_AFIO_AF(GPIOJ_LCD_INT, 0U) | \
  1562. PIN_AFIO_AF(GPIOJ_PIN6, 0U) | \
  1563. PIN_AFIO_AF(GPIOJ_PIN7, 0U))
  1564. #define VAL_GPIOJ_AFRH (PIN_AFIO_AF(GPIOJ_PIN8, 0U) | \
  1565. PIN_AFIO_AF(GPIOJ_PIN9, 0U) | \
  1566. PIN_AFIO_AF(GPIOJ_PIN10, 0U) | \
  1567. PIN_AFIO_AF(GPIOJ_PIN11, 0U) | \
  1568. PIN_AFIO_AF(GPIOJ_PIN12, 0U) | \
  1569. PIN_AFIO_AF(GPIOJ_PIN13, 0U) | \
  1570. PIN_AFIO_AF(GPIOJ_PIN14, 0U) | \
  1571. PIN_AFIO_AF(GPIOJ_PIN15, 0U))
  1572. /*
  1573. * GPIOK setup:
  1574. *
  1575. * PK0 - PIN0 (input pullup).
  1576. * PK1 - PIN1 (input pullup).
  1577. * PK2 - PIN2 (input pullup).
  1578. * PK3 - LED4 (output pushpull maximum).
  1579. * PK4 - PIN4 (input pullup).
  1580. * PK5 - PIN5 (input pullup).
  1581. * PK6 - PIN6 (input pullup).
  1582. * PK7 - PIN7 (input pullup).
  1583. * PK8 - PIN8 (input pullup).
  1584. * PK9 - PIN9 (input pullup).
  1585. * PK10 - PIN10 (input pullup).
  1586. * PK11 - PIN11 (input pullup).
  1587. * PK12 - PIN12 (input pullup).
  1588. * PK13 - PIN13 (input pullup).
  1589. * PK14 - PIN14 (input pullup).
  1590. * PK15 - PIN15 (input pullup).
  1591. */
  1592. #define VAL_GPIOK_MODER (PIN_MODE_INPUT(GPIOK_PIN0) | \
  1593. PIN_MODE_INPUT(GPIOK_PIN1) | \
  1594. PIN_MODE_INPUT(GPIOK_PIN2) | \
  1595. PIN_MODE_OUTPUT(GPIOK_LED4) | \
  1596. PIN_MODE_INPUT(GPIOK_PIN4) | \
  1597. PIN_MODE_INPUT(GPIOK_PIN5) | \
  1598. PIN_MODE_INPUT(GPIOK_PIN6) | \
  1599. PIN_MODE_INPUT(GPIOK_PIN7) | \
  1600. PIN_MODE_INPUT(GPIOK_PIN8) | \
  1601. PIN_MODE_INPUT(GPIOK_PIN9) | \
  1602. PIN_MODE_INPUT(GPIOK_PIN10) | \
  1603. PIN_MODE_INPUT(GPIOK_PIN11) | \
  1604. PIN_MODE_INPUT(GPIOK_PIN12) | \
  1605. PIN_MODE_INPUT(GPIOK_PIN13) | \
  1606. PIN_MODE_INPUT(GPIOK_PIN14) | \
  1607. PIN_MODE_INPUT(GPIOK_PIN15))
  1608. #define VAL_GPIOK_OTYPER (PIN_OTYPE_PUSHPULL(GPIOK_PIN0) | \
  1609. PIN_OTYPE_PUSHPULL(GPIOK_PIN1) | \
  1610. PIN_OTYPE_PUSHPULL(GPIOK_PIN2) | \
  1611. PIN_OTYPE_PUSHPULL(GPIOK_LED4) | \
  1612. PIN_OTYPE_PUSHPULL(GPIOK_PIN4) | \
  1613. PIN_OTYPE_PUSHPULL(GPIOK_PIN5) | \
  1614. PIN_OTYPE_PUSHPULL(GPIOK_PIN6) | \
  1615. PIN_OTYPE_PUSHPULL(GPIOK_PIN7) | \
  1616. PIN_OTYPE_PUSHPULL(GPIOK_PIN8) | \
  1617. PIN_OTYPE_PUSHPULL(GPIOK_PIN9) | \
  1618. PIN_OTYPE_PUSHPULL(GPIOK_PIN10) | \
  1619. PIN_OTYPE_PUSHPULL(GPIOK_PIN11) | \
  1620. PIN_OTYPE_PUSHPULL(GPIOK_PIN12) | \
  1621. PIN_OTYPE_PUSHPULL(GPIOK_PIN13) | \
  1622. PIN_OTYPE_PUSHPULL(GPIOK_PIN14) | \
  1623. PIN_OTYPE_PUSHPULL(GPIOK_PIN15))
  1624. #define VAL_GPIOK_OSPEEDR (PIN_OSPEED_VERYLOW(GPIOK_PIN0) | \
  1625. PIN_OSPEED_VERYLOW(GPIOK_PIN1) | \
  1626. PIN_OSPEED_VERYLOW(GPIOK_PIN2) | \
  1627. PIN_OSPEED_HIGH(GPIOK_LED4) | \
  1628. PIN_OSPEED_VERYLOW(GPIOK_PIN4) | \
  1629. PIN_OSPEED_VERYLOW(GPIOK_PIN5) | \
  1630. PIN_OSPEED_VERYLOW(GPIOK_PIN6) | \
  1631. PIN_OSPEED_VERYLOW(GPIOK_PIN7) | \
  1632. PIN_OSPEED_VERYLOW(GPIOK_PIN8) | \
  1633. PIN_OSPEED_VERYLOW(GPIOK_PIN9) | \
  1634. PIN_OSPEED_VERYLOW(GPIOK_PIN10) | \
  1635. PIN_OSPEED_VERYLOW(GPIOK_PIN11) | \
  1636. PIN_OSPEED_VERYLOW(GPIOK_PIN12) | \
  1637. PIN_OSPEED_VERYLOW(GPIOK_PIN13) | \
  1638. PIN_OSPEED_VERYLOW(GPIOK_PIN14) | \
  1639. PIN_OSPEED_VERYLOW(GPIOK_PIN15))
  1640. #define VAL_GPIOK_PUPDR (PIN_PUPDR_PULLUP(GPIOK_PIN0) | \
  1641. PIN_PUPDR_PULLUP(GPIOK_PIN1) | \
  1642. PIN_PUPDR_PULLUP(GPIOK_PIN2) | \
  1643. PIN_PUPDR_FLOATING(GPIOK_LED4) | \
  1644. PIN_PUPDR_PULLUP(GPIOK_PIN4) | \
  1645. PIN_PUPDR_PULLUP(GPIOK_PIN5) | \
  1646. PIN_PUPDR_PULLUP(GPIOK_PIN6) | \
  1647. PIN_PUPDR_PULLUP(GPIOK_PIN7) | \
  1648. PIN_PUPDR_PULLUP(GPIOK_PIN8) | \
  1649. PIN_PUPDR_PULLUP(GPIOK_PIN9) | \
  1650. PIN_PUPDR_PULLUP(GPIOK_PIN10) | \
  1651. PIN_PUPDR_PULLUP(GPIOK_PIN11) | \
  1652. PIN_PUPDR_PULLUP(GPIOK_PIN12) | \
  1653. PIN_PUPDR_PULLUP(GPIOK_PIN13) | \
  1654. PIN_PUPDR_PULLUP(GPIOK_PIN14) | \
  1655. PIN_PUPDR_PULLUP(GPIOK_PIN15))
  1656. #define VAL_GPIOK_ODR (PIN_ODR_HIGH(GPIOK_PIN0) | \
  1657. PIN_ODR_HIGH(GPIOK_PIN1) | \
  1658. PIN_ODR_HIGH(GPIOK_PIN2) | \
  1659. PIN_ODR_HIGH(GPIOK_LED4) | \
  1660. PIN_ODR_HIGH(GPIOK_PIN4) | \
  1661. PIN_ODR_HIGH(GPIOK_PIN5) | \
  1662. PIN_ODR_HIGH(GPIOK_PIN6) | \
  1663. PIN_ODR_HIGH(GPIOK_PIN7) | \
  1664. PIN_ODR_HIGH(GPIOK_PIN8) | \
  1665. PIN_ODR_HIGH(GPIOK_PIN9) | \
  1666. PIN_ODR_HIGH(GPIOK_PIN10) | \
  1667. PIN_ODR_HIGH(GPIOK_PIN11) | \
  1668. PIN_ODR_HIGH(GPIOK_PIN12) | \
  1669. PIN_ODR_HIGH(GPIOK_PIN13) | \
  1670. PIN_ODR_HIGH(GPIOK_PIN14) | \
  1671. PIN_ODR_HIGH(GPIOK_PIN15))
  1672. #define VAL_GPIOK_AFRL (PIN_AFIO_AF(GPIOK_PIN0, 0U) | \
  1673. PIN_AFIO_AF(GPIOK_PIN1, 0U) | \
  1674. PIN_AFIO_AF(GPIOK_PIN2, 0U) | \
  1675. PIN_AFIO_AF(GPIOK_LED4, 0U) | \
  1676. PIN_AFIO_AF(GPIOK_PIN4, 0U) | \
  1677. PIN_AFIO_AF(GPIOK_PIN5, 0U) | \
  1678. PIN_AFIO_AF(GPIOK_PIN6, 0U) | \
  1679. PIN_AFIO_AF(GPIOK_PIN7, 0U))
  1680. #define VAL_GPIOK_AFRH (PIN_AFIO_AF(GPIOK_PIN8, 0U) | \
  1681. PIN_AFIO_AF(GPIOK_PIN9, 0U) | \
  1682. PIN_AFIO_AF(GPIOK_PIN10, 0U) | \
  1683. PIN_AFIO_AF(GPIOK_PIN11, 0U) | \
  1684. PIN_AFIO_AF(GPIOK_PIN12, 0U) | \
  1685. PIN_AFIO_AF(GPIOK_PIN13, 0U) | \
  1686. PIN_AFIO_AF(GPIOK_PIN14, 0U) | \
  1687. PIN_AFIO_AF(GPIOK_PIN15, 0U))
  1688. /*===========================================================================*/
  1689. /* External declarations. */
  1690. /*===========================================================================*/
  1691. #if !defined(_FROM_ASM_)
  1692. #ifdef __cplusplus
  1693. extern "C" {
  1694. #endif
  1695. void boardInit(void);
  1696. #ifdef __cplusplus
  1697. }
  1698. #endif
  1699. #endif /* _FROM_ASM_ */
  1700. #endif /* BOARD_H */