board.h 85 KB

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