board.h 75 KB

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