board.h 88 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420
  1. /*
  2. ChibiOS - Copyright (C) 2006..2018 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 STM32F429I-Discovery board.
  24. */
  25. /*
  26. * Board identifier.
  27. */
  28. #define BOARD_ST_STM32F429I_DISCOVERY
  29. #define BOARD_NAME "STMicroelectronics STM32F429I-Discovery"
  30. /*
  31. * Board oscillators-related settings.
  32. * NOTE: LSE not fitted.
  33. */
  34. #if !defined(STM32_LSECLK)
  35. #define STM32_LSECLK 0U
  36. #endif
  37. #if !defined(STM32_HSECLK)
  38. #define STM32_HSECLK 8000000U
  39. #endif
  40. /*
  41. * Board voltages.
  42. * Required for performance limits calculation.
  43. */
  44. #define STM32_VDD 300U
  45. /*
  46. * MCU type as defined in the ST header.
  47. */
  48. #define STM32F429xx
  49. /*
  50. * IO pins assignments.
  51. */
  52. #define GPIOA_BUTTON 0U
  53. #define GPIOA_MEMS_INT1 1U
  54. #define GPIOA_MEMS_INT2 2U
  55. #define GPIOA_LCD_B5 3U
  56. #define GPIOA_LCD_VSYNC 4U
  57. #define GPIOA_PIN5 5U
  58. #define GPIOA_LCD_G2 6U
  59. #define GPIOA_ACP_RST 7U
  60. #define GPIOA_I2C3_SCL 8U
  61. #define GPIOA_UART_TX 9U
  62. #define GPIOA_UART_RX 10U
  63. #define GPIOA_LCD_R4 11U
  64. #define GPIOA_LCD_R5 12U
  65. #define GPIOA_SWDIO 13U
  66. #define GPIOA_SWCLK 14U
  67. #define GPIOA_TP_INT 15U
  68. #define GPIOB_LCD_R3 0U
  69. #define GPIOB_LCD_R6 1U
  70. #define GPIOB_BOOT1 2U
  71. #define GPIOB_SWO 3U
  72. #define GPIOB_PIN4 4U
  73. #define GPIOB_FMC_SDCKE1 5U
  74. #define GPIOB_FMC_SDNE1 6U
  75. #define GPIOB_PIN7 7U
  76. #define GPIOB_LCD_B6 8U
  77. #define GPIOB_LCD_B7 9U
  78. #define GPIOB_LCD_G4 10U
  79. #define GPIOB_LCD_G5 11U
  80. #define GPIOB_OTG_HS_ID 12U
  81. #define GPIOB_OTG_HS_VBUS 13U
  82. #define GPIOB_OTG_HS_DM 14U
  83. #define GPIOB_OTG_HS_DP 15U
  84. #define GPIOC_FMC_SDNWE 0U
  85. #define GPIOC_SPI5_MEMS_CS 1U
  86. #define GPIOC_SPI5_LCD_CS 2U
  87. #define GPIOC_PIN3 3U
  88. #define GPIOC_OTG_HS_PSO 4U
  89. #define GPIOC_OTG_HS_OC 5U
  90. #define GPIOC_LCD_HSYNC 6U
  91. #define GPIOC_LCD_G6 7U
  92. #define GPIOC_PIN8 8U
  93. #define GPIOC_I2C3_SDA 9U
  94. #define GPIOC_LCD_R2 10U
  95. #define GPIOC_PIN11 11U
  96. #define GPIOC_PIN12 12U
  97. #define GPIOC_PIN13 13U
  98. #define GPIOC_OSC32_IN 14U
  99. #define GPIOC_OSC32_OUT 15U
  100. #define GPIOD_FMC_D2 0U
  101. #define GPIOD_FMC_D3 1U
  102. #define GPIOD_PIN2 2U
  103. #define GPIOD_LCD_G7 3U
  104. #define GPIOD_PIN4 4U
  105. #define GPIOD_PIN5 5U
  106. #define GPIOD_LCD_B2 6U
  107. #define GPIOD_PIN7 7U
  108. #define GPIOD_FMC_D13 8U
  109. #define GPIOD_FMC_D14 9U
  110. #define GPIOD_FMC_D15 10U
  111. #define GPIOD_LCD_TE 11U
  112. #define GPIOD_LCD_RDX 12U
  113. #define GPIOD_LCD_WRX 13U
  114. #define GPIOD_FMC_D0 14U
  115. #define GPIOD_FMC_D1 15U
  116. #define GPIOE_FMC_NBL0 0U
  117. #define GPIOE_FMC_NBL1 1U
  118. #define GPIOE_PIN2 2U
  119. #define GPIOE_PIN3 3U
  120. #define GPIOE_PIN4 4U
  121. #define GPIOE_PIN5 5U
  122. #define GPIOE_PIN6 6U
  123. #define GPIOE_FMC_D4 7U
  124. #define GPIOE_FMC_D5 8U
  125. #define GPIOE_FMC_D6 9U
  126. #define GPIOE_FMC_D7 10U
  127. #define GPIOE_FMC_D8 11U
  128. #define GPIOE_FMC_D9 12U
  129. #define GPIOE_FMC_D10 13U
  130. #define GPIOE_FMC_D11 14U
  131. #define GPIOE_FMC_D12 15U
  132. #define GPIOF_FMC_A0 0U
  133. #define GPIOF_FMC_A1 1U
  134. #define GPIOF_FMC_A2 2U
  135. #define GPIOF_FMC_A3 3U
  136. #define GPIOF_FMC_A4 4U
  137. #define GPIOF_FMC_A5 5U
  138. #define GPIOF_PIN6 6U
  139. #define GPIOF_LCD_DCX 7U
  140. #define GPIOF_SPI5_MISO 8U
  141. #define GPIOF_SPI5_MOSI 9U
  142. #define GPIOF_LCD_DE 10U
  143. #define GPIOF_FMC_SDNRAS 11U
  144. #define GPIOF_FMC_A6 12U
  145. #define GPIOF_FMC_A7 13U
  146. #define GPIOF_FMC_A8 14U
  147. #define GPIOF_FMC_A9 15U
  148. #define GPIOG_FMC_A10 0U
  149. #define GPIOG_FMC_A11 1U
  150. #define GPIOG_PIN2 2U
  151. #define GPIOG_PIN3 3U
  152. #define GPIOG_FMC_BA0 4U
  153. #define GPIOG_FMC_BA1 5U
  154. #define GPIOG_LCD_R7 6U
  155. #define GPIOG_LCD_CLK 7U
  156. #define GPIOG_FMC_SDCLK 8U
  157. #define GPIOG_PIN9 9U
  158. #define GPIOG_LCD_G3 10U
  159. #define GPIOG_LCD_B3 11U
  160. #define GPIOG_LCD_B4 12U
  161. #define GPIOG_LED3_GREEN 13U
  162. #define GPIOG_LED4_RED 14U
  163. #define GPIOG_FMC_SDNCAS 15U
  164. #define GPIOH_OSC_IN 0U
  165. #define GPIOH_OSC_OUT 1U
  166. #define GPIOH_PIN2 2U
  167. #define GPIOH_PIN3 3U
  168. #define GPIOH_PIN4 4U
  169. #define GPIOH_PIN5 5U
  170. #define GPIOH_PIN6 6U
  171. #define GPIOH_PIN7 7U
  172. #define GPIOH_PIN8 8U
  173. #define GPIOH_PIN9 9U
  174. #define GPIOH_PIN10 10U
  175. #define GPIOH_PIN11 11U
  176. #define GPIOH_PIN12 12U
  177. #define GPIOH_PIN13 13U
  178. #define GPIOH_PIN14 14U
  179. #define GPIOH_PIN15 15U
  180. #define GPIOI_PIN0 0U
  181. #define GPIOI_PIN1 1U
  182. #define GPIOI_PIN2 2U
  183. #define GPIOI_PIN3 3U
  184. #define GPIOI_PIN4 4U
  185. #define GPIOI_PIN5 5U
  186. #define GPIOI_PIN6 6U
  187. #define GPIOI_PIN7 7U
  188. #define GPIOI_PIN8 8U
  189. #define GPIOI_PIN9 9U
  190. #define GPIOI_PIN10 10U
  191. #define GPIOI_PIN11 11U
  192. #define GPIOI_PIN12 12U
  193. #define GPIOI_PIN13 13U
  194. #define GPIOI_PIN14 14U
  195. #define GPIOI_PIN15 15U
  196. /*
  197. * IO lines assignments.
  198. */
  199. #define LINE_BUTTON PAL_LINE(GPIOA, 0U)
  200. #define LINE_MEMS_INT1 PAL_LINE(GPIOA, 1U)
  201. #define LINE_MEMS_INT2 PAL_LINE(GPIOA, 2U)
  202. #define LINE_LCD_B5 PAL_LINE(GPIOA, 3U)
  203. #define LINE_LCD_VSYNC PAL_LINE(GPIOA, 4U)
  204. #define LINE_LCD_G2 PAL_LINE(GPIOA, 6U)
  205. #define LINE_ACP_RST PAL_LINE(GPIOA, 7U)
  206. #define LINE_I2C3_SCL PAL_LINE(GPIOA, 8U)
  207. #define LINE_UART_TX PAL_LINE(GPIOA, 9U)
  208. #define LINE_UART_RX PAL_LINE(GPIOA, 10U)
  209. #define LINE_LCD_R4 PAL_LINE(GPIOA, 11U)
  210. #define LINE_LCD_R5 PAL_LINE(GPIOA, 12U)
  211. #define LINE_SWDIO PAL_LINE(GPIOA, 13U)
  212. #define LINE_SWCLK PAL_LINE(GPIOA, 14U)
  213. #define LINE_TP_INT PAL_LINE(GPIOA, 15U)
  214. #define LINE_LCD_R3 PAL_LINE(GPIOB, 0U)
  215. #define LINE_LCD_R6 PAL_LINE(GPIOB, 1U)
  216. #define LINE_BOOT1 PAL_LINE(GPIOB, 2U)
  217. #define LINE_SWO PAL_LINE(GPIOB, 3U)
  218. #define LINE_FMC_SDCKE1 PAL_LINE(GPIOB, 5U)
  219. #define LINE_FMC_SDNE1 PAL_LINE(GPIOB, 6U)
  220. #define LINE_LCD_B6 PAL_LINE(GPIOB, 8U)
  221. #define LINE_LCD_B7 PAL_LINE(GPIOB, 9U)
  222. #define LINE_LCD_G4 PAL_LINE(GPIOB, 10U)
  223. #define LINE_LCD_G5 PAL_LINE(GPIOB, 11U)
  224. #define LINE_OTG_HS_ID PAL_LINE(GPIOB, 12U)
  225. #define LINE_OTG_HS_VBUS PAL_LINE(GPIOB, 13U)
  226. #define LINE_OTG_HS_DM PAL_LINE(GPIOB, 14U)
  227. #define LINE_OTG_HS_DP PAL_LINE(GPIOB, 15U)
  228. #define LINE_FMC_SDNWE PAL_LINE(GPIOC, 0U)
  229. #define LINE_SPI5_MEMS_CS PAL_LINE(GPIOC, 1U)
  230. #define LINE_SPI5_LCD_CS PAL_LINE(GPIOC, 2U)
  231. #define LINE_OTG_HS_PSO PAL_LINE(GPIOC, 4U)
  232. #define LINE_OTG_HS_OC PAL_LINE(GPIOC, 5U)
  233. #define LINE_LCD_HSYNC PAL_LINE(GPIOC, 6U)
  234. #define LINE_LCD_G6 PAL_LINE(GPIOC, 7U)
  235. #define LINE_I2C3_SDA PAL_LINE(GPIOC, 9U)
  236. #define LINE_LCD_R2 PAL_LINE(GPIOC, 10U)
  237. #define LINE_OSC32_IN PAL_LINE(GPIOC, 14U)
  238. #define LINE_OSC32_OUT PAL_LINE(GPIOC, 15U)
  239. #define LINE_FMC_D2 PAL_LINE(GPIOD, 0U)
  240. #define LINE_FMC_D3 PAL_LINE(GPIOD, 1U)
  241. #define LINE_LCD_G7 PAL_LINE(GPIOD, 3U)
  242. #define LINE_LCD_B2 PAL_LINE(GPIOD, 6U)
  243. #define LINE_FMC_D13 PAL_LINE(GPIOD, 8U)
  244. #define LINE_FMC_D14 PAL_LINE(GPIOD, 9U)
  245. #define LINE_FMC_D15 PAL_LINE(GPIOD, 10U)
  246. #define LINE_LCD_TE PAL_LINE(GPIOD, 11U)
  247. #define LINE_LCD_RDX PAL_LINE(GPIOD, 12U)
  248. #define LINE_LCD_WRX PAL_LINE(GPIOD, 13U)
  249. #define LINE_FMC_D0 PAL_LINE(GPIOD, 14U)
  250. #define LINE_FMC_D1 PAL_LINE(GPIOD, 15U)
  251. #define LINE_FMC_NBL0 PAL_LINE(GPIOE, 0U)
  252. #define LINE_FMC_NBL1 PAL_LINE(GPIOE, 1U)
  253. #define LINE_FMC_D4 PAL_LINE(GPIOE, 7U)
  254. #define LINE_FMC_D5 PAL_LINE(GPIOE, 8U)
  255. #define LINE_FMC_D6 PAL_LINE(GPIOE, 9U)
  256. #define LINE_FMC_D7 PAL_LINE(GPIOE, 10U)
  257. #define LINE_FMC_D8 PAL_LINE(GPIOE, 11U)
  258. #define LINE_FMC_D9 PAL_LINE(GPIOE, 12U)
  259. #define LINE_FMC_D10 PAL_LINE(GPIOE, 13U)
  260. #define LINE_FMC_D11 PAL_LINE(GPIOE, 14U)
  261. #define LINE_FMC_D12 PAL_LINE(GPIOE, 15U)
  262. #define LINE_FMC_A0 PAL_LINE(GPIOF, 0U)
  263. #define LINE_FMC_A1 PAL_LINE(GPIOF, 1U)
  264. #define LINE_FMC_A2 PAL_LINE(GPIOF, 2U)
  265. #define LINE_FMC_A3 PAL_LINE(GPIOF, 3U)
  266. #define LINE_FMC_A4 PAL_LINE(GPIOF, 4U)
  267. #define LINE_FMC_A5 PAL_LINE(GPIOF, 5U)
  268. #define LINE_LCD_DCX PAL_LINE(GPIOF, 7U)
  269. #define LINE_SPI5_MISO PAL_LINE(GPIOF, 8U)
  270. #define LINE_SPI5_MOSI PAL_LINE(GPIOF, 9U)
  271. #define LINE_LCD_DE PAL_LINE(GPIOF, 10U)
  272. #define LINE_FMC_SDNRAS PAL_LINE(GPIOF, 11U)
  273. #define LINE_FMC_A6 PAL_LINE(GPIOF, 12U)
  274. #define LINE_FMC_A7 PAL_LINE(GPIOF, 13U)
  275. #define LINE_FMC_A8 PAL_LINE(GPIOF, 14U)
  276. #define LINE_FMC_A9 PAL_LINE(GPIOF, 15U)
  277. #define LINE_FMC_A10 PAL_LINE(GPIOG, 0U)
  278. #define LINE_FMC_A11 PAL_LINE(GPIOG, 1U)
  279. #define LINE_FMC_BA0 PAL_LINE(GPIOG, 4U)
  280. #define LINE_FMC_BA1 PAL_LINE(GPIOG, 5U)
  281. #define LINE_LCD_R7 PAL_LINE(GPIOG, 6U)
  282. #define LINE_LCD_CLK PAL_LINE(GPIOG, 7U)
  283. #define LINE_FMC_SDCLK PAL_LINE(GPIOG, 8U)
  284. #define LINE_LCD_G3 PAL_LINE(GPIOG, 10U)
  285. #define LINE_LCD_B3 PAL_LINE(GPIOG, 11U)
  286. #define LINE_LCD_B4 PAL_LINE(GPIOG, 12U)
  287. #define LINE_LED3_GREEN PAL_LINE(GPIOG, 13U)
  288. #define LINE_LED4_RED PAL_LINE(GPIOG, 14U)
  289. #define LINE_FMC_SDNCAS PAL_LINE(GPIOG, 15U)
  290. #define LINE_OSC_IN PAL_LINE(GPIOH, 0U)
  291. #define LINE_OSC_OUT PAL_LINE(GPIOH, 1U)
  292. /*===========================================================================*/
  293. /* Driver pre-compile time settings. */
  294. /*===========================================================================*/
  295. /*===========================================================================*/
  296. /* Derived constants and error checks. */
  297. /*===========================================================================*/
  298. /*===========================================================================*/
  299. /* Driver data structures and types. */
  300. /*===========================================================================*/
  301. /*===========================================================================*/
  302. /* Driver macros. */
  303. /*===========================================================================*/
  304. /*
  305. * I/O ports initial setup, this configuration is established soon after reset
  306. * in the initialization code.
  307. * Please refer to the STM32 Reference Manual for details.
  308. */
  309. #define PIN_MODE_INPUT(n) (0U << ((n) * 2U))
  310. #define PIN_MODE_OUTPUT(n) (1U << ((n) * 2U))
  311. #define PIN_MODE_ALTERNATE(n) (2U << ((n) * 2U))
  312. #define PIN_MODE_ANALOG(n) (3U << ((n) * 2U))
  313. #define PIN_ODR_LOW(n) (0U << (n))
  314. #define PIN_ODR_HIGH(n) (1U << (n))
  315. #define PIN_OTYPE_PUSHPULL(n) (0U << (n))
  316. #define PIN_OTYPE_OPENDRAIN(n) (1U << (n))
  317. #define PIN_OSPEED_VERYLOW(n) (0U << ((n) * 2U))
  318. #define PIN_OSPEED_LOW(n) (1U << ((n) * 2U))
  319. #define PIN_OSPEED_MEDIUM(n) (2U << ((n) * 2U))
  320. #define PIN_OSPEED_HIGH(n) (3U << ((n) * 2U))
  321. #define PIN_PUPDR_FLOATING(n) (0U << ((n) * 2U))
  322. #define PIN_PUPDR_PULLUP(n) (1U << ((n) * 2U))
  323. #define PIN_PUPDR_PULLDOWN(n) (2U << ((n) * 2U))
  324. #define PIN_AFIO_AF(n, v) ((v) << (((n) % 8U) * 4U))
  325. /*
  326. * GPIOA setup:
  327. *
  328. * PA0 - BUTTON (input floating).
  329. * PA1 - MEMS_INT1 (input floating).
  330. * PA2 - MEMS_INT2 (input floating).
  331. * PA3 - LCD_B5 (alternate 14).
  332. * PA4 - LCD_VSYNC (alternate 14).
  333. * PA5 - PIN5 (input pullup).
  334. * PA6 - LCD_G2 (alternate 14).
  335. * PA7 - ACP_RST (input pullup).
  336. * PA8 - I2C3_SCL (alternate 4).
  337. * PA9 - UART_TX (alternate 7).
  338. * PA10 - UART_RX (alternate 7).
  339. * PA11 - LCD_R4 (alternate 14).
  340. * PA12 - LCD_R5 (alternate 14).
  341. * PA13 - SWDIO (alternate 0).
  342. * PA14 - SWCLK (alternate 0).
  343. * PA15 - TP_INT (input floating).
  344. */
  345. #define VAL_GPIOA_MODER (PIN_MODE_INPUT(GPIOA_BUTTON) | \
  346. PIN_MODE_INPUT(GPIOA_MEMS_INT1) | \
  347. PIN_MODE_INPUT(GPIOA_MEMS_INT2) | \
  348. PIN_MODE_ALTERNATE(GPIOA_LCD_B5) | \
  349. PIN_MODE_ALTERNATE(GPIOA_LCD_VSYNC) | \
  350. PIN_MODE_INPUT(GPIOA_PIN5) | \
  351. PIN_MODE_ALTERNATE(GPIOA_LCD_G2) | \
  352. PIN_MODE_INPUT(GPIOA_ACP_RST) | \
  353. PIN_MODE_ALTERNATE(GPIOA_I2C3_SCL) | \
  354. PIN_MODE_ALTERNATE(GPIOA_UART_TX) | \
  355. PIN_MODE_ALTERNATE(GPIOA_UART_RX) | \
  356. PIN_MODE_ALTERNATE(GPIOA_LCD_R4) | \
  357. PIN_MODE_ALTERNATE(GPIOA_LCD_R5) | \
  358. PIN_MODE_ALTERNATE(GPIOA_SWDIO) | \
  359. PIN_MODE_ALTERNATE(GPIOA_SWCLK) | \
  360. PIN_MODE_INPUT(GPIOA_TP_INT))
  361. #define VAL_GPIOA_OTYPER (PIN_OTYPE_PUSHPULL(GPIOA_BUTTON) | \
  362. PIN_OTYPE_PUSHPULL(GPIOA_MEMS_INT1) | \
  363. PIN_OTYPE_PUSHPULL(GPIOA_MEMS_INT2) | \
  364. PIN_OTYPE_PUSHPULL(GPIOA_LCD_B5) | \
  365. PIN_OTYPE_PUSHPULL(GPIOA_LCD_VSYNC) | \
  366. PIN_OTYPE_PUSHPULL(GPIOA_PIN5) | \
  367. PIN_OTYPE_PUSHPULL(GPIOA_LCD_G2) | \
  368. PIN_OTYPE_PUSHPULL(GPIOA_ACP_RST) | \
  369. PIN_OTYPE_OPENDRAIN(GPIOA_I2C3_SCL) | \
  370. PIN_OTYPE_PUSHPULL(GPIOA_UART_TX) | \
  371. PIN_OTYPE_PUSHPULL(GPIOA_UART_RX) | \
  372. PIN_OTYPE_PUSHPULL(GPIOA_LCD_R4) | \
  373. PIN_OTYPE_PUSHPULL(GPIOA_LCD_R5) | \
  374. PIN_OTYPE_PUSHPULL(GPIOA_SWDIO) | \
  375. PIN_OTYPE_PUSHPULL(GPIOA_SWCLK) | \
  376. PIN_OTYPE_PUSHPULL(GPIOA_TP_INT))
  377. #define VAL_GPIOA_OSPEEDR (PIN_OSPEED_VERYLOW(GPIOA_BUTTON) | \
  378. PIN_OSPEED_VERYLOW(GPIOA_MEMS_INT1) | \
  379. PIN_OSPEED_VERYLOW(GPIOA_MEMS_INT2) | \
  380. PIN_OSPEED_HIGH(GPIOA_LCD_B5) | \
  381. PIN_OSPEED_HIGH(GPIOA_LCD_VSYNC) | \
  382. PIN_OSPEED_VERYLOW(GPIOA_PIN5) | \
  383. PIN_OSPEED_HIGH(GPIOA_LCD_G2) | \
  384. PIN_OSPEED_VERYLOW(GPIOA_ACP_RST) | \
  385. PIN_OSPEED_HIGH(GPIOA_I2C3_SCL) | \
  386. PIN_OSPEED_VERYLOW(GPIOA_UART_TX) | \
  387. PIN_OSPEED_VERYLOW(GPIOA_UART_RX) | \
  388. PIN_OSPEED_HIGH(GPIOA_LCD_R4) | \
  389. PIN_OSPEED_HIGH(GPIOA_LCD_R5) | \
  390. PIN_OSPEED_HIGH(GPIOA_SWDIO) | \
  391. PIN_OSPEED_HIGH(GPIOA_SWCLK) | \
  392. PIN_OSPEED_VERYLOW(GPIOA_TP_INT))
  393. #define VAL_GPIOA_PUPDR (PIN_PUPDR_FLOATING(GPIOA_BUTTON) | \
  394. PIN_PUPDR_FLOATING(GPIOA_MEMS_INT1) | \
  395. PIN_PUPDR_FLOATING(GPIOA_MEMS_INT2) | \
  396. PIN_PUPDR_FLOATING(GPIOA_LCD_B5) | \
  397. PIN_PUPDR_FLOATING(GPIOA_LCD_VSYNC) | \
  398. PIN_PUPDR_PULLUP(GPIOA_PIN5) | \
  399. PIN_PUPDR_FLOATING(GPIOA_LCD_G2) | \
  400. PIN_PUPDR_PULLUP(GPIOA_ACP_RST) | \
  401. PIN_PUPDR_FLOATING(GPIOA_I2C3_SCL) | \
  402. PIN_PUPDR_PULLUP(GPIOA_UART_TX) | \
  403. PIN_PUPDR_PULLUP(GPIOA_UART_RX) | \
  404. PIN_PUPDR_FLOATING(GPIOA_LCD_R4) | \
  405. PIN_PUPDR_FLOATING(GPIOA_LCD_R5) | \
  406. PIN_PUPDR_PULLUP(GPIOA_SWDIO) | \
  407. PIN_PUPDR_PULLDOWN(GPIOA_SWCLK) | \
  408. PIN_PUPDR_FLOATING(GPIOA_TP_INT))
  409. #define VAL_GPIOA_ODR (PIN_ODR_HIGH(GPIOA_BUTTON) | \
  410. PIN_ODR_HIGH(GPIOA_MEMS_INT1) | \
  411. PIN_ODR_HIGH(GPIOA_MEMS_INT2) | \
  412. PIN_ODR_HIGH(GPIOA_LCD_B5) | \
  413. PIN_ODR_HIGH(GPIOA_LCD_VSYNC) | \
  414. PIN_ODR_HIGH(GPIOA_PIN5) | \
  415. PIN_ODR_HIGH(GPIOA_LCD_G2) | \
  416. PIN_ODR_HIGH(GPIOA_ACP_RST) | \
  417. PIN_ODR_HIGH(GPIOA_I2C3_SCL) | \
  418. PIN_ODR_HIGH(GPIOA_UART_TX) | \
  419. PIN_ODR_HIGH(GPIOA_UART_RX) | \
  420. PIN_ODR_HIGH(GPIOA_LCD_R4) | \
  421. PIN_ODR_HIGH(GPIOA_LCD_R5) | \
  422. PIN_ODR_HIGH(GPIOA_SWDIO) | \
  423. PIN_ODR_HIGH(GPIOA_SWCLK) | \
  424. PIN_ODR_HIGH(GPIOA_TP_INT))
  425. #define VAL_GPIOA_AFRL (PIN_AFIO_AF(GPIOA_BUTTON, 0U) | \
  426. PIN_AFIO_AF(GPIOA_MEMS_INT1, 0U) | \
  427. PIN_AFIO_AF(GPIOA_MEMS_INT2, 0U) | \
  428. PIN_AFIO_AF(GPIOA_LCD_B5, 14U) | \
  429. PIN_AFIO_AF(GPIOA_LCD_VSYNC, 14U) | \
  430. PIN_AFIO_AF(GPIOA_PIN5, 0U) | \
  431. PIN_AFIO_AF(GPIOA_LCD_G2, 14U) | \
  432. PIN_AFIO_AF(GPIOA_ACP_RST, 0U))
  433. #define VAL_GPIOA_AFRH (PIN_AFIO_AF(GPIOA_I2C3_SCL, 4U) | \
  434. PIN_AFIO_AF(GPIOA_UART_TX, 7U) | \
  435. PIN_AFIO_AF(GPIOA_UART_RX, 7U) | \
  436. PIN_AFIO_AF(GPIOA_LCD_R4, 14U) | \
  437. PIN_AFIO_AF(GPIOA_LCD_R5, 14U) | \
  438. PIN_AFIO_AF(GPIOA_SWDIO, 0U) | \
  439. PIN_AFIO_AF(GPIOA_SWCLK, 0U) | \
  440. PIN_AFIO_AF(GPIOA_TP_INT, 0U))
  441. /*
  442. * GPIOB setup:
  443. *
  444. * PB0 - LCD_R3 (alternate 14).
  445. * PB1 - LCD_R6 (alternate 14).
  446. * PB2 - BOOT1 (input pullup).
  447. * PB3 - SWO (alternate 0).
  448. * PB4 - PIN4 (input pullup).
  449. * PB5 - FMC_SDCKE1 (alternate 12).
  450. * PB6 - FMC_SDNE1 (alternate 12).
  451. * PB7 - PIN7 (input pullup).
  452. * PB8 - LCD_B6 (alternate 14).
  453. * PB9 - LCD_B7 (alternate 14).
  454. * PB10 - LCD_G4 (alternate 14).
  455. * PB11 - LCD_G5 (alternate 14).
  456. * PB12 - OTG_HS_ID (alternate 12).
  457. * PB13 - OTG_HS_VBUS (input pulldown).
  458. * PB14 - OTG_HS_DM (alternate 12).
  459. * PB15 - OTG_HS_DP (alternate 12).
  460. */
  461. #define VAL_GPIOB_MODER (PIN_MODE_ALTERNATE(GPIOB_LCD_R3) | \
  462. PIN_MODE_ALTERNATE(GPIOB_LCD_R6) | \
  463. PIN_MODE_INPUT(GPIOB_BOOT1) | \
  464. PIN_MODE_ALTERNATE(GPIOB_SWO) | \
  465. PIN_MODE_INPUT(GPIOB_PIN4) | \
  466. PIN_MODE_ALTERNATE(GPIOB_FMC_SDCKE1) | \
  467. PIN_MODE_ALTERNATE(GPIOB_FMC_SDNE1) | \
  468. PIN_MODE_INPUT(GPIOB_PIN7) | \
  469. PIN_MODE_ALTERNATE(GPIOB_LCD_B6) | \
  470. PIN_MODE_ALTERNATE(GPIOB_LCD_B7) | \
  471. PIN_MODE_ALTERNATE(GPIOB_LCD_G4) | \
  472. PIN_MODE_ALTERNATE(GPIOB_LCD_G5) | \
  473. PIN_MODE_ALTERNATE(GPIOB_OTG_HS_ID) | \
  474. PIN_MODE_INPUT(GPIOB_OTG_HS_VBUS) | \
  475. PIN_MODE_ALTERNATE(GPIOB_OTG_HS_DM) | \
  476. PIN_MODE_ALTERNATE(GPIOB_OTG_HS_DP))
  477. #define VAL_GPIOB_OTYPER (PIN_OTYPE_PUSHPULL(GPIOB_LCD_R3) | \
  478. PIN_OTYPE_PUSHPULL(GPIOB_LCD_R6) | \
  479. PIN_OTYPE_PUSHPULL(GPIOB_BOOT1) | \
  480. PIN_OTYPE_PUSHPULL(GPIOB_SWO) | \
  481. PIN_OTYPE_PUSHPULL(GPIOB_PIN4) | \
  482. PIN_OTYPE_PUSHPULL(GPIOB_FMC_SDCKE1) | \
  483. PIN_OTYPE_PUSHPULL(GPIOB_FMC_SDNE1) | \
  484. PIN_OTYPE_PUSHPULL(GPIOB_PIN7) | \
  485. PIN_OTYPE_PUSHPULL(GPIOB_LCD_B6) | \
  486. PIN_OTYPE_PUSHPULL(GPIOB_LCD_B7) | \
  487. PIN_OTYPE_PUSHPULL(GPIOB_LCD_G4) | \
  488. PIN_OTYPE_PUSHPULL(GPIOB_LCD_G5) | \
  489. PIN_OTYPE_PUSHPULL(GPIOB_OTG_HS_ID) | \
  490. PIN_OTYPE_PUSHPULL(GPIOB_OTG_HS_VBUS) |\
  491. PIN_OTYPE_PUSHPULL(GPIOB_OTG_HS_DM) | \
  492. PIN_OTYPE_PUSHPULL(GPIOB_OTG_HS_DP))
  493. #define VAL_GPIOB_OSPEEDR (PIN_OSPEED_HIGH(GPIOB_LCD_R3) | \
  494. PIN_OSPEED_HIGH(GPIOB_LCD_R6) | \
  495. PIN_OSPEED_HIGH(GPIOB_BOOT1) | \
  496. PIN_OSPEED_HIGH(GPIOB_SWO) | \
  497. PIN_OSPEED_VERYLOW(GPIOB_PIN4) | \
  498. PIN_OSPEED_HIGH(GPIOB_FMC_SDCKE1) | \
  499. PIN_OSPEED_HIGH(GPIOB_FMC_SDNE1) | \
  500. PIN_OSPEED_VERYLOW(GPIOB_PIN7) | \
  501. PIN_OSPEED_HIGH(GPIOB_LCD_B6) | \
  502. PIN_OSPEED_HIGH(GPIOB_LCD_B7) | \
  503. PIN_OSPEED_HIGH(GPIOB_LCD_G4) | \
  504. PIN_OSPEED_HIGH(GPIOB_LCD_G5) | \
  505. PIN_OSPEED_HIGH(GPIOB_OTG_HS_ID) | \
  506. PIN_OSPEED_VERYLOW(GPIOB_OTG_HS_VBUS) |\
  507. PIN_OSPEED_HIGH(GPIOB_OTG_HS_DM) | \
  508. PIN_OSPEED_HIGH(GPIOB_OTG_HS_DP))
  509. #define VAL_GPIOB_PUPDR (PIN_PUPDR_FLOATING(GPIOB_LCD_R3) | \
  510. PIN_PUPDR_FLOATING(GPIOB_LCD_R6) | \
  511. PIN_PUPDR_PULLUP(GPIOB_BOOT1) | \
  512. PIN_PUPDR_FLOATING(GPIOB_SWO) | \
  513. PIN_PUPDR_PULLUP(GPIOB_PIN4) | \
  514. PIN_PUPDR_FLOATING(GPIOB_FMC_SDCKE1) | \
  515. PIN_PUPDR_FLOATING(GPIOB_FMC_SDNE1) | \
  516. PIN_PUPDR_PULLUP(GPIOB_PIN7) | \
  517. PIN_PUPDR_FLOATING(GPIOB_LCD_B6) | \
  518. PIN_PUPDR_FLOATING(GPIOB_LCD_B7) | \
  519. PIN_PUPDR_FLOATING(GPIOB_LCD_G4) | \
  520. PIN_PUPDR_FLOATING(GPIOB_LCD_G5) | \
  521. PIN_PUPDR_FLOATING(GPIOB_OTG_HS_ID) | \
  522. PIN_PUPDR_PULLDOWN(GPIOB_OTG_HS_VBUS) |\
  523. PIN_PUPDR_FLOATING(GPIOB_OTG_HS_DM) | \
  524. PIN_PUPDR_FLOATING(GPIOB_OTG_HS_DP))
  525. #define VAL_GPIOB_ODR (PIN_ODR_HIGH(GPIOB_LCD_R3) | \
  526. PIN_ODR_HIGH(GPIOB_LCD_R6) | \
  527. PIN_ODR_HIGH(GPIOB_BOOT1) | \
  528. PIN_ODR_HIGH(GPIOB_SWO) | \
  529. PIN_ODR_HIGH(GPIOB_PIN4) | \
  530. PIN_ODR_HIGH(GPIOB_FMC_SDCKE1) | \
  531. PIN_ODR_HIGH(GPIOB_FMC_SDNE1) | \
  532. PIN_ODR_HIGH(GPIOB_PIN7) | \
  533. PIN_ODR_HIGH(GPIOB_LCD_B6) | \
  534. PIN_ODR_HIGH(GPIOB_LCD_B7) | \
  535. PIN_ODR_HIGH(GPIOB_LCD_G4) | \
  536. PIN_ODR_HIGH(GPIOB_LCD_G5) | \
  537. PIN_ODR_HIGH(GPIOB_OTG_HS_ID) | \
  538. PIN_ODR_HIGH(GPIOB_OTG_HS_VBUS) | \
  539. PIN_ODR_HIGH(GPIOB_OTG_HS_DM) | \
  540. PIN_ODR_HIGH(GPIOB_OTG_HS_DP))
  541. #define VAL_GPIOB_AFRL (PIN_AFIO_AF(GPIOB_LCD_R3, 14U) | \
  542. PIN_AFIO_AF(GPIOB_LCD_R6, 14U) | \
  543. PIN_AFIO_AF(GPIOB_BOOT1, 0U) | \
  544. PIN_AFIO_AF(GPIOB_SWO, 0U) | \
  545. PIN_AFIO_AF(GPIOB_PIN4, 0U) | \
  546. PIN_AFIO_AF(GPIOB_FMC_SDCKE1, 12U) | \
  547. PIN_AFIO_AF(GPIOB_FMC_SDNE1, 12U) | \
  548. PIN_AFIO_AF(GPIOB_PIN7, 0U))
  549. #define VAL_GPIOB_AFRH (PIN_AFIO_AF(GPIOB_LCD_B6, 14U) | \
  550. PIN_AFIO_AF(GPIOB_LCD_B7, 14U) | \
  551. PIN_AFIO_AF(GPIOB_LCD_G4, 14U) | \
  552. PIN_AFIO_AF(GPIOB_LCD_G5, 14U) | \
  553. PIN_AFIO_AF(GPIOB_OTG_HS_ID, 12U) | \
  554. PIN_AFIO_AF(GPIOB_OTG_HS_VBUS, 0U) | \
  555. PIN_AFIO_AF(GPIOB_OTG_HS_DM, 12U) | \
  556. PIN_AFIO_AF(GPIOB_OTG_HS_DP, 12U))
  557. /*
  558. * GPIOC setup:
  559. *
  560. * PC0 - FMC_SDNWE (alternate 12).
  561. * PC1 - SPI5_MEMS_CS (output pushpull maximum).
  562. * PC2 - SPI5_LCD_CS (output pushpull maximum).
  563. * PC3 - PIN3 (input pullup).
  564. * PC4 - OTG_HS_PSO (output pushpull maximum).
  565. * PC5 - OTG_HS_OC (input floating).
  566. * PC6 - LCD_HSYNC (alternate 14).
  567. * PC7 - LCD_G6 (alternate 14).
  568. * PC8 - PIN8 (input pullup).
  569. * PC9 - I2C3_SDA (alternate 4).
  570. * PC10 - LCD_R2 (alternate 14).
  571. * PC11 - PIN11 (input pullup).
  572. * PC12 - PIN12 (input pullup).
  573. * PC13 - PIN13 (input pullup).
  574. * PC14 - OSC32_IN (input floating).
  575. * PC15 - OSC32_OUT (input floating).
  576. */
  577. #define VAL_GPIOC_MODER (PIN_MODE_ALTERNATE(GPIOC_FMC_SDNWE) | \
  578. PIN_MODE_OUTPUT(GPIOC_SPI5_MEMS_CS) | \
  579. PIN_MODE_OUTPUT(GPIOC_SPI5_LCD_CS) | \
  580. PIN_MODE_INPUT(GPIOC_PIN3) | \
  581. PIN_MODE_OUTPUT(GPIOC_OTG_HS_PSO) | \
  582. PIN_MODE_INPUT(GPIOC_OTG_HS_OC) | \
  583. PIN_MODE_ALTERNATE(GPIOC_LCD_HSYNC) | \
  584. PIN_MODE_ALTERNATE(GPIOC_LCD_G6) | \
  585. PIN_MODE_INPUT(GPIOC_PIN8) | \
  586. PIN_MODE_ALTERNATE(GPIOC_I2C3_SDA) | \
  587. PIN_MODE_ALTERNATE(GPIOC_LCD_R2) | \
  588. PIN_MODE_INPUT(GPIOC_PIN11) | \
  589. PIN_MODE_INPUT(GPIOC_PIN12) | \
  590. PIN_MODE_INPUT(GPIOC_PIN13) | \
  591. PIN_MODE_INPUT(GPIOC_OSC32_IN) | \
  592. PIN_MODE_INPUT(GPIOC_OSC32_OUT))
  593. #define VAL_GPIOC_OTYPER (PIN_OTYPE_PUSHPULL(GPIOC_FMC_SDNWE) | \
  594. PIN_OTYPE_PUSHPULL(GPIOC_SPI5_MEMS_CS) |\
  595. PIN_OTYPE_PUSHPULL(GPIOC_SPI5_LCD_CS) |\
  596. PIN_OTYPE_PUSHPULL(GPIOC_PIN3) | \
  597. PIN_OTYPE_PUSHPULL(GPIOC_OTG_HS_PSO) | \
  598. PIN_OTYPE_PUSHPULL(GPIOC_OTG_HS_OC) | \
  599. PIN_OTYPE_PUSHPULL(GPIOC_LCD_HSYNC) | \
  600. PIN_OTYPE_PUSHPULL(GPIOC_LCD_G6) | \
  601. PIN_OTYPE_PUSHPULL(GPIOC_PIN8) | \
  602. PIN_OTYPE_OPENDRAIN(GPIOC_I2C3_SDA) | \
  603. PIN_OTYPE_PUSHPULL(GPIOC_LCD_R2) | \
  604. PIN_OTYPE_PUSHPULL(GPIOC_PIN11) | \
  605. PIN_OTYPE_PUSHPULL(GPIOC_PIN12) | \
  606. PIN_OTYPE_PUSHPULL(GPIOC_PIN13) | \
  607. PIN_OTYPE_PUSHPULL(GPIOC_OSC32_IN) | \
  608. PIN_OTYPE_PUSHPULL(GPIOC_OSC32_OUT))
  609. #define VAL_GPIOC_OSPEEDR (PIN_OSPEED_HIGH(GPIOC_FMC_SDNWE) | \
  610. PIN_OSPEED_HIGH(GPIOC_SPI5_MEMS_CS) | \
  611. PIN_OSPEED_HIGH(GPIOC_SPI5_LCD_CS) | \
  612. PIN_OSPEED_VERYLOW(GPIOC_PIN3) | \
  613. PIN_OSPEED_HIGH(GPIOC_OTG_HS_PSO) | \
  614. PIN_OSPEED_HIGH(GPIOC_OTG_HS_OC) | \
  615. PIN_OSPEED_HIGH(GPIOC_LCD_HSYNC) | \
  616. PIN_OSPEED_HIGH(GPIOC_LCD_G6) | \
  617. PIN_OSPEED_VERYLOW(GPIOC_PIN8) | \
  618. PIN_OSPEED_HIGH(GPIOC_I2C3_SDA) | \
  619. PIN_OSPEED_HIGH(GPIOC_LCD_R2) | \
  620. PIN_OSPEED_VERYLOW(GPIOC_PIN11) | \
  621. PIN_OSPEED_VERYLOW(GPIOC_PIN12) | \
  622. PIN_OSPEED_VERYLOW(GPIOC_PIN13) | \
  623. PIN_OSPEED_HIGH(GPIOC_OSC32_IN) | \
  624. PIN_OSPEED_HIGH(GPIOC_OSC32_OUT))
  625. #define VAL_GPIOC_PUPDR (PIN_PUPDR_FLOATING(GPIOC_FMC_SDNWE) | \
  626. PIN_PUPDR_FLOATING(GPIOC_SPI5_MEMS_CS) |\
  627. PIN_PUPDR_FLOATING(GPIOC_SPI5_LCD_CS) |\
  628. PIN_PUPDR_PULLUP(GPIOC_PIN3) | \
  629. PIN_PUPDR_FLOATING(GPIOC_OTG_HS_PSO) | \
  630. PIN_PUPDR_FLOATING(GPIOC_OTG_HS_OC) | \
  631. PIN_PUPDR_FLOATING(GPIOC_LCD_HSYNC) | \
  632. PIN_PUPDR_FLOATING(GPIOC_LCD_G6) | \
  633. PIN_PUPDR_PULLUP(GPIOC_PIN8) | \
  634. PIN_PUPDR_FLOATING(GPIOC_I2C3_SDA) | \
  635. PIN_PUPDR_FLOATING(GPIOC_LCD_R2) | \
  636. PIN_PUPDR_PULLUP(GPIOC_PIN11) | \
  637. PIN_PUPDR_PULLUP(GPIOC_PIN12) | \
  638. PIN_PUPDR_PULLUP(GPIOC_PIN13) | \
  639. PIN_PUPDR_FLOATING(GPIOC_OSC32_IN) | \
  640. PIN_PUPDR_FLOATING(GPIOC_OSC32_OUT))
  641. #define VAL_GPIOC_ODR (PIN_ODR_HIGH(GPIOC_FMC_SDNWE) | \
  642. PIN_ODR_HIGH(GPIOC_SPI5_MEMS_CS) | \
  643. PIN_ODR_HIGH(GPIOC_SPI5_LCD_CS) | \
  644. PIN_ODR_HIGH(GPIOC_PIN3) | \
  645. PIN_ODR_HIGH(GPIOC_OTG_HS_PSO) | \
  646. PIN_ODR_HIGH(GPIOC_OTG_HS_OC) | \
  647. PIN_ODR_HIGH(GPIOC_LCD_HSYNC) | \
  648. PIN_ODR_HIGH(GPIOC_LCD_G6) | \
  649. PIN_ODR_HIGH(GPIOC_PIN8) | \
  650. PIN_ODR_HIGH(GPIOC_I2C3_SDA) | \
  651. PIN_ODR_HIGH(GPIOC_LCD_R2) | \
  652. PIN_ODR_HIGH(GPIOC_PIN11) | \
  653. PIN_ODR_HIGH(GPIOC_PIN12) | \
  654. PIN_ODR_HIGH(GPIOC_PIN13) | \
  655. PIN_ODR_HIGH(GPIOC_OSC32_IN) | \
  656. PIN_ODR_HIGH(GPIOC_OSC32_OUT))
  657. #define VAL_GPIOC_AFRL (PIN_AFIO_AF(GPIOC_FMC_SDNWE, 12U) | \
  658. PIN_AFIO_AF(GPIOC_SPI5_MEMS_CS, 0U) | \
  659. PIN_AFIO_AF(GPIOC_SPI5_LCD_CS, 0U) | \
  660. PIN_AFIO_AF(GPIOC_PIN3, 0U) | \
  661. PIN_AFIO_AF(GPIOC_OTG_HS_PSO, 0U) | \
  662. PIN_AFIO_AF(GPIOC_OTG_HS_OC, 0U) | \
  663. PIN_AFIO_AF(GPIOC_LCD_HSYNC, 14U) | \
  664. PIN_AFIO_AF(GPIOC_LCD_G6, 14U))
  665. #define VAL_GPIOC_AFRH (PIN_AFIO_AF(GPIOC_PIN8, 0U) | \
  666. PIN_AFIO_AF(GPIOC_I2C3_SDA, 4U) | \
  667. PIN_AFIO_AF(GPIOC_LCD_R2, 14U) | \
  668. PIN_AFIO_AF(GPIOC_PIN11, 0U) | \
  669. PIN_AFIO_AF(GPIOC_PIN12, 0U) | \
  670. PIN_AFIO_AF(GPIOC_PIN13, 0U) | \
  671. PIN_AFIO_AF(GPIOC_OSC32_IN, 0U) | \
  672. PIN_AFIO_AF(GPIOC_OSC32_OUT, 0U))
  673. /*
  674. * GPIOD setup:
  675. *
  676. * PD0 - FMC_D2 (alternate 12).
  677. * PD1 - FMC_D3 (alternate 12).
  678. * PD2 - PIN2 (input pullup).
  679. * PD3 - LCD_G7 (alternate 14).
  680. * PD4 - PIN4 (input pullup).
  681. * PD5 - PIN5 (input pullup).
  682. * PD6 - LCD_B2 (alternate 14).
  683. * PD7 - PIN7 (input pullup).
  684. * PD8 - FMC_D13 (alternate 12).
  685. * PD9 - FMC_D14 (alternate 12).
  686. * PD10 - FMC_D15 (alternate 12).
  687. * PD11 - LCD_TE (input floating).
  688. * PD12 - LCD_RDX (output pushpull maximum).
  689. * PD13 - LCD_WRX (output pushpull maximum).
  690. * PD14 - FMC_D0 (alternate 12).
  691. * PD15 - FMC_D1 (alternate 12).
  692. */
  693. #define VAL_GPIOD_MODER (PIN_MODE_ALTERNATE(GPIOD_FMC_D2) | \
  694. PIN_MODE_ALTERNATE(GPIOD_FMC_D3) | \
  695. PIN_MODE_INPUT(GPIOD_PIN2) | \
  696. PIN_MODE_ALTERNATE(GPIOD_LCD_G7) | \
  697. PIN_MODE_INPUT(GPIOD_PIN4) | \
  698. PIN_MODE_INPUT(GPIOD_PIN5) | \
  699. PIN_MODE_ALTERNATE(GPIOD_LCD_B2) | \
  700. PIN_MODE_INPUT(GPIOD_PIN7) | \
  701. PIN_MODE_ALTERNATE(GPIOD_FMC_D13) | \
  702. PIN_MODE_ALTERNATE(GPIOD_FMC_D14) | \
  703. PIN_MODE_ALTERNATE(GPIOD_FMC_D15) | \
  704. PIN_MODE_INPUT(GPIOD_LCD_TE) | \
  705. PIN_MODE_OUTPUT(GPIOD_LCD_RDX) | \
  706. PIN_MODE_OUTPUT(GPIOD_LCD_WRX) | \
  707. PIN_MODE_ALTERNATE(GPIOD_FMC_D0) | \
  708. PIN_MODE_ALTERNATE(GPIOD_FMC_D1))
  709. #define VAL_GPIOD_OTYPER (PIN_OTYPE_PUSHPULL(GPIOD_FMC_D2) | \
  710. PIN_OTYPE_PUSHPULL(GPIOD_FMC_D3) | \
  711. PIN_OTYPE_PUSHPULL(GPIOD_PIN2) | \
  712. PIN_OTYPE_PUSHPULL(GPIOD_LCD_G7) | \
  713. PIN_OTYPE_PUSHPULL(GPIOD_PIN4) | \
  714. PIN_OTYPE_PUSHPULL(GPIOD_PIN5) | \
  715. PIN_OTYPE_PUSHPULL(GPIOD_LCD_B2) | \
  716. PIN_OTYPE_PUSHPULL(GPIOD_PIN7) | \
  717. PIN_OTYPE_PUSHPULL(GPIOD_FMC_D13) | \
  718. PIN_OTYPE_PUSHPULL(GPIOD_FMC_D14) | \
  719. PIN_OTYPE_PUSHPULL(GPIOD_FMC_D15) | \
  720. PIN_OTYPE_PUSHPULL(GPIOD_LCD_TE) | \
  721. PIN_OTYPE_PUSHPULL(GPIOD_LCD_RDX) | \
  722. PIN_OTYPE_PUSHPULL(GPIOD_LCD_WRX) | \
  723. PIN_OTYPE_PUSHPULL(GPIOD_FMC_D0) | \
  724. PIN_OTYPE_PUSHPULL(GPIOD_FMC_D1))
  725. #define VAL_GPIOD_OSPEEDR (PIN_OSPEED_HIGH(GPIOD_FMC_D2) | \
  726. PIN_OSPEED_HIGH(GPIOD_FMC_D3) | \
  727. PIN_OSPEED_VERYLOW(GPIOD_PIN2) | \
  728. PIN_OSPEED_HIGH(GPIOD_LCD_G7) | \
  729. PIN_OSPEED_VERYLOW(GPIOD_PIN4) | \
  730. PIN_OSPEED_VERYLOW(GPIOD_PIN5) | \
  731. PIN_OSPEED_HIGH(GPIOD_LCD_B2) | \
  732. PIN_OSPEED_VERYLOW(GPIOD_PIN7) | \
  733. PIN_OSPEED_HIGH(GPIOD_FMC_D13) | \
  734. PIN_OSPEED_HIGH(GPIOD_FMC_D14) | \
  735. PIN_OSPEED_HIGH(GPIOD_FMC_D15) | \
  736. PIN_OSPEED_HIGH(GPIOD_LCD_TE) | \
  737. PIN_OSPEED_HIGH(GPIOD_LCD_RDX) | \
  738. PIN_OSPEED_HIGH(GPIOD_LCD_WRX) | \
  739. PIN_OSPEED_HIGH(GPIOD_FMC_D0) | \
  740. PIN_OSPEED_HIGH(GPIOD_FMC_D1))
  741. #define VAL_GPIOD_PUPDR (PIN_PUPDR_FLOATING(GPIOD_FMC_D2) | \
  742. PIN_PUPDR_FLOATING(GPIOD_FMC_D3) | \
  743. PIN_PUPDR_PULLUP(GPIOD_PIN2) | \
  744. PIN_PUPDR_FLOATING(GPIOD_LCD_G7) | \
  745. PIN_PUPDR_PULLUP(GPIOD_PIN4) | \
  746. PIN_PUPDR_PULLUP(GPIOD_PIN5) | \
  747. PIN_PUPDR_FLOATING(GPIOD_LCD_B2) | \
  748. PIN_PUPDR_PULLUP(GPIOD_PIN7) | \
  749. PIN_PUPDR_FLOATING(GPIOD_FMC_D13) | \
  750. PIN_PUPDR_FLOATING(GPIOD_FMC_D14) | \
  751. PIN_PUPDR_FLOATING(GPIOD_FMC_D15) | \
  752. PIN_PUPDR_FLOATING(GPIOD_LCD_TE) | \
  753. PIN_PUPDR_FLOATING(GPIOD_LCD_RDX) | \
  754. PIN_PUPDR_FLOATING(GPIOD_LCD_WRX) | \
  755. PIN_PUPDR_FLOATING(GPIOD_FMC_D0) | \
  756. PIN_PUPDR_FLOATING(GPIOD_FMC_D1))
  757. #define VAL_GPIOD_ODR (PIN_ODR_HIGH(GPIOD_FMC_D2) | \
  758. PIN_ODR_HIGH(GPIOD_FMC_D3) | \
  759. PIN_ODR_HIGH(GPIOD_PIN2) | \
  760. PIN_ODR_HIGH(GPIOD_LCD_G7) | \
  761. PIN_ODR_HIGH(GPIOD_PIN4) | \
  762. PIN_ODR_HIGH(GPIOD_PIN5) | \
  763. PIN_ODR_HIGH(GPIOD_LCD_B2) | \
  764. PIN_ODR_HIGH(GPIOD_PIN7) | \
  765. PIN_ODR_HIGH(GPIOD_FMC_D13) | \
  766. PIN_ODR_HIGH(GPIOD_FMC_D14) | \
  767. PIN_ODR_HIGH(GPIOD_FMC_D15) | \
  768. PIN_ODR_HIGH(GPIOD_LCD_TE) | \
  769. PIN_ODR_HIGH(GPIOD_LCD_RDX) | \
  770. PIN_ODR_HIGH(GPIOD_LCD_WRX) | \
  771. PIN_ODR_HIGH(GPIOD_FMC_D0) | \
  772. PIN_ODR_HIGH(GPIOD_FMC_D1))
  773. #define VAL_GPIOD_AFRL (PIN_AFIO_AF(GPIOD_FMC_D2, 12U) | \
  774. PIN_AFIO_AF(GPIOD_FMC_D3, 12U) | \
  775. PIN_AFIO_AF(GPIOD_PIN2, 0U) | \
  776. PIN_AFIO_AF(GPIOD_LCD_G7, 14U) | \
  777. PIN_AFIO_AF(GPIOD_PIN4, 0U) | \
  778. PIN_AFIO_AF(GPIOD_PIN5, 0U) | \
  779. PIN_AFIO_AF(GPIOD_LCD_B2, 14U) | \
  780. PIN_AFIO_AF(GPIOD_PIN7, 0U))
  781. #define VAL_GPIOD_AFRH (PIN_AFIO_AF(GPIOD_FMC_D13, 12U) | \
  782. PIN_AFIO_AF(GPIOD_FMC_D14, 12U) | \
  783. PIN_AFIO_AF(GPIOD_FMC_D15, 12U) | \
  784. PIN_AFIO_AF(GPIOD_LCD_TE, 0U) | \
  785. PIN_AFIO_AF(GPIOD_LCD_RDX, 0U) | \
  786. PIN_AFIO_AF(GPIOD_LCD_WRX, 0U) | \
  787. PIN_AFIO_AF(GPIOD_FMC_D0, 12U) | \
  788. PIN_AFIO_AF(GPIOD_FMC_D1, 12U))
  789. /*
  790. * GPIOE setup:
  791. *
  792. * PE0 - FMC_NBL0 (alternate 12).
  793. * PE1 - FMC_NBL1 (alternate 12).
  794. * PE2 - PIN2 (input pullup).
  795. * PE3 - PIN3 (input pullup).
  796. * PE4 - PIN4 (input pullup).
  797. * PE5 - PIN5 (input pullup).
  798. * PE6 - PIN6 (input pullup).
  799. * PE7 - FMC_D4 (alternate 12).
  800. * PE8 - FMC_D5 (alternate 12).
  801. * PE9 - FMC_D6 (alternate 12).
  802. * PE10 - FMC_D7 (alternate 12).
  803. * PE11 - FMC_D8 (alternate 12).
  804. * PE12 - FMC_D9 (alternate 12).
  805. * PE13 - FMC_D10 (alternate 12).
  806. * PE14 - FMC_D11 (alternate 12).
  807. * PE15 - FMC_D12 (alternate 12).
  808. */
  809. #define VAL_GPIOE_MODER (PIN_MODE_ALTERNATE(GPIOE_FMC_NBL0) | \
  810. PIN_MODE_ALTERNATE(GPIOE_FMC_NBL1) | \
  811. PIN_MODE_INPUT(GPIOE_PIN2) | \
  812. PIN_MODE_INPUT(GPIOE_PIN3) | \
  813. PIN_MODE_INPUT(GPIOE_PIN4) | \
  814. PIN_MODE_INPUT(GPIOE_PIN5) | \
  815. PIN_MODE_INPUT(GPIOE_PIN6) | \
  816. PIN_MODE_ALTERNATE(GPIOE_FMC_D4) | \
  817. PIN_MODE_ALTERNATE(GPIOE_FMC_D5) | \
  818. PIN_MODE_ALTERNATE(GPIOE_FMC_D6) | \
  819. PIN_MODE_ALTERNATE(GPIOE_FMC_D7) | \
  820. PIN_MODE_ALTERNATE(GPIOE_FMC_D8) | \
  821. PIN_MODE_ALTERNATE(GPIOE_FMC_D9) | \
  822. PIN_MODE_ALTERNATE(GPIOE_FMC_D10) | \
  823. PIN_MODE_ALTERNATE(GPIOE_FMC_D11) | \
  824. PIN_MODE_ALTERNATE(GPIOE_FMC_D12))
  825. #define VAL_GPIOE_OTYPER (PIN_OTYPE_PUSHPULL(GPIOE_FMC_NBL0) | \
  826. PIN_OTYPE_PUSHPULL(GPIOE_FMC_NBL1) | \
  827. PIN_OTYPE_PUSHPULL(GPIOE_PIN2) | \
  828. PIN_OTYPE_PUSHPULL(GPIOE_PIN3) | \
  829. PIN_OTYPE_PUSHPULL(GPIOE_PIN4) | \
  830. PIN_OTYPE_PUSHPULL(GPIOE_PIN5) | \
  831. PIN_OTYPE_PUSHPULL(GPIOE_PIN6) | \
  832. PIN_OTYPE_PUSHPULL(GPIOE_FMC_D4) | \
  833. PIN_OTYPE_PUSHPULL(GPIOE_FMC_D5) | \
  834. PIN_OTYPE_PUSHPULL(GPIOE_FMC_D6) | \
  835. PIN_OTYPE_PUSHPULL(GPIOE_FMC_D7) | \
  836. PIN_OTYPE_PUSHPULL(GPIOE_FMC_D8) | \
  837. PIN_OTYPE_PUSHPULL(GPIOE_FMC_D9) | \
  838. PIN_OTYPE_PUSHPULL(GPIOE_FMC_D10) | \
  839. PIN_OTYPE_PUSHPULL(GPIOE_FMC_D11) | \
  840. PIN_OTYPE_PUSHPULL(GPIOE_FMC_D12))
  841. #define VAL_GPIOE_OSPEEDR (PIN_OSPEED_HIGH(GPIOE_FMC_NBL0) | \
  842. PIN_OSPEED_HIGH(GPIOE_FMC_NBL1) | \
  843. PIN_OSPEED_VERYLOW(GPIOE_PIN2) | \
  844. PIN_OSPEED_VERYLOW(GPIOE_PIN3) | \
  845. PIN_OSPEED_VERYLOW(GPIOE_PIN4) | \
  846. PIN_OSPEED_VERYLOW(GPIOE_PIN5) | \
  847. PIN_OSPEED_VERYLOW(GPIOE_PIN6) | \
  848. PIN_OSPEED_HIGH(GPIOE_FMC_D4) | \
  849. PIN_OSPEED_HIGH(GPIOE_FMC_D5) | \
  850. PIN_OSPEED_HIGH(GPIOE_FMC_D6) | \
  851. PIN_OSPEED_HIGH(GPIOE_FMC_D7) | \
  852. PIN_OSPEED_HIGH(GPIOE_FMC_D8) | \
  853. PIN_OSPEED_HIGH(GPIOE_FMC_D9) | \
  854. PIN_OSPEED_HIGH(GPIOE_FMC_D10) | \
  855. PIN_OSPEED_HIGH(GPIOE_FMC_D11) | \
  856. PIN_OSPEED_HIGH(GPIOE_FMC_D12))
  857. #define VAL_GPIOE_PUPDR (PIN_PUPDR_FLOATING(GPIOE_FMC_NBL0) | \
  858. PIN_PUPDR_FLOATING(GPIOE_FMC_NBL1) | \
  859. PIN_PUPDR_PULLUP(GPIOE_PIN2) | \
  860. PIN_PUPDR_PULLUP(GPIOE_PIN3) | \
  861. PIN_PUPDR_PULLUP(GPIOE_PIN4) | \
  862. PIN_PUPDR_PULLUP(GPIOE_PIN5) | \
  863. PIN_PUPDR_PULLUP(GPIOE_PIN6) | \
  864. PIN_PUPDR_FLOATING(GPIOE_FMC_D4) | \
  865. PIN_PUPDR_FLOATING(GPIOE_FMC_D5) | \
  866. PIN_PUPDR_FLOATING(GPIOE_FMC_D6) | \
  867. PIN_PUPDR_FLOATING(GPIOE_FMC_D7) | \
  868. PIN_PUPDR_FLOATING(GPIOE_FMC_D8) | \
  869. PIN_PUPDR_FLOATING(GPIOE_FMC_D9) | \
  870. PIN_PUPDR_FLOATING(GPIOE_FMC_D10) | \
  871. PIN_PUPDR_FLOATING(GPIOE_FMC_D11) | \
  872. PIN_PUPDR_FLOATING(GPIOE_FMC_D12))
  873. #define VAL_GPIOE_ODR (PIN_ODR_HIGH(GPIOE_FMC_NBL0) | \
  874. PIN_ODR_HIGH(GPIOE_FMC_NBL1) | \
  875. PIN_ODR_HIGH(GPIOE_PIN2) | \
  876. PIN_ODR_HIGH(GPIOE_PIN3) | \
  877. PIN_ODR_HIGH(GPIOE_PIN4) | \
  878. PIN_ODR_HIGH(GPIOE_PIN5) | \
  879. PIN_ODR_HIGH(GPIOE_PIN6) | \
  880. PIN_ODR_HIGH(GPIOE_FMC_D4) | \
  881. PIN_ODR_HIGH(GPIOE_FMC_D5) | \
  882. PIN_ODR_HIGH(GPIOE_FMC_D6) | \
  883. PIN_ODR_HIGH(GPIOE_FMC_D7) | \
  884. PIN_ODR_HIGH(GPIOE_FMC_D8) | \
  885. PIN_ODR_HIGH(GPIOE_FMC_D9) | \
  886. PIN_ODR_HIGH(GPIOE_FMC_D10) | \
  887. PIN_ODR_HIGH(GPIOE_FMC_D11) | \
  888. PIN_ODR_HIGH(GPIOE_FMC_D12))
  889. #define VAL_GPIOE_AFRL (PIN_AFIO_AF(GPIOE_FMC_NBL0, 12U) | \
  890. PIN_AFIO_AF(GPIOE_FMC_NBL1, 12U) | \
  891. PIN_AFIO_AF(GPIOE_PIN2, 0U) | \
  892. PIN_AFIO_AF(GPIOE_PIN3, 0U) | \
  893. PIN_AFIO_AF(GPIOE_PIN4, 0U) | \
  894. PIN_AFIO_AF(GPIOE_PIN5, 0U) | \
  895. PIN_AFIO_AF(GPIOE_PIN6, 0U) | \
  896. PIN_AFIO_AF(GPIOE_FMC_D4, 12U))
  897. #define VAL_GPIOE_AFRH (PIN_AFIO_AF(GPIOE_FMC_D5, 12U) | \
  898. PIN_AFIO_AF(GPIOE_FMC_D6, 12U) | \
  899. PIN_AFIO_AF(GPIOE_FMC_D7, 12U) | \
  900. PIN_AFIO_AF(GPIOE_FMC_D8, 12U) | \
  901. PIN_AFIO_AF(GPIOE_FMC_D9, 12U) | \
  902. PIN_AFIO_AF(GPIOE_FMC_D10, 12U) | \
  903. PIN_AFIO_AF(GPIOE_FMC_D11, 12U) | \
  904. PIN_AFIO_AF(GPIOE_FMC_D12, 12U))
  905. /*
  906. * GPIOF setup:
  907. *
  908. * PF0 - FMC_A0 (alternate 12).
  909. * PF1 - FMC_A1 (alternate 12).
  910. * PF2 - FMC_A2 (alternate 12).
  911. * PF3 - FMC_A3 (alternate 12).
  912. * PF4 - FMC_A4 (alternate 12).
  913. * PF5 - FMC_A5 (alternate 12).
  914. * PF6 - PIN6 (input pullup).
  915. * PF7 - LCD_DCX (alternate 5).
  916. * PF8 - SPI5_MISO (alternate 5).
  917. * PF9 - SPI5_MOSI (alternate 5).
  918. * PF10 - LCD_DE (alternate 14).
  919. * PF11 - FMC_SDNRAS (alternate 12).
  920. * PF12 - FMC_A6 (alternate 12).
  921. * PF13 - FMC_A7 (alternate 12).
  922. * PF14 - FMC_A8 (alternate 12).
  923. * PF15 - FMC_A9 (alternate 12).
  924. */
  925. #define VAL_GPIOF_MODER (PIN_MODE_ALTERNATE(GPIOF_FMC_A0) | \
  926. PIN_MODE_ALTERNATE(GPIOF_FMC_A1) | \
  927. PIN_MODE_ALTERNATE(GPIOF_FMC_A2) | \
  928. PIN_MODE_ALTERNATE(GPIOF_FMC_A3) | \
  929. PIN_MODE_ALTERNATE(GPIOF_FMC_A4) | \
  930. PIN_MODE_ALTERNATE(GPIOF_FMC_A5) | \
  931. PIN_MODE_INPUT(GPIOF_PIN6) | \
  932. PIN_MODE_ALTERNATE(GPIOF_LCD_DCX) | \
  933. PIN_MODE_ALTERNATE(GPIOF_SPI5_MISO) | \
  934. PIN_MODE_ALTERNATE(GPIOF_SPI5_MOSI) | \
  935. PIN_MODE_ALTERNATE(GPIOF_LCD_DE) | \
  936. PIN_MODE_ALTERNATE(GPIOF_FMC_SDNRAS) | \
  937. PIN_MODE_ALTERNATE(GPIOF_FMC_A6) | \
  938. PIN_MODE_ALTERNATE(GPIOF_FMC_A7) | \
  939. PIN_MODE_ALTERNATE(GPIOF_FMC_A8) | \
  940. PIN_MODE_ALTERNATE(GPIOF_FMC_A9))
  941. #define VAL_GPIOF_OTYPER (PIN_OTYPE_PUSHPULL(GPIOF_FMC_A0) | \
  942. PIN_OTYPE_PUSHPULL(GPIOF_FMC_A1) | \
  943. PIN_OTYPE_PUSHPULL(GPIOF_FMC_A2) | \
  944. PIN_OTYPE_PUSHPULL(GPIOF_FMC_A3) | \
  945. PIN_OTYPE_PUSHPULL(GPIOF_FMC_A4) | \
  946. PIN_OTYPE_PUSHPULL(GPIOF_FMC_A5) | \
  947. PIN_OTYPE_PUSHPULL(GPIOF_PIN6) | \
  948. PIN_OTYPE_PUSHPULL(GPIOF_LCD_DCX) | \
  949. PIN_OTYPE_PUSHPULL(GPIOF_SPI5_MISO) | \
  950. PIN_OTYPE_PUSHPULL(GPIOF_SPI5_MOSI) | \
  951. PIN_OTYPE_PUSHPULL(GPIOF_LCD_DE) | \
  952. PIN_OTYPE_PUSHPULL(GPIOF_FMC_SDNRAS) | \
  953. PIN_OTYPE_PUSHPULL(GPIOF_FMC_A6) | \
  954. PIN_OTYPE_PUSHPULL(GPIOF_FMC_A7) | \
  955. PIN_OTYPE_PUSHPULL(GPIOF_FMC_A8) | \
  956. PIN_OTYPE_PUSHPULL(GPIOF_FMC_A9))
  957. #define VAL_GPIOF_OSPEEDR (PIN_OSPEED_HIGH(GPIOF_FMC_A0) | \
  958. PIN_OSPEED_HIGH(GPIOF_FMC_A1) | \
  959. PIN_OSPEED_HIGH(GPIOF_FMC_A2) | \
  960. PIN_OSPEED_HIGH(GPIOF_FMC_A3) | \
  961. PIN_OSPEED_HIGH(GPIOF_FMC_A4) | \
  962. PIN_OSPEED_HIGH(GPIOF_FMC_A5) | \
  963. PIN_OSPEED_VERYLOW(GPIOF_PIN6) | \
  964. PIN_OSPEED_HIGH(GPIOF_LCD_DCX) | \
  965. PIN_OSPEED_HIGH(GPIOF_SPI5_MISO) | \
  966. PIN_OSPEED_HIGH(GPIOF_SPI5_MOSI) | \
  967. PIN_OSPEED_HIGH(GPIOF_LCD_DE) | \
  968. PIN_OSPEED_HIGH(GPIOF_FMC_SDNRAS) | \
  969. PIN_OSPEED_HIGH(GPIOF_FMC_A6) | \
  970. PIN_OSPEED_HIGH(GPIOF_FMC_A7) | \
  971. PIN_OSPEED_HIGH(GPIOF_FMC_A8) | \
  972. PIN_OSPEED_HIGH(GPIOF_FMC_A9))
  973. #define VAL_GPIOF_PUPDR (PIN_PUPDR_FLOATING(GPIOF_FMC_A0) | \
  974. PIN_PUPDR_FLOATING(GPIOF_FMC_A1) | \
  975. PIN_PUPDR_FLOATING(GPIOF_FMC_A2) | \
  976. PIN_PUPDR_FLOATING(GPIOF_FMC_A3) | \
  977. PIN_PUPDR_FLOATING(GPIOF_FMC_A4) | \
  978. PIN_PUPDR_FLOATING(GPIOF_FMC_A5) | \
  979. PIN_PUPDR_PULLUP(GPIOF_PIN6) | \
  980. PIN_PUPDR_FLOATING(GPIOF_LCD_DCX) | \
  981. PIN_PUPDR_FLOATING(GPIOF_SPI5_MISO) | \
  982. PIN_PUPDR_FLOATING(GPIOF_SPI5_MOSI) | \
  983. PIN_PUPDR_FLOATING(GPIOF_LCD_DE) | \
  984. PIN_PUPDR_FLOATING(GPIOF_FMC_SDNRAS) | \
  985. PIN_PUPDR_FLOATING(GPIOF_FMC_A6) | \
  986. PIN_PUPDR_FLOATING(GPIOF_FMC_A7) | \
  987. PIN_PUPDR_FLOATING(GPIOF_FMC_A8) | \
  988. PIN_PUPDR_FLOATING(GPIOF_FMC_A9))
  989. #define VAL_GPIOF_ODR (PIN_ODR_HIGH(GPIOF_FMC_A0) | \
  990. PIN_ODR_HIGH(GPIOF_FMC_A1) | \
  991. PIN_ODR_HIGH(GPIOF_FMC_A2) | \
  992. PIN_ODR_HIGH(GPIOF_FMC_A3) | \
  993. PIN_ODR_HIGH(GPIOF_FMC_A4) | \
  994. PIN_ODR_HIGH(GPIOF_FMC_A5) | \
  995. PIN_ODR_HIGH(GPIOF_PIN6) | \
  996. PIN_ODR_HIGH(GPIOF_LCD_DCX) | \
  997. PIN_ODR_HIGH(GPIOF_SPI5_MISO) | \
  998. PIN_ODR_HIGH(GPIOF_SPI5_MOSI) | \
  999. PIN_ODR_HIGH(GPIOF_LCD_DE) | \
  1000. PIN_ODR_HIGH(GPIOF_FMC_SDNRAS) | \
  1001. PIN_ODR_HIGH(GPIOF_FMC_A6) | \
  1002. PIN_ODR_HIGH(GPIOF_FMC_A7) | \
  1003. PIN_ODR_HIGH(GPIOF_FMC_A8) | \
  1004. PIN_ODR_HIGH(GPIOF_FMC_A9))
  1005. #define VAL_GPIOF_AFRL (PIN_AFIO_AF(GPIOF_FMC_A0, 12U) | \
  1006. PIN_AFIO_AF(GPIOF_FMC_A1, 12U) | \
  1007. PIN_AFIO_AF(GPIOF_FMC_A2, 12U) | \
  1008. PIN_AFIO_AF(GPIOF_FMC_A3, 12U) | \
  1009. PIN_AFIO_AF(GPIOF_FMC_A4, 12U) | \
  1010. PIN_AFIO_AF(GPIOF_FMC_A5, 12U) | \
  1011. PIN_AFIO_AF(GPIOF_PIN6, 0U) | \
  1012. PIN_AFIO_AF(GPIOF_LCD_DCX, 5U))
  1013. #define VAL_GPIOF_AFRH (PIN_AFIO_AF(GPIOF_SPI5_MISO, 5U) | \
  1014. PIN_AFIO_AF(GPIOF_SPI5_MOSI, 5U) | \
  1015. PIN_AFIO_AF(GPIOF_LCD_DE, 14U) | \
  1016. PIN_AFIO_AF(GPIOF_FMC_SDNRAS, 12U) | \
  1017. PIN_AFIO_AF(GPIOF_FMC_A6, 12U) | \
  1018. PIN_AFIO_AF(GPIOF_FMC_A7, 12U) | \
  1019. PIN_AFIO_AF(GPIOF_FMC_A8, 12U) | \
  1020. PIN_AFIO_AF(GPIOF_FMC_A9, 12U))
  1021. /*
  1022. * GPIOG setup:
  1023. *
  1024. * PG0 - FMC_A10 (alternate 12).
  1025. * PG1 - FMC_A11 (alternate 12).
  1026. * PG2 - PIN2 (input pullup).
  1027. * PG3 - PIN3 (input pullup).
  1028. * PG4 - FMC_BA0 (alternate 12).
  1029. * PG5 - FMC_BA1 (alternate 12).
  1030. * PG6 - LCD_R7 (alternate 14).
  1031. * PG7 - LCD_CLK (alternate 14).
  1032. * PG8 - FMC_SDCLK (alternate 12).
  1033. * PG9 - PIN9 (input pullup).
  1034. * PG10 - LCD_G3 (alternate 14).
  1035. * PG11 - LCD_B3 (alternate 14).
  1036. * PG12 - LCD_B4 (alternate 14).
  1037. * PG13 - LED3_GREEN (output pushpull maximum).
  1038. * PG14 - LED4_RED (output pushpull maximum).
  1039. * PG15 - FMC_SDNCAS (alternate 12).
  1040. */
  1041. #define VAL_GPIOG_MODER (PIN_MODE_ALTERNATE(GPIOG_FMC_A10) | \
  1042. PIN_MODE_ALTERNATE(GPIOG_FMC_A11) | \
  1043. PIN_MODE_INPUT(GPIOG_PIN2) | \
  1044. PIN_MODE_INPUT(GPIOG_PIN3) | \
  1045. PIN_MODE_ALTERNATE(GPIOG_FMC_BA0) | \
  1046. PIN_MODE_ALTERNATE(GPIOG_FMC_BA1) | \
  1047. PIN_MODE_ALTERNATE(GPIOG_LCD_R7) | \
  1048. PIN_MODE_ALTERNATE(GPIOG_LCD_CLK) | \
  1049. PIN_MODE_ALTERNATE(GPIOG_FMC_SDCLK) | \
  1050. PIN_MODE_INPUT(GPIOG_PIN9) | \
  1051. PIN_MODE_ALTERNATE(GPIOG_LCD_G3) | \
  1052. PIN_MODE_ALTERNATE(GPIOG_LCD_B3) | \
  1053. PIN_MODE_ALTERNATE(GPIOG_LCD_B4) | \
  1054. PIN_MODE_OUTPUT(GPIOG_LED3_GREEN) | \
  1055. PIN_MODE_OUTPUT(GPIOG_LED4_RED) | \
  1056. PIN_MODE_ALTERNATE(GPIOG_FMC_SDNCAS))
  1057. #define VAL_GPIOG_OTYPER (PIN_OTYPE_PUSHPULL(GPIOG_FMC_A10) | \
  1058. PIN_OTYPE_PUSHPULL(GPIOG_FMC_A11) | \
  1059. PIN_OTYPE_PUSHPULL(GPIOG_PIN2) | \
  1060. PIN_OTYPE_PUSHPULL(GPIOG_PIN3) | \
  1061. PIN_OTYPE_PUSHPULL(GPIOG_FMC_BA0) | \
  1062. PIN_OTYPE_PUSHPULL(GPIOG_FMC_BA1) | \
  1063. PIN_OTYPE_PUSHPULL(GPIOG_LCD_R7) | \
  1064. PIN_OTYPE_PUSHPULL(GPIOG_LCD_CLK) | \
  1065. PIN_OTYPE_PUSHPULL(GPIOG_FMC_SDCLK) | \
  1066. PIN_OTYPE_PUSHPULL(GPIOG_PIN9) | \
  1067. PIN_OTYPE_PUSHPULL(GPIOG_LCD_G3) | \
  1068. PIN_OTYPE_PUSHPULL(GPIOG_LCD_B3) | \
  1069. PIN_OTYPE_PUSHPULL(GPIOG_LCD_B4) | \
  1070. PIN_OTYPE_PUSHPULL(GPIOG_LED3_GREEN) | \
  1071. PIN_OTYPE_PUSHPULL(GPIOG_LED4_RED) | \
  1072. PIN_OTYPE_PUSHPULL(GPIOG_FMC_SDNCAS))
  1073. #define VAL_GPIOG_OSPEEDR (PIN_OSPEED_HIGH(GPIOG_FMC_A10) | \
  1074. PIN_OSPEED_HIGH(GPIOG_FMC_A11) | \
  1075. PIN_OSPEED_VERYLOW(GPIOG_PIN2) | \
  1076. PIN_OSPEED_VERYLOW(GPIOG_PIN3) | \
  1077. PIN_OSPEED_HIGH(GPIOG_FMC_BA0) | \
  1078. PIN_OSPEED_HIGH(GPIOG_FMC_BA1) | \
  1079. PIN_OSPEED_HIGH(GPIOG_LCD_R7) | \
  1080. PIN_OSPEED_HIGH(GPIOG_LCD_CLK) | \
  1081. PIN_OSPEED_HIGH(GPIOG_FMC_SDCLK) | \
  1082. PIN_OSPEED_VERYLOW(GPIOG_PIN9) | \
  1083. PIN_OSPEED_HIGH(GPIOG_LCD_G3) | \
  1084. PIN_OSPEED_HIGH(GPIOG_LCD_B3) | \
  1085. PIN_OSPEED_HIGH(GPIOG_LCD_B4) | \
  1086. PIN_OSPEED_HIGH(GPIOG_LED3_GREEN) | \
  1087. PIN_OSPEED_HIGH(GPIOG_LED4_RED) | \
  1088. PIN_OSPEED_HIGH(GPIOG_FMC_SDNCAS))
  1089. #define VAL_GPIOG_PUPDR (PIN_PUPDR_FLOATING(GPIOG_FMC_A10) | \
  1090. PIN_PUPDR_FLOATING(GPIOG_FMC_A11) | \
  1091. PIN_PUPDR_PULLUP(GPIOG_PIN2) | \
  1092. PIN_PUPDR_PULLUP(GPIOG_PIN3) | \
  1093. PIN_PUPDR_FLOATING(GPIOG_FMC_BA0) | \
  1094. PIN_PUPDR_FLOATING(GPIOG_FMC_BA1) | \
  1095. PIN_PUPDR_FLOATING(GPIOG_LCD_R7) | \
  1096. PIN_PUPDR_FLOATING(GPIOG_LCD_CLK) | \
  1097. PIN_PUPDR_FLOATING(GPIOG_FMC_SDCLK) | \
  1098. PIN_PUPDR_PULLUP(GPIOG_PIN9) | \
  1099. PIN_PUPDR_FLOATING(GPIOG_LCD_G3) | \
  1100. PIN_PUPDR_FLOATING(GPIOG_LCD_B3) | \
  1101. PIN_PUPDR_FLOATING(GPIOG_LCD_B4) | \
  1102. PIN_PUPDR_FLOATING(GPIOG_LED3_GREEN) | \
  1103. PIN_PUPDR_FLOATING(GPIOG_LED4_RED) | \
  1104. PIN_PUPDR_FLOATING(GPIOG_FMC_SDNCAS))
  1105. #define VAL_GPIOG_ODR (PIN_ODR_HIGH(GPIOG_FMC_A10) | \
  1106. PIN_ODR_HIGH(GPIOG_FMC_A11) | \
  1107. PIN_ODR_HIGH(GPIOG_PIN2) | \
  1108. PIN_ODR_HIGH(GPIOG_PIN3) | \
  1109. PIN_ODR_HIGH(GPIOG_FMC_BA0) | \
  1110. PIN_ODR_HIGH(GPIOG_FMC_BA1) | \
  1111. PIN_ODR_HIGH(GPIOG_LCD_R7) | \
  1112. PIN_ODR_HIGH(GPIOG_LCD_CLK) | \
  1113. PIN_ODR_HIGH(GPIOG_FMC_SDCLK) | \
  1114. PIN_ODR_HIGH(GPIOG_PIN9) | \
  1115. PIN_ODR_HIGH(GPIOG_LCD_G3) | \
  1116. PIN_ODR_HIGH(GPIOG_LCD_B3) | \
  1117. PIN_ODR_HIGH(GPIOG_LCD_B4) | \
  1118. PIN_ODR_LOW(GPIOG_LED3_GREEN) | \
  1119. PIN_ODR_LOW(GPIOG_LED4_RED) | \
  1120. PIN_ODR_HIGH(GPIOG_FMC_SDNCAS))
  1121. #define VAL_GPIOG_AFRL (PIN_AFIO_AF(GPIOG_FMC_A10, 12U) | \
  1122. PIN_AFIO_AF(GPIOG_FMC_A11, 12U) | \
  1123. PIN_AFIO_AF(GPIOG_PIN2, 0U) | \
  1124. PIN_AFIO_AF(GPIOG_PIN3, 0U) | \
  1125. PIN_AFIO_AF(GPIOG_FMC_BA0, 12U) | \
  1126. PIN_AFIO_AF(GPIOG_FMC_BA1, 12U) | \
  1127. PIN_AFIO_AF(GPIOG_LCD_R7, 14U) | \
  1128. PIN_AFIO_AF(GPIOG_LCD_CLK, 14U))
  1129. #define VAL_GPIOG_AFRH (PIN_AFIO_AF(GPIOG_FMC_SDCLK, 12U) | \
  1130. PIN_AFIO_AF(GPIOG_PIN9, 0U) | \
  1131. PIN_AFIO_AF(GPIOG_LCD_G3, 14U) | \
  1132. PIN_AFIO_AF(GPIOG_LCD_B3, 14U) | \
  1133. PIN_AFIO_AF(GPIOG_LCD_B4, 14U) | \
  1134. PIN_AFIO_AF(GPIOG_LED3_GREEN, 0U) | \
  1135. PIN_AFIO_AF(GPIOG_LED4_RED, 0U) | \
  1136. PIN_AFIO_AF(GPIOG_FMC_SDNCAS, 12U))
  1137. /*
  1138. * GPIOH setup:
  1139. *
  1140. * PH0 - OSC_IN (input floating).
  1141. * PH1 - OSC_OUT (input floating).
  1142. * PH2 - PIN2 (input pullup).
  1143. * PH3 - PIN3 (input pullup).
  1144. * PH4 - PIN4 (input pullup).
  1145. * PH5 - PIN5 (input pullup).
  1146. * PH6 - PIN6 (input pullup).
  1147. * PH7 - PIN7 (input pullup).
  1148. * PH8 - PIN8 (input pullup).
  1149. * PH9 - PIN9 (input pullup).
  1150. * PH10 - PIN10 (input pullup).
  1151. * PH11 - PIN11 (input pullup).
  1152. * PH12 - PIN12 (input pullup).
  1153. * PH13 - PIN13 (input pullup).
  1154. * PH14 - PIN14 (input pullup).
  1155. * PH15 - PIN15 (input pullup).
  1156. */
  1157. #define VAL_GPIOH_MODER (PIN_MODE_INPUT(GPIOH_OSC_IN) | \
  1158. PIN_MODE_INPUT(GPIOH_OSC_OUT) | \
  1159. PIN_MODE_INPUT(GPIOH_PIN2) | \
  1160. PIN_MODE_INPUT(GPIOH_PIN3) | \
  1161. PIN_MODE_INPUT(GPIOH_PIN4) | \
  1162. PIN_MODE_INPUT(GPIOH_PIN5) | \
  1163. PIN_MODE_INPUT(GPIOH_PIN6) | \
  1164. PIN_MODE_INPUT(GPIOH_PIN7) | \
  1165. PIN_MODE_INPUT(GPIOH_PIN8) | \
  1166. PIN_MODE_INPUT(GPIOH_PIN9) | \
  1167. PIN_MODE_INPUT(GPIOH_PIN10) | \
  1168. PIN_MODE_INPUT(GPIOH_PIN11) | \
  1169. PIN_MODE_INPUT(GPIOH_PIN12) | \
  1170. PIN_MODE_INPUT(GPIOH_PIN13) | \
  1171. PIN_MODE_INPUT(GPIOH_PIN14) | \
  1172. PIN_MODE_INPUT(GPIOH_PIN15))
  1173. #define VAL_GPIOH_OTYPER (PIN_OTYPE_PUSHPULL(GPIOH_OSC_IN) | \
  1174. PIN_OTYPE_PUSHPULL(GPIOH_OSC_OUT) | \
  1175. PIN_OTYPE_PUSHPULL(GPIOH_PIN2) | \
  1176. PIN_OTYPE_PUSHPULL(GPIOH_PIN3) | \
  1177. PIN_OTYPE_PUSHPULL(GPIOH_PIN4) | \
  1178. PIN_OTYPE_PUSHPULL(GPIOH_PIN5) | \
  1179. PIN_OTYPE_PUSHPULL(GPIOH_PIN6) | \
  1180. PIN_OTYPE_PUSHPULL(GPIOH_PIN7) | \
  1181. PIN_OTYPE_PUSHPULL(GPIOH_PIN8) | \
  1182. PIN_OTYPE_PUSHPULL(GPIOH_PIN9) | \
  1183. PIN_OTYPE_PUSHPULL(GPIOH_PIN10) | \
  1184. PIN_OTYPE_PUSHPULL(GPIOH_PIN11) | \
  1185. PIN_OTYPE_PUSHPULL(GPIOH_PIN12) | \
  1186. PIN_OTYPE_PUSHPULL(GPIOH_PIN13) | \
  1187. PIN_OTYPE_PUSHPULL(GPIOH_PIN14) | \
  1188. PIN_OTYPE_PUSHPULL(GPIOH_PIN15))
  1189. #define VAL_GPIOH_OSPEEDR (PIN_OSPEED_HIGH(GPIOH_OSC_IN) | \
  1190. PIN_OSPEED_HIGH(GPIOH_OSC_OUT) | \
  1191. PIN_OSPEED_VERYLOW(GPIOH_PIN2) | \
  1192. PIN_OSPEED_VERYLOW(GPIOH_PIN3) | \
  1193. PIN_OSPEED_VERYLOW(GPIOH_PIN4) | \
  1194. PIN_OSPEED_VERYLOW(GPIOH_PIN5) | \
  1195. PIN_OSPEED_VERYLOW(GPIOH_PIN6) | \
  1196. PIN_OSPEED_VERYLOW(GPIOH_PIN7) | \
  1197. PIN_OSPEED_VERYLOW(GPIOH_PIN8) | \
  1198. PIN_OSPEED_VERYLOW(GPIOH_PIN9) | \
  1199. PIN_OSPEED_VERYLOW(GPIOH_PIN10) | \
  1200. PIN_OSPEED_VERYLOW(GPIOH_PIN11) | \
  1201. PIN_OSPEED_VERYLOW(GPIOH_PIN12) | \
  1202. PIN_OSPEED_VERYLOW(GPIOH_PIN13) | \
  1203. PIN_OSPEED_VERYLOW(GPIOH_PIN14) | \
  1204. PIN_OSPEED_VERYLOW(GPIOH_PIN15))
  1205. #define VAL_GPIOH_PUPDR (PIN_PUPDR_FLOATING(GPIOH_OSC_IN) | \
  1206. PIN_PUPDR_FLOATING(GPIOH_OSC_OUT) | \
  1207. PIN_PUPDR_PULLUP(GPIOH_PIN2) | \
  1208. PIN_PUPDR_PULLUP(GPIOH_PIN3) | \
  1209. PIN_PUPDR_PULLUP(GPIOH_PIN4) | \
  1210. PIN_PUPDR_PULLUP(GPIOH_PIN5) | \
  1211. PIN_PUPDR_PULLUP(GPIOH_PIN6) | \
  1212. PIN_PUPDR_PULLUP(GPIOH_PIN7) | \
  1213. PIN_PUPDR_PULLUP(GPIOH_PIN8) | \
  1214. PIN_PUPDR_PULLUP(GPIOH_PIN9) | \
  1215. PIN_PUPDR_PULLUP(GPIOH_PIN10) | \
  1216. PIN_PUPDR_PULLUP(GPIOH_PIN11) | \
  1217. PIN_PUPDR_PULLUP(GPIOH_PIN12) | \
  1218. PIN_PUPDR_PULLUP(GPIOH_PIN13) | \
  1219. PIN_PUPDR_PULLUP(GPIOH_PIN14) | \
  1220. PIN_PUPDR_PULLUP(GPIOH_PIN15))
  1221. #define VAL_GPIOH_ODR (PIN_ODR_HIGH(GPIOH_OSC_IN) | \
  1222. PIN_ODR_HIGH(GPIOH_OSC_OUT) | \
  1223. PIN_ODR_HIGH(GPIOH_PIN2) | \
  1224. PIN_ODR_HIGH(GPIOH_PIN3) | \
  1225. PIN_ODR_HIGH(GPIOH_PIN4) | \
  1226. PIN_ODR_HIGH(GPIOH_PIN5) | \
  1227. PIN_ODR_HIGH(GPIOH_PIN6) | \
  1228. PIN_ODR_HIGH(GPIOH_PIN7) | \
  1229. PIN_ODR_HIGH(GPIOH_PIN8) | \
  1230. PIN_ODR_HIGH(GPIOH_PIN9) | \
  1231. PIN_ODR_HIGH(GPIOH_PIN10) | \
  1232. PIN_ODR_HIGH(GPIOH_PIN11) | \
  1233. PIN_ODR_HIGH(GPIOH_PIN12) | \
  1234. PIN_ODR_HIGH(GPIOH_PIN13) | \
  1235. PIN_ODR_HIGH(GPIOH_PIN14) | \
  1236. PIN_ODR_HIGH(GPIOH_PIN15))
  1237. #define VAL_GPIOH_AFRL (PIN_AFIO_AF(GPIOH_OSC_IN, 0U) | \
  1238. PIN_AFIO_AF(GPIOH_OSC_OUT, 0U) | \
  1239. PIN_AFIO_AF(GPIOH_PIN2, 0U) | \
  1240. PIN_AFIO_AF(GPIOH_PIN3, 0U) | \
  1241. PIN_AFIO_AF(GPIOH_PIN4, 0U) | \
  1242. PIN_AFIO_AF(GPIOH_PIN5, 0U) | \
  1243. PIN_AFIO_AF(GPIOH_PIN6, 0U) | \
  1244. PIN_AFIO_AF(GPIOH_PIN7, 0U))
  1245. #define VAL_GPIOH_AFRH (PIN_AFIO_AF(GPIOH_PIN8, 0U) | \
  1246. PIN_AFIO_AF(GPIOH_PIN9, 0U) | \
  1247. PIN_AFIO_AF(GPIOH_PIN10, 0U) | \
  1248. PIN_AFIO_AF(GPIOH_PIN11, 0U) | \
  1249. PIN_AFIO_AF(GPIOH_PIN12, 0U) | \
  1250. PIN_AFIO_AF(GPIOH_PIN13, 0U) | \
  1251. PIN_AFIO_AF(GPIOH_PIN14, 0U) | \
  1252. PIN_AFIO_AF(GPIOH_PIN15, 0U))
  1253. /*
  1254. * GPIOI setup:
  1255. *
  1256. * PI0 - PIN0 (input pullup).
  1257. * PI1 - PIN1 (input pullup).
  1258. * PI2 - PIN2 (input pullup).
  1259. * PI3 - PIN3 (input pullup).
  1260. * PI4 - PIN4 (input pullup).
  1261. * PI5 - PIN5 (input pullup).
  1262. * PI6 - PIN6 (input pullup).
  1263. * PI7 - PIN7 (input pullup).
  1264. * PI8 - PIN8 (input pullup).
  1265. * PI9 - PIN9 (input pullup).
  1266. * PI10 - PIN10 (input pullup).
  1267. * PI11 - PIN11 (input pullup).
  1268. * PI12 - PIN12 (input pullup).
  1269. * PI13 - PIN13 (input pullup).
  1270. * PI14 - PIN14 (input pullup).
  1271. * PI15 - PIN15 (input pullup).
  1272. */
  1273. #define VAL_GPIOI_MODER (PIN_MODE_INPUT(GPIOI_PIN0) | \
  1274. PIN_MODE_INPUT(GPIOI_PIN1) | \
  1275. PIN_MODE_INPUT(GPIOI_PIN2) | \
  1276. PIN_MODE_INPUT(GPIOI_PIN3) | \
  1277. PIN_MODE_INPUT(GPIOI_PIN4) | \
  1278. PIN_MODE_INPUT(GPIOI_PIN5) | \
  1279. PIN_MODE_INPUT(GPIOI_PIN6) | \
  1280. PIN_MODE_INPUT(GPIOI_PIN7) | \
  1281. PIN_MODE_INPUT(GPIOI_PIN8) | \
  1282. PIN_MODE_INPUT(GPIOI_PIN9) | \
  1283. PIN_MODE_INPUT(GPIOI_PIN10) | \
  1284. PIN_MODE_INPUT(GPIOI_PIN11) | \
  1285. PIN_MODE_INPUT(GPIOI_PIN12) | \
  1286. PIN_MODE_INPUT(GPIOI_PIN13) | \
  1287. PIN_MODE_INPUT(GPIOI_PIN14) | \
  1288. PIN_MODE_INPUT(GPIOI_PIN15))
  1289. #define VAL_GPIOI_OTYPER (PIN_OTYPE_PUSHPULL(GPIOI_PIN0) | \
  1290. PIN_OTYPE_PUSHPULL(GPIOI_PIN1) | \
  1291. PIN_OTYPE_PUSHPULL(GPIOI_PIN2) | \
  1292. PIN_OTYPE_PUSHPULL(GPIOI_PIN3) | \
  1293. PIN_OTYPE_PUSHPULL(GPIOI_PIN4) | \
  1294. PIN_OTYPE_PUSHPULL(GPIOI_PIN5) | \
  1295. PIN_OTYPE_PUSHPULL(GPIOI_PIN6) | \
  1296. PIN_OTYPE_PUSHPULL(GPIOI_PIN7) | \
  1297. PIN_OTYPE_PUSHPULL(GPIOI_PIN8) | \
  1298. PIN_OTYPE_PUSHPULL(GPIOI_PIN9) | \
  1299. PIN_OTYPE_PUSHPULL(GPIOI_PIN10) | \
  1300. PIN_OTYPE_PUSHPULL(GPIOI_PIN11) | \
  1301. PIN_OTYPE_PUSHPULL(GPIOI_PIN12) | \
  1302. PIN_OTYPE_PUSHPULL(GPIOI_PIN13) | \
  1303. PIN_OTYPE_PUSHPULL(GPIOI_PIN14) | \
  1304. PIN_OTYPE_PUSHPULL(GPIOI_PIN15))
  1305. #define VAL_GPIOI_OSPEEDR (PIN_OSPEED_VERYLOW(GPIOI_PIN0) | \
  1306. PIN_OSPEED_VERYLOW(GPIOI_PIN1) | \
  1307. PIN_OSPEED_VERYLOW(GPIOI_PIN2) | \
  1308. PIN_OSPEED_VERYLOW(GPIOI_PIN3) | \
  1309. PIN_OSPEED_VERYLOW(GPIOI_PIN4) | \
  1310. PIN_OSPEED_VERYLOW(GPIOI_PIN5) | \
  1311. PIN_OSPEED_VERYLOW(GPIOI_PIN6) | \
  1312. PIN_OSPEED_VERYLOW(GPIOI_PIN7) | \
  1313. PIN_OSPEED_VERYLOW(GPIOI_PIN8) | \
  1314. PIN_OSPEED_VERYLOW(GPIOI_PIN9) | \
  1315. PIN_OSPEED_VERYLOW(GPIOI_PIN10) | \
  1316. PIN_OSPEED_VERYLOW(GPIOI_PIN11) | \
  1317. PIN_OSPEED_VERYLOW(GPIOI_PIN12) | \
  1318. PIN_OSPEED_VERYLOW(GPIOI_PIN13) | \
  1319. PIN_OSPEED_VERYLOW(GPIOI_PIN14) | \
  1320. PIN_OSPEED_VERYLOW(GPIOI_PIN15))
  1321. #define VAL_GPIOI_PUPDR (PIN_PUPDR_PULLUP(GPIOI_PIN0) | \
  1322. PIN_PUPDR_PULLUP(GPIOI_PIN1) | \
  1323. PIN_PUPDR_PULLUP(GPIOI_PIN2) | \
  1324. PIN_PUPDR_PULLUP(GPIOI_PIN3) | \
  1325. PIN_PUPDR_PULLUP(GPIOI_PIN4) | \
  1326. PIN_PUPDR_PULLUP(GPIOI_PIN5) | \
  1327. PIN_PUPDR_PULLUP(GPIOI_PIN6) | \
  1328. PIN_PUPDR_PULLUP(GPIOI_PIN7) | \
  1329. PIN_PUPDR_PULLUP(GPIOI_PIN8) | \
  1330. PIN_PUPDR_PULLUP(GPIOI_PIN9) | \
  1331. PIN_PUPDR_PULLUP(GPIOI_PIN10) | \
  1332. PIN_PUPDR_PULLUP(GPIOI_PIN11) | \
  1333. PIN_PUPDR_PULLUP(GPIOI_PIN12) | \
  1334. PIN_PUPDR_PULLUP(GPIOI_PIN13) | \
  1335. PIN_PUPDR_PULLUP(GPIOI_PIN14) | \
  1336. PIN_PUPDR_PULLUP(GPIOI_PIN15))
  1337. #define VAL_GPIOI_ODR (PIN_ODR_HIGH(GPIOI_PIN0) | \
  1338. PIN_ODR_HIGH(GPIOI_PIN1) | \
  1339. PIN_ODR_HIGH(GPIOI_PIN2) | \
  1340. PIN_ODR_HIGH(GPIOI_PIN3) | \
  1341. PIN_ODR_HIGH(GPIOI_PIN4) | \
  1342. PIN_ODR_HIGH(GPIOI_PIN5) | \
  1343. PIN_ODR_HIGH(GPIOI_PIN6) | \
  1344. PIN_ODR_HIGH(GPIOI_PIN7) | \
  1345. PIN_ODR_HIGH(GPIOI_PIN8) | \
  1346. PIN_ODR_HIGH(GPIOI_PIN9) | \
  1347. PIN_ODR_HIGH(GPIOI_PIN10) | \
  1348. PIN_ODR_HIGH(GPIOI_PIN11) | \
  1349. PIN_ODR_HIGH(GPIOI_PIN12) | \
  1350. PIN_ODR_HIGH(GPIOI_PIN13) | \
  1351. PIN_ODR_HIGH(GPIOI_PIN14) | \
  1352. PIN_ODR_HIGH(GPIOI_PIN15))
  1353. #define VAL_GPIOI_AFRL (PIN_AFIO_AF(GPIOI_PIN0, 0U) | \
  1354. PIN_AFIO_AF(GPIOI_PIN1, 0U) | \
  1355. PIN_AFIO_AF(GPIOI_PIN2, 0U) | \
  1356. PIN_AFIO_AF(GPIOI_PIN3, 0U) | \
  1357. PIN_AFIO_AF(GPIOI_PIN4, 0U) | \
  1358. PIN_AFIO_AF(GPIOI_PIN5, 0U) | \
  1359. PIN_AFIO_AF(GPIOI_PIN6, 0U) | \
  1360. PIN_AFIO_AF(GPIOI_PIN7, 0U))
  1361. #define VAL_GPIOI_AFRH (PIN_AFIO_AF(GPIOI_PIN8, 0U) | \
  1362. PIN_AFIO_AF(GPIOI_PIN9, 0U) | \
  1363. PIN_AFIO_AF(GPIOI_PIN10, 0U) | \
  1364. PIN_AFIO_AF(GPIOI_PIN11, 0U) | \
  1365. PIN_AFIO_AF(GPIOI_PIN12, 0U) | \
  1366. PIN_AFIO_AF(GPIOI_PIN13, 0U) | \
  1367. PIN_AFIO_AF(GPIOI_PIN14, 0U) | \
  1368. PIN_AFIO_AF(GPIOI_PIN15, 0U))
  1369. /*===========================================================================*/
  1370. /* External declarations. */
  1371. /*===========================================================================*/
  1372. #if !defined(_FROM_ASM_)
  1373. #ifdef __cplusplus
  1374. extern "C" {
  1375. #endif
  1376. void boardInit(void);
  1377. #ifdef __cplusplus
  1378. }
  1379. #endif
  1380. #endif /* _FROM_ASM_ */
  1381. #endif /* BOARD_H */