board.h 50 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837
  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-L053R8 board.
  24. */
  25. /*
  26. * Board identifier.
  27. */
  28. #define BOARD_ST_NUCLEO64_L053R8
  29. #define BOARD_NAME "STMicroelectronics STM32 Nucleo64-L053R8"
  30. /*
  31. * Board oscillators-related settings.
  32. */
  33. #if !defined(STM32_LSECLK)
  34. #define STM32_LSECLK 32768U
  35. #endif
  36. #define STM32_LSEDRV (3U << 11U)
  37. #if !defined(STM32_HSECLK)
  38. #define STM32_HSECLK 8000000U
  39. #endif
  40. #define STM32_HSE_BYPASS
  41. /*
  42. * MCU type as defined in the ST header.
  43. */
  44. #define STM32L053xx
  45. /*
  46. * IO pins assignments.
  47. */
  48. #define GPIOA_ARD_A0 0U
  49. #define GPIOA_ACD1_IN0 0U
  50. #define GPIOA_ARD_A1 1U
  51. #define GPIOA_ACD1_IN1 1U
  52. #define GPIOA_ARD_D1 2U
  53. #define GPIOA_USART2_TX 2U
  54. #define GPIOA_ARD_D0 3U
  55. #define GPIOA_USART2_RX 3U
  56. #define GPIOA_ARD_A2 4U
  57. #define GPIOA_ACD1_IN4 4U
  58. #define GPIOA_LED_GREEN 5U
  59. #define GPIOA_ARD_D13 5U
  60. #define GPIOA_ARD_D12 6U
  61. #define GPIOA_ARD_D11 7U
  62. #define GPIOA_ARD_D7 8U
  63. #define GPIOA_ARD_D8 9U
  64. #define GPIOA_ARD_D2 10U
  65. #define GPIOA_PIN11 11U
  66. #define GPIOA_PIN12 12U
  67. #define GPIOA_SWDIO 13U
  68. #define GPIOA_SWCLK 14U
  69. #define GPIOA_PIN15 15U
  70. #define GPIOB_ARD_A3 0U
  71. #define GPIOB_ACD1_IN8 0U
  72. #define GPIOB_PIN1 1U
  73. #define GPIOB_PIN2 2U
  74. #define GPIOB_SWO 3U
  75. #define GPIOB_ARD_D3 3U
  76. #define GPIOB_ARD_D5 4U
  77. #define GPIOB_ARD_D4 5U
  78. #define GPIOB_ARD_D10 6U
  79. #define GPIOB_PIN7 7U
  80. #define GPIOB_ARD_D15 8U
  81. #define GPIOB_ARD_D14 9U
  82. #define GPIOB_ARD_D6 10U
  83. #define GPIOB_PIN11 11U
  84. #define GPIOB_PIN12 12U
  85. #define GPIOB_PIN13 13U
  86. #define GPIOB_PIN14 14U
  87. #define GPIOB_PIN15 15U
  88. #define GPIOC_ARD_A5 0U
  89. #define GPIOC_ACD1_IN10 0U
  90. #define GPIOC_ARD_A4 1U
  91. #define GPIOC_ACD1_IN11 1U
  92. #define GPIOC_PIN2 2U
  93. #define GPIOC_PIN3 3U
  94. #define GPIOC_PIN4 4U
  95. #define GPIOC_PIN5 5U
  96. #define GPIOC_PIN6 6U
  97. #define GPIOC_ARD_D9 7U
  98. #define GPIOC_PIN8 8U
  99. #define GPIOC_PIN9 9U
  100. #define GPIOC_PIN10 10U
  101. #define GPIOC_PIN11 11U
  102. #define GPIOC_PIN12 12U
  103. #define GPIOC_BUTTON 13U
  104. #define GPIOC_OSC32_IN 14U
  105. #define GPIOC_OSC32_OUT 15U
  106. #define GPIOD_PIN0 0U
  107. #define GPIOD_PIN1 1U
  108. #define GPIOD_PIN2 2U
  109. #define GPIOD_PIN3 3U
  110. #define GPIOD_PIN4 4U
  111. #define GPIOD_PIN5 5U
  112. #define GPIOD_PIN6 6U
  113. #define GPIOD_PIN7 7U
  114. #define GPIOD_PIN8 8U
  115. #define GPIOD_PIN9 9U
  116. #define GPIOD_PIN10 10U
  117. #define GPIOD_PIN11 11U
  118. #define GPIOD_PIN12 12U
  119. #define GPIOD_PIN13 13U
  120. #define GPIOD_PIN14 14U
  121. #define GPIOD_PIN15 15U
  122. #define GPIOH_OSC_IN 0U
  123. #define GPIOH_OSC_OUT 1U
  124. #define GPIOH_PIN2 2U
  125. #define GPIOH_PIN3 3U
  126. #define GPIOH_PIN4 4U
  127. #define GPIOH_PIN5 5U
  128. #define GPIOH_PIN6 6U
  129. #define GPIOH_PIN7 7U
  130. #define GPIOH_PIN8 8U
  131. #define GPIOH_PIN9 9U
  132. #define GPIOH_PIN10 10U
  133. #define GPIOH_PIN11 11U
  134. #define GPIOH_PIN12 12U
  135. #define GPIOH_PIN13 13U
  136. #define GPIOH_PIN14 14U
  137. #define GPIOH_PIN15 15U
  138. /*
  139. * IO lines assignments.
  140. */
  141. #define LINE_ARD_A0 PAL_LINE(GPIOA, 0U)
  142. #define LINE_ACD1_IN0 PAL_LINE(GPIOA, 0U)
  143. #define LINE_ARD_A1 PAL_LINE(GPIOA, 1U)
  144. #define LINE_ACD1_IN1 PAL_LINE(GPIOA, 1U)
  145. #define LINE_ARD_D1 PAL_LINE(GPIOA, 2U)
  146. #define LINE_USART2_TX PAL_LINE(GPIOA, 2U)
  147. #define LINE_ARD_D0 PAL_LINE(GPIOA, 3U)
  148. #define LINE_USART2_RX PAL_LINE(GPIOA, 3U)
  149. #define LINE_ARD_A2 PAL_LINE(GPIOA, 4U)
  150. #define LINE_ACD1_IN4 PAL_LINE(GPIOA, 4U)
  151. #define LINE_LED_GREEN PAL_LINE(GPIOA, 5U)
  152. #define LINE_ARD_D13 PAL_LINE(GPIOA, 5U)
  153. #define LINE_ARD_D12 PAL_LINE(GPIOA, 6U)
  154. #define LINE_ARD_D11 PAL_LINE(GPIOA, 7U)
  155. #define LINE_ARD_D7 PAL_LINE(GPIOA, 8U)
  156. #define LINE_ARD_D8 PAL_LINE(GPIOA, 9U)
  157. #define LINE_ARD_D2 PAL_LINE(GPIOA, 10U)
  158. #define LINE_SWDIO PAL_LINE(GPIOA, 13U)
  159. #define LINE_SWCLK PAL_LINE(GPIOA, 14U)
  160. #define LINE_ARD_A3 PAL_LINE(GPIOB, 0U)
  161. #define LINE_ACD1_IN8 PAL_LINE(GPIOB, 0U)
  162. #define LINE_SWO PAL_LINE(GPIOB, 3U)
  163. #define LINE_ARD_D3 PAL_LINE(GPIOB, 3U)
  164. #define LINE_ARD_D5 PAL_LINE(GPIOB, 4U)
  165. #define LINE_ARD_D4 PAL_LINE(GPIOB, 5U)
  166. #define LINE_ARD_D10 PAL_LINE(GPIOB, 6U)
  167. #define LINE_ARD_D15 PAL_LINE(GPIOB, 8U)
  168. #define LINE_ARD_D14 PAL_LINE(GPIOB, 9U)
  169. #define LINE_ARD_D6 PAL_LINE(GPIOB, 10U)
  170. #define LINE_ARD_A5 PAL_LINE(GPIOC, 0U)
  171. #define LINE_ACD1_IN10 PAL_LINE(GPIOC, 0U)
  172. #define LINE_ARD_A4 PAL_LINE(GPIOC, 1U)
  173. #define LINE_ACD1_IN11 PAL_LINE(GPIOC, 1U)
  174. #define LINE_ARD_D9 PAL_LINE(GPIOC, 7U)
  175. #define LINE_BUTTON PAL_LINE(GPIOC, 13U)
  176. #define LINE_OSC32_IN PAL_LINE(GPIOC, 14U)
  177. #define LINE_OSC32_OUT PAL_LINE(GPIOC, 15U)
  178. #define LINE_OSC_IN PAL_LINE(GPIOH, 0U)
  179. #define LINE_OSC_OUT PAL_LINE(GPIOH, 1U)
  180. /*===========================================================================*/
  181. /* Driver pre-compile time settings. */
  182. /*===========================================================================*/
  183. /*===========================================================================*/
  184. /* Derived constants and error checks. */
  185. /*===========================================================================*/
  186. /*===========================================================================*/
  187. /* Driver data structures and types. */
  188. /*===========================================================================*/
  189. /*===========================================================================*/
  190. /* Driver macros. */
  191. /*===========================================================================*/
  192. /*
  193. * I/O ports initial setup, this configuration is established soon after reset
  194. * in the initialization code.
  195. * Please refer to the STM32 Reference Manual for details.
  196. */
  197. #define PIN_MODE_INPUT(n) (0U << ((n) * 2U))
  198. #define PIN_MODE_OUTPUT(n) (1U << ((n) * 2U))
  199. #define PIN_MODE_ALTERNATE(n) (2U << ((n) * 2U))
  200. #define PIN_MODE_ANALOG(n) (3U << ((n) * 2U))
  201. #define PIN_ODR_LOW(n) (0U << (n))
  202. #define PIN_ODR_HIGH(n) (1U << (n))
  203. #define PIN_OTYPE_PUSHPULL(n) (0U << (n))
  204. #define PIN_OTYPE_OPENDRAIN(n) (1U << (n))
  205. #define PIN_OSPEED_VERYLOW(n) (0U << ((n) * 2U))
  206. #define PIN_OSPEED_LOW(n) (1U << ((n) * 2U))
  207. #define PIN_OSPEED_MEDIUM(n) (2U << ((n) * 2U))
  208. #define PIN_OSPEED_HIGH(n) (3U << ((n) * 2U))
  209. #define PIN_PUPDR_FLOATING(n) (0U << ((n) * 2U))
  210. #define PIN_PUPDR_PULLUP(n) (1U << ((n) * 2U))
  211. #define PIN_PUPDR_PULLDOWN(n) (2U << ((n) * 2U))
  212. #define PIN_AFIO_AF(n, v) ((v) << (((n) % 8U) * 4U))
  213. /*
  214. * GPIOA setup:
  215. *
  216. * PA0 - ARD_A0 ACD1_IN0 (input pullup).
  217. * PA1 - ARD_A1 ACD1_IN1 (input pullup).
  218. * PA2 - ARD_D1 USART2_TX (alternate 4).
  219. * PA3 - ARD_D0 USART2_RX (alternate 4).
  220. * PA4 - ARD_A2 ACD1_IN4 (input pullup).
  221. * PA5 - LED_GREEN ARD_D13 (output pushpull maximum).
  222. * PA6 - ARD_D12 (input pullup).
  223. * PA7 - ARD_D11 (input pullup).
  224. * PA8 - ARD_D7 (input pullup).
  225. * PA9 - ARD_D8 (input pullup).
  226. * PA10 - ARD_D2 (input pullup).
  227. * PA11 - PIN11 (input pullup).
  228. * PA12 - PIN12 (input pullup).
  229. * PA13 - SWDIO (alternate 0).
  230. * PA14 - SWCLK (alternate 0).
  231. * PA15 - PIN15 (input pullup).
  232. */
  233. #define VAL_GPIOA_MODER (PIN_MODE_INPUT(GPIOA_ARD_A0) | \
  234. PIN_MODE_INPUT(GPIOA_ARD_A1) | \
  235. PIN_MODE_ALTERNATE(GPIOA_ARD_D1) | \
  236. PIN_MODE_ALTERNATE(GPIOA_ARD_D0) | \
  237. PIN_MODE_INPUT(GPIOA_ARD_A2) | \
  238. PIN_MODE_OUTPUT(GPIOA_LED_GREEN) | \
  239. PIN_MODE_INPUT(GPIOA_ARD_D12) | \
  240. PIN_MODE_INPUT(GPIOA_ARD_D11) | \
  241. PIN_MODE_INPUT(GPIOA_ARD_D7) | \
  242. PIN_MODE_INPUT(GPIOA_ARD_D8) | \
  243. PIN_MODE_INPUT(GPIOA_ARD_D2) | \
  244. PIN_MODE_INPUT(GPIOA_PIN11) | \
  245. PIN_MODE_INPUT(GPIOA_PIN12) | \
  246. PIN_MODE_ALTERNATE(GPIOA_SWDIO) | \
  247. PIN_MODE_ALTERNATE(GPIOA_SWCLK) | \
  248. PIN_MODE_INPUT(GPIOA_PIN15))
  249. #define VAL_GPIOA_OTYPER (PIN_OTYPE_PUSHPULL(GPIOA_ARD_A0) | \
  250. PIN_OTYPE_PUSHPULL(GPIOA_ARD_A1) | \
  251. PIN_OTYPE_PUSHPULL(GPIOA_ARD_D1) | \
  252. PIN_OTYPE_PUSHPULL(GPIOA_ARD_D0) | \
  253. PIN_OTYPE_PUSHPULL(GPIOA_ARD_A2) | \
  254. PIN_OTYPE_PUSHPULL(GPIOA_LED_GREEN) | \
  255. PIN_OTYPE_PUSHPULL(GPIOA_ARD_D12) | \
  256. PIN_OTYPE_PUSHPULL(GPIOA_ARD_D11) | \
  257. PIN_OTYPE_PUSHPULL(GPIOA_ARD_D7) | \
  258. PIN_OTYPE_PUSHPULL(GPIOA_ARD_D8) | \
  259. PIN_OTYPE_PUSHPULL(GPIOA_ARD_D2) | \
  260. PIN_OTYPE_PUSHPULL(GPIOA_PIN11) | \
  261. PIN_OTYPE_PUSHPULL(GPIOA_PIN12) | \
  262. PIN_OTYPE_PUSHPULL(GPIOA_SWDIO) | \
  263. PIN_OTYPE_PUSHPULL(GPIOA_SWCLK) | \
  264. PIN_OTYPE_PUSHPULL(GPIOA_PIN15))
  265. #define VAL_GPIOA_OSPEEDR (PIN_OSPEED_HIGH(GPIOA_ARD_A0) | \
  266. PIN_OSPEED_HIGH(GPIOA_ARD_A1) | \
  267. PIN_OSPEED_MEDIUM(GPIOA_ARD_D1) | \
  268. PIN_OSPEED_MEDIUM(GPIOA_ARD_D0) | \
  269. PIN_OSPEED_HIGH(GPIOA_ARD_A2) | \
  270. PIN_OSPEED_HIGH(GPIOA_LED_GREEN) | \
  271. PIN_OSPEED_HIGH(GPIOA_ARD_D12) | \
  272. PIN_OSPEED_HIGH(GPIOA_ARD_D11) | \
  273. PIN_OSPEED_HIGH(GPIOA_ARD_D7) | \
  274. PIN_OSPEED_HIGH(GPIOA_ARD_D8) | \
  275. PIN_OSPEED_HIGH(GPIOA_ARD_D2) | \
  276. PIN_OSPEED_HIGH(GPIOA_PIN11) | \
  277. PIN_OSPEED_HIGH(GPIOA_PIN12) | \
  278. PIN_OSPEED_HIGH(GPIOA_SWDIO) | \
  279. PIN_OSPEED_HIGH(GPIOA_SWCLK) | \
  280. PIN_OSPEED_HIGH(GPIOA_PIN15))
  281. #define VAL_GPIOA_PUPDR (PIN_PUPDR_PULLUP(GPIOA_ARD_A0) | \
  282. PIN_PUPDR_PULLUP(GPIOA_ARD_A1) | \
  283. PIN_PUPDR_FLOATING(GPIOA_ARD_D1) | \
  284. PIN_PUPDR_FLOATING(GPIOA_ARD_D0) | \
  285. PIN_PUPDR_PULLUP(GPIOA_ARD_A2) | \
  286. PIN_PUPDR_FLOATING(GPIOA_LED_GREEN) | \
  287. PIN_PUPDR_PULLUP(GPIOA_ARD_D12) | \
  288. PIN_PUPDR_PULLUP(GPIOA_ARD_D11) | \
  289. PIN_PUPDR_PULLUP(GPIOA_ARD_D7) | \
  290. PIN_PUPDR_PULLUP(GPIOA_ARD_D8) | \
  291. PIN_PUPDR_PULLUP(GPIOA_ARD_D2) | \
  292. PIN_PUPDR_PULLUP(GPIOA_PIN11) | \
  293. PIN_PUPDR_PULLUP(GPIOA_PIN12) | \
  294. PIN_PUPDR_PULLUP(GPIOA_SWDIO) | \
  295. PIN_PUPDR_PULLDOWN(GPIOA_SWCLK) | \
  296. PIN_PUPDR_PULLUP(GPIOA_PIN15))
  297. #define VAL_GPIOA_ODR (PIN_ODR_HIGH(GPIOA_ARD_A0) | \
  298. PIN_ODR_HIGH(GPIOA_ARD_A1) | \
  299. PIN_ODR_HIGH(GPIOA_ARD_D1) | \
  300. PIN_ODR_HIGH(GPIOA_ARD_D0) | \
  301. PIN_ODR_HIGH(GPIOA_ARD_A2) | \
  302. PIN_ODR_LOW(GPIOA_LED_GREEN) | \
  303. PIN_ODR_HIGH(GPIOA_ARD_D12) | \
  304. PIN_ODR_HIGH(GPIOA_ARD_D11) | \
  305. PIN_ODR_HIGH(GPIOA_ARD_D7) | \
  306. PIN_ODR_HIGH(GPIOA_ARD_D8) | \
  307. PIN_ODR_HIGH(GPIOA_ARD_D2) | \
  308. PIN_ODR_HIGH(GPIOA_PIN11) | \
  309. PIN_ODR_HIGH(GPIOA_PIN12) | \
  310. PIN_ODR_HIGH(GPIOA_SWDIO) | \
  311. PIN_ODR_HIGH(GPIOA_SWCLK) | \
  312. PIN_ODR_HIGH(GPIOA_PIN15))
  313. #define VAL_GPIOA_AFRL (PIN_AFIO_AF(GPIOA_ARD_A0, 0U) | \
  314. PIN_AFIO_AF(GPIOA_ARD_A1, 0U) | \
  315. PIN_AFIO_AF(GPIOA_ARD_D1, 4U) | \
  316. PIN_AFIO_AF(GPIOA_ARD_D0, 4U) | \
  317. PIN_AFIO_AF(GPIOA_ARD_A2, 0U) | \
  318. PIN_AFIO_AF(GPIOA_LED_GREEN, 0U) | \
  319. PIN_AFIO_AF(GPIOA_ARD_D12, 0U) | \
  320. PIN_AFIO_AF(GPIOA_ARD_D11, 0U))
  321. #define VAL_GPIOA_AFRH (PIN_AFIO_AF(GPIOA_ARD_D7, 0U) | \
  322. PIN_AFIO_AF(GPIOA_ARD_D8, 0U) | \
  323. PIN_AFIO_AF(GPIOA_ARD_D2, 0U) | \
  324. PIN_AFIO_AF(GPIOA_PIN11, 0U) | \
  325. PIN_AFIO_AF(GPIOA_PIN12, 0U) | \
  326. PIN_AFIO_AF(GPIOA_SWDIO, 0U) | \
  327. PIN_AFIO_AF(GPIOA_SWCLK, 0U) | \
  328. PIN_AFIO_AF(GPIOA_PIN15, 0U))
  329. /*
  330. * GPIOB setup:
  331. *
  332. * PB0 - ARD_A3 ACD1_IN8 (input pullup).
  333. * PB1 - PIN1 (input pullup).
  334. * PB2 - PIN2 (input pullup).
  335. * PB3 - SWO ARD_D3 (alternate 0).
  336. * PB4 - ARD_D5 (input pullup).
  337. * PB5 - ARD_D4 (input pullup).
  338. * PB6 - ARD_D10 (input pullup).
  339. * PB7 - PIN7 (input pullup).
  340. * PB8 - ARD_D15 (input pullup).
  341. * PB9 - ARD_D14 (input pullup).
  342. * PB10 - ARD_D6 (input pullup).
  343. * PB11 - PIN11 (input pullup).
  344. * PB12 - PIN12 (input pullup).
  345. * PB13 - PIN13 (input pullup).
  346. * PB14 - PIN14 (input pullup).
  347. * PB15 - PIN15 (input pullup).
  348. */
  349. #define VAL_GPIOB_MODER (PIN_MODE_INPUT(GPIOB_ARD_A3) | \
  350. PIN_MODE_INPUT(GPIOB_PIN1) | \
  351. PIN_MODE_INPUT(GPIOB_PIN2) | \
  352. PIN_MODE_ALTERNATE(GPIOB_SWO) | \
  353. PIN_MODE_INPUT(GPIOB_ARD_D5) | \
  354. PIN_MODE_INPUT(GPIOB_ARD_D4) | \
  355. PIN_MODE_INPUT(GPIOB_ARD_D10) | \
  356. PIN_MODE_INPUT(GPIOB_PIN7) | \
  357. PIN_MODE_INPUT(GPIOB_ARD_D15) | \
  358. PIN_MODE_INPUT(GPIOB_ARD_D14) | \
  359. PIN_MODE_INPUT(GPIOB_ARD_D6) | \
  360. PIN_MODE_INPUT(GPIOB_PIN11) | \
  361. PIN_MODE_INPUT(GPIOB_PIN12) | \
  362. PIN_MODE_INPUT(GPIOB_PIN13) | \
  363. PIN_MODE_INPUT(GPIOB_PIN14) | \
  364. PIN_MODE_INPUT(GPIOB_PIN15))
  365. #define VAL_GPIOB_OTYPER (PIN_OTYPE_PUSHPULL(GPIOB_ARD_A3) | \
  366. PIN_OTYPE_PUSHPULL(GPIOB_PIN1) | \
  367. PIN_OTYPE_PUSHPULL(GPIOB_PIN2) | \
  368. PIN_OTYPE_PUSHPULL(GPIOB_SWO) | \
  369. PIN_OTYPE_PUSHPULL(GPIOB_ARD_D5) | \
  370. PIN_OTYPE_PUSHPULL(GPIOB_ARD_D4) | \
  371. PIN_OTYPE_PUSHPULL(GPIOB_ARD_D10) | \
  372. PIN_OTYPE_PUSHPULL(GPIOB_PIN7) | \
  373. PIN_OTYPE_PUSHPULL(GPIOB_ARD_D15) | \
  374. PIN_OTYPE_PUSHPULL(GPIOB_ARD_D14) | \
  375. PIN_OTYPE_PUSHPULL(GPIOB_ARD_D6) | \
  376. PIN_OTYPE_PUSHPULL(GPIOB_PIN11) | \
  377. PIN_OTYPE_PUSHPULL(GPIOB_PIN12) | \
  378. PIN_OTYPE_PUSHPULL(GPIOB_PIN13) | \
  379. PIN_OTYPE_PUSHPULL(GPIOB_PIN14) | \
  380. PIN_OTYPE_PUSHPULL(GPIOB_PIN15))
  381. #define VAL_GPIOB_OSPEEDR (PIN_OSPEED_HIGH(GPIOB_ARD_A3) | \
  382. PIN_OSPEED_HIGH(GPIOB_PIN1) | \
  383. PIN_OSPEED_HIGH(GPIOB_PIN2) | \
  384. PIN_OSPEED_HIGH(GPIOB_SWO) | \
  385. PIN_OSPEED_HIGH(GPIOB_ARD_D5) | \
  386. PIN_OSPEED_HIGH(GPIOB_ARD_D4) | \
  387. PIN_OSPEED_HIGH(GPIOB_ARD_D10) | \
  388. PIN_OSPEED_HIGH(GPIOB_PIN7) | \
  389. PIN_OSPEED_HIGH(GPIOB_ARD_D15) | \
  390. PIN_OSPEED_HIGH(GPIOB_ARD_D14) | \
  391. PIN_OSPEED_HIGH(GPIOB_ARD_D6) | \
  392. PIN_OSPEED_HIGH(GPIOB_PIN11) | \
  393. PIN_OSPEED_HIGH(GPIOB_PIN12) | \
  394. PIN_OSPEED_HIGH(GPIOB_PIN13) | \
  395. PIN_OSPEED_HIGH(GPIOB_PIN14) | \
  396. PIN_OSPEED_HIGH(GPIOB_PIN15))
  397. #define VAL_GPIOB_PUPDR (PIN_PUPDR_PULLUP(GPIOB_ARD_A3) | \
  398. PIN_PUPDR_PULLUP(GPIOB_PIN1) | \
  399. PIN_PUPDR_PULLUP(GPIOB_PIN2) | \
  400. PIN_PUPDR_PULLUP(GPIOB_SWO) | \
  401. PIN_PUPDR_PULLUP(GPIOB_ARD_D5) | \
  402. PIN_PUPDR_PULLUP(GPIOB_ARD_D4) | \
  403. PIN_PUPDR_PULLUP(GPIOB_ARD_D10) | \
  404. PIN_PUPDR_PULLUP(GPIOB_PIN7) | \
  405. PIN_PUPDR_PULLUP(GPIOB_ARD_D15) | \
  406. PIN_PUPDR_PULLUP(GPIOB_ARD_D14) | \
  407. PIN_PUPDR_PULLUP(GPIOB_ARD_D6) | \
  408. PIN_PUPDR_PULLUP(GPIOB_PIN11) | \
  409. PIN_PUPDR_PULLUP(GPIOB_PIN12) | \
  410. PIN_PUPDR_PULLUP(GPIOB_PIN13) | \
  411. PIN_PUPDR_PULLUP(GPIOB_PIN14) | \
  412. PIN_PUPDR_PULLUP(GPIOB_PIN15))
  413. #define VAL_GPIOB_ODR (PIN_ODR_HIGH(GPIOB_ARD_A3) | \
  414. PIN_ODR_HIGH(GPIOB_PIN1) | \
  415. PIN_ODR_HIGH(GPIOB_PIN2) | \
  416. PIN_ODR_HIGH(GPIOB_SWO) | \
  417. PIN_ODR_HIGH(GPIOB_ARD_D5) | \
  418. PIN_ODR_HIGH(GPIOB_ARD_D4) | \
  419. PIN_ODR_HIGH(GPIOB_ARD_D10) | \
  420. PIN_ODR_HIGH(GPIOB_PIN7) | \
  421. PIN_ODR_HIGH(GPIOB_ARD_D15) | \
  422. PIN_ODR_HIGH(GPIOB_ARD_D14) | \
  423. PIN_ODR_HIGH(GPIOB_ARD_D6) | \
  424. PIN_ODR_HIGH(GPIOB_PIN11) | \
  425. PIN_ODR_HIGH(GPIOB_PIN12) | \
  426. PIN_ODR_HIGH(GPIOB_PIN13) | \
  427. PIN_ODR_HIGH(GPIOB_PIN14) | \
  428. PIN_ODR_HIGH(GPIOB_PIN15))
  429. #define VAL_GPIOB_AFRL (PIN_AFIO_AF(GPIOB_ARD_A3, 0U) | \
  430. PIN_AFIO_AF(GPIOB_PIN1, 0U) | \
  431. PIN_AFIO_AF(GPIOB_PIN2, 0U) | \
  432. PIN_AFIO_AF(GPIOB_SWO, 0U) | \
  433. PIN_AFIO_AF(GPIOB_ARD_D5, 0U) | \
  434. PIN_AFIO_AF(GPIOB_ARD_D4, 0U) | \
  435. PIN_AFIO_AF(GPIOB_ARD_D10, 0U) | \
  436. PIN_AFIO_AF(GPIOB_PIN7, 0U))
  437. #define VAL_GPIOB_AFRH (PIN_AFIO_AF(GPIOB_ARD_D15, 0U) | \
  438. PIN_AFIO_AF(GPIOB_ARD_D14, 0U) | \
  439. PIN_AFIO_AF(GPIOB_ARD_D6, 0U) | \
  440. PIN_AFIO_AF(GPIOB_PIN11, 0U) | \
  441. PIN_AFIO_AF(GPIOB_PIN12, 0U) | \
  442. PIN_AFIO_AF(GPIOB_PIN13, 0U) | \
  443. PIN_AFIO_AF(GPIOB_PIN14, 0U) | \
  444. PIN_AFIO_AF(GPIOB_PIN15, 0U))
  445. /*
  446. * GPIOC setup:
  447. *
  448. * PC0 - ARD_A5 ACD1_IN10 (input pullup).
  449. * PC1 - ARD_A4 ACD1_IN11 (input pullup).
  450. * PC2 - PIN2 (input pullup).
  451. * PC3 - PIN3 (input pullup).
  452. * PC4 - PIN4 (input pullup).
  453. * PC5 - PIN5 (input pullup).
  454. * PC6 - PIN6 (input pullup).
  455. * PC7 - ARD_D9 (input pullup).
  456. * PC8 - PIN8 (input pullup).
  457. * PC9 - PIN9 (input pullup).
  458. * PC10 - PIN10 (input pullup).
  459. * PC11 - PIN11 (input pullup).
  460. * PC12 - PIN12 (input pullup).
  461. * PC13 - BUTTON (input floating).
  462. * PC14 - OSC32_IN (input floating).
  463. * PC15 - OSC32_OUT (input floating).
  464. */
  465. #define VAL_GPIOC_MODER (PIN_MODE_INPUT(GPIOC_ARD_A5) | \
  466. PIN_MODE_INPUT(GPIOC_ARD_A4) | \
  467. PIN_MODE_INPUT(GPIOC_PIN2) | \
  468. PIN_MODE_INPUT(GPIOC_PIN3) | \
  469. PIN_MODE_INPUT(GPIOC_PIN4) | \
  470. PIN_MODE_INPUT(GPIOC_PIN5) | \
  471. PIN_MODE_INPUT(GPIOC_PIN6) | \
  472. PIN_MODE_INPUT(GPIOC_ARD_D9) | \
  473. PIN_MODE_INPUT(GPIOC_PIN8) | \
  474. PIN_MODE_INPUT(GPIOC_PIN9) | \
  475. PIN_MODE_INPUT(GPIOC_PIN10) | \
  476. PIN_MODE_INPUT(GPIOC_PIN11) | \
  477. PIN_MODE_INPUT(GPIOC_PIN12) | \
  478. PIN_MODE_INPUT(GPIOC_BUTTON) | \
  479. PIN_MODE_INPUT(GPIOC_OSC32_IN) | \
  480. PIN_MODE_INPUT(GPIOC_OSC32_OUT))
  481. #define VAL_GPIOC_OTYPER (PIN_OTYPE_PUSHPULL(GPIOC_ARD_A5) | \
  482. PIN_OTYPE_PUSHPULL(GPIOC_ARD_A4) | \
  483. PIN_OTYPE_PUSHPULL(GPIOC_PIN2) | \
  484. PIN_OTYPE_PUSHPULL(GPIOC_PIN3) | \
  485. PIN_OTYPE_PUSHPULL(GPIOC_PIN4) | \
  486. PIN_OTYPE_PUSHPULL(GPIOC_PIN5) | \
  487. PIN_OTYPE_PUSHPULL(GPIOC_PIN6) | \
  488. PIN_OTYPE_PUSHPULL(GPIOC_ARD_D9) | \
  489. PIN_OTYPE_PUSHPULL(GPIOC_PIN8) | \
  490. PIN_OTYPE_PUSHPULL(GPIOC_PIN9) | \
  491. PIN_OTYPE_PUSHPULL(GPIOC_PIN10) | \
  492. PIN_OTYPE_PUSHPULL(GPIOC_PIN11) | \
  493. PIN_OTYPE_PUSHPULL(GPIOC_PIN12) | \
  494. PIN_OTYPE_PUSHPULL(GPIOC_BUTTON) | \
  495. PIN_OTYPE_PUSHPULL(GPIOC_OSC32_IN) | \
  496. PIN_OTYPE_PUSHPULL(GPIOC_OSC32_OUT))
  497. #define VAL_GPIOC_OSPEEDR (PIN_OSPEED_HIGH(GPIOC_ARD_A5) | \
  498. PIN_OSPEED_HIGH(GPIOC_ARD_A4) | \
  499. PIN_OSPEED_HIGH(GPIOC_PIN2) | \
  500. PIN_OSPEED_HIGH(GPIOC_PIN3) | \
  501. PIN_OSPEED_HIGH(GPIOC_PIN4) | \
  502. PIN_OSPEED_HIGH(GPIOC_PIN5) | \
  503. PIN_OSPEED_HIGH(GPIOC_PIN6) | \
  504. PIN_OSPEED_HIGH(GPIOC_ARD_D9) | \
  505. PIN_OSPEED_HIGH(GPIOC_PIN8) | \
  506. PIN_OSPEED_HIGH(GPIOC_PIN9) | \
  507. PIN_OSPEED_HIGH(GPIOC_PIN10) | \
  508. PIN_OSPEED_HIGH(GPIOC_PIN11) | \
  509. PIN_OSPEED_HIGH(GPIOC_PIN12) | \
  510. PIN_OSPEED_HIGH(GPIOC_BUTTON) | \
  511. PIN_OSPEED_HIGH(GPIOC_OSC32_IN) | \
  512. PIN_OSPEED_HIGH(GPIOC_OSC32_OUT))
  513. #define VAL_GPIOC_PUPDR (PIN_PUPDR_PULLUP(GPIOC_ARD_A5) | \
  514. PIN_PUPDR_PULLUP(GPIOC_ARD_A4) | \
  515. PIN_PUPDR_PULLUP(GPIOC_PIN2) | \
  516. PIN_PUPDR_PULLUP(GPIOC_PIN3) | \
  517. PIN_PUPDR_PULLUP(GPIOC_PIN4) | \
  518. PIN_PUPDR_PULLUP(GPIOC_PIN5) | \
  519. PIN_PUPDR_PULLUP(GPIOC_PIN6) | \
  520. PIN_PUPDR_PULLUP(GPIOC_ARD_D9) | \
  521. PIN_PUPDR_PULLUP(GPIOC_PIN8) | \
  522. PIN_PUPDR_PULLUP(GPIOC_PIN9) | \
  523. PIN_PUPDR_PULLUP(GPIOC_PIN10) | \
  524. PIN_PUPDR_PULLUP(GPIOC_PIN11) | \
  525. PIN_PUPDR_PULLUP(GPIOC_PIN12) | \
  526. PIN_PUPDR_FLOATING(GPIOC_BUTTON) | \
  527. PIN_PUPDR_FLOATING(GPIOC_OSC32_IN) | \
  528. PIN_PUPDR_FLOATING(GPIOC_OSC32_OUT))
  529. #define VAL_GPIOC_ODR (PIN_ODR_HIGH(GPIOC_ARD_A5) | \
  530. PIN_ODR_HIGH(GPIOC_ARD_A4) | \
  531. PIN_ODR_HIGH(GPIOC_PIN2) | \
  532. PIN_ODR_HIGH(GPIOC_PIN3) | \
  533. PIN_ODR_HIGH(GPIOC_PIN4) | \
  534. PIN_ODR_HIGH(GPIOC_PIN5) | \
  535. PIN_ODR_HIGH(GPIOC_PIN6) | \
  536. PIN_ODR_HIGH(GPIOC_ARD_D9) | \
  537. PIN_ODR_HIGH(GPIOC_PIN8) | \
  538. PIN_ODR_HIGH(GPIOC_PIN9) | \
  539. PIN_ODR_HIGH(GPIOC_PIN10) | \
  540. PIN_ODR_HIGH(GPIOC_PIN11) | \
  541. PIN_ODR_HIGH(GPIOC_PIN12) | \
  542. PIN_ODR_HIGH(GPIOC_BUTTON) | \
  543. PIN_ODR_HIGH(GPIOC_OSC32_IN) | \
  544. PIN_ODR_HIGH(GPIOC_OSC32_OUT))
  545. #define VAL_GPIOC_AFRL (PIN_AFIO_AF(GPIOC_ARD_A5, 0U) | \
  546. PIN_AFIO_AF(GPIOC_ARD_A4, 0U) | \
  547. PIN_AFIO_AF(GPIOC_PIN2, 0U) | \
  548. PIN_AFIO_AF(GPIOC_PIN3, 0U) | \
  549. PIN_AFIO_AF(GPIOC_PIN4, 0U) | \
  550. PIN_AFIO_AF(GPIOC_PIN5, 0U) | \
  551. PIN_AFIO_AF(GPIOC_PIN6, 0U) | \
  552. PIN_AFIO_AF(GPIOC_ARD_D9, 0U))
  553. #define VAL_GPIOC_AFRH (PIN_AFIO_AF(GPIOC_PIN8, 0U) | \
  554. PIN_AFIO_AF(GPIOC_PIN9, 0U) | \
  555. PIN_AFIO_AF(GPIOC_PIN10, 0U) | \
  556. PIN_AFIO_AF(GPIOC_PIN11, 0U) | \
  557. PIN_AFIO_AF(GPIOC_PIN12, 0U) | \
  558. PIN_AFIO_AF(GPIOC_BUTTON, 0U) | \
  559. PIN_AFIO_AF(GPIOC_OSC32_IN, 0U) | \
  560. PIN_AFIO_AF(GPIOC_OSC32_OUT, 0U))
  561. /*
  562. * GPIOD setup:
  563. *
  564. * PD0 - PIN0 (input pullup).
  565. * PD1 - PIN1 (input pullup).
  566. * PD2 - PIN2 (input pullup).
  567. * PD3 - PIN3 (input pullup).
  568. * PD4 - PIN4 (input pullup).
  569. * PD5 - PIN5 (input pullup).
  570. * PD6 - PIN6 (input pullup).
  571. * PD7 - PIN7 (input pullup).
  572. * PD8 - PIN8 (input pullup).
  573. * PD9 - PIN9 (input pullup).
  574. * PD10 - PIN10 (input pullup).
  575. * PD11 - PIN11 (input pullup).
  576. * PD12 - PIN12 (input pullup).
  577. * PD13 - PIN13 (input pullup).
  578. * PD14 - PIN14 (input pullup).
  579. * PD15 - PIN15 (input pullup).
  580. */
  581. #define VAL_GPIOD_MODER (PIN_MODE_INPUT(GPIOD_PIN0) | \
  582. PIN_MODE_INPUT(GPIOD_PIN1) | \
  583. PIN_MODE_INPUT(GPIOD_PIN2) | \
  584. PIN_MODE_INPUT(GPIOD_PIN3) | \
  585. PIN_MODE_INPUT(GPIOD_PIN4) | \
  586. PIN_MODE_INPUT(GPIOD_PIN5) | \
  587. PIN_MODE_INPUT(GPIOD_PIN6) | \
  588. PIN_MODE_INPUT(GPIOD_PIN7) | \
  589. PIN_MODE_INPUT(GPIOD_PIN8) | \
  590. PIN_MODE_INPUT(GPIOD_PIN9) | \
  591. PIN_MODE_INPUT(GPIOD_PIN10) | \
  592. PIN_MODE_INPUT(GPIOD_PIN11) | \
  593. PIN_MODE_INPUT(GPIOD_PIN12) | \
  594. PIN_MODE_INPUT(GPIOD_PIN13) | \
  595. PIN_MODE_INPUT(GPIOD_PIN14) | \
  596. PIN_MODE_INPUT(GPIOD_PIN15))
  597. #define VAL_GPIOD_OTYPER (PIN_OTYPE_PUSHPULL(GPIOD_PIN0) | \
  598. PIN_OTYPE_PUSHPULL(GPIOD_PIN1) | \
  599. PIN_OTYPE_PUSHPULL(GPIOD_PIN2) | \
  600. PIN_OTYPE_PUSHPULL(GPIOD_PIN3) | \
  601. PIN_OTYPE_PUSHPULL(GPIOD_PIN4) | \
  602. PIN_OTYPE_PUSHPULL(GPIOD_PIN5) | \
  603. PIN_OTYPE_PUSHPULL(GPIOD_PIN6) | \
  604. PIN_OTYPE_PUSHPULL(GPIOD_PIN7) | \
  605. PIN_OTYPE_PUSHPULL(GPIOD_PIN8) | \
  606. PIN_OTYPE_PUSHPULL(GPIOD_PIN9) | \
  607. PIN_OTYPE_PUSHPULL(GPIOD_PIN10) | \
  608. PIN_OTYPE_PUSHPULL(GPIOD_PIN11) | \
  609. PIN_OTYPE_PUSHPULL(GPIOD_PIN12) | \
  610. PIN_OTYPE_PUSHPULL(GPIOD_PIN13) | \
  611. PIN_OTYPE_PUSHPULL(GPIOD_PIN14) | \
  612. PIN_OTYPE_PUSHPULL(GPIOD_PIN15))
  613. #define VAL_GPIOD_OSPEEDR (PIN_OSPEED_HIGH(GPIOD_PIN0) | \
  614. PIN_OSPEED_HIGH(GPIOD_PIN1) | \
  615. PIN_OSPEED_HIGH(GPIOD_PIN2) | \
  616. PIN_OSPEED_HIGH(GPIOD_PIN3) | \
  617. PIN_OSPEED_HIGH(GPIOD_PIN4) | \
  618. PIN_OSPEED_HIGH(GPIOD_PIN5) | \
  619. PIN_OSPEED_HIGH(GPIOD_PIN6) | \
  620. PIN_OSPEED_HIGH(GPIOD_PIN7) | \
  621. PIN_OSPEED_HIGH(GPIOD_PIN8) | \
  622. PIN_OSPEED_HIGH(GPIOD_PIN9) | \
  623. PIN_OSPEED_HIGH(GPIOD_PIN10) | \
  624. PIN_OSPEED_HIGH(GPIOD_PIN11) | \
  625. PIN_OSPEED_HIGH(GPIOD_PIN12) | \
  626. PIN_OSPEED_HIGH(GPIOD_PIN13) | \
  627. PIN_OSPEED_HIGH(GPIOD_PIN14) | \
  628. PIN_OSPEED_HIGH(GPIOD_PIN15))
  629. #define VAL_GPIOD_PUPDR (PIN_PUPDR_PULLUP(GPIOD_PIN0) | \
  630. PIN_PUPDR_PULLUP(GPIOD_PIN1) | \
  631. PIN_PUPDR_PULLUP(GPIOD_PIN2) | \
  632. PIN_PUPDR_PULLUP(GPIOD_PIN3) | \
  633. PIN_PUPDR_PULLUP(GPIOD_PIN4) | \
  634. PIN_PUPDR_PULLUP(GPIOD_PIN5) | \
  635. PIN_PUPDR_PULLUP(GPIOD_PIN6) | \
  636. PIN_PUPDR_PULLUP(GPIOD_PIN7) | \
  637. PIN_PUPDR_PULLUP(GPIOD_PIN8) | \
  638. PIN_PUPDR_PULLUP(GPIOD_PIN9) | \
  639. PIN_PUPDR_PULLUP(GPIOD_PIN10) | \
  640. PIN_PUPDR_PULLUP(GPIOD_PIN11) | \
  641. PIN_PUPDR_PULLUP(GPIOD_PIN12) | \
  642. PIN_PUPDR_PULLUP(GPIOD_PIN13) | \
  643. PIN_PUPDR_PULLUP(GPIOD_PIN14) | \
  644. PIN_PUPDR_PULLUP(GPIOD_PIN15))
  645. #define VAL_GPIOD_ODR (PIN_ODR_HIGH(GPIOD_PIN0) | \
  646. PIN_ODR_HIGH(GPIOD_PIN1) | \
  647. PIN_ODR_HIGH(GPIOD_PIN2) | \
  648. PIN_ODR_HIGH(GPIOD_PIN3) | \
  649. PIN_ODR_HIGH(GPIOD_PIN4) | \
  650. PIN_ODR_HIGH(GPIOD_PIN5) | \
  651. PIN_ODR_HIGH(GPIOD_PIN6) | \
  652. PIN_ODR_HIGH(GPIOD_PIN7) | \
  653. PIN_ODR_HIGH(GPIOD_PIN8) | \
  654. PIN_ODR_HIGH(GPIOD_PIN9) | \
  655. PIN_ODR_HIGH(GPIOD_PIN10) | \
  656. PIN_ODR_HIGH(GPIOD_PIN11) | \
  657. PIN_ODR_HIGH(GPIOD_PIN12) | \
  658. PIN_ODR_HIGH(GPIOD_PIN13) | \
  659. PIN_ODR_HIGH(GPIOD_PIN14) | \
  660. PIN_ODR_HIGH(GPIOD_PIN15))
  661. #define VAL_GPIOD_AFRL (PIN_AFIO_AF(GPIOD_PIN0, 0U) | \
  662. PIN_AFIO_AF(GPIOD_PIN1, 0U) | \
  663. PIN_AFIO_AF(GPIOD_PIN2, 0U) | \
  664. PIN_AFIO_AF(GPIOD_PIN3, 0U) | \
  665. PIN_AFIO_AF(GPIOD_PIN4, 0U) | \
  666. PIN_AFIO_AF(GPIOD_PIN5, 0U) | \
  667. PIN_AFIO_AF(GPIOD_PIN6, 0U) | \
  668. PIN_AFIO_AF(GPIOD_PIN7, 0U))
  669. #define VAL_GPIOD_AFRH (PIN_AFIO_AF(GPIOD_PIN8, 0U) | \
  670. PIN_AFIO_AF(GPIOD_PIN9, 0U) | \
  671. PIN_AFIO_AF(GPIOD_PIN10, 0U) | \
  672. PIN_AFIO_AF(GPIOD_PIN11, 0U) | \
  673. PIN_AFIO_AF(GPIOD_PIN12, 0U) | \
  674. PIN_AFIO_AF(GPIOD_PIN13, 0U) | \
  675. PIN_AFIO_AF(GPIOD_PIN14, 0U) | \
  676. PIN_AFIO_AF(GPIOD_PIN15, 0U))
  677. /*
  678. * GPIOH setup:
  679. *
  680. * PH0 - OSC_IN (input floating).
  681. * PH1 - OSC_OUT (input floating).
  682. * PH2 - PIN2 (input pullup).
  683. * PH3 - PIN3 (input pullup).
  684. * PH4 - PIN4 (input pullup).
  685. * PH5 - PIN5 (input pullup).
  686. * PH6 - PIN6 (input pullup).
  687. * PH7 - PIN7 (input pullup).
  688. * PH8 - PIN8 (input pullup).
  689. * PH9 - PIN9 (input pullup).
  690. * PH10 - PIN10 (input pullup).
  691. * PH11 - PIN11 (input pullup).
  692. * PH12 - PIN12 (input pullup).
  693. * PH13 - PIN13 (input pullup).
  694. * PH14 - PIN14 (input pullup).
  695. * PH15 - PIN15 (input pullup).
  696. */
  697. #define VAL_GPIOH_MODER (PIN_MODE_INPUT(GPIOH_OSC_IN) | \
  698. PIN_MODE_INPUT(GPIOH_OSC_OUT) | \
  699. PIN_MODE_INPUT(GPIOH_PIN2) | \
  700. PIN_MODE_INPUT(GPIOH_PIN3) | \
  701. PIN_MODE_INPUT(GPIOH_PIN4) | \
  702. PIN_MODE_INPUT(GPIOH_PIN5) | \
  703. PIN_MODE_INPUT(GPIOH_PIN6) | \
  704. PIN_MODE_INPUT(GPIOH_PIN7) | \
  705. PIN_MODE_INPUT(GPIOH_PIN8) | \
  706. PIN_MODE_INPUT(GPIOH_PIN9) | \
  707. PIN_MODE_INPUT(GPIOH_PIN10) | \
  708. PIN_MODE_INPUT(GPIOH_PIN11) | \
  709. PIN_MODE_INPUT(GPIOH_PIN12) | \
  710. PIN_MODE_INPUT(GPIOH_PIN13) | \
  711. PIN_MODE_INPUT(GPIOH_PIN14) | \
  712. PIN_MODE_INPUT(GPIOH_PIN15))
  713. #define VAL_GPIOH_OTYPER (PIN_OTYPE_PUSHPULL(GPIOH_OSC_IN) | \
  714. PIN_OTYPE_PUSHPULL(GPIOH_OSC_OUT) | \
  715. PIN_OTYPE_PUSHPULL(GPIOH_PIN2) | \
  716. PIN_OTYPE_PUSHPULL(GPIOH_PIN3) | \
  717. PIN_OTYPE_PUSHPULL(GPIOH_PIN4) | \
  718. PIN_OTYPE_PUSHPULL(GPIOH_PIN5) | \
  719. PIN_OTYPE_PUSHPULL(GPIOH_PIN6) | \
  720. PIN_OTYPE_PUSHPULL(GPIOH_PIN7) | \
  721. PIN_OTYPE_PUSHPULL(GPIOH_PIN8) | \
  722. PIN_OTYPE_PUSHPULL(GPIOH_PIN9) | \
  723. PIN_OTYPE_PUSHPULL(GPIOH_PIN10) | \
  724. PIN_OTYPE_PUSHPULL(GPIOH_PIN11) | \
  725. PIN_OTYPE_PUSHPULL(GPIOH_PIN12) | \
  726. PIN_OTYPE_PUSHPULL(GPIOH_PIN13) | \
  727. PIN_OTYPE_PUSHPULL(GPIOH_PIN14) | \
  728. PIN_OTYPE_PUSHPULL(GPIOH_PIN15))
  729. #define VAL_GPIOH_OSPEEDR (PIN_OSPEED_HIGH(GPIOH_OSC_IN) | \
  730. PIN_OSPEED_HIGH(GPIOH_OSC_OUT) | \
  731. PIN_OSPEED_HIGH(GPIOH_PIN2) | \
  732. PIN_OSPEED_HIGH(GPIOH_PIN3) | \
  733. PIN_OSPEED_HIGH(GPIOH_PIN4) | \
  734. PIN_OSPEED_HIGH(GPIOH_PIN5) | \
  735. PIN_OSPEED_HIGH(GPIOH_PIN6) | \
  736. PIN_OSPEED_HIGH(GPIOH_PIN7) | \
  737. PIN_OSPEED_HIGH(GPIOH_PIN8) | \
  738. PIN_OSPEED_HIGH(GPIOH_PIN9) | \
  739. PIN_OSPEED_HIGH(GPIOH_PIN10) | \
  740. PIN_OSPEED_HIGH(GPIOH_PIN11) | \
  741. PIN_OSPEED_HIGH(GPIOH_PIN12) | \
  742. PIN_OSPEED_HIGH(GPIOH_PIN13) | \
  743. PIN_OSPEED_HIGH(GPIOH_PIN14) | \
  744. PIN_OSPEED_HIGH(GPIOH_PIN15))
  745. #define VAL_GPIOH_PUPDR (PIN_PUPDR_FLOATING(GPIOH_OSC_IN) | \
  746. PIN_PUPDR_FLOATING(GPIOH_OSC_OUT) | \
  747. PIN_PUPDR_PULLUP(GPIOH_PIN2) | \
  748. PIN_PUPDR_PULLUP(GPIOH_PIN3) | \
  749. PIN_PUPDR_PULLUP(GPIOH_PIN4) | \
  750. PIN_PUPDR_PULLUP(GPIOH_PIN5) | \
  751. PIN_PUPDR_PULLUP(GPIOH_PIN6) | \
  752. PIN_PUPDR_PULLUP(GPIOH_PIN7) | \
  753. PIN_PUPDR_PULLUP(GPIOH_PIN8) | \
  754. PIN_PUPDR_PULLUP(GPIOH_PIN9) | \
  755. PIN_PUPDR_PULLUP(GPIOH_PIN10) | \
  756. PIN_PUPDR_PULLUP(GPIOH_PIN11) | \
  757. PIN_PUPDR_PULLUP(GPIOH_PIN12) | \
  758. PIN_PUPDR_PULLUP(GPIOH_PIN13) | \
  759. PIN_PUPDR_PULLUP(GPIOH_PIN14) | \
  760. PIN_PUPDR_PULLUP(GPIOH_PIN15))
  761. #define VAL_GPIOH_ODR (PIN_ODR_HIGH(GPIOH_OSC_IN) | \
  762. PIN_ODR_HIGH(GPIOH_OSC_OUT) | \
  763. PIN_ODR_HIGH(GPIOH_PIN2) | \
  764. PIN_ODR_HIGH(GPIOH_PIN3) | \
  765. PIN_ODR_HIGH(GPIOH_PIN4) | \
  766. PIN_ODR_HIGH(GPIOH_PIN5) | \
  767. PIN_ODR_HIGH(GPIOH_PIN6) | \
  768. PIN_ODR_HIGH(GPIOH_PIN7) | \
  769. PIN_ODR_HIGH(GPIOH_PIN8) | \
  770. PIN_ODR_HIGH(GPIOH_PIN9) | \
  771. PIN_ODR_HIGH(GPIOH_PIN10) | \
  772. PIN_ODR_HIGH(GPIOH_PIN11) | \
  773. PIN_ODR_HIGH(GPIOH_PIN12) | \
  774. PIN_ODR_HIGH(GPIOH_PIN13) | \
  775. PIN_ODR_HIGH(GPIOH_PIN14) | \
  776. PIN_ODR_HIGH(GPIOH_PIN15))
  777. #define VAL_GPIOH_AFRL (PIN_AFIO_AF(GPIOH_OSC_IN, 0U) | \
  778. PIN_AFIO_AF(GPIOH_OSC_OUT, 0U) | \
  779. PIN_AFIO_AF(GPIOH_PIN2, 0U) | \
  780. PIN_AFIO_AF(GPIOH_PIN3, 0U) | \
  781. PIN_AFIO_AF(GPIOH_PIN4, 0U) | \
  782. PIN_AFIO_AF(GPIOH_PIN5, 0U) | \
  783. PIN_AFIO_AF(GPIOH_PIN6, 0U) | \
  784. PIN_AFIO_AF(GPIOH_PIN7, 0U))
  785. #define VAL_GPIOH_AFRH (PIN_AFIO_AF(GPIOH_PIN8, 0U) | \
  786. PIN_AFIO_AF(GPIOH_PIN9, 0U) | \
  787. PIN_AFIO_AF(GPIOH_PIN10, 0U) | \
  788. PIN_AFIO_AF(GPIOH_PIN11, 0U) | \
  789. PIN_AFIO_AF(GPIOH_PIN12, 0U) | \
  790. PIN_AFIO_AF(GPIOH_PIN13, 0U) | \
  791. PIN_AFIO_AF(GPIOH_PIN14, 0U) | \
  792. PIN_AFIO_AF(GPIOH_PIN15, 0U))
  793. /*===========================================================================*/
  794. /* External declarations. */
  795. /*===========================================================================*/
  796. #if !defined(_FROM_ASM_)
  797. #ifdef __cplusplus
  798. extern "C" {
  799. #endif
  800. void boardInit(void);
  801. #ifdef __cplusplus
  802. }
  803. #endif
  804. #endif /* _FROM_ASM_ */
  805. #endif /* BOARD_H */