board.h 59 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970
  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-F070RB board.
  24. */
  25. /*
  26. * Board identifier.
  27. */
  28. #define BOARD_ST_NUCLEO64_F070RB
  29. #define BOARD_NAME "STMicroelectronics STM32 Nucleo64-F070RB"
  30. /*
  31. * Board oscillators-related settings.
  32. * NOTE: LSE not fitted.
  33. */
  34. #if !defined(STM32_LSECLK)
  35. #define STM32_LSECLK 0U
  36. #endif
  37. #define STM32_LSEDRV (3U << 3U)
  38. #if !defined(STM32_HSECLK)
  39. #define STM32_HSECLK 8000000U
  40. #endif
  41. #define STM32_HSE_BYPASS
  42. /*
  43. * MCU type as defined in the ST header.
  44. */
  45. #define STM32F070xB
  46. /*
  47. * IO pins assignments.
  48. */
  49. #define GPIOA_ARD_A0 0U
  50. #define GPIOA_ADC1_IN0 0U
  51. #define GPIOA_ARD_A1 1U
  52. #define GPIOA_ADC1_IN1 1U
  53. #define GPIOA_ARD_D1 2U
  54. #define GPIOA_USART2_TX 2U
  55. #define GPIOA_ARD_D0 3U
  56. #define GPIOA_USART2_RX 3U
  57. #define GPIOA_ARD_A2 4U
  58. #define GPIOA_ADC1_IN4 4U
  59. #define GPIOA_LED_GREEN 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_ADC1_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_ADC1_IN11 0U
  90. #define GPIOC_ARD_A4 1U
  91. #define GPIOC_ADC1_IN10 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 GPIOE_PIN0 0U
  123. #define GPIOE_PIN1 1U
  124. #define GPIOE_PIN2 2U
  125. #define GPIOE_PIN3 3U
  126. #define GPIOE_PIN4 4U
  127. #define GPIOE_PIN5 5U
  128. #define GPIOE_PIN6 6U
  129. #define GPIOE_PIN7 7U
  130. #define GPIOE_PIN8 8U
  131. #define GPIOE_PIN9 9U
  132. #define GPIOE_PIN10 10U
  133. #define GPIOE_PIN11 11U
  134. #define GPIOE_PIN12 12U
  135. #define GPIOE_PIN13 13U
  136. #define GPIOE_PIN14 14U
  137. #define GPIOE_PIN15 15U
  138. #define GPIOF_OSC_IN 0U
  139. #define GPIOF_OSC_OUT 1U
  140. #define GPIOF_PIN2 2U
  141. #define GPIOF_PIN3 3U
  142. #define GPIOF_PIN4 4U
  143. #define GPIOF_PIN5 5U
  144. #define GPIOF_PIN6 6U
  145. #define GPIOF_PIN7 7U
  146. #define GPIOF_PIN8 8U
  147. #define GPIOF_PIN9 9U
  148. #define GPIOF_PIN10 10U
  149. #define GPIOF_PIN11 11U
  150. #define GPIOF_PIN12 12U
  151. #define GPIOF_PIN13 13U
  152. #define GPIOF_PIN14 14U
  153. #define GPIOF_PIN15 15U
  154. /*
  155. * IO lines assignments.
  156. */
  157. #define LINE_ARD_A0 PAL_LINE(GPIOA, 0U)
  158. #define LINE_ADC1_IN0 PAL_LINE(GPIOA, 0U)
  159. #define LINE_ARD_A1 PAL_LINE(GPIOA, 1U)
  160. #define LINE_ADC1_IN1 PAL_LINE(GPIOA, 1U)
  161. #define LINE_ARD_D1 PAL_LINE(GPIOA, 2U)
  162. #define LINE_USART2_TX PAL_LINE(GPIOA, 2U)
  163. #define LINE_ARD_D0 PAL_LINE(GPIOA, 3U)
  164. #define LINE_USART2_RX PAL_LINE(GPIOA, 3U)
  165. #define LINE_ARD_A2 PAL_LINE(GPIOA, 4U)
  166. #define LINE_ADC1_IN4 PAL_LINE(GPIOA, 4U)
  167. #define LINE_LED_GREEN PAL_LINE(GPIOA, 5U)
  168. #define LINE_ARD_D12 PAL_LINE(GPIOA, 6U)
  169. #define LINE_ARD_D11 PAL_LINE(GPIOA, 7U)
  170. #define LINE_ARD_D7 PAL_LINE(GPIOA, 8U)
  171. #define LINE_ARD_D8 PAL_LINE(GPIOA, 9U)
  172. #define LINE_ARD_D2 PAL_LINE(GPIOA, 10U)
  173. #define LINE_SWDIO PAL_LINE(GPIOA, 13U)
  174. #define LINE_SWCLK PAL_LINE(GPIOA, 14U)
  175. #define LINE_ARD_A3 PAL_LINE(GPIOB, 0U)
  176. #define LINE_ADC1_IN8 PAL_LINE(GPIOB, 0U)
  177. #define LINE_SWO PAL_LINE(GPIOB, 3U)
  178. #define LINE_ARD_D3 PAL_LINE(GPIOB, 3U)
  179. #define LINE_ARD_D5 PAL_LINE(GPIOB, 4U)
  180. #define LINE_ARD_D4 PAL_LINE(GPIOB, 5U)
  181. #define LINE_ARD_D10 PAL_LINE(GPIOB, 6U)
  182. #define LINE_ARD_D15 PAL_LINE(GPIOB, 8U)
  183. #define LINE_ARD_D14 PAL_LINE(GPIOB, 9U)
  184. #define LINE_ARD_D6 PAL_LINE(GPIOB, 10U)
  185. #define LINE_ARD_A5 PAL_LINE(GPIOC, 0U)
  186. #define LINE_ADC1_IN11 PAL_LINE(GPIOC, 0U)
  187. #define LINE_ARD_A4 PAL_LINE(GPIOC, 1U)
  188. #define LINE_ADC1_IN10 PAL_LINE(GPIOC, 1U)
  189. #define LINE_ARD_D9 PAL_LINE(GPIOC, 7U)
  190. #define LINE_BUTTON PAL_LINE(GPIOC, 13U)
  191. #define LINE_OSC32_IN PAL_LINE(GPIOC, 14U)
  192. #define LINE_OSC32_OUT PAL_LINE(GPIOC, 15U)
  193. #define LINE_OSC_IN PAL_LINE(GPIOF, 0U)
  194. #define LINE_OSC_OUT PAL_LINE(GPIOF, 1U)
  195. /*===========================================================================*/
  196. /* Driver pre-compile time settings. */
  197. /*===========================================================================*/
  198. /*===========================================================================*/
  199. /* Derived constants and error checks. */
  200. /*===========================================================================*/
  201. /*===========================================================================*/
  202. /* Driver data structures and types. */
  203. /*===========================================================================*/
  204. /*===========================================================================*/
  205. /* Driver macros. */
  206. /*===========================================================================*/
  207. /*
  208. * I/O ports initial setup, this configuration is established soon after reset
  209. * in the initialization code.
  210. * Please refer to the STM32 Reference Manual for details.
  211. */
  212. #define PIN_MODE_INPUT(n) (0U << ((n) * 2U))
  213. #define PIN_MODE_OUTPUT(n) (1U << ((n) * 2U))
  214. #define PIN_MODE_ALTERNATE(n) (2U << ((n) * 2U))
  215. #define PIN_MODE_ANALOG(n) (3U << ((n) * 2U))
  216. #define PIN_ODR_LOW(n) (0U << (n))
  217. #define PIN_ODR_HIGH(n) (1U << (n))
  218. #define PIN_OTYPE_PUSHPULL(n) (0U << (n))
  219. #define PIN_OTYPE_OPENDRAIN(n) (1U << (n))
  220. #define PIN_OSPEED_VERYLOW(n) (0U << ((n) * 2U))
  221. #define PIN_OSPEED_LOW(n) (1U << ((n) * 2U))
  222. #define PIN_OSPEED_MEDIUM(n) (2U << ((n) * 2U))
  223. #define PIN_OSPEED_HIGH(n) (3U << ((n) * 2U))
  224. #define PIN_PUPDR_FLOATING(n) (0U << ((n) * 2U))
  225. #define PIN_PUPDR_PULLUP(n) (1U << ((n) * 2U))
  226. #define PIN_PUPDR_PULLDOWN(n) (2U << ((n) * 2U))
  227. #define PIN_AFIO_AF(n, v) ((v) << (((n) % 8U) * 4U))
  228. /*
  229. * GPIOA setup:
  230. *
  231. * PA0 - ARD_A0 ADC1_IN0 (input pullup).
  232. * PA1 - ARD_A1 ADC1_IN1 (input pullup).
  233. * PA2 - ARD_D1 USART2_TX (alternate 1).
  234. * PA3 - ARD_D0 USART2_RX (alternate 1).
  235. * PA4 - ARD_A2 ADC1_IN4 (input pullup).
  236. * PA5 - LED_GREEN (output pushpull high).
  237. * PA6 - ARD_D12 (input pullup).
  238. * PA7 - ARD_D11 (input pullup).
  239. * PA8 - ARD_D7 (input pullup).
  240. * PA9 - ARD_D8 (input pullup).
  241. * PA10 - ARD_D2 (input pullup).
  242. * PA11 - PIN11 (input pullup).
  243. * PA12 - PIN12 (input pullup).
  244. * PA13 - SWDIO (alternate 0).
  245. * PA14 - SWCLK (alternate 0).
  246. * PA15 - PIN15 (input pullup).
  247. */
  248. #define VAL_GPIOA_MODER (PIN_MODE_INPUT(GPIOA_ARD_A0) | \
  249. PIN_MODE_INPUT(GPIOA_ARD_A1) | \
  250. PIN_MODE_ALTERNATE(GPIOA_ARD_D1) | \
  251. PIN_MODE_ALTERNATE(GPIOA_ARD_D0) | \
  252. PIN_MODE_INPUT(GPIOA_ARD_A2) | \
  253. PIN_MODE_OUTPUT(GPIOA_LED_GREEN) | \
  254. PIN_MODE_INPUT(GPIOA_ARD_D12) | \
  255. PIN_MODE_INPUT(GPIOA_ARD_D11) | \
  256. PIN_MODE_INPUT(GPIOA_ARD_D7) | \
  257. PIN_MODE_INPUT(GPIOA_ARD_D8) | \
  258. PIN_MODE_INPUT(GPIOA_ARD_D2) | \
  259. PIN_MODE_INPUT(GPIOA_PIN11) | \
  260. PIN_MODE_INPUT(GPIOA_PIN12) | \
  261. PIN_MODE_ALTERNATE(GPIOA_SWDIO) | \
  262. PIN_MODE_ALTERNATE(GPIOA_SWCLK) | \
  263. PIN_MODE_INPUT(GPIOA_PIN15))
  264. #define VAL_GPIOA_OTYPER (PIN_OTYPE_PUSHPULL(GPIOA_ARD_A0) | \
  265. PIN_OTYPE_PUSHPULL(GPIOA_ARD_A1) | \
  266. PIN_OTYPE_PUSHPULL(GPIOA_ARD_D1) | \
  267. PIN_OTYPE_PUSHPULL(GPIOA_ARD_D0) | \
  268. PIN_OTYPE_PUSHPULL(GPIOA_ARD_A2) | \
  269. PIN_OTYPE_PUSHPULL(GPIOA_LED_GREEN) | \
  270. PIN_OTYPE_PUSHPULL(GPIOA_ARD_D12) | \
  271. PIN_OTYPE_PUSHPULL(GPIOA_ARD_D11) | \
  272. PIN_OTYPE_PUSHPULL(GPIOA_ARD_D7) | \
  273. PIN_OTYPE_PUSHPULL(GPIOA_ARD_D8) | \
  274. PIN_OTYPE_PUSHPULL(GPIOA_ARD_D2) | \
  275. PIN_OTYPE_PUSHPULL(GPIOA_PIN11) | \
  276. PIN_OTYPE_PUSHPULL(GPIOA_PIN12) | \
  277. PIN_OTYPE_PUSHPULL(GPIOA_SWDIO) | \
  278. PIN_OTYPE_PUSHPULL(GPIOA_SWCLK) | \
  279. PIN_OTYPE_PUSHPULL(GPIOA_PIN15))
  280. #define VAL_GPIOA_OSPEEDR (PIN_OSPEED_HIGH(GPIOA_ARD_A0) | \
  281. PIN_OSPEED_HIGH(GPIOA_ARD_A1) | \
  282. PIN_OSPEED_LOW(GPIOA_ARD_D1) | \
  283. PIN_OSPEED_LOW(GPIOA_ARD_D0) | \
  284. PIN_OSPEED_HIGH(GPIOA_ARD_A2) | \
  285. PIN_OSPEED_LOW(GPIOA_LED_GREEN) | \
  286. PIN_OSPEED_HIGH(GPIOA_ARD_D12) | \
  287. PIN_OSPEED_HIGH(GPIOA_ARD_D11) | \
  288. PIN_OSPEED_HIGH(GPIOA_ARD_D7) | \
  289. PIN_OSPEED_HIGH(GPIOA_ARD_D8) | \
  290. PIN_OSPEED_HIGH(GPIOA_ARD_D2) | \
  291. PIN_OSPEED_HIGH(GPIOA_PIN11) | \
  292. PIN_OSPEED_HIGH(GPIOA_PIN12) | \
  293. PIN_OSPEED_HIGH(GPIOA_SWDIO) | \
  294. PIN_OSPEED_HIGH(GPIOA_SWCLK) | \
  295. PIN_OSPEED_HIGH(GPIOA_PIN15))
  296. #define VAL_GPIOA_PUPDR (PIN_PUPDR_PULLUP(GPIOA_ARD_A0) | \
  297. PIN_PUPDR_PULLUP(GPIOA_ARD_A1) | \
  298. PIN_PUPDR_FLOATING(GPIOA_ARD_D1) | \
  299. PIN_PUPDR_FLOATING(GPIOA_ARD_D0) | \
  300. PIN_PUPDR_PULLUP(GPIOA_ARD_A2) | \
  301. PIN_PUPDR_FLOATING(GPIOA_LED_GREEN) | \
  302. PIN_PUPDR_PULLUP(GPIOA_ARD_D12) | \
  303. PIN_PUPDR_PULLUP(GPIOA_ARD_D11) | \
  304. PIN_PUPDR_PULLUP(GPIOA_ARD_D7) | \
  305. PIN_PUPDR_PULLUP(GPIOA_ARD_D8) | \
  306. PIN_PUPDR_PULLUP(GPIOA_ARD_D2) | \
  307. PIN_PUPDR_PULLUP(GPIOA_PIN11) | \
  308. PIN_PUPDR_PULLUP(GPIOA_PIN12) | \
  309. PIN_PUPDR_PULLUP(GPIOA_SWDIO) | \
  310. PIN_PUPDR_PULLDOWN(GPIOA_SWCLK) | \
  311. PIN_PUPDR_PULLUP(GPIOA_PIN15))
  312. #define VAL_GPIOA_ODR (PIN_ODR_HIGH(GPIOA_ARD_A0) | \
  313. PIN_ODR_HIGH(GPIOA_ARD_A1) | \
  314. PIN_ODR_HIGH(GPIOA_ARD_D1) | \
  315. PIN_ODR_HIGH(GPIOA_ARD_D0) | \
  316. PIN_ODR_HIGH(GPIOA_ARD_A2) | \
  317. PIN_ODR_LOW(GPIOA_LED_GREEN) | \
  318. PIN_ODR_HIGH(GPIOA_ARD_D12) | \
  319. PIN_ODR_HIGH(GPIOA_ARD_D11) | \
  320. PIN_ODR_HIGH(GPIOA_ARD_D7) | \
  321. PIN_ODR_HIGH(GPIOA_ARD_D8) | \
  322. PIN_ODR_HIGH(GPIOA_ARD_D2) | \
  323. PIN_ODR_HIGH(GPIOA_PIN11) | \
  324. PIN_ODR_HIGH(GPIOA_PIN12) | \
  325. PIN_ODR_HIGH(GPIOA_SWDIO) | \
  326. PIN_ODR_HIGH(GPIOA_SWCLK) | \
  327. PIN_ODR_HIGH(GPIOA_PIN15))
  328. #define VAL_GPIOA_AFRL (PIN_AFIO_AF(GPIOA_ARD_A0, 0U) | \
  329. PIN_AFIO_AF(GPIOA_ARD_A1, 0U) | \
  330. PIN_AFIO_AF(GPIOA_ARD_D1, 1U) | \
  331. PIN_AFIO_AF(GPIOA_ARD_D0, 1U) | \
  332. PIN_AFIO_AF(GPIOA_ARD_A2, 0U) | \
  333. PIN_AFIO_AF(GPIOA_LED_GREEN, 0U) | \
  334. PIN_AFIO_AF(GPIOA_ARD_D12, 0U) | \
  335. PIN_AFIO_AF(GPIOA_ARD_D11, 0U))
  336. #define VAL_GPIOA_AFRH (PIN_AFIO_AF(GPIOA_ARD_D7, 0U) | \
  337. PIN_AFIO_AF(GPIOA_ARD_D8, 0U) | \
  338. PIN_AFIO_AF(GPIOA_ARD_D2, 0U) | \
  339. PIN_AFIO_AF(GPIOA_PIN11, 0U) | \
  340. PIN_AFIO_AF(GPIOA_PIN12, 0U) | \
  341. PIN_AFIO_AF(GPIOA_SWDIO, 0U) | \
  342. PIN_AFIO_AF(GPIOA_SWCLK, 0U) | \
  343. PIN_AFIO_AF(GPIOA_PIN15, 0U))
  344. /*
  345. * GPIOB setup:
  346. *
  347. * PB0 - ARD_A3 ADC1_IN8 (input pullup).
  348. * PB1 - PIN1 (input pullup).
  349. * PB2 - PIN2 (input pullup).
  350. * PB3 - SWO ARD_D3 (alternate 0).
  351. * PB4 - ARD_D5 (input pullup).
  352. * PB5 - ARD_D4 (input pullup).
  353. * PB6 - ARD_D10 (input pullup).
  354. * PB7 - PIN7 (input pullup).
  355. * PB8 - ARD_D15 (input pullup).
  356. * PB9 - ARD_D14 (input pullup).
  357. * PB10 - ARD_D6 (input pullup).
  358. * PB11 - PIN11 (input pullup).
  359. * PB12 - PIN12 (input pullup).
  360. * PB13 - PIN13 (input pullup).
  361. * PB14 - PIN14 (input pullup).
  362. * PB15 - PIN15 (input pullup).
  363. */
  364. #define VAL_GPIOB_MODER (PIN_MODE_INPUT(GPIOB_ARD_A3) | \
  365. PIN_MODE_INPUT(GPIOB_PIN1) | \
  366. PIN_MODE_INPUT(GPIOB_PIN2) | \
  367. PIN_MODE_ALTERNATE(GPIOB_SWO) | \
  368. PIN_MODE_INPUT(GPIOB_ARD_D5) | \
  369. PIN_MODE_INPUT(GPIOB_ARD_D4) | \
  370. PIN_MODE_INPUT(GPIOB_ARD_D10) | \
  371. PIN_MODE_INPUT(GPIOB_PIN7) | \
  372. PIN_MODE_INPUT(GPIOB_ARD_D15) | \
  373. PIN_MODE_INPUT(GPIOB_ARD_D14) | \
  374. PIN_MODE_INPUT(GPIOB_ARD_D6) | \
  375. PIN_MODE_INPUT(GPIOB_PIN11) | \
  376. PIN_MODE_INPUT(GPIOB_PIN12) | \
  377. PIN_MODE_INPUT(GPIOB_PIN13) | \
  378. PIN_MODE_INPUT(GPIOB_PIN14) | \
  379. PIN_MODE_INPUT(GPIOB_PIN15))
  380. #define VAL_GPIOB_OTYPER (PIN_OTYPE_PUSHPULL(GPIOB_ARD_A3) | \
  381. PIN_OTYPE_PUSHPULL(GPIOB_PIN1) | \
  382. PIN_OTYPE_PUSHPULL(GPIOB_PIN2) | \
  383. PIN_OTYPE_PUSHPULL(GPIOB_SWO) | \
  384. PIN_OTYPE_PUSHPULL(GPIOB_ARD_D5) | \
  385. PIN_OTYPE_PUSHPULL(GPIOB_ARD_D4) | \
  386. PIN_OTYPE_PUSHPULL(GPIOB_ARD_D10) | \
  387. PIN_OTYPE_PUSHPULL(GPIOB_PIN7) | \
  388. PIN_OTYPE_PUSHPULL(GPIOB_ARD_D15) | \
  389. PIN_OTYPE_PUSHPULL(GPIOB_ARD_D14) | \
  390. PIN_OTYPE_PUSHPULL(GPIOB_ARD_D6) | \
  391. PIN_OTYPE_PUSHPULL(GPIOB_PIN11) | \
  392. PIN_OTYPE_PUSHPULL(GPIOB_PIN12) | \
  393. PIN_OTYPE_PUSHPULL(GPIOB_PIN13) | \
  394. PIN_OTYPE_PUSHPULL(GPIOB_PIN14) | \
  395. PIN_OTYPE_PUSHPULL(GPIOB_PIN15))
  396. #define VAL_GPIOB_OSPEEDR (PIN_OSPEED_HIGH(GPIOB_ARD_A3) | \
  397. PIN_OSPEED_HIGH(GPIOB_PIN1) | \
  398. PIN_OSPEED_HIGH(GPIOB_PIN2) | \
  399. PIN_OSPEED_HIGH(GPIOB_SWO) | \
  400. PIN_OSPEED_HIGH(GPIOB_ARD_D5) | \
  401. PIN_OSPEED_HIGH(GPIOB_ARD_D4) | \
  402. PIN_OSPEED_HIGH(GPIOB_ARD_D10) | \
  403. PIN_OSPEED_HIGH(GPIOB_PIN7) | \
  404. PIN_OSPEED_HIGH(GPIOB_ARD_D15) | \
  405. PIN_OSPEED_HIGH(GPIOB_ARD_D14) | \
  406. PIN_OSPEED_HIGH(GPIOB_ARD_D6) | \
  407. PIN_OSPEED_HIGH(GPIOB_PIN11) | \
  408. PIN_OSPEED_HIGH(GPIOB_PIN12) | \
  409. PIN_OSPEED_HIGH(GPIOB_PIN13) | \
  410. PIN_OSPEED_HIGH(GPIOB_PIN14) | \
  411. PIN_OSPEED_HIGH(GPIOB_PIN15))
  412. #define VAL_GPIOB_PUPDR (PIN_PUPDR_PULLUP(GPIOB_ARD_A3) | \
  413. PIN_PUPDR_PULLUP(GPIOB_PIN1) | \
  414. PIN_PUPDR_PULLUP(GPIOB_PIN2) | \
  415. PIN_PUPDR_PULLUP(GPIOB_SWO) | \
  416. PIN_PUPDR_PULLUP(GPIOB_ARD_D5) | \
  417. PIN_PUPDR_PULLUP(GPIOB_ARD_D4) | \
  418. PIN_PUPDR_PULLUP(GPIOB_ARD_D10) | \
  419. PIN_PUPDR_PULLUP(GPIOB_PIN7) | \
  420. PIN_PUPDR_PULLUP(GPIOB_ARD_D15) | \
  421. PIN_PUPDR_PULLUP(GPIOB_ARD_D14) | \
  422. PIN_PUPDR_PULLUP(GPIOB_ARD_D6) | \
  423. PIN_PUPDR_PULLUP(GPIOB_PIN11) | \
  424. PIN_PUPDR_PULLUP(GPIOB_PIN12) | \
  425. PIN_PUPDR_PULLUP(GPIOB_PIN13) | \
  426. PIN_PUPDR_PULLUP(GPIOB_PIN14) | \
  427. PIN_PUPDR_PULLUP(GPIOB_PIN15))
  428. #define VAL_GPIOB_ODR (PIN_ODR_HIGH(GPIOB_ARD_A3) | \
  429. PIN_ODR_HIGH(GPIOB_PIN1) | \
  430. PIN_ODR_HIGH(GPIOB_PIN2) | \
  431. PIN_ODR_HIGH(GPIOB_SWO) | \
  432. PIN_ODR_HIGH(GPIOB_ARD_D5) | \
  433. PIN_ODR_HIGH(GPIOB_ARD_D4) | \
  434. PIN_ODR_HIGH(GPIOB_ARD_D10) | \
  435. PIN_ODR_HIGH(GPIOB_PIN7) | \
  436. PIN_ODR_HIGH(GPIOB_ARD_D15) | \
  437. PIN_ODR_HIGH(GPIOB_ARD_D14) | \
  438. PIN_ODR_HIGH(GPIOB_ARD_D6) | \
  439. PIN_ODR_HIGH(GPIOB_PIN11) | \
  440. PIN_ODR_HIGH(GPIOB_PIN12) | \
  441. PIN_ODR_HIGH(GPIOB_PIN13) | \
  442. PIN_ODR_HIGH(GPIOB_PIN14) | \
  443. PIN_ODR_HIGH(GPIOB_PIN15))
  444. #define VAL_GPIOB_AFRL (PIN_AFIO_AF(GPIOB_ARD_A3, 0U) | \
  445. PIN_AFIO_AF(GPIOB_PIN1, 0U) | \
  446. PIN_AFIO_AF(GPIOB_PIN2, 0U) | \
  447. PIN_AFIO_AF(GPIOB_SWO, 0U) | \
  448. PIN_AFIO_AF(GPIOB_ARD_D5, 0U) | \
  449. PIN_AFIO_AF(GPIOB_ARD_D4, 0U) | \
  450. PIN_AFIO_AF(GPIOB_ARD_D10, 0U) | \
  451. PIN_AFIO_AF(GPIOB_PIN7, 0U))
  452. #define VAL_GPIOB_AFRH (PIN_AFIO_AF(GPIOB_ARD_D15, 0U) | \
  453. PIN_AFIO_AF(GPIOB_ARD_D14, 0U) | \
  454. PIN_AFIO_AF(GPIOB_ARD_D6, 0U) | \
  455. PIN_AFIO_AF(GPIOB_PIN11, 0U) | \
  456. PIN_AFIO_AF(GPIOB_PIN12, 0U) | \
  457. PIN_AFIO_AF(GPIOB_PIN13, 0U) | \
  458. PIN_AFIO_AF(GPIOB_PIN14, 0U) | \
  459. PIN_AFIO_AF(GPIOB_PIN15, 0U))
  460. /*
  461. * GPIOC setup:
  462. *
  463. * PC0 - ARD_A5 ADC1_IN11 (input pullup).
  464. * PC1 - ARD_A4 ADC1_IN10 (input pullup).
  465. * PC2 - PIN2 (input pullup).
  466. * PC3 - PIN3 (input pullup).
  467. * PC4 - PIN4 (input pullup).
  468. * PC5 - PIN5 (input pullup).
  469. * PC6 - PIN6 (input pullup).
  470. * PC7 - ARD_D9 (input pullup).
  471. * PC8 - PIN8 (input pullup).
  472. * PC9 - PIN9 (input pullup).
  473. * PC10 - PIN10 (input pullup).
  474. * PC11 - PIN11 (input pullup).
  475. * PC12 - PIN12 (input pullup).
  476. * PC13 - BUTTON (input floating).
  477. * PC14 - OSC32_IN (input floating).
  478. * PC15 - OSC32_OUT (input floating).
  479. */
  480. #define VAL_GPIOC_MODER (PIN_MODE_INPUT(GPIOC_ARD_A5) | \
  481. PIN_MODE_INPUT(GPIOC_ARD_A4) | \
  482. PIN_MODE_INPUT(GPIOC_PIN2) | \
  483. PIN_MODE_INPUT(GPIOC_PIN3) | \
  484. PIN_MODE_INPUT(GPIOC_PIN4) | \
  485. PIN_MODE_INPUT(GPIOC_PIN5) | \
  486. PIN_MODE_INPUT(GPIOC_PIN6) | \
  487. PIN_MODE_INPUT(GPIOC_ARD_D9) | \
  488. PIN_MODE_INPUT(GPIOC_PIN8) | \
  489. PIN_MODE_INPUT(GPIOC_PIN9) | \
  490. PIN_MODE_INPUT(GPIOC_PIN10) | \
  491. PIN_MODE_INPUT(GPIOC_PIN11) | \
  492. PIN_MODE_INPUT(GPIOC_PIN12) | \
  493. PIN_MODE_INPUT(GPIOC_BUTTON) | \
  494. PIN_MODE_INPUT(GPIOC_OSC32_IN) | \
  495. PIN_MODE_INPUT(GPIOC_OSC32_OUT))
  496. #define VAL_GPIOC_OTYPER (PIN_OTYPE_PUSHPULL(GPIOC_ARD_A5) | \
  497. PIN_OTYPE_PUSHPULL(GPIOC_ARD_A4) | \
  498. PIN_OTYPE_PUSHPULL(GPIOC_PIN2) | \
  499. PIN_OTYPE_PUSHPULL(GPIOC_PIN3) | \
  500. PIN_OTYPE_PUSHPULL(GPIOC_PIN4) | \
  501. PIN_OTYPE_PUSHPULL(GPIOC_PIN5) | \
  502. PIN_OTYPE_PUSHPULL(GPIOC_PIN6) | \
  503. PIN_OTYPE_PUSHPULL(GPIOC_ARD_D9) | \
  504. PIN_OTYPE_PUSHPULL(GPIOC_PIN8) | \
  505. PIN_OTYPE_PUSHPULL(GPIOC_PIN9) | \
  506. PIN_OTYPE_PUSHPULL(GPIOC_PIN10) | \
  507. PIN_OTYPE_PUSHPULL(GPIOC_PIN11) | \
  508. PIN_OTYPE_PUSHPULL(GPIOC_PIN12) | \
  509. PIN_OTYPE_PUSHPULL(GPIOC_BUTTON) | \
  510. PIN_OTYPE_PUSHPULL(GPIOC_OSC32_IN) | \
  511. PIN_OTYPE_PUSHPULL(GPIOC_OSC32_OUT))
  512. #define VAL_GPIOC_OSPEEDR (PIN_OSPEED_HIGH(GPIOC_ARD_A5) | \
  513. PIN_OSPEED_HIGH(GPIOC_ARD_A4) | \
  514. PIN_OSPEED_HIGH(GPIOC_PIN2) | \
  515. PIN_OSPEED_HIGH(GPIOC_PIN3) | \
  516. PIN_OSPEED_HIGH(GPIOC_PIN4) | \
  517. PIN_OSPEED_HIGH(GPIOC_PIN5) | \
  518. PIN_OSPEED_HIGH(GPIOC_PIN6) | \
  519. PIN_OSPEED_HIGH(GPIOC_ARD_D9) | \
  520. PIN_OSPEED_HIGH(GPIOC_PIN8) | \
  521. PIN_OSPEED_HIGH(GPIOC_PIN9) | \
  522. PIN_OSPEED_HIGH(GPIOC_PIN10) | \
  523. PIN_OSPEED_HIGH(GPIOC_PIN11) | \
  524. PIN_OSPEED_HIGH(GPIOC_PIN12) | \
  525. PIN_OSPEED_HIGH(GPIOC_BUTTON) | \
  526. PIN_OSPEED_HIGH(GPIOC_OSC32_IN) | \
  527. PIN_OSPEED_HIGH(GPIOC_OSC32_OUT))
  528. #define VAL_GPIOC_PUPDR (PIN_PUPDR_PULLUP(GPIOC_ARD_A5) | \
  529. PIN_PUPDR_PULLUP(GPIOC_ARD_A4) | \
  530. PIN_PUPDR_PULLUP(GPIOC_PIN2) | \
  531. PIN_PUPDR_PULLUP(GPIOC_PIN3) | \
  532. PIN_PUPDR_PULLUP(GPIOC_PIN4) | \
  533. PIN_PUPDR_PULLUP(GPIOC_PIN5) | \
  534. PIN_PUPDR_PULLUP(GPIOC_PIN6) | \
  535. PIN_PUPDR_PULLUP(GPIOC_ARD_D9) | \
  536. PIN_PUPDR_PULLUP(GPIOC_PIN8) | \
  537. PIN_PUPDR_PULLUP(GPIOC_PIN9) | \
  538. PIN_PUPDR_PULLUP(GPIOC_PIN10) | \
  539. PIN_PUPDR_PULLUP(GPIOC_PIN11) | \
  540. PIN_PUPDR_PULLUP(GPIOC_PIN12) | \
  541. PIN_PUPDR_FLOATING(GPIOC_BUTTON) | \
  542. PIN_PUPDR_FLOATING(GPIOC_OSC32_IN) | \
  543. PIN_PUPDR_FLOATING(GPIOC_OSC32_OUT))
  544. #define VAL_GPIOC_ODR (PIN_ODR_HIGH(GPIOC_ARD_A5) | \
  545. PIN_ODR_HIGH(GPIOC_ARD_A4) | \
  546. PIN_ODR_HIGH(GPIOC_PIN2) | \
  547. PIN_ODR_HIGH(GPIOC_PIN3) | \
  548. PIN_ODR_HIGH(GPIOC_PIN4) | \
  549. PIN_ODR_HIGH(GPIOC_PIN5) | \
  550. PIN_ODR_HIGH(GPIOC_PIN6) | \
  551. PIN_ODR_HIGH(GPIOC_ARD_D9) | \
  552. PIN_ODR_HIGH(GPIOC_PIN8) | \
  553. PIN_ODR_HIGH(GPIOC_PIN9) | \
  554. PIN_ODR_HIGH(GPIOC_PIN10) | \
  555. PIN_ODR_HIGH(GPIOC_PIN11) | \
  556. PIN_ODR_HIGH(GPIOC_PIN12) | \
  557. PIN_ODR_HIGH(GPIOC_BUTTON) | \
  558. PIN_ODR_HIGH(GPIOC_OSC32_IN) | \
  559. PIN_ODR_HIGH(GPIOC_OSC32_OUT))
  560. #define VAL_GPIOC_AFRL (PIN_AFIO_AF(GPIOC_ARD_A5, 0U) | \
  561. PIN_AFIO_AF(GPIOC_ARD_A4, 0U) | \
  562. PIN_AFIO_AF(GPIOC_PIN2, 0U) | \
  563. PIN_AFIO_AF(GPIOC_PIN3, 0U) | \
  564. PIN_AFIO_AF(GPIOC_PIN4, 0U) | \
  565. PIN_AFIO_AF(GPIOC_PIN5, 0U) | \
  566. PIN_AFIO_AF(GPIOC_PIN6, 0U) | \
  567. PIN_AFIO_AF(GPIOC_ARD_D9, 0U))
  568. #define VAL_GPIOC_AFRH (PIN_AFIO_AF(GPIOC_PIN8, 0U) | \
  569. PIN_AFIO_AF(GPIOC_PIN9, 0U) | \
  570. PIN_AFIO_AF(GPIOC_PIN10, 0U) | \
  571. PIN_AFIO_AF(GPIOC_PIN11, 0U) | \
  572. PIN_AFIO_AF(GPIOC_PIN12, 0U) | \
  573. PIN_AFIO_AF(GPIOC_BUTTON, 0U) | \
  574. PIN_AFIO_AF(GPIOC_OSC32_IN, 0U) | \
  575. PIN_AFIO_AF(GPIOC_OSC32_OUT, 0U))
  576. /*
  577. * GPIOD setup:
  578. *
  579. * PD0 - PIN0 (input pullup).
  580. * PD1 - PIN1 (input pullup).
  581. * PD2 - PIN2 (input pullup).
  582. * PD3 - PIN3 (input pullup).
  583. * PD4 - PIN4 (input pullup).
  584. * PD5 - PIN5 (input pullup).
  585. * PD6 - PIN6 (input pullup).
  586. * PD7 - PIN7 (input pullup).
  587. * PD8 - PIN8 (input pullup).
  588. * PD9 - PIN9 (input pullup).
  589. * PD10 - PIN10 (input pullup).
  590. * PD11 - PIN11 (input pullup).
  591. * PD12 - PIN12 (input pullup).
  592. * PD13 - PIN13 (input pullup).
  593. * PD14 - PIN14 (input pullup).
  594. * PD15 - PIN15 (input pullup).
  595. */
  596. #define VAL_GPIOD_MODER (PIN_MODE_INPUT(GPIOD_PIN0) | \
  597. PIN_MODE_INPUT(GPIOD_PIN1) | \
  598. PIN_MODE_INPUT(GPIOD_PIN2) | \
  599. PIN_MODE_INPUT(GPIOD_PIN3) | \
  600. PIN_MODE_INPUT(GPIOD_PIN4) | \
  601. PIN_MODE_INPUT(GPIOD_PIN5) | \
  602. PIN_MODE_INPUT(GPIOD_PIN6) | \
  603. PIN_MODE_INPUT(GPIOD_PIN7) | \
  604. PIN_MODE_INPUT(GPIOD_PIN8) | \
  605. PIN_MODE_INPUT(GPIOD_PIN9) | \
  606. PIN_MODE_INPUT(GPIOD_PIN10) | \
  607. PIN_MODE_INPUT(GPIOD_PIN11) | \
  608. PIN_MODE_INPUT(GPIOD_PIN12) | \
  609. PIN_MODE_INPUT(GPIOD_PIN13) | \
  610. PIN_MODE_INPUT(GPIOD_PIN14) | \
  611. PIN_MODE_INPUT(GPIOD_PIN15))
  612. #define VAL_GPIOD_OTYPER (PIN_OTYPE_PUSHPULL(GPIOD_PIN0) | \
  613. PIN_OTYPE_PUSHPULL(GPIOD_PIN1) | \
  614. PIN_OTYPE_PUSHPULL(GPIOD_PIN2) | \
  615. PIN_OTYPE_PUSHPULL(GPIOD_PIN3) | \
  616. PIN_OTYPE_PUSHPULL(GPIOD_PIN4) | \
  617. PIN_OTYPE_PUSHPULL(GPIOD_PIN5) | \
  618. PIN_OTYPE_PUSHPULL(GPIOD_PIN6) | \
  619. PIN_OTYPE_PUSHPULL(GPIOD_PIN7) | \
  620. PIN_OTYPE_PUSHPULL(GPIOD_PIN8) | \
  621. PIN_OTYPE_PUSHPULL(GPIOD_PIN9) | \
  622. PIN_OTYPE_PUSHPULL(GPIOD_PIN10) | \
  623. PIN_OTYPE_PUSHPULL(GPIOD_PIN11) | \
  624. PIN_OTYPE_PUSHPULL(GPIOD_PIN12) | \
  625. PIN_OTYPE_PUSHPULL(GPIOD_PIN13) | \
  626. PIN_OTYPE_PUSHPULL(GPIOD_PIN14) | \
  627. PIN_OTYPE_PUSHPULL(GPIOD_PIN15))
  628. #define VAL_GPIOD_OSPEEDR (PIN_OSPEED_HIGH(GPIOD_PIN0) | \
  629. PIN_OSPEED_HIGH(GPIOD_PIN1) | \
  630. PIN_OSPEED_HIGH(GPIOD_PIN2) | \
  631. PIN_OSPEED_HIGH(GPIOD_PIN3) | \
  632. PIN_OSPEED_HIGH(GPIOD_PIN4) | \
  633. PIN_OSPEED_HIGH(GPIOD_PIN5) | \
  634. PIN_OSPEED_HIGH(GPIOD_PIN6) | \
  635. PIN_OSPEED_HIGH(GPIOD_PIN7) | \
  636. PIN_OSPEED_HIGH(GPIOD_PIN8) | \
  637. PIN_OSPEED_HIGH(GPIOD_PIN9) | \
  638. PIN_OSPEED_HIGH(GPIOD_PIN10) | \
  639. PIN_OSPEED_HIGH(GPIOD_PIN11) | \
  640. PIN_OSPEED_HIGH(GPIOD_PIN12) | \
  641. PIN_OSPEED_HIGH(GPIOD_PIN13) | \
  642. PIN_OSPEED_HIGH(GPIOD_PIN14) | \
  643. PIN_OSPEED_HIGH(GPIOD_PIN15))
  644. #define VAL_GPIOD_PUPDR (PIN_PUPDR_PULLUP(GPIOD_PIN0) | \
  645. PIN_PUPDR_PULLUP(GPIOD_PIN1) | \
  646. PIN_PUPDR_PULLUP(GPIOD_PIN2) | \
  647. PIN_PUPDR_PULLUP(GPIOD_PIN3) | \
  648. PIN_PUPDR_PULLUP(GPIOD_PIN4) | \
  649. PIN_PUPDR_PULLUP(GPIOD_PIN5) | \
  650. PIN_PUPDR_PULLUP(GPIOD_PIN6) | \
  651. PIN_PUPDR_PULLUP(GPIOD_PIN7) | \
  652. PIN_PUPDR_PULLUP(GPIOD_PIN8) | \
  653. PIN_PUPDR_PULLUP(GPIOD_PIN9) | \
  654. PIN_PUPDR_PULLUP(GPIOD_PIN10) | \
  655. PIN_PUPDR_PULLUP(GPIOD_PIN11) | \
  656. PIN_PUPDR_PULLUP(GPIOD_PIN12) | \
  657. PIN_PUPDR_PULLUP(GPIOD_PIN13) | \
  658. PIN_PUPDR_PULLUP(GPIOD_PIN14) | \
  659. PIN_PUPDR_PULLUP(GPIOD_PIN15))
  660. #define VAL_GPIOD_ODR (PIN_ODR_HIGH(GPIOD_PIN0) | \
  661. PIN_ODR_HIGH(GPIOD_PIN1) | \
  662. PIN_ODR_HIGH(GPIOD_PIN2) | \
  663. PIN_ODR_HIGH(GPIOD_PIN3) | \
  664. PIN_ODR_HIGH(GPIOD_PIN4) | \
  665. PIN_ODR_HIGH(GPIOD_PIN5) | \
  666. PIN_ODR_HIGH(GPIOD_PIN6) | \
  667. PIN_ODR_HIGH(GPIOD_PIN7) | \
  668. PIN_ODR_HIGH(GPIOD_PIN8) | \
  669. PIN_ODR_HIGH(GPIOD_PIN9) | \
  670. PIN_ODR_HIGH(GPIOD_PIN10) | \
  671. PIN_ODR_HIGH(GPIOD_PIN11) | \
  672. PIN_ODR_HIGH(GPIOD_PIN12) | \
  673. PIN_ODR_HIGH(GPIOD_PIN13) | \
  674. PIN_ODR_HIGH(GPIOD_PIN14) | \
  675. PIN_ODR_HIGH(GPIOD_PIN15))
  676. #define VAL_GPIOD_AFRL (PIN_AFIO_AF(GPIOD_PIN0, 0U) | \
  677. PIN_AFIO_AF(GPIOD_PIN1, 0U) | \
  678. PIN_AFIO_AF(GPIOD_PIN2, 0U) | \
  679. PIN_AFIO_AF(GPIOD_PIN3, 0U) | \
  680. PIN_AFIO_AF(GPIOD_PIN4, 0U) | \
  681. PIN_AFIO_AF(GPIOD_PIN5, 0U) | \
  682. PIN_AFIO_AF(GPIOD_PIN6, 0U) | \
  683. PIN_AFIO_AF(GPIOD_PIN7, 0U))
  684. #define VAL_GPIOD_AFRH (PIN_AFIO_AF(GPIOD_PIN8, 0U) | \
  685. PIN_AFIO_AF(GPIOD_PIN9, 0U) | \
  686. PIN_AFIO_AF(GPIOD_PIN10, 0U) | \
  687. PIN_AFIO_AF(GPIOD_PIN11, 0U) | \
  688. PIN_AFIO_AF(GPIOD_PIN12, 0U) | \
  689. PIN_AFIO_AF(GPIOD_PIN13, 0U) | \
  690. PIN_AFIO_AF(GPIOD_PIN14, 0U) | \
  691. PIN_AFIO_AF(GPIOD_PIN15, 0U))
  692. /*
  693. * GPIOE setup:
  694. *
  695. * PE0 - PIN0 (input pullup).
  696. * PE1 - PIN1 (input pullup).
  697. * PE2 - PIN2 (input pullup).
  698. * PE3 - PIN3 (input pullup).
  699. * PE4 - PIN4 (input pullup).
  700. * PE5 - PIN5 (input pullup).
  701. * PE6 - PIN6 (input pullup).
  702. * PE7 - PIN7 (input pullup).
  703. * PE8 - PIN8 (input pullup).
  704. * PE9 - PIN9 (input pullup).
  705. * PE10 - PIN10 (input pullup).
  706. * PE11 - PIN11 (input pullup).
  707. * PE12 - PIN12 (input pullup).
  708. * PE13 - PIN13 (input pullup).
  709. * PE14 - PIN14 (input pullup).
  710. * PE15 - PIN15 (input pullup).
  711. */
  712. #define VAL_GPIOE_MODER (PIN_MODE_INPUT(GPIOE_PIN0) | \
  713. PIN_MODE_INPUT(GPIOE_PIN1) | \
  714. PIN_MODE_INPUT(GPIOE_PIN2) | \
  715. PIN_MODE_INPUT(GPIOE_PIN3) | \
  716. PIN_MODE_INPUT(GPIOE_PIN4) | \
  717. PIN_MODE_INPUT(GPIOE_PIN5) | \
  718. PIN_MODE_INPUT(GPIOE_PIN6) | \
  719. PIN_MODE_INPUT(GPIOE_PIN7) | \
  720. PIN_MODE_INPUT(GPIOE_PIN8) | \
  721. PIN_MODE_INPUT(GPIOE_PIN9) | \
  722. PIN_MODE_INPUT(GPIOE_PIN10) | \
  723. PIN_MODE_INPUT(GPIOE_PIN11) | \
  724. PIN_MODE_INPUT(GPIOE_PIN12) | \
  725. PIN_MODE_INPUT(GPIOE_PIN13) | \
  726. PIN_MODE_INPUT(GPIOE_PIN14) | \
  727. PIN_MODE_INPUT(GPIOE_PIN15))
  728. #define VAL_GPIOE_OTYPER (PIN_OTYPE_PUSHPULL(GPIOE_PIN0) | \
  729. PIN_OTYPE_PUSHPULL(GPIOE_PIN1) | \
  730. PIN_OTYPE_PUSHPULL(GPIOE_PIN2) | \
  731. PIN_OTYPE_PUSHPULL(GPIOE_PIN3) | \
  732. PIN_OTYPE_PUSHPULL(GPIOE_PIN4) | \
  733. PIN_OTYPE_PUSHPULL(GPIOE_PIN5) | \
  734. PIN_OTYPE_PUSHPULL(GPIOE_PIN6) | \
  735. PIN_OTYPE_PUSHPULL(GPIOE_PIN7) | \
  736. PIN_OTYPE_PUSHPULL(GPIOE_PIN8) | \
  737. PIN_OTYPE_PUSHPULL(GPIOE_PIN9) | \
  738. PIN_OTYPE_PUSHPULL(GPIOE_PIN10) | \
  739. PIN_OTYPE_PUSHPULL(GPIOE_PIN11) | \
  740. PIN_OTYPE_PUSHPULL(GPIOE_PIN12) | \
  741. PIN_OTYPE_PUSHPULL(GPIOE_PIN13) | \
  742. PIN_OTYPE_PUSHPULL(GPIOE_PIN14) | \
  743. PIN_OTYPE_PUSHPULL(GPIOE_PIN15))
  744. #define VAL_GPIOE_OSPEEDR (PIN_OSPEED_HIGH(GPIOE_PIN0) | \
  745. PIN_OSPEED_HIGH(GPIOE_PIN1) | \
  746. PIN_OSPEED_HIGH(GPIOE_PIN2) | \
  747. PIN_OSPEED_HIGH(GPIOE_PIN3) | \
  748. PIN_OSPEED_HIGH(GPIOE_PIN4) | \
  749. PIN_OSPEED_HIGH(GPIOE_PIN5) | \
  750. PIN_OSPEED_HIGH(GPIOE_PIN6) | \
  751. PIN_OSPEED_HIGH(GPIOE_PIN7) | \
  752. PIN_OSPEED_HIGH(GPIOE_PIN8) | \
  753. PIN_OSPEED_HIGH(GPIOE_PIN9) | \
  754. PIN_OSPEED_HIGH(GPIOE_PIN10) | \
  755. PIN_OSPEED_HIGH(GPIOE_PIN11) | \
  756. PIN_OSPEED_HIGH(GPIOE_PIN12) | \
  757. PIN_OSPEED_HIGH(GPIOE_PIN13) | \
  758. PIN_OSPEED_HIGH(GPIOE_PIN14) | \
  759. PIN_OSPEED_HIGH(GPIOE_PIN15))
  760. #define VAL_GPIOE_PUPDR (PIN_PUPDR_PULLUP(GPIOE_PIN0) | \
  761. PIN_PUPDR_PULLUP(GPIOE_PIN1) | \
  762. PIN_PUPDR_PULLUP(GPIOE_PIN2) | \
  763. PIN_PUPDR_PULLUP(GPIOE_PIN3) | \
  764. PIN_PUPDR_PULLUP(GPIOE_PIN4) | \
  765. PIN_PUPDR_PULLUP(GPIOE_PIN5) | \
  766. PIN_PUPDR_PULLUP(GPIOE_PIN6) | \
  767. PIN_PUPDR_PULLUP(GPIOE_PIN7) | \
  768. PIN_PUPDR_PULLUP(GPIOE_PIN8) | \
  769. PIN_PUPDR_PULLUP(GPIOE_PIN9) | \
  770. PIN_PUPDR_PULLUP(GPIOE_PIN10) | \
  771. PIN_PUPDR_PULLUP(GPIOE_PIN11) | \
  772. PIN_PUPDR_PULLUP(GPIOE_PIN12) | \
  773. PIN_PUPDR_PULLUP(GPIOE_PIN13) | \
  774. PIN_PUPDR_PULLUP(GPIOE_PIN14) | \
  775. PIN_PUPDR_PULLUP(GPIOE_PIN15))
  776. #define VAL_GPIOE_ODR (PIN_ODR_HIGH(GPIOE_PIN0) | \
  777. PIN_ODR_HIGH(GPIOE_PIN1) | \
  778. PIN_ODR_HIGH(GPIOE_PIN2) | \
  779. PIN_ODR_HIGH(GPIOE_PIN3) | \
  780. PIN_ODR_HIGH(GPIOE_PIN4) | \
  781. PIN_ODR_HIGH(GPIOE_PIN5) | \
  782. PIN_ODR_HIGH(GPIOE_PIN6) | \
  783. PIN_ODR_HIGH(GPIOE_PIN7) | \
  784. PIN_ODR_HIGH(GPIOE_PIN8) | \
  785. PIN_ODR_HIGH(GPIOE_PIN9) | \
  786. PIN_ODR_HIGH(GPIOE_PIN10) | \
  787. PIN_ODR_HIGH(GPIOE_PIN11) | \
  788. PIN_ODR_HIGH(GPIOE_PIN12) | \
  789. PIN_ODR_HIGH(GPIOE_PIN13) | \
  790. PIN_ODR_HIGH(GPIOE_PIN14) | \
  791. PIN_ODR_HIGH(GPIOE_PIN15))
  792. #define VAL_GPIOE_AFRL (PIN_AFIO_AF(GPIOE_PIN0, 0U) | \
  793. PIN_AFIO_AF(GPIOE_PIN1, 0U) | \
  794. PIN_AFIO_AF(GPIOE_PIN2, 0U) | \
  795. PIN_AFIO_AF(GPIOE_PIN3, 0U) | \
  796. PIN_AFIO_AF(GPIOE_PIN4, 0U) | \
  797. PIN_AFIO_AF(GPIOE_PIN5, 0U) | \
  798. PIN_AFIO_AF(GPIOE_PIN6, 0U) | \
  799. PIN_AFIO_AF(GPIOE_PIN7, 0U))
  800. #define VAL_GPIOE_AFRH (PIN_AFIO_AF(GPIOE_PIN8, 0U) | \
  801. PIN_AFIO_AF(GPIOE_PIN9, 0U) | \
  802. PIN_AFIO_AF(GPIOE_PIN10, 0U) | \
  803. PIN_AFIO_AF(GPIOE_PIN11, 0U) | \
  804. PIN_AFIO_AF(GPIOE_PIN12, 0U) | \
  805. PIN_AFIO_AF(GPIOE_PIN13, 0U) | \
  806. PIN_AFIO_AF(GPIOE_PIN14, 0U) | \
  807. PIN_AFIO_AF(GPIOE_PIN15, 0U))
  808. /*
  809. * GPIOF setup:
  810. *
  811. * PF0 - OSC_IN (input floating).
  812. * PF1 - OSC_OUT (input floating).
  813. * PF2 - PIN2 (input pullup).
  814. * PF3 - PIN3 (input pullup).
  815. * PF4 - PIN4 (input pullup).
  816. * PF5 - PIN5 (input pullup).
  817. * PF6 - PIN6 (input pullup).
  818. * PF7 - PIN7 (input pullup).
  819. * PF8 - PIN8 (input pullup).
  820. * PF9 - PIN9 (input pullup).
  821. * PF10 - PIN10 (input pullup).
  822. * PF11 - PIN11 (input pullup).
  823. * PF12 - PIN12 (input pullup).
  824. * PF13 - PIN13 (input pullup).
  825. * PF14 - PIN14 (input pullup).
  826. * PF15 - PIN15 (input pullup).
  827. */
  828. #define VAL_GPIOF_MODER (PIN_MODE_INPUT(GPIOF_OSC_IN) | \
  829. PIN_MODE_INPUT(GPIOF_OSC_OUT) | \
  830. PIN_MODE_INPUT(GPIOF_PIN2) | \
  831. PIN_MODE_INPUT(GPIOF_PIN3) | \
  832. PIN_MODE_INPUT(GPIOF_PIN4) | \
  833. PIN_MODE_INPUT(GPIOF_PIN5) | \
  834. PIN_MODE_INPUT(GPIOF_PIN6) | \
  835. PIN_MODE_INPUT(GPIOF_PIN7) | \
  836. PIN_MODE_INPUT(GPIOF_PIN8) | \
  837. PIN_MODE_INPUT(GPIOF_PIN9) | \
  838. PIN_MODE_INPUT(GPIOF_PIN10) | \
  839. PIN_MODE_INPUT(GPIOF_PIN11) | \
  840. PIN_MODE_INPUT(GPIOF_PIN12) | \
  841. PIN_MODE_INPUT(GPIOF_PIN13) | \
  842. PIN_MODE_INPUT(GPIOF_PIN14) | \
  843. PIN_MODE_INPUT(GPIOF_PIN15))
  844. #define VAL_GPIOF_OTYPER (PIN_OTYPE_PUSHPULL(GPIOF_OSC_IN) | \
  845. PIN_OTYPE_PUSHPULL(GPIOF_OSC_OUT) | \
  846. PIN_OTYPE_PUSHPULL(GPIOF_PIN2) | \
  847. PIN_OTYPE_PUSHPULL(GPIOF_PIN3) | \
  848. PIN_OTYPE_PUSHPULL(GPIOF_PIN4) | \
  849. PIN_OTYPE_PUSHPULL(GPIOF_PIN5) | \
  850. PIN_OTYPE_PUSHPULL(GPIOF_PIN6) | \
  851. PIN_OTYPE_PUSHPULL(GPIOF_PIN7) | \
  852. PIN_OTYPE_PUSHPULL(GPIOF_PIN8) | \
  853. PIN_OTYPE_PUSHPULL(GPIOF_PIN9) | \
  854. PIN_OTYPE_PUSHPULL(GPIOF_PIN10) | \
  855. PIN_OTYPE_PUSHPULL(GPIOF_PIN11) | \
  856. PIN_OTYPE_PUSHPULL(GPIOF_PIN12) | \
  857. PIN_OTYPE_PUSHPULL(GPIOF_PIN13) | \
  858. PIN_OTYPE_PUSHPULL(GPIOF_PIN14) | \
  859. PIN_OTYPE_PUSHPULL(GPIOF_PIN15))
  860. #define VAL_GPIOF_OSPEEDR (PIN_OSPEED_HIGH(GPIOF_OSC_IN) | \
  861. PIN_OSPEED_HIGH(GPIOF_OSC_OUT) | \
  862. PIN_OSPEED_HIGH(GPIOF_PIN2) | \
  863. PIN_OSPEED_HIGH(GPIOF_PIN3) | \
  864. PIN_OSPEED_HIGH(GPIOF_PIN4) | \
  865. PIN_OSPEED_HIGH(GPIOF_PIN5) | \
  866. PIN_OSPEED_HIGH(GPIOF_PIN6) | \
  867. PIN_OSPEED_HIGH(GPIOF_PIN7) | \
  868. PIN_OSPEED_HIGH(GPIOF_PIN8) | \
  869. PIN_OSPEED_HIGH(GPIOF_PIN9) | \
  870. PIN_OSPEED_HIGH(GPIOF_PIN10) | \
  871. PIN_OSPEED_HIGH(GPIOF_PIN11) | \
  872. PIN_OSPEED_HIGH(GPIOF_PIN12) | \
  873. PIN_OSPEED_HIGH(GPIOF_PIN13) | \
  874. PIN_OSPEED_HIGH(GPIOF_PIN14) | \
  875. PIN_OSPEED_HIGH(GPIOF_PIN15))
  876. #define VAL_GPIOF_PUPDR (PIN_PUPDR_FLOATING(GPIOF_OSC_IN) | \
  877. PIN_PUPDR_FLOATING(GPIOF_OSC_OUT) | \
  878. PIN_PUPDR_PULLUP(GPIOF_PIN2) | \
  879. PIN_PUPDR_PULLUP(GPIOF_PIN3) | \
  880. PIN_PUPDR_PULLUP(GPIOF_PIN4) | \
  881. PIN_PUPDR_PULLUP(GPIOF_PIN5) | \
  882. PIN_PUPDR_PULLUP(GPIOF_PIN6) | \
  883. PIN_PUPDR_PULLUP(GPIOF_PIN7) | \
  884. PIN_PUPDR_PULLUP(GPIOF_PIN8) | \
  885. PIN_PUPDR_PULLUP(GPIOF_PIN9) | \
  886. PIN_PUPDR_PULLUP(GPIOF_PIN10) | \
  887. PIN_PUPDR_PULLUP(GPIOF_PIN11) | \
  888. PIN_PUPDR_PULLUP(GPIOF_PIN12) | \
  889. PIN_PUPDR_PULLUP(GPIOF_PIN13) | \
  890. PIN_PUPDR_PULLUP(GPIOF_PIN14) | \
  891. PIN_PUPDR_PULLUP(GPIOF_PIN15))
  892. #define VAL_GPIOF_ODR (PIN_ODR_HIGH(GPIOF_OSC_IN) | \
  893. PIN_ODR_HIGH(GPIOF_OSC_OUT) | \
  894. PIN_ODR_HIGH(GPIOF_PIN2) | \
  895. PIN_ODR_HIGH(GPIOF_PIN3) | \
  896. PIN_ODR_HIGH(GPIOF_PIN4) | \
  897. PIN_ODR_HIGH(GPIOF_PIN5) | \
  898. PIN_ODR_HIGH(GPIOF_PIN6) | \
  899. PIN_ODR_HIGH(GPIOF_PIN7) | \
  900. PIN_ODR_HIGH(GPIOF_PIN8) | \
  901. PIN_ODR_HIGH(GPIOF_PIN9) | \
  902. PIN_ODR_HIGH(GPIOF_PIN10) | \
  903. PIN_ODR_HIGH(GPIOF_PIN11) | \
  904. PIN_ODR_HIGH(GPIOF_PIN12) | \
  905. PIN_ODR_HIGH(GPIOF_PIN13) | \
  906. PIN_ODR_HIGH(GPIOF_PIN14) | \
  907. PIN_ODR_HIGH(GPIOF_PIN15))
  908. #define VAL_GPIOF_AFRL (PIN_AFIO_AF(GPIOF_OSC_IN, 0U) | \
  909. PIN_AFIO_AF(GPIOF_OSC_OUT, 0U) | \
  910. PIN_AFIO_AF(GPIOF_PIN2, 0U) | \
  911. PIN_AFIO_AF(GPIOF_PIN3, 0U) | \
  912. PIN_AFIO_AF(GPIOF_PIN4, 0U) | \
  913. PIN_AFIO_AF(GPIOF_PIN5, 0U) | \
  914. PIN_AFIO_AF(GPIOF_PIN6, 0U) | \
  915. PIN_AFIO_AF(GPIOF_PIN7, 0U))
  916. #define VAL_GPIOF_AFRH (PIN_AFIO_AF(GPIOF_PIN8, 0U) | \
  917. PIN_AFIO_AF(GPIOF_PIN9, 0U) | \
  918. PIN_AFIO_AF(GPIOF_PIN10, 0U) | \
  919. PIN_AFIO_AF(GPIOF_PIN11, 0U) | \
  920. PIN_AFIO_AF(GPIOF_PIN12, 0U) | \
  921. PIN_AFIO_AF(GPIOF_PIN13, 0U) | \
  922. PIN_AFIO_AF(GPIOF_PIN14, 0U) | \
  923. PIN_AFIO_AF(GPIOF_PIN15, 0U))
  924. /*===========================================================================*/
  925. /* External declarations. */
  926. /*===========================================================================*/
  927. #if !defined(_FROM_ASM_)
  928. #ifdef __cplusplus
  929. extern "C" {
  930. #endif
  931. void boardInit(void);
  932. #ifdef __cplusplus
  933. }
  934. #endif
  935. #endif /* _FROM_ASM_ */
  936. #endif /* BOARD_H */