board.h 76 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240
  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 STM32 Nucleo64-F303RE board.
  24. */
  25. /*
  26. * Board identifier.
  27. */
  28. #define BOARD_ST_NUCLEO64_F303RE
  29. #define BOARD_NAME "STMicroelectronics STM32 Nucleo64-F303RE"
  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. #define STM32_LSEDRV (3U << 3U)
  38. #if !defined(STM32_HSECLK)
  39. #define STM32_HSECLK 8000000U
  40. #endif
  41. #define STM32_HSE_BYPASS
  42. /*
  43. * MCU type as defined in the ST header.
  44. */
  45. #define STM32F303xE
  46. /*
  47. * IO pins assignments.
  48. */
  49. #define GPIOA_ARD_A0 0U
  50. #define GPIOA_ADC1_IN1 0U
  51. #define GPIOA_ARD_A1 1U
  52. #define GPIOA_ADC1_IN2 1U
  53. #define GPIOA_ARD_D1 2U
  54. #define GPIOA_USART2_TX 2U
  55. #define GPIOA_ARD_D0 3U
  56. #define GPIOA_USART2_RX 3U
  57. #define GPIOA_ARD_A2 4U
  58. #define GPIOA_ADC2_IN1 4U
  59. #define GPIOA_LED_GREEN 5U
  60. #define GPIOA_ARD_D13 5U
  61. #define GPIOA_ARD_D12 6U
  62. #define GPIOA_ARD_D11 7U
  63. #define GPIOA_ARD_D7 8U
  64. #define GPIOA_ARD_D8 9U
  65. #define GPIOA_ARD_D2 10U
  66. #define GPIOA_PIN11 11U
  67. #define GPIOA_PIN12 12U
  68. #define GPIOA_SWDIO 13U
  69. #define GPIOA_SWCLK 14U
  70. #define GPIOA_PIN15 15U
  71. #define GPIOB_ARD_A3 0U
  72. #define GPIOB_ADC3_IN12 0U
  73. #define GPIOB_PIN1 1U
  74. #define GPIOB_PIN2 2U
  75. #define GPIOB_SWO 3U
  76. #define GPIOB_ARD_D3 3U
  77. #define GPIOB_ARD_D5 4U
  78. #define GPIOB_ARD_D4 5U
  79. #define GPIOB_ARD_D10 6U
  80. #define GPIOB_PIN7 7U
  81. #define GPIOB_ARD_D15 8U
  82. #define GPIOB_ARD_D14 9U
  83. #define GPIOB_ARD_D6 10U
  84. #define GPIOB_PIN11 11U
  85. #define GPIOB_PIN12 12U
  86. #define GPIOB_PIN13 13U
  87. #define GPIOB_PIN14 14U
  88. #define GPIOB_PIN15 15U
  89. #define GPIOC_ARD_A5 0U
  90. #define GPIOC_ADC12_IN6 0U
  91. #define GPIOC_ARD_A4 1U
  92. #define GPIOC_ADC12_IN7 1U
  93. #define GPIOC_PIN2 2U
  94. #define GPIOC_PIN3 3U
  95. #define GPIOC_PIN4 4U
  96. #define GPIOC_PIN5 5U
  97. #define GPIOC_PIN6 6U
  98. #define GPIOC_ARD_D9 7U
  99. #define GPIOC_PIN8 8U
  100. #define GPIOC_PIN9 9U
  101. #define GPIOC_PIN10 10U
  102. #define GPIOC_PIN11 11U
  103. #define GPIOC_PIN12 12U
  104. #define GPIOC_BUTTON 13U
  105. #define GPIOC_OSC32_IN 14U
  106. #define GPIOC_OSC32_OUT 15U
  107. #define GPIOD_PIN0 0U
  108. #define GPIOD_PIN1 1U
  109. #define GPIOD_PIN2 2U
  110. #define GPIOD_PIN3 3U
  111. #define GPIOD_PIN4 4U
  112. #define GPIOD_PIN5 5U
  113. #define GPIOD_PIN6 6U
  114. #define GPIOD_PIN7 7U
  115. #define GPIOD_PIN8 8U
  116. #define GPIOD_PIN9 9U
  117. #define GPIOD_PIN10 10U
  118. #define GPIOD_PIN11 11U
  119. #define GPIOD_PIN12 12U
  120. #define GPIOD_PIN13 13U
  121. #define GPIOD_PIN14 14U
  122. #define GPIOD_PIN15 15U
  123. #define GPIOE_PIN0 0U
  124. #define GPIOE_PIN1 1U
  125. #define GPIOE_PIN2 2U
  126. #define GPIOE_PIN3 3U
  127. #define GPIOE_PIN4 4U
  128. #define GPIOE_PIN5 5U
  129. #define GPIOE_PIN6 6U
  130. #define GPIOE_PIN7 7U
  131. #define GPIOE_PIN8 8U
  132. #define GPIOE_PIN9 9U
  133. #define GPIOE_PIN10 10U
  134. #define GPIOE_PIN11 11U
  135. #define GPIOE_PIN12 12U
  136. #define GPIOE_PIN13 13U
  137. #define GPIOE_PIN14 14U
  138. #define GPIOE_PIN15 15U
  139. #define GPIOF_OSC_IN 0U
  140. #define GPIOF_OSC_OUT 1U
  141. #define GPIOF_PIN2 2U
  142. #define GPIOF_PIN3 3U
  143. #define GPIOF_PIN4 4U
  144. #define GPIOF_PIN5 5U
  145. #define GPIOF_PIN6 6U
  146. #define GPIOF_PIN7 7U
  147. #define GPIOF_PIN8 8U
  148. #define GPIOF_PIN9 9U
  149. #define GPIOF_PIN10 10U
  150. #define GPIOF_PIN11 11U
  151. #define GPIOF_PIN12 12U
  152. #define GPIOF_PIN13 13U
  153. #define GPIOF_PIN14 14U
  154. #define GPIOF_PIN15 15U
  155. #define GPIOG_PIN0 0U
  156. #define GPIOG_PIN1 1U
  157. #define GPIOG_PIN2 2U
  158. #define GPIOG_PIN3 3U
  159. #define GPIOG_PIN4 4U
  160. #define GPIOG_PIN5 5U
  161. #define GPIOG_PIN6 6U
  162. #define GPIOG_PIN7 7U
  163. #define GPIOG_PIN8 8U
  164. #define GPIOG_PIN9 9U
  165. #define GPIOG_PIN10 10U
  166. #define GPIOG_PIN11 11U
  167. #define GPIOG_PIN12 12U
  168. #define GPIOG_PIN13 13U
  169. #define GPIOG_PIN14 14U
  170. #define GPIOG_PIN15 15U
  171. #define GPIOH_PIN0 0U
  172. #define GPIOH_PIN1 1U
  173. #define GPIOH_PIN2 2U
  174. #define GPIOH_PIN3 3U
  175. #define GPIOH_PIN4 4U
  176. #define GPIOH_PIN5 5U
  177. #define GPIOH_PIN6 6U
  178. #define GPIOH_PIN7 7U
  179. #define GPIOH_PIN8 8U
  180. #define GPIOH_PIN9 9U
  181. #define GPIOH_PIN10 10U
  182. #define GPIOH_PIN11 11U
  183. #define GPIOH_PIN12 12U
  184. #define GPIOH_PIN13 13U
  185. #define GPIOH_PIN14 14U
  186. #define GPIOH_PIN15 15U
  187. /*
  188. * IO lines assignments.
  189. */
  190. #define LINE_ARD_A0 PAL_LINE(GPIOA, 0U)
  191. #define LINE_ADC1_IN1 PAL_LINE(GPIOA, 0U)
  192. #define LINE_ARD_A1 PAL_LINE(GPIOA, 1U)
  193. #define LINE_ADC1_IN2 PAL_LINE(GPIOA, 1U)
  194. #define LINE_ARD_D1 PAL_LINE(GPIOA, 2U)
  195. #define LINE_USART2_TX PAL_LINE(GPIOA, 2U)
  196. #define LINE_ARD_D0 PAL_LINE(GPIOA, 3U)
  197. #define LINE_USART2_RX PAL_LINE(GPIOA, 3U)
  198. #define LINE_ARD_A2 PAL_LINE(GPIOA, 4U)
  199. #define LINE_ADC2_IN1 PAL_LINE(GPIOA, 4U)
  200. #define LINE_LED_GREEN PAL_LINE(GPIOA, 5U)
  201. #define LINE_ARD_D13 PAL_LINE(GPIOA, 5U)
  202. #define LINE_ARD_D12 PAL_LINE(GPIOA, 6U)
  203. #define LINE_ARD_D11 PAL_LINE(GPIOA, 7U)
  204. #define LINE_ARD_D7 PAL_LINE(GPIOA, 8U)
  205. #define LINE_ARD_D8 PAL_LINE(GPIOA, 9U)
  206. #define LINE_ARD_D2 PAL_LINE(GPIOA, 10U)
  207. #define LINE_SWDIO PAL_LINE(GPIOA, 13U)
  208. #define LINE_SWCLK PAL_LINE(GPIOA, 14U)
  209. #define LINE_ARD_A3 PAL_LINE(GPIOB, 0U)
  210. #define LINE_ADC3_IN12 PAL_LINE(GPIOB, 0U)
  211. #define LINE_SWO PAL_LINE(GPIOB, 3U)
  212. #define LINE_ARD_D3 PAL_LINE(GPIOB, 3U)
  213. #define LINE_ARD_D5 PAL_LINE(GPIOB, 4U)
  214. #define LINE_ARD_D4 PAL_LINE(GPIOB, 5U)
  215. #define LINE_ARD_D10 PAL_LINE(GPIOB, 6U)
  216. #define LINE_ARD_D15 PAL_LINE(GPIOB, 8U)
  217. #define LINE_ARD_D14 PAL_LINE(GPIOB, 9U)
  218. #define LINE_ARD_D6 PAL_LINE(GPIOB, 10U)
  219. #define LINE_ARD_A5 PAL_LINE(GPIOC, 0U)
  220. #define LINE_ADC12_IN6 PAL_LINE(GPIOC, 0U)
  221. #define LINE_ARD_A4 PAL_LINE(GPIOC, 1U)
  222. #define LINE_ADC12_IN7 PAL_LINE(GPIOC, 1U)
  223. #define LINE_ARD_D9 PAL_LINE(GPIOC, 7U)
  224. #define LINE_BUTTON PAL_LINE(GPIOC, 13U)
  225. #define LINE_OSC32_IN PAL_LINE(GPIOC, 14U)
  226. #define LINE_OSC32_OUT PAL_LINE(GPIOC, 15U)
  227. #define LINE_OSC_IN PAL_LINE(GPIOF, 0U)
  228. #define LINE_OSC_OUT PAL_LINE(GPIOF, 1U)
  229. /*===========================================================================*/
  230. /* Driver pre-compile time settings. */
  231. /*===========================================================================*/
  232. /*===========================================================================*/
  233. /* Derived constants and error checks. */
  234. /*===========================================================================*/
  235. /*===========================================================================*/
  236. /* Driver data structures and types. */
  237. /*===========================================================================*/
  238. /*===========================================================================*/
  239. /* Driver macros. */
  240. /*===========================================================================*/
  241. /*
  242. * I/O ports initial setup, this configuration is established soon after reset
  243. * in the initialization code.
  244. * Please refer to the STM32 Reference Manual for details.
  245. */
  246. #define PIN_MODE_INPUT(n) (0U << ((n) * 2U))
  247. #define PIN_MODE_OUTPUT(n) (1U << ((n) * 2U))
  248. #define PIN_MODE_ALTERNATE(n) (2U << ((n) * 2U))
  249. #define PIN_MODE_ANALOG(n) (3U << ((n) * 2U))
  250. #define PIN_ODR_LOW(n) (0U << (n))
  251. #define PIN_ODR_HIGH(n) (1U << (n))
  252. #define PIN_OTYPE_PUSHPULL(n) (0U << (n))
  253. #define PIN_OTYPE_OPENDRAIN(n) (1U << (n))
  254. #define PIN_OSPEED_VERYLOW(n) (0U << ((n) * 2U))
  255. #define PIN_OSPEED_LOW(n) (1U << ((n) * 2U))
  256. #define PIN_OSPEED_MEDIUM(n) (2U << ((n) * 2U))
  257. #define PIN_OSPEED_HIGH(n) (3U << ((n) * 2U))
  258. #define PIN_PUPDR_FLOATING(n) (0U << ((n) * 2U))
  259. #define PIN_PUPDR_PULLUP(n) (1U << ((n) * 2U))
  260. #define PIN_PUPDR_PULLDOWN(n) (2U << ((n) * 2U))
  261. #define PIN_AFIO_AF(n, v) ((v) << (((n) % 8U) * 4U))
  262. /*
  263. * GPIOA setup:
  264. *
  265. * PA0 - ARD_A0 ADC1_IN1 (input pullup).
  266. * PA1 - ARD_A1 ADC1_IN2 (input pullup).
  267. * PA2 - ARD_D1 USART2_TX (alternate 7).
  268. * PA3 - ARD_D0 USART2_RX (alternate 7).
  269. * PA4 - ARD_A2 ADC2_IN1 (input pullup).
  270. * PA5 - LED_GREEN ARD_D13 (output pushpull high).
  271. * PA6 - ARD_D12 (input pullup).
  272. * PA7 - ARD_D11 (input pullup).
  273. * PA8 - ARD_D7 (input pullup).
  274. * PA9 - ARD_D8 (input pullup).
  275. * PA10 - ARD_D2 (input pullup).
  276. * PA11 - PIN11 (input pullup).
  277. * PA12 - PIN12 (input pullup).
  278. * PA13 - SWDIO (alternate 0).
  279. * PA14 - SWCLK (alternate 0).
  280. * PA15 - PIN15 (input pullup).
  281. */
  282. #define VAL_GPIOA_MODER (PIN_MODE_INPUT(GPIOA_ARD_A0) | \
  283. PIN_MODE_INPUT(GPIOA_ARD_A1) | \
  284. PIN_MODE_ALTERNATE(GPIOA_ARD_D1) | \
  285. PIN_MODE_ALTERNATE(GPIOA_ARD_D0) | \
  286. PIN_MODE_INPUT(GPIOA_ARD_A2) | \
  287. PIN_MODE_OUTPUT(GPIOA_LED_GREEN) | \
  288. PIN_MODE_INPUT(GPIOA_ARD_D12) | \
  289. PIN_MODE_INPUT(GPIOA_ARD_D11) | \
  290. PIN_MODE_INPUT(GPIOA_ARD_D7) | \
  291. PIN_MODE_INPUT(GPIOA_ARD_D8) | \
  292. PIN_MODE_INPUT(GPIOA_ARD_D2) | \
  293. PIN_MODE_INPUT(GPIOA_PIN11) | \
  294. PIN_MODE_INPUT(GPIOA_PIN12) | \
  295. PIN_MODE_ALTERNATE(GPIOA_SWDIO) | \
  296. PIN_MODE_ALTERNATE(GPIOA_SWCLK) | \
  297. PIN_MODE_INPUT(GPIOA_PIN15))
  298. #define VAL_GPIOA_OTYPER (PIN_OTYPE_PUSHPULL(GPIOA_ARD_A0) | \
  299. PIN_OTYPE_PUSHPULL(GPIOA_ARD_A1) | \
  300. PIN_OTYPE_PUSHPULL(GPIOA_ARD_D1) | \
  301. PIN_OTYPE_PUSHPULL(GPIOA_ARD_D0) | \
  302. PIN_OTYPE_PUSHPULL(GPIOA_ARD_A2) | \
  303. PIN_OTYPE_PUSHPULL(GPIOA_LED_GREEN) | \
  304. PIN_OTYPE_PUSHPULL(GPIOA_ARD_D12) | \
  305. PIN_OTYPE_PUSHPULL(GPIOA_ARD_D11) | \
  306. PIN_OTYPE_PUSHPULL(GPIOA_ARD_D7) | \
  307. PIN_OTYPE_PUSHPULL(GPIOA_ARD_D8) | \
  308. PIN_OTYPE_PUSHPULL(GPIOA_ARD_D2) | \
  309. PIN_OTYPE_PUSHPULL(GPIOA_PIN11) | \
  310. PIN_OTYPE_PUSHPULL(GPIOA_PIN12) | \
  311. PIN_OTYPE_PUSHPULL(GPIOA_SWDIO) | \
  312. PIN_OTYPE_PUSHPULL(GPIOA_SWCLK) | \
  313. PIN_OTYPE_PUSHPULL(GPIOA_PIN15))
  314. #define VAL_GPIOA_OSPEEDR (PIN_OSPEED_HIGH(GPIOA_ARD_A0) | \
  315. PIN_OSPEED_HIGH(GPIOA_ARD_A1) | \
  316. PIN_OSPEED_LOW(GPIOA_ARD_D1) | \
  317. PIN_OSPEED_LOW(GPIOA_ARD_D0) | \
  318. PIN_OSPEED_HIGH(GPIOA_ARD_A2) | \
  319. PIN_OSPEED_LOW(GPIOA_LED_GREEN) | \
  320. PIN_OSPEED_HIGH(GPIOA_ARD_D12) | \
  321. PIN_OSPEED_HIGH(GPIOA_ARD_D11) | \
  322. PIN_OSPEED_HIGH(GPIOA_ARD_D7) | \
  323. PIN_OSPEED_HIGH(GPIOA_ARD_D8) | \
  324. PIN_OSPEED_HIGH(GPIOA_ARD_D2) | \
  325. PIN_OSPEED_HIGH(GPIOA_PIN11) | \
  326. PIN_OSPEED_HIGH(GPIOA_PIN12) | \
  327. PIN_OSPEED_HIGH(GPIOA_SWDIO) | \
  328. PIN_OSPEED_HIGH(GPIOA_SWCLK) | \
  329. PIN_OSPEED_HIGH(GPIOA_PIN15))
  330. #define VAL_GPIOA_PUPDR (PIN_PUPDR_PULLUP(GPIOA_ARD_A0) | \
  331. PIN_PUPDR_PULLUP(GPIOA_ARD_A1) | \
  332. PIN_PUPDR_FLOATING(GPIOA_ARD_D1) | \
  333. PIN_PUPDR_FLOATING(GPIOA_ARD_D0) | \
  334. PIN_PUPDR_PULLUP(GPIOA_ARD_A2) | \
  335. PIN_PUPDR_FLOATING(GPIOA_LED_GREEN) | \
  336. PIN_PUPDR_PULLUP(GPIOA_ARD_D12) | \
  337. PIN_PUPDR_PULLUP(GPIOA_ARD_D11) | \
  338. PIN_PUPDR_PULLUP(GPIOA_ARD_D7) | \
  339. PIN_PUPDR_PULLUP(GPIOA_ARD_D8) | \
  340. PIN_PUPDR_PULLUP(GPIOA_ARD_D2) | \
  341. PIN_PUPDR_PULLUP(GPIOA_PIN11) | \
  342. PIN_PUPDR_PULLUP(GPIOA_PIN12) | \
  343. PIN_PUPDR_PULLUP(GPIOA_SWDIO) | \
  344. PIN_PUPDR_PULLDOWN(GPIOA_SWCLK) | \
  345. PIN_PUPDR_PULLUP(GPIOA_PIN15))
  346. #define VAL_GPIOA_ODR (PIN_ODR_HIGH(GPIOA_ARD_A0) | \
  347. PIN_ODR_HIGH(GPIOA_ARD_A1) | \
  348. PIN_ODR_HIGH(GPIOA_ARD_D1) | \
  349. PIN_ODR_HIGH(GPIOA_ARD_D0) | \
  350. PIN_ODR_HIGH(GPIOA_ARD_A2) | \
  351. PIN_ODR_LOW(GPIOA_LED_GREEN) | \
  352. PIN_ODR_HIGH(GPIOA_ARD_D12) | \
  353. PIN_ODR_HIGH(GPIOA_ARD_D11) | \
  354. PIN_ODR_HIGH(GPIOA_ARD_D7) | \
  355. PIN_ODR_HIGH(GPIOA_ARD_D8) | \
  356. PIN_ODR_HIGH(GPIOA_ARD_D2) | \
  357. PIN_ODR_HIGH(GPIOA_PIN11) | \
  358. PIN_ODR_HIGH(GPIOA_PIN12) | \
  359. PIN_ODR_HIGH(GPIOA_SWDIO) | \
  360. PIN_ODR_HIGH(GPIOA_SWCLK) | \
  361. PIN_ODR_HIGH(GPIOA_PIN15))
  362. #define VAL_GPIOA_AFRL (PIN_AFIO_AF(GPIOA_ARD_A0, 0U) | \
  363. PIN_AFIO_AF(GPIOA_ARD_A1, 0U) | \
  364. PIN_AFIO_AF(GPIOA_ARD_D1, 7U) | \
  365. PIN_AFIO_AF(GPIOA_ARD_D0, 7U) | \
  366. PIN_AFIO_AF(GPIOA_ARD_A2, 0U) | \
  367. PIN_AFIO_AF(GPIOA_LED_GREEN, 0U) | \
  368. PIN_AFIO_AF(GPIOA_ARD_D12, 0U) | \
  369. PIN_AFIO_AF(GPIOA_ARD_D11, 0U))
  370. #define VAL_GPIOA_AFRH (PIN_AFIO_AF(GPIOA_ARD_D7, 0U) | \
  371. PIN_AFIO_AF(GPIOA_ARD_D8, 0U) | \
  372. PIN_AFIO_AF(GPIOA_ARD_D2, 0U) | \
  373. PIN_AFIO_AF(GPIOA_PIN11, 0U) | \
  374. PIN_AFIO_AF(GPIOA_PIN12, 0U) | \
  375. PIN_AFIO_AF(GPIOA_SWDIO, 0U) | \
  376. PIN_AFIO_AF(GPIOA_SWCLK, 0U) | \
  377. PIN_AFIO_AF(GPIOA_PIN15, 0U))
  378. /*
  379. * GPIOB setup:
  380. *
  381. * PB0 - ARD_A3 ADC3_IN12 (input pullup).
  382. * PB1 - PIN1 (input pullup).
  383. * PB2 - PIN2 (input pullup).
  384. * PB3 - SWO ARD_D3 (alternate 0).
  385. * PB4 - ARD_D5 (input pullup).
  386. * PB5 - ARD_D4 (input pullup).
  387. * PB6 - ARD_D10 (input pullup).
  388. * PB7 - PIN7 (input pullup).
  389. * PB8 - ARD_D15 (input pullup).
  390. * PB9 - ARD_D14 (input pullup).
  391. * PB10 - ARD_D6 (input pullup).
  392. * PB11 - PIN11 (input pullup).
  393. * PB12 - PIN12 (input pullup).
  394. * PB13 - PIN13 (input pullup).
  395. * PB14 - PIN14 (input pullup).
  396. * PB15 - PIN15 (input pullup).
  397. */
  398. #define VAL_GPIOB_MODER (PIN_MODE_INPUT(GPIOB_ARD_A3) | \
  399. PIN_MODE_INPUT(GPIOB_PIN1) | \
  400. PIN_MODE_INPUT(GPIOB_PIN2) | \
  401. PIN_MODE_ALTERNATE(GPIOB_SWO) | \
  402. PIN_MODE_INPUT(GPIOB_ARD_D5) | \
  403. PIN_MODE_INPUT(GPIOB_ARD_D4) | \
  404. PIN_MODE_INPUT(GPIOB_ARD_D10) | \
  405. PIN_MODE_INPUT(GPIOB_PIN7) | \
  406. PIN_MODE_INPUT(GPIOB_ARD_D15) | \
  407. PIN_MODE_INPUT(GPIOB_ARD_D14) | \
  408. PIN_MODE_INPUT(GPIOB_ARD_D6) | \
  409. PIN_MODE_INPUT(GPIOB_PIN11) | \
  410. PIN_MODE_INPUT(GPIOB_PIN12) | \
  411. PIN_MODE_INPUT(GPIOB_PIN13) | \
  412. PIN_MODE_INPUT(GPIOB_PIN14) | \
  413. PIN_MODE_INPUT(GPIOB_PIN15))
  414. #define VAL_GPIOB_OTYPER (PIN_OTYPE_PUSHPULL(GPIOB_ARD_A3) | \
  415. PIN_OTYPE_PUSHPULL(GPIOB_PIN1) | \
  416. PIN_OTYPE_PUSHPULL(GPIOB_PIN2) | \
  417. PIN_OTYPE_PUSHPULL(GPIOB_SWO) | \
  418. PIN_OTYPE_PUSHPULL(GPIOB_ARD_D5) | \
  419. PIN_OTYPE_PUSHPULL(GPIOB_ARD_D4) | \
  420. PIN_OTYPE_PUSHPULL(GPIOB_ARD_D10) | \
  421. PIN_OTYPE_PUSHPULL(GPIOB_PIN7) | \
  422. PIN_OTYPE_PUSHPULL(GPIOB_ARD_D15) | \
  423. PIN_OTYPE_PUSHPULL(GPIOB_ARD_D14) | \
  424. PIN_OTYPE_PUSHPULL(GPIOB_ARD_D6) | \
  425. PIN_OTYPE_PUSHPULL(GPIOB_PIN11) | \
  426. PIN_OTYPE_PUSHPULL(GPIOB_PIN12) | \
  427. PIN_OTYPE_PUSHPULL(GPIOB_PIN13) | \
  428. PIN_OTYPE_PUSHPULL(GPIOB_PIN14) | \
  429. PIN_OTYPE_PUSHPULL(GPIOB_PIN15))
  430. #define VAL_GPIOB_OSPEEDR (PIN_OSPEED_HIGH(GPIOB_ARD_A3) | \
  431. PIN_OSPEED_HIGH(GPIOB_PIN1) | \
  432. PIN_OSPEED_HIGH(GPIOB_PIN2) | \
  433. PIN_OSPEED_HIGH(GPIOB_SWO) | \
  434. PIN_OSPEED_HIGH(GPIOB_ARD_D5) | \
  435. PIN_OSPEED_HIGH(GPIOB_ARD_D4) | \
  436. PIN_OSPEED_HIGH(GPIOB_ARD_D10) | \
  437. PIN_OSPEED_HIGH(GPIOB_PIN7) | \
  438. PIN_OSPEED_HIGH(GPIOB_ARD_D15) | \
  439. PIN_OSPEED_HIGH(GPIOB_ARD_D14) | \
  440. PIN_OSPEED_HIGH(GPIOB_ARD_D6) | \
  441. PIN_OSPEED_HIGH(GPIOB_PIN11) | \
  442. PIN_OSPEED_HIGH(GPIOB_PIN12) | \
  443. PIN_OSPEED_HIGH(GPIOB_PIN13) | \
  444. PIN_OSPEED_HIGH(GPIOB_PIN14) | \
  445. PIN_OSPEED_HIGH(GPIOB_PIN15))
  446. #define VAL_GPIOB_PUPDR (PIN_PUPDR_PULLUP(GPIOB_ARD_A3) | \
  447. PIN_PUPDR_PULLUP(GPIOB_PIN1) | \
  448. PIN_PUPDR_PULLUP(GPIOB_PIN2) | \
  449. PIN_PUPDR_PULLUP(GPIOB_SWO) | \
  450. PIN_PUPDR_PULLUP(GPIOB_ARD_D5) | \
  451. PIN_PUPDR_PULLUP(GPIOB_ARD_D4) | \
  452. PIN_PUPDR_PULLUP(GPIOB_ARD_D10) | \
  453. PIN_PUPDR_PULLUP(GPIOB_PIN7) | \
  454. PIN_PUPDR_PULLUP(GPIOB_ARD_D15) | \
  455. PIN_PUPDR_PULLUP(GPIOB_ARD_D14) | \
  456. PIN_PUPDR_PULLUP(GPIOB_ARD_D6) | \
  457. PIN_PUPDR_PULLUP(GPIOB_PIN11) | \
  458. PIN_PUPDR_PULLUP(GPIOB_PIN12) | \
  459. PIN_PUPDR_PULLUP(GPIOB_PIN13) | \
  460. PIN_PUPDR_PULLUP(GPIOB_PIN14) | \
  461. PIN_PUPDR_PULLUP(GPIOB_PIN15))
  462. #define VAL_GPIOB_ODR (PIN_ODR_HIGH(GPIOB_ARD_A3) | \
  463. PIN_ODR_HIGH(GPIOB_PIN1) | \
  464. PIN_ODR_HIGH(GPIOB_PIN2) | \
  465. PIN_ODR_HIGH(GPIOB_SWO) | \
  466. PIN_ODR_HIGH(GPIOB_ARD_D5) | \
  467. PIN_ODR_HIGH(GPIOB_ARD_D4) | \
  468. PIN_ODR_HIGH(GPIOB_ARD_D10) | \
  469. PIN_ODR_HIGH(GPIOB_PIN7) | \
  470. PIN_ODR_HIGH(GPIOB_ARD_D15) | \
  471. PIN_ODR_HIGH(GPIOB_ARD_D14) | \
  472. PIN_ODR_HIGH(GPIOB_ARD_D6) | \
  473. PIN_ODR_HIGH(GPIOB_PIN11) | \
  474. PIN_ODR_HIGH(GPIOB_PIN12) | \
  475. PIN_ODR_HIGH(GPIOB_PIN13) | \
  476. PIN_ODR_HIGH(GPIOB_PIN14) | \
  477. PIN_ODR_HIGH(GPIOB_PIN15))
  478. #define VAL_GPIOB_AFRL (PIN_AFIO_AF(GPIOB_ARD_A3, 0U) | \
  479. PIN_AFIO_AF(GPIOB_PIN1, 0U) | \
  480. PIN_AFIO_AF(GPIOB_PIN2, 0U) | \
  481. PIN_AFIO_AF(GPIOB_SWO, 0U) | \
  482. PIN_AFIO_AF(GPIOB_ARD_D5, 0U) | \
  483. PIN_AFIO_AF(GPIOB_ARD_D4, 0U) | \
  484. PIN_AFIO_AF(GPIOB_ARD_D10, 0U) | \
  485. PIN_AFIO_AF(GPIOB_PIN7, 0U))
  486. #define VAL_GPIOB_AFRH (PIN_AFIO_AF(GPIOB_ARD_D15, 0U) | \
  487. PIN_AFIO_AF(GPIOB_ARD_D14, 0U) | \
  488. PIN_AFIO_AF(GPIOB_ARD_D6, 0U) | \
  489. PIN_AFIO_AF(GPIOB_PIN11, 0U) | \
  490. PIN_AFIO_AF(GPIOB_PIN12, 0U) | \
  491. PIN_AFIO_AF(GPIOB_PIN13, 0U) | \
  492. PIN_AFIO_AF(GPIOB_PIN14, 0U) | \
  493. PIN_AFIO_AF(GPIOB_PIN15, 0U))
  494. /*
  495. * GPIOC setup:
  496. *
  497. * PC0 - ARD_A5 ADC12_IN6 (input pullup).
  498. * PC1 - ARD_A4 ADC12_IN7 (input pullup).
  499. * PC2 - PIN2 (input pullup).
  500. * PC3 - PIN3 (input pullup).
  501. * PC4 - PIN4 (input pullup).
  502. * PC5 - PIN5 (input pullup).
  503. * PC6 - PIN6 (input pullup).
  504. * PC7 - ARD_D9 (input pullup).
  505. * PC8 - PIN8 (input pullup).
  506. * PC9 - PIN9 (input pullup).
  507. * PC10 - PIN10 (input pullup).
  508. * PC11 - PIN11 (input pullup).
  509. * PC12 - PIN12 (input pullup).
  510. * PC13 - BUTTON (input floating).
  511. * PC14 - OSC32_IN (input floating).
  512. * PC15 - OSC32_OUT (input floating).
  513. */
  514. #define VAL_GPIOC_MODER (PIN_MODE_INPUT(GPIOC_ARD_A5) | \
  515. PIN_MODE_INPUT(GPIOC_ARD_A4) | \
  516. PIN_MODE_INPUT(GPIOC_PIN2) | \
  517. PIN_MODE_INPUT(GPIOC_PIN3) | \
  518. PIN_MODE_INPUT(GPIOC_PIN4) | \
  519. PIN_MODE_INPUT(GPIOC_PIN5) | \
  520. PIN_MODE_INPUT(GPIOC_PIN6) | \
  521. PIN_MODE_INPUT(GPIOC_ARD_D9) | \
  522. PIN_MODE_INPUT(GPIOC_PIN8) | \
  523. PIN_MODE_INPUT(GPIOC_PIN9) | \
  524. PIN_MODE_INPUT(GPIOC_PIN10) | \
  525. PIN_MODE_INPUT(GPIOC_PIN11) | \
  526. PIN_MODE_INPUT(GPIOC_PIN12) | \
  527. PIN_MODE_INPUT(GPIOC_BUTTON) | \
  528. PIN_MODE_INPUT(GPIOC_OSC32_IN) | \
  529. PIN_MODE_INPUT(GPIOC_OSC32_OUT))
  530. #define VAL_GPIOC_OTYPER (PIN_OTYPE_PUSHPULL(GPIOC_ARD_A5) | \
  531. PIN_OTYPE_PUSHPULL(GPIOC_ARD_A4) | \
  532. PIN_OTYPE_PUSHPULL(GPIOC_PIN2) | \
  533. PIN_OTYPE_PUSHPULL(GPIOC_PIN3) | \
  534. PIN_OTYPE_PUSHPULL(GPIOC_PIN4) | \
  535. PIN_OTYPE_PUSHPULL(GPIOC_PIN5) | \
  536. PIN_OTYPE_PUSHPULL(GPIOC_PIN6) | \
  537. PIN_OTYPE_PUSHPULL(GPIOC_ARD_D9) | \
  538. PIN_OTYPE_PUSHPULL(GPIOC_PIN8) | \
  539. PIN_OTYPE_PUSHPULL(GPIOC_PIN9) | \
  540. PIN_OTYPE_PUSHPULL(GPIOC_PIN10) | \
  541. PIN_OTYPE_PUSHPULL(GPIOC_PIN11) | \
  542. PIN_OTYPE_PUSHPULL(GPIOC_PIN12) | \
  543. PIN_OTYPE_PUSHPULL(GPIOC_BUTTON) | \
  544. PIN_OTYPE_PUSHPULL(GPIOC_OSC32_IN) | \
  545. PIN_OTYPE_PUSHPULL(GPIOC_OSC32_OUT))
  546. #define VAL_GPIOC_OSPEEDR (PIN_OSPEED_HIGH(GPIOC_ARD_A5) | \
  547. PIN_OSPEED_HIGH(GPIOC_ARD_A4) | \
  548. PIN_OSPEED_HIGH(GPIOC_PIN2) | \
  549. PIN_OSPEED_HIGH(GPIOC_PIN3) | \
  550. PIN_OSPEED_HIGH(GPIOC_PIN4) | \
  551. PIN_OSPEED_HIGH(GPIOC_PIN5) | \
  552. PIN_OSPEED_HIGH(GPIOC_PIN6) | \
  553. PIN_OSPEED_HIGH(GPIOC_ARD_D9) | \
  554. PIN_OSPEED_HIGH(GPIOC_PIN8) | \
  555. PIN_OSPEED_HIGH(GPIOC_PIN9) | \
  556. PIN_OSPEED_HIGH(GPIOC_PIN10) | \
  557. PIN_OSPEED_HIGH(GPIOC_PIN11) | \
  558. PIN_OSPEED_HIGH(GPIOC_PIN12) | \
  559. PIN_OSPEED_HIGH(GPIOC_BUTTON) | \
  560. PIN_OSPEED_HIGH(GPIOC_OSC32_IN) | \
  561. PIN_OSPEED_HIGH(GPIOC_OSC32_OUT))
  562. #define VAL_GPIOC_PUPDR (PIN_PUPDR_PULLUP(GPIOC_ARD_A5) | \
  563. PIN_PUPDR_PULLUP(GPIOC_ARD_A4) | \
  564. PIN_PUPDR_PULLUP(GPIOC_PIN2) | \
  565. PIN_PUPDR_PULLUP(GPIOC_PIN3) | \
  566. PIN_PUPDR_PULLUP(GPIOC_PIN4) | \
  567. PIN_PUPDR_PULLUP(GPIOC_PIN5) | \
  568. PIN_PUPDR_PULLUP(GPIOC_PIN6) | \
  569. PIN_PUPDR_PULLUP(GPIOC_ARD_D9) | \
  570. PIN_PUPDR_PULLUP(GPIOC_PIN8) | \
  571. PIN_PUPDR_PULLUP(GPIOC_PIN9) | \
  572. PIN_PUPDR_PULLUP(GPIOC_PIN10) | \
  573. PIN_PUPDR_PULLUP(GPIOC_PIN11) | \
  574. PIN_PUPDR_PULLUP(GPIOC_PIN12) | \
  575. PIN_PUPDR_FLOATING(GPIOC_BUTTON) | \
  576. PIN_PUPDR_FLOATING(GPIOC_OSC32_IN) | \
  577. PIN_PUPDR_FLOATING(GPIOC_OSC32_OUT))
  578. #define VAL_GPIOC_ODR (PIN_ODR_HIGH(GPIOC_ARD_A5) | \
  579. PIN_ODR_HIGH(GPIOC_ARD_A4) | \
  580. PIN_ODR_HIGH(GPIOC_PIN2) | \
  581. PIN_ODR_HIGH(GPIOC_PIN3) | \
  582. PIN_ODR_HIGH(GPIOC_PIN4) | \
  583. PIN_ODR_HIGH(GPIOC_PIN5) | \
  584. PIN_ODR_HIGH(GPIOC_PIN6) | \
  585. PIN_ODR_HIGH(GPIOC_ARD_D9) | \
  586. PIN_ODR_HIGH(GPIOC_PIN8) | \
  587. PIN_ODR_HIGH(GPIOC_PIN9) | \
  588. PIN_ODR_HIGH(GPIOC_PIN10) | \
  589. PIN_ODR_HIGH(GPIOC_PIN11) | \
  590. PIN_ODR_HIGH(GPIOC_PIN12) | \
  591. PIN_ODR_HIGH(GPIOC_BUTTON) | \
  592. PIN_ODR_HIGH(GPIOC_OSC32_IN) | \
  593. PIN_ODR_HIGH(GPIOC_OSC32_OUT))
  594. #define VAL_GPIOC_AFRL (PIN_AFIO_AF(GPIOC_ARD_A5, 0U) | \
  595. PIN_AFIO_AF(GPIOC_ARD_A4, 0U) | \
  596. PIN_AFIO_AF(GPIOC_PIN2, 0U) | \
  597. PIN_AFIO_AF(GPIOC_PIN3, 0U) | \
  598. PIN_AFIO_AF(GPIOC_PIN4, 0U) | \
  599. PIN_AFIO_AF(GPIOC_PIN5, 0U) | \
  600. PIN_AFIO_AF(GPIOC_PIN6, 0U) | \
  601. PIN_AFIO_AF(GPIOC_ARD_D9, 0U))
  602. #define VAL_GPIOC_AFRH (PIN_AFIO_AF(GPIOC_PIN8, 0U) | \
  603. PIN_AFIO_AF(GPIOC_PIN9, 0U) | \
  604. PIN_AFIO_AF(GPIOC_PIN10, 0U) | \
  605. PIN_AFIO_AF(GPIOC_PIN11, 0U) | \
  606. PIN_AFIO_AF(GPIOC_PIN12, 0U) | \
  607. PIN_AFIO_AF(GPIOC_BUTTON, 0U) | \
  608. PIN_AFIO_AF(GPIOC_OSC32_IN, 0U) | \
  609. PIN_AFIO_AF(GPIOC_OSC32_OUT, 0U))
  610. /*
  611. * GPIOD setup:
  612. *
  613. * PD0 - PIN0 (input pullup).
  614. * PD1 - PIN1 (input pullup).
  615. * PD2 - PIN2 (input pullup).
  616. * PD3 - PIN3 (input pullup).
  617. * PD4 - PIN4 (input pullup).
  618. * PD5 - PIN5 (input pullup).
  619. * PD6 - PIN6 (input pullup).
  620. * PD7 - PIN7 (input pullup).
  621. * PD8 - PIN8 (input pullup).
  622. * PD9 - PIN9 (input pullup).
  623. * PD10 - PIN10 (input pullup).
  624. * PD11 - PIN11 (input pullup).
  625. * PD12 - PIN12 (input pullup).
  626. * PD13 - PIN13 (input pullup).
  627. * PD14 - PIN14 (input pullup).
  628. * PD15 - PIN15 (input pullup).
  629. */
  630. #define VAL_GPIOD_MODER (PIN_MODE_INPUT(GPIOD_PIN0) | \
  631. PIN_MODE_INPUT(GPIOD_PIN1) | \
  632. PIN_MODE_INPUT(GPIOD_PIN2) | \
  633. PIN_MODE_INPUT(GPIOD_PIN3) | \
  634. PIN_MODE_INPUT(GPIOD_PIN4) | \
  635. PIN_MODE_INPUT(GPIOD_PIN5) | \
  636. PIN_MODE_INPUT(GPIOD_PIN6) | \
  637. PIN_MODE_INPUT(GPIOD_PIN7) | \
  638. PIN_MODE_INPUT(GPIOD_PIN8) | \
  639. PIN_MODE_INPUT(GPIOD_PIN9) | \
  640. PIN_MODE_INPUT(GPIOD_PIN10) | \
  641. PIN_MODE_INPUT(GPIOD_PIN11) | \
  642. PIN_MODE_INPUT(GPIOD_PIN12) | \
  643. PIN_MODE_INPUT(GPIOD_PIN13) | \
  644. PIN_MODE_INPUT(GPIOD_PIN14) | \
  645. PIN_MODE_INPUT(GPIOD_PIN15))
  646. #define VAL_GPIOD_OTYPER (PIN_OTYPE_PUSHPULL(GPIOD_PIN0) | \
  647. PIN_OTYPE_PUSHPULL(GPIOD_PIN1) | \
  648. PIN_OTYPE_PUSHPULL(GPIOD_PIN2) | \
  649. PIN_OTYPE_PUSHPULL(GPIOD_PIN3) | \
  650. PIN_OTYPE_PUSHPULL(GPIOD_PIN4) | \
  651. PIN_OTYPE_PUSHPULL(GPIOD_PIN5) | \
  652. PIN_OTYPE_PUSHPULL(GPIOD_PIN6) | \
  653. PIN_OTYPE_PUSHPULL(GPIOD_PIN7) | \
  654. PIN_OTYPE_PUSHPULL(GPIOD_PIN8) | \
  655. PIN_OTYPE_PUSHPULL(GPIOD_PIN9) | \
  656. PIN_OTYPE_PUSHPULL(GPIOD_PIN10) | \
  657. PIN_OTYPE_PUSHPULL(GPIOD_PIN11) | \
  658. PIN_OTYPE_PUSHPULL(GPIOD_PIN12) | \
  659. PIN_OTYPE_PUSHPULL(GPIOD_PIN13) | \
  660. PIN_OTYPE_PUSHPULL(GPIOD_PIN14) | \
  661. PIN_OTYPE_PUSHPULL(GPIOD_PIN15))
  662. #define VAL_GPIOD_OSPEEDR (PIN_OSPEED_HIGH(GPIOD_PIN0) | \
  663. PIN_OSPEED_HIGH(GPIOD_PIN1) | \
  664. PIN_OSPEED_HIGH(GPIOD_PIN2) | \
  665. PIN_OSPEED_HIGH(GPIOD_PIN3) | \
  666. PIN_OSPEED_HIGH(GPIOD_PIN4) | \
  667. PIN_OSPEED_HIGH(GPIOD_PIN5) | \
  668. PIN_OSPEED_HIGH(GPIOD_PIN6) | \
  669. PIN_OSPEED_HIGH(GPIOD_PIN7) | \
  670. PIN_OSPEED_HIGH(GPIOD_PIN8) | \
  671. PIN_OSPEED_HIGH(GPIOD_PIN9) | \
  672. PIN_OSPEED_HIGH(GPIOD_PIN10) | \
  673. PIN_OSPEED_HIGH(GPIOD_PIN11) | \
  674. PIN_OSPEED_HIGH(GPIOD_PIN12) | \
  675. PIN_OSPEED_HIGH(GPIOD_PIN13) | \
  676. PIN_OSPEED_HIGH(GPIOD_PIN14) | \
  677. PIN_OSPEED_HIGH(GPIOD_PIN15))
  678. #define VAL_GPIOD_PUPDR (PIN_PUPDR_PULLUP(GPIOD_PIN0) | \
  679. PIN_PUPDR_PULLUP(GPIOD_PIN1) | \
  680. PIN_PUPDR_PULLUP(GPIOD_PIN2) | \
  681. PIN_PUPDR_PULLUP(GPIOD_PIN3) | \
  682. PIN_PUPDR_PULLUP(GPIOD_PIN4) | \
  683. PIN_PUPDR_PULLUP(GPIOD_PIN5) | \
  684. PIN_PUPDR_PULLUP(GPIOD_PIN6) | \
  685. PIN_PUPDR_PULLUP(GPIOD_PIN7) | \
  686. PIN_PUPDR_PULLUP(GPIOD_PIN8) | \
  687. PIN_PUPDR_PULLUP(GPIOD_PIN9) | \
  688. PIN_PUPDR_PULLUP(GPIOD_PIN10) | \
  689. PIN_PUPDR_PULLUP(GPIOD_PIN11) | \
  690. PIN_PUPDR_PULLUP(GPIOD_PIN12) | \
  691. PIN_PUPDR_PULLUP(GPIOD_PIN13) | \
  692. PIN_PUPDR_PULLUP(GPIOD_PIN14) | \
  693. PIN_PUPDR_PULLUP(GPIOD_PIN15))
  694. #define VAL_GPIOD_ODR (PIN_ODR_HIGH(GPIOD_PIN0) | \
  695. PIN_ODR_HIGH(GPIOD_PIN1) | \
  696. PIN_ODR_HIGH(GPIOD_PIN2) | \
  697. PIN_ODR_HIGH(GPIOD_PIN3) | \
  698. PIN_ODR_HIGH(GPIOD_PIN4) | \
  699. PIN_ODR_HIGH(GPIOD_PIN5) | \
  700. PIN_ODR_HIGH(GPIOD_PIN6) | \
  701. PIN_ODR_HIGH(GPIOD_PIN7) | \
  702. PIN_ODR_HIGH(GPIOD_PIN8) | \
  703. PIN_ODR_HIGH(GPIOD_PIN9) | \
  704. PIN_ODR_HIGH(GPIOD_PIN10) | \
  705. PIN_ODR_HIGH(GPIOD_PIN11) | \
  706. PIN_ODR_HIGH(GPIOD_PIN12) | \
  707. PIN_ODR_HIGH(GPIOD_PIN13) | \
  708. PIN_ODR_HIGH(GPIOD_PIN14) | \
  709. PIN_ODR_HIGH(GPIOD_PIN15))
  710. #define VAL_GPIOD_AFRL (PIN_AFIO_AF(GPIOD_PIN0, 0U) | \
  711. PIN_AFIO_AF(GPIOD_PIN1, 0U) | \
  712. PIN_AFIO_AF(GPIOD_PIN2, 0U) | \
  713. PIN_AFIO_AF(GPIOD_PIN3, 0U) | \
  714. PIN_AFIO_AF(GPIOD_PIN4, 0U) | \
  715. PIN_AFIO_AF(GPIOD_PIN5, 0U) | \
  716. PIN_AFIO_AF(GPIOD_PIN6, 0U) | \
  717. PIN_AFIO_AF(GPIOD_PIN7, 0U))
  718. #define VAL_GPIOD_AFRH (PIN_AFIO_AF(GPIOD_PIN8, 0U) | \
  719. PIN_AFIO_AF(GPIOD_PIN9, 0U) | \
  720. PIN_AFIO_AF(GPIOD_PIN10, 0U) | \
  721. PIN_AFIO_AF(GPIOD_PIN11, 0U) | \
  722. PIN_AFIO_AF(GPIOD_PIN12, 0U) | \
  723. PIN_AFIO_AF(GPIOD_PIN13, 0U) | \
  724. PIN_AFIO_AF(GPIOD_PIN14, 0U) | \
  725. PIN_AFIO_AF(GPIOD_PIN15, 0U))
  726. /*
  727. * GPIOE setup:
  728. *
  729. * PE0 - PIN0 (input pullup).
  730. * PE1 - PIN1 (input pullup).
  731. * PE2 - PIN2 (input pullup).
  732. * PE3 - PIN3 (input pullup).
  733. * PE4 - PIN4 (input pullup).
  734. * PE5 - PIN5 (input pullup).
  735. * PE6 - PIN6 (input pullup).
  736. * PE7 - PIN7 (input pullup).
  737. * PE8 - PIN8 (input pullup).
  738. * PE9 - PIN9 (input pullup).
  739. * PE10 - PIN10 (input pullup).
  740. * PE11 - PIN11 (input pullup).
  741. * PE12 - PIN12 (input pullup).
  742. * PE13 - PIN13 (input pullup).
  743. * PE14 - PIN14 (input pullup).
  744. * PE15 - PIN15 (input pullup).
  745. */
  746. #define VAL_GPIOE_MODER (PIN_MODE_INPUT(GPIOE_PIN0) | \
  747. PIN_MODE_INPUT(GPIOE_PIN1) | \
  748. PIN_MODE_INPUT(GPIOE_PIN2) | \
  749. PIN_MODE_INPUT(GPIOE_PIN3) | \
  750. PIN_MODE_INPUT(GPIOE_PIN4) | \
  751. PIN_MODE_INPUT(GPIOE_PIN5) | \
  752. PIN_MODE_INPUT(GPIOE_PIN6) | \
  753. PIN_MODE_INPUT(GPIOE_PIN7) | \
  754. PIN_MODE_INPUT(GPIOE_PIN8) | \
  755. PIN_MODE_INPUT(GPIOE_PIN9) | \
  756. PIN_MODE_INPUT(GPIOE_PIN10) | \
  757. PIN_MODE_INPUT(GPIOE_PIN11) | \
  758. PIN_MODE_INPUT(GPIOE_PIN12) | \
  759. PIN_MODE_INPUT(GPIOE_PIN13) | \
  760. PIN_MODE_INPUT(GPIOE_PIN14) | \
  761. PIN_MODE_INPUT(GPIOE_PIN15))
  762. #define VAL_GPIOE_OTYPER (PIN_OTYPE_PUSHPULL(GPIOE_PIN0) | \
  763. PIN_OTYPE_PUSHPULL(GPIOE_PIN1) | \
  764. PIN_OTYPE_PUSHPULL(GPIOE_PIN2) | \
  765. PIN_OTYPE_PUSHPULL(GPIOE_PIN3) | \
  766. PIN_OTYPE_PUSHPULL(GPIOE_PIN4) | \
  767. PIN_OTYPE_PUSHPULL(GPIOE_PIN5) | \
  768. PIN_OTYPE_PUSHPULL(GPIOE_PIN6) | \
  769. PIN_OTYPE_PUSHPULL(GPIOE_PIN7) | \
  770. PIN_OTYPE_PUSHPULL(GPIOE_PIN8) | \
  771. PIN_OTYPE_PUSHPULL(GPIOE_PIN9) | \
  772. PIN_OTYPE_PUSHPULL(GPIOE_PIN10) | \
  773. PIN_OTYPE_PUSHPULL(GPIOE_PIN11) | \
  774. PIN_OTYPE_PUSHPULL(GPIOE_PIN12) | \
  775. PIN_OTYPE_PUSHPULL(GPIOE_PIN13) | \
  776. PIN_OTYPE_PUSHPULL(GPIOE_PIN14) | \
  777. PIN_OTYPE_PUSHPULL(GPIOE_PIN15))
  778. #define VAL_GPIOE_OSPEEDR (PIN_OSPEED_HIGH(GPIOE_PIN0) | \
  779. PIN_OSPEED_HIGH(GPIOE_PIN1) | \
  780. PIN_OSPEED_HIGH(GPIOE_PIN2) | \
  781. PIN_OSPEED_HIGH(GPIOE_PIN3) | \
  782. PIN_OSPEED_HIGH(GPIOE_PIN4) | \
  783. PIN_OSPEED_HIGH(GPIOE_PIN5) | \
  784. PIN_OSPEED_HIGH(GPIOE_PIN6) | \
  785. PIN_OSPEED_HIGH(GPIOE_PIN7) | \
  786. PIN_OSPEED_HIGH(GPIOE_PIN8) | \
  787. PIN_OSPEED_HIGH(GPIOE_PIN9) | \
  788. PIN_OSPEED_HIGH(GPIOE_PIN10) | \
  789. PIN_OSPEED_HIGH(GPIOE_PIN11) | \
  790. PIN_OSPEED_HIGH(GPIOE_PIN12) | \
  791. PIN_OSPEED_HIGH(GPIOE_PIN13) | \
  792. PIN_OSPEED_HIGH(GPIOE_PIN14) | \
  793. PIN_OSPEED_HIGH(GPIOE_PIN15))
  794. #define VAL_GPIOE_PUPDR (PIN_PUPDR_PULLUP(GPIOE_PIN0) | \
  795. PIN_PUPDR_PULLUP(GPIOE_PIN1) | \
  796. PIN_PUPDR_PULLUP(GPIOE_PIN2) | \
  797. PIN_PUPDR_PULLUP(GPIOE_PIN3) | \
  798. PIN_PUPDR_PULLUP(GPIOE_PIN4) | \
  799. PIN_PUPDR_PULLUP(GPIOE_PIN5) | \
  800. PIN_PUPDR_PULLUP(GPIOE_PIN6) | \
  801. PIN_PUPDR_PULLUP(GPIOE_PIN7) | \
  802. PIN_PUPDR_PULLUP(GPIOE_PIN8) | \
  803. PIN_PUPDR_PULLUP(GPIOE_PIN9) | \
  804. PIN_PUPDR_PULLUP(GPIOE_PIN10) | \
  805. PIN_PUPDR_PULLUP(GPIOE_PIN11) | \
  806. PIN_PUPDR_PULLUP(GPIOE_PIN12) | \
  807. PIN_PUPDR_PULLUP(GPIOE_PIN13) | \
  808. PIN_PUPDR_PULLUP(GPIOE_PIN14) | \
  809. PIN_PUPDR_PULLUP(GPIOE_PIN15))
  810. #define VAL_GPIOE_ODR (PIN_ODR_HIGH(GPIOE_PIN0) | \
  811. PIN_ODR_HIGH(GPIOE_PIN1) | \
  812. PIN_ODR_HIGH(GPIOE_PIN2) | \
  813. PIN_ODR_HIGH(GPIOE_PIN3) | \
  814. PIN_ODR_HIGH(GPIOE_PIN4) | \
  815. PIN_ODR_HIGH(GPIOE_PIN5) | \
  816. PIN_ODR_HIGH(GPIOE_PIN6) | \
  817. PIN_ODR_HIGH(GPIOE_PIN7) | \
  818. PIN_ODR_HIGH(GPIOE_PIN8) | \
  819. PIN_ODR_HIGH(GPIOE_PIN9) | \
  820. PIN_ODR_HIGH(GPIOE_PIN10) | \
  821. PIN_ODR_HIGH(GPIOE_PIN11) | \
  822. PIN_ODR_HIGH(GPIOE_PIN12) | \
  823. PIN_ODR_HIGH(GPIOE_PIN13) | \
  824. PIN_ODR_HIGH(GPIOE_PIN14) | \
  825. PIN_ODR_HIGH(GPIOE_PIN15))
  826. #define VAL_GPIOE_AFRL (PIN_AFIO_AF(GPIOE_PIN0, 0U) | \
  827. PIN_AFIO_AF(GPIOE_PIN1, 0U) | \
  828. PIN_AFIO_AF(GPIOE_PIN2, 0U) | \
  829. PIN_AFIO_AF(GPIOE_PIN3, 0U) | \
  830. PIN_AFIO_AF(GPIOE_PIN4, 0U) | \
  831. PIN_AFIO_AF(GPIOE_PIN5, 0U) | \
  832. PIN_AFIO_AF(GPIOE_PIN6, 0U) | \
  833. PIN_AFIO_AF(GPIOE_PIN7, 0U))
  834. #define VAL_GPIOE_AFRH (PIN_AFIO_AF(GPIOE_PIN8, 0U) | \
  835. PIN_AFIO_AF(GPIOE_PIN9, 0U) | \
  836. PIN_AFIO_AF(GPIOE_PIN10, 0U) | \
  837. PIN_AFIO_AF(GPIOE_PIN11, 0U) | \
  838. PIN_AFIO_AF(GPIOE_PIN12, 0U) | \
  839. PIN_AFIO_AF(GPIOE_PIN13, 0U) | \
  840. PIN_AFIO_AF(GPIOE_PIN14, 0U) | \
  841. PIN_AFIO_AF(GPIOE_PIN15, 0U))
  842. /*
  843. * GPIOF setup:
  844. *
  845. * PF0 - OSC_IN (input floating).
  846. * PF1 - OSC_OUT (input floating).
  847. * PF2 - PIN2 (input pullup).
  848. * PF3 - PIN3 (input pullup).
  849. * PF4 - PIN4 (input pullup).
  850. * PF5 - PIN5 (input pullup).
  851. * PF6 - PIN6 (input pullup).
  852. * PF7 - PIN7 (input pullup).
  853. * PF8 - PIN8 (input pullup).
  854. * PF9 - PIN9 (input pullup).
  855. * PF10 - PIN10 (input pullup).
  856. * PF11 - PIN11 (input pullup).
  857. * PF12 - PIN12 (input pullup).
  858. * PF13 - PIN13 (input pullup).
  859. * PF14 - PIN14 (input pullup).
  860. * PF15 - PIN15 (input pullup).
  861. */
  862. #define VAL_GPIOF_MODER (PIN_MODE_INPUT(GPIOF_OSC_IN) | \
  863. PIN_MODE_INPUT(GPIOF_OSC_OUT) | \
  864. PIN_MODE_INPUT(GPIOF_PIN2) | \
  865. PIN_MODE_INPUT(GPIOF_PIN3) | \
  866. PIN_MODE_INPUT(GPIOF_PIN4) | \
  867. PIN_MODE_INPUT(GPIOF_PIN5) | \
  868. PIN_MODE_INPUT(GPIOF_PIN6) | \
  869. PIN_MODE_INPUT(GPIOF_PIN7) | \
  870. PIN_MODE_INPUT(GPIOF_PIN8) | \
  871. PIN_MODE_INPUT(GPIOF_PIN9) | \
  872. PIN_MODE_INPUT(GPIOF_PIN10) | \
  873. PIN_MODE_INPUT(GPIOF_PIN11) | \
  874. PIN_MODE_INPUT(GPIOF_PIN12) | \
  875. PIN_MODE_INPUT(GPIOF_PIN13) | \
  876. PIN_MODE_INPUT(GPIOF_PIN14) | \
  877. PIN_MODE_INPUT(GPIOF_PIN15))
  878. #define VAL_GPIOF_OTYPER (PIN_OTYPE_PUSHPULL(GPIOF_OSC_IN) | \
  879. PIN_OTYPE_PUSHPULL(GPIOF_OSC_OUT) | \
  880. PIN_OTYPE_PUSHPULL(GPIOF_PIN2) | \
  881. PIN_OTYPE_PUSHPULL(GPIOF_PIN3) | \
  882. PIN_OTYPE_PUSHPULL(GPIOF_PIN4) | \
  883. PIN_OTYPE_PUSHPULL(GPIOF_PIN5) | \
  884. PIN_OTYPE_PUSHPULL(GPIOF_PIN6) | \
  885. PIN_OTYPE_PUSHPULL(GPIOF_PIN7) | \
  886. PIN_OTYPE_PUSHPULL(GPIOF_PIN8) | \
  887. PIN_OTYPE_PUSHPULL(GPIOF_PIN9) | \
  888. PIN_OTYPE_PUSHPULL(GPIOF_PIN10) | \
  889. PIN_OTYPE_PUSHPULL(GPIOF_PIN11) | \
  890. PIN_OTYPE_PUSHPULL(GPIOF_PIN12) | \
  891. PIN_OTYPE_PUSHPULL(GPIOF_PIN13) | \
  892. PIN_OTYPE_PUSHPULL(GPIOF_PIN14) | \
  893. PIN_OTYPE_PUSHPULL(GPIOF_PIN15))
  894. #define VAL_GPIOF_OSPEEDR (PIN_OSPEED_HIGH(GPIOF_OSC_IN) | \
  895. PIN_OSPEED_HIGH(GPIOF_OSC_OUT) | \
  896. PIN_OSPEED_HIGH(GPIOF_PIN2) | \
  897. PIN_OSPEED_HIGH(GPIOF_PIN3) | \
  898. PIN_OSPEED_HIGH(GPIOF_PIN4) | \
  899. PIN_OSPEED_HIGH(GPIOF_PIN5) | \
  900. PIN_OSPEED_HIGH(GPIOF_PIN6) | \
  901. PIN_OSPEED_HIGH(GPIOF_PIN7) | \
  902. PIN_OSPEED_HIGH(GPIOF_PIN8) | \
  903. PIN_OSPEED_HIGH(GPIOF_PIN9) | \
  904. PIN_OSPEED_HIGH(GPIOF_PIN10) | \
  905. PIN_OSPEED_HIGH(GPIOF_PIN11) | \
  906. PIN_OSPEED_HIGH(GPIOF_PIN12) | \
  907. PIN_OSPEED_HIGH(GPIOF_PIN13) | \
  908. PIN_OSPEED_HIGH(GPIOF_PIN14) | \
  909. PIN_OSPEED_HIGH(GPIOF_PIN15))
  910. #define VAL_GPIOF_PUPDR (PIN_PUPDR_FLOATING(GPIOF_OSC_IN) | \
  911. PIN_PUPDR_FLOATING(GPIOF_OSC_OUT) | \
  912. PIN_PUPDR_PULLUP(GPIOF_PIN2) | \
  913. PIN_PUPDR_PULLUP(GPIOF_PIN3) | \
  914. PIN_PUPDR_PULLUP(GPIOF_PIN4) | \
  915. PIN_PUPDR_PULLUP(GPIOF_PIN5) | \
  916. PIN_PUPDR_PULLUP(GPIOF_PIN6) | \
  917. PIN_PUPDR_PULLUP(GPIOF_PIN7) | \
  918. PIN_PUPDR_PULLUP(GPIOF_PIN8) | \
  919. PIN_PUPDR_PULLUP(GPIOF_PIN9) | \
  920. PIN_PUPDR_PULLUP(GPIOF_PIN10) | \
  921. PIN_PUPDR_PULLUP(GPIOF_PIN11) | \
  922. PIN_PUPDR_PULLUP(GPIOF_PIN12) | \
  923. PIN_PUPDR_PULLUP(GPIOF_PIN13) | \
  924. PIN_PUPDR_PULLUP(GPIOF_PIN14) | \
  925. PIN_PUPDR_PULLUP(GPIOF_PIN15))
  926. #define VAL_GPIOF_ODR (PIN_ODR_HIGH(GPIOF_OSC_IN) | \
  927. PIN_ODR_HIGH(GPIOF_OSC_OUT) | \
  928. PIN_ODR_HIGH(GPIOF_PIN2) | \
  929. PIN_ODR_HIGH(GPIOF_PIN3) | \
  930. PIN_ODR_HIGH(GPIOF_PIN4) | \
  931. PIN_ODR_HIGH(GPIOF_PIN5) | \
  932. PIN_ODR_HIGH(GPIOF_PIN6) | \
  933. PIN_ODR_HIGH(GPIOF_PIN7) | \
  934. PIN_ODR_HIGH(GPIOF_PIN8) | \
  935. PIN_ODR_HIGH(GPIOF_PIN9) | \
  936. PIN_ODR_HIGH(GPIOF_PIN10) | \
  937. PIN_ODR_HIGH(GPIOF_PIN11) | \
  938. PIN_ODR_HIGH(GPIOF_PIN12) | \
  939. PIN_ODR_HIGH(GPIOF_PIN13) | \
  940. PIN_ODR_HIGH(GPIOF_PIN14) | \
  941. PIN_ODR_HIGH(GPIOF_PIN15))
  942. #define VAL_GPIOF_AFRL (PIN_AFIO_AF(GPIOF_OSC_IN, 0U) | \
  943. PIN_AFIO_AF(GPIOF_OSC_OUT, 0U) | \
  944. PIN_AFIO_AF(GPIOF_PIN2, 0U) | \
  945. PIN_AFIO_AF(GPIOF_PIN3, 0U) | \
  946. PIN_AFIO_AF(GPIOF_PIN4, 0U) | \
  947. PIN_AFIO_AF(GPIOF_PIN5, 0U) | \
  948. PIN_AFIO_AF(GPIOF_PIN6, 0U) | \
  949. PIN_AFIO_AF(GPIOF_PIN7, 0U))
  950. #define VAL_GPIOF_AFRH (PIN_AFIO_AF(GPIOF_PIN8, 0U) | \
  951. PIN_AFIO_AF(GPIOF_PIN9, 0U) | \
  952. PIN_AFIO_AF(GPIOF_PIN10, 0U) | \
  953. PIN_AFIO_AF(GPIOF_PIN11, 0U) | \
  954. PIN_AFIO_AF(GPIOF_PIN12, 0U) | \
  955. PIN_AFIO_AF(GPIOF_PIN13, 0U) | \
  956. PIN_AFIO_AF(GPIOF_PIN14, 0U) | \
  957. PIN_AFIO_AF(GPIOF_PIN15, 0U))
  958. /*
  959. * GPIOG setup:
  960. *
  961. * PG0 - PIN0 (input pullup).
  962. * PG1 - PIN1 (input pullup).
  963. * PG2 - PIN2 (input pullup).
  964. * PG3 - PIN3 (input pullup).
  965. * PG4 - PIN4 (input pullup).
  966. * PG5 - PIN5 (input pullup).
  967. * PG6 - PIN6 (input pullup).
  968. * PG7 - PIN7 (input pullup).
  969. * PG8 - PIN8 (input pullup).
  970. * PG9 - PIN9 (input pullup).
  971. * PG10 - PIN10 (input pullup).
  972. * PG11 - PIN11 (input pullup).
  973. * PG12 - PIN12 (input pullup).
  974. * PG13 - PIN13 (input pullup).
  975. * PG14 - PIN14 (input pullup).
  976. * PG15 - PIN15 (input pullup).
  977. */
  978. #define VAL_GPIOG_MODER (PIN_MODE_INPUT(GPIOG_PIN0) | \
  979. PIN_MODE_INPUT(GPIOG_PIN1) | \
  980. PIN_MODE_INPUT(GPIOG_PIN2) | \
  981. PIN_MODE_INPUT(GPIOG_PIN3) | \
  982. PIN_MODE_INPUT(GPIOG_PIN4) | \
  983. PIN_MODE_INPUT(GPIOG_PIN5) | \
  984. PIN_MODE_INPUT(GPIOG_PIN6) | \
  985. PIN_MODE_INPUT(GPIOG_PIN7) | \
  986. PIN_MODE_INPUT(GPIOG_PIN8) | \
  987. PIN_MODE_INPUT(GPIOG_PIN9) | \
  988. PIN_MODE_INPUT(GPIOG_PIN10) | \
  989. PIN_MODE_INPUT(GPIOG_PIN11) | \
  990. PIN_MODE_INPUT(GPIOG_PIN12) | \
  991. PIN_MODE_INPUT(GPIOG_PIN13) | \
  992. PIN_MODE_INPUT(GPIOG_PIN14) | \
  993. PIN_MODE_INPUT(GPIOG_PIN15))
  994. #define VAL_GPIOG_OTYPER (PIN_OTYPE_PUSHPULL(GPIOG_PIN0) | \
  995. PIN_OTYPE_PUSHPULL(GPIOG_PIN1) | \
  996. PIN_OTYPE_PUSHPULL(GPIOG_PIN2) | \
  997. PIN_OTYPE_PUSHPULL(GPIOG_PIN3) | \
  998. PIN_OTYPE_PUSHPULL(GPIOG_PIN4) | \
  999. PIN_OTYPE_PUSHPULL(GPIOG_PIN5) | \
  1000. PIN_OTYPE_PUSHPULL(GPIOG_PIN6) | \
  1001. PIN_OTYPE_PUSHPULL(GPIOG_PIN7) | \
  1002. PIN_OTYPE_PUSHPULL(GPIOG_PIN8) | \
  1003. PIN_OTYPE_PUSHPULL(GPIOG_PIN9) | \
  1004. PIN_OTYPE_PUSHPULL(GPIOG_PIN10) | \
  1005. PIN_OTYPE_PUSHPULL(GPIOG_PIN11) | \
  1006. PIN_OTYPE_PUSHPULL(GPIOG_PIN12) | \
  1007. PIN_OTYPE_PUSHPULL(GPIOG_PIN13) | \
  1008. PIN_OTYPE_PUSHPULL(GPIOG_PIN14) | \
  1009. PIN_OTYPE_PUSHPULL(GPIOG_PIN15))
  1010. #define VAL_GPIOG_OSPEEDR (PIN_OSPEED_VERYLOW(GPIOG_PIN0) | \
  1011. PIN_OSPEED_VERYLOW(GPIOG_PIN1) | \
  1012. PIN_OSPEED_VERYLOW(GPIOG_PIN2) | \
  1013. PIN_OSPEED_VERYLOW(GPIOG_PIN3) | \
  1014. PIN_OSPEED_VERYLOW(GPIOG_PIN4) | \
  1015. PIN_OSPEED_VERYLOW(GPIOG_PIN5) | \
  1016. PIN_OSPEED_VERYLOW(GPIOG_PIN6) | \
  1017. PIN_OSPEED_VERYLOW(GPIOG_PIN7) | \
  1018. PIN_OSPEED_VERYLOW(GPIOG_PIN8) | \
  1019. PIN_OSPEED_VERYLOW(GPIOG_PIN9) | \
  1020. PIN_OSPEED_VERYLOW(GPIOG_PIN10) | \
  1021. PIN_OSPEED_VERYLOW(GPIOG_PIN11) | \
  1022. PIN_OSPEED_VERYLOW(GPIOG_PIN12) | \
  1023. PIN_OSPEED_VERYLOW(GPIOG_PIN13) | \
  1024. PIN_OSPEED_VERYLOW(GPIOG_PIN14) | \
  1025. PIN_OSPEED_VERYLOW(GPIOG_PIN15))
  1026. #define VAL_GPIOG_PUPDR (PIN_PUPDR_PULLUP(GPIOG_PIN0) | \
  1027. PIN_PUPDR_PULLUP(GPIOG_PIN1) | \
  1028. PIN_PUPDR_PULLUP(GPIOG_PIN2) | \
  1029. PIN_PUPDR_PULLUP(GPIOG_PIN3) | \
  1030. PIN_PUPDR_PULLUP(GPIOG_PIN4) | \
  1031. PIN_PUPDR_PULLUP(GPIOG_PIN5) | \
  1032. PIN_PUPDR_PULLUP(GPIOG_PIN6) | \
  1033. PIN_PUPDR_PULLUP(GPIOG_PIN7) | \
  1034. PIN_PUPDR_PULLUP(GPIOG_PIN8) | \
  1035. PIN_PUPDR_PULLUP(GPIOG_PIN9) | \
  1036. PIN_PUPDR_PULLUP(GPIOG_PIN10) | \
  1037. PIN_PUPDR_PULLUP(GPIOG_PIN11) | \
  1038. PIN_PUPDR_PULLUP(GPIOG_PIN12) | \
  1039. PIN_PUPDR_PULLUP(GPIOG_PIN13) | \
  1040. PIN_PUPDR_PULLUP(GPIOG_PIN14) | \
  1041. PIN_PUPDR_PULLUP(GPIOG_PIN15))
  1042. #define VAL_GPIOG_ODR (PIN_ODR_HIGH(GPIOG_PIN0) | \
  1043. PIN_ODR_HIGH(GPIOG_PIN1) | \
  1044. PIN_ODR_HIGH(GPIOG_PIN2) | \
  1045. PIN_ODR_HIGH(GPIOG_PIN3) | \
  1046. PIN_ODR_HIGH(GPIOG_PIN4) | \
  1047. PIN_ODR_HIGH(GPIOG_PIN5) | \
  1048. PIN_ODR_HIGH(GPIOG_PIN6) | \
  1049. PIN_ODR_HIGH(GPIOG_PIN7) | \
  1050. PIN_ODR_HIGH(GPIOG_PIN8) | \
  1051. PIN_ODR_HIGH(GPIOG_PIN9) | \
  1052. PIN_ODR_HIGH(GPIOG_PIN10) | \
  1053. PIN_ODR_HIGH(GPIOG_PIN11) | \
  1054. PIN_ODR_HIGH(GPIOG_PIN12) | \
  1055. PIN_ODR_HIGH(GPIOG_PIN13) | \
  1056. PIN_ODR_HIGH(GPIOG_PIN14) | \
  1057. PIN_ODR_HIGH(GPIOG_PIN15))
  1058. #define VAL_GPIOG_AFRL (PIN_AFIO_AF(GPIOG_PIN0, 0U) | \
  1059. PIN_AFIO_AF(GPIOG_PIN1, 0U) | \
  1060. PIN_AFIO_AF(GPIOG_PIN2, 0U) | \
  1061. PIN_AFIO_AF(GPIOG_PIN3, 0U) | \
  1062. PIN_AFIO_AF(GPIOG_PIN4, 0U) | \
  1063. PIN_AFIO_AF(GPIOG_PIN5, 0U) | \
  1064. PIN_AFIO_AF(GPIOG_PIN6, 0U) | \
  1065. PIN_AFIO_AF(GPIOG_PIN7, 0U))
  1066. #define VAL_GPIOG_AFRH (PIN_AFIO_AF(GPIOG_PIN8, 0U) | \
  1067. PIN_AFIO_AF(GPIOG_PIN9, 0U) | \
  1068. PIN_AFIO_AF(GPIOG_PIN10, 0U) | \
  1069. PIN_AFIO_AF(GPIOG_PIN11, 0U) | \
  1070. PIN_AFIO_AF(GPIOG_PIN12, 0U) | \
  1071. PIN_AFIO_AF(GPIOG_PIN13, 0U) | \
  1072. PIN_AFIO_AF(GPIOG_PIN14, 0U) | \
  1073. PIN_AFIO_AF(GPIOG_PIN15, 0U))
  1074. /*
  1075. * GPIOH setup:
  1076. *
  1077. * PH0 - PIN0 (input pullup).
  1078. * PH1 - PIN1 (input pullup).
  1079. * PH2 - PIN2 (input pullup).
  1080. * PH3 - PIN3 (input pullup).
  1081. * PH4 - PIN4 (input pullup).
  1082. * PH5 - PIN5 (input pullup).
  1083. * PH6 - PIN6 (input pullup).
  1084. * PH7 - PIN7 (input pullup).
  1085. * PH8 - PIN8 (input pullup).
  1086. * PH9 - PIN9 (input pullup).
  1087. * PH10 - PIN10 (input pullup).
  1088. * PH11 - PIN11 (input pullup).
  1089. * PH12 - PIN12 (input pullup).
  1090. * PH13 - PIN13 (input pullup).
  1091. * PH14 - PIN14 (input pullup).
  1092. * PH15 - PIN15 (input pullup).
  1093. */
  1094. #define VAL_GPIOH_MODER (PIN_MODE_INPUT(GPIOH_PIN0) | \
  1095. PIN_MODE_INPUT(GPIOH_PIN1) | \
  1096. PIN_MODE_INPUT(GPIOH_PIN2) | \
  1097. PIN_MODE_INPUT(GPIOH_PIN3) | \
  1098. PIN_MODE_INPUT(GPIOH_PIN4) | \
  1099. PIN_MODE_INPUT(GPIOH_PIN5) | \
  1100. PIN_MODE_INPUT(GPIOH_PIN6) | \
  1101. PIN_MODE_INPUT(GPIOH_PIN7) | \
  1102. PIN_MODE_INPUT(GPIOH_PIN8) | \
  1103. PIN_MODE_INPUT(GPIOH_PIN9) | \
  1104. PIN_MODE_INPUT(GPIOH_PIN10) | \
  1105. PIN_MODE_INPUT(GPIOH_PIN11) | \
  1106. PIN_MODE_INPUT(GPIOH_PIN12) | \
  1107. PIN_MODE_INPUT(GPIOH_PIN13) | \
  1108. PIN_MODE_INPUT(GPIOH_PIN14) | \
  1109. PIN_MODE_INPUT(GPIOH_PIN15))
  1110. #define VAL_GPIOH_OTYPER (PIN_OTYPE_PUSHPULL(GPIOH_PIN0) | \
  1111. PIN_OTYPE_PUSHPULL(GPIOH_PIN1) | \
  1112. PIN_OTYPE_PUSHPULL(GPIOH_PIN2) | \
  1113. PIN_OTYPE_PUSHPULL(GPIOH_PIN3) | \
  1114. PIN_OTYPE_PUSHPULL(GPIOH_PIN4) | \
  1115. PIN_OTYPE_PUSHPULL(GPIOH_PIN5) | \
  1116. PIN_OTYPE_PUSHPULL(GPIOH_PIN6) | \
  1117. PIN_OTYPE_PUSHPULL(GPIOH_PIN7) | \
  1118. PIN_OTYPE_PUSHPULL(GPIOH_PIN8) | \
  1119. PIN_OTYPE_PUSHPULL(GPIOH_PIN9) | \
  1120. PIN_OTYPE_PUSHPULL(GPIOH_PIN10) | \
  1121. PIN_OTYPE_PUSHPULL(GPIOH_PIN11) | \
  1122. PIN_OTYPE_PUSHPULL(GPIOH_PIN12) | \
  1123. PIN_OTYPE_PUSHPULL(GPIOH_PIN13) | \
  1124. PIN_OTYPE_PUSHPULL(GPIOH_PIN14) | \
  1125. PIN_OTYPE_PUSHPULL(GPIOH_PIN15))
  1126. #define VAL_GPIOH_OSPEEDR (PIN_OSPEED_VERYLOW(GPIOH_PIN0) | \
  1127. PIN_OSPEED_VERYLOW(GPIOH_PIN1) | \
  1128. PIN_OSPEED_VERYLOW(GPIOH_PIN2) | \
  1129. PIN_OSPEED_VERYLOW(GPIOH_PIN3) | \
  1130. PIN_OSPEED_VERYLOW(GPIOH_PIN4) | \
  1131. PIN_OSPEED_VERYLOW(GPIOH_PIN5) | \
  1132. PIN_OSPEED_VERYLOW(GPIOH_PIN6) | \
  1133. PIN_OSPEED_VERYLOW(GPIOH_PIN7) | \
  1134. PIN_OSPEED_VERYLOW(GPIOH_PIN8) | \
  1135. PIN_OSPEED_VERYLOW(GPIOH_PIN9) | \
  1136. PIN_OSPEED_VERYLOW(GPIOH_PIN10) | \
  1137. PIN_OSPEED_VERYLOW(GPIOH_PIN11) | \
  1138. PIN_OSPEED_VERYLOW(GPIOH_PIN12) | \
  1139. PIN_OSPEED_VERYLOW(GPIOH_PIN13) | \
  1140. PIN_OSPEED_VERYLOW(GPIOH_PIN14) | \
  1141. PIN_OSPEED_VERYLOW(GPIOH_PIN15))
  1142. #define VAL_GPIOH_PUPDR (PIN_PUPDR_PULLUP(GPIOH_PIN0) | \
  1143. PIN_PUPDR_PULLUP(GPIOH_PIN1) | \
  1144. PIN_PUPDR_PULLUP(GPIOH_PIN2) | \
  1145. PIN_PUPDR_PULLUP(GPIOH_PIN3) | \
  1146. PIN_PUPDR_PULLUP(GPIOH_PIN4) | \
  1147. PIN_PUPDR_PULLUP(GPIOH_PIN5) | \
  1148. PIN_PUPDR_PULLUP(GPIOH_PIN6) | \
  1149. PIN_PUPDR_PULLUP(GPIOH_PIN7) | \
  1150. PIN_PUPDR_PULLUP(GPIOH_PIN8) | \
  1151. PIN_PUPDR_PULLUP(GPIOH_PIN9) | \
  1152. PIN_PUPDR_PULLUP(GPIOH_PIN10) | \
  1153. PIN_PUPDR_PULLUP(GPIOH_PIN11) | \
  1154. PIN_PUPDR_PULLUP(GPIOH_PIN12) | \
  1155. PIN_PUPDR_PULLUP(GPIOH_PIN13) | \
  1156. PIN_PUPDR_PULLUP(GPIOH_PIN14) | \
  1157. PIN_PUPDR_PULLUP(GPIOH_PIN15))
  1158. #define VAL_GPIOH_ODR (PIN_ODR_HIGH(GPIOH_PIN0) | \
  1159. PIN_ODR_HIGH(GPIOH_PIN1) | \
  1160. PIN_ODR_HIGH(GPIOH_PIN2) | \
  1161. PIN_ODR_HIGH(GPIOH_PIN3) | \
  1162. PIN_ODR_HIGH(GPIOH_PIN4) | \
  1163. PIN_ODR_HIGH(GPIOH_PIN5) | \
  1164. PIN_ODR_HIGH(GPIOH_PIN6) | \
  1165. PIN_ODR_HIGH(GPIOH_PIN7) | \
  1166. PIN_ODR_HIGH(GPIOH_PIN8) | \
  1167. PIN_ODR_HIGH(GPIOH_PIN9) | \
  1168. PIN_ODR_HIGH(GPIOH_PIN10) | \
  1169. PIN_ODR_HIGH(GPIOH_PIN11) | \
  1170. PIN_ODR_HIGH(GPIOH_PIN12) | \
  1171. PIN_ODR_HIGH(GPIOH_PIN13) | \
  1172. PIN_ODR_HIGH(GPIOH_PIN14) | \
  1173. PIN_ODR_HIGH(GPIOH_PIN15))
  1174. #define VAL_GPIOH_AFRL (PIN_AFIO_AF(GPIOH_PIN0, 0U) | \
  1175. PIN_AFIO_AF(GPIOH_PIN1, 0U) | \
  1176. PIN_AFIO_AF(GPIOH_PIN2, 0U) | \
  1177. PIN_AFIO_AF(GPIOH_PIN3, 0U) | \
  1178. PIN_AFIO_AF(GPIOH_PIN4, 0U) | \
  1179. PIN_AFIO_AF(GPIOH_PIN5, 0U) | \
  1180. PIN_AFIO_AF(GPIOH_PIN6, 0U) | \
  1181. PIN_AFIO_AF(GPIOH_PIN7, 0U))
  1182. #define VAL_GPIOH_AFRH (PIN_AFIO_AF(GPIOH_PIN8, 0U) | \
  1183. PIN_AFIO_AF(GPIOH_PIN9, 0U) | \
  1184. PIN_AFIO_AF(GPIOH_PIN10, 0U) | \
  1185. PIN_AFIO_AF(GPIOH_PIN11, 0U) | \
  1186. PIN_AFIO_AF(GPIOH_PIN12, 0U) | \
  1187. PIN_AFIO_AF(GPIOH_PIN13, 0U) | \
  1188. PIN_AFIO_AF(GPIOH_PIN14, 0U) | \
  1189. PIN_AFIO_AF(GPIOH_PIN15, 0U))
  1190. /*===========================================================================*/
  1191. /* External declarations. */
  1192. /*===========================================================================*/
  1193. #if !defined(_FROM_ASM_)
  1194. #ifdef __cplusplus
  1195. extern "C" {
  1196. #endif
  1197. void boardInit(void);
  1198. #ifdef __cplusplus
  1199. }
  1200. #endif
  1201. #endif /* _FROM_ASM_ */
  1202. #endif /* BOARD_H */