board.h 57 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934
  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 ST STM32L-Discovery board.
  24. */
  25. /*
  26. * Board identifier.
  27. */
  28. #define BOARD_ST_STM32L_DISCOVERY
  29. #define BOARD_NAME "ST STM32L-Discovery"
  30. /*
  31. * Board oscillators-related settings.
  32. * NOTE: HSE not fitted.
  33. */
  34. #if !defined(STM32_LSECLK)
  35. #define STM32_LSECLK 32768U
  36. #endif
  37. #if !defined(STM32_HSECLK)
  38. #define STM32_HSECLK 0U
  39. #endif
  40. #define STM32_HSE_BYPASS
  41. /*
  42. * MCU type as defined in the ST header.
  43. */
  44. #define STM32L152xB
  45. /*
  46. * IO pins assignments.
  47. */
  48. #define GPIOA_BUTTON 0U
  49. #define GPIOA_PIN1 1U
  50. #define GPIOA_PIN2 2U
  51. #define GPIOA_PIN3 3U
  52. #define GPIOA_PIN4 4U
  53. #define GPIOA_PIN5 5U
  54. #define GPIOA_PIN6 6U
  55. #define GPIOA_PIN7 7U
  56. #define GPIOA_PIN8 8U
  57. #define GPIOA_PIN9 9U
  58. #define GPIOA_PIN10 10U
  59. #define GPIOA_PIN11 11U
  60. #define GPIOA_PIN12 12U
  61. #define GPIOA_JTAG_TMS 13U
  62. #define GPIOA_JTAG_TCK 14U
  63. #define GPIOA_JTAG_TDI 15U
  64. #define GPIOB_PIN0 0U
  65. #define GPIOB_PIN1 1U
  66. #define GPIOB_BOOT1 2U
  67. #define GPIOB_JTAG_TDO 3U
  68. #define GPIOB_JTAG_TRST 4U
  69. #define GPIOB_PIN5 5U
  70. #define GPIOB_LED4 6U
  71. #define GPIOB_LED3 7U
  72. #define GPIOB_PIN8 8U
  73. #define GPIOB_PIN9 9U
  74. #define GPIOB_PIN10 10U
  75. #define GPIOB_PIN11 11U
  76. #define GPIOB_PIN12 12U
  77. #define GPIOB_PIN13 13U
  78. #define GPIOB_PIN14 14U
  79. #define GPIOB_PIN15 15U
  80. #define GPIOC_PIN0 0U
  81. #define GPIOC_PIN1 1U
  82. #define GPIOC_PIN2 2U
  83. #define GPIOC_PIN3 3U
  84. #define GPIOC_PIN4 4U
  85. #define GPIOC_PIN5 5U
  86. #define GPIOC_PIN6 6U
  87. #define GPIOC_PIN7 7U
  88. #define GPIOC_PIN8 8U
  89. #define GPIOC_PIN9 9U
  90. #define GPIOC_PIN10 10U
  91. #define GPIOC_PIN11 11U
  92. #define GPIOC_PIN12 12U
  93. #define GPIOC_PIN13 13U
  94. #define GPIOC_OSC32_IN 14U
  95. #define GPIOC_OSC32_OUT 15U
  96. #define GPIOD_PIN0 0U
  97. #define GPIOD_PIN1 1U
  98. #define GPIOD_PIN2 2U
  99. #define GPIOD_PIN3 3U
  100. #define GPIOD_PIN4 4U
  101. #define GPIOD_PIN5 5U
  102. #define GPIOD_PIN6 6U
  103. #define GPIOD_PIN7 7U
  104. #define GPIOD_PIN8 8U
  105. #define GPIOD_PIN9 9U
  106. #define GPIOD_PIN10 10U
  107. #define GPIOD_PIN11 11U
  108. #define GPIOD_PIN12 12U
  109. #define GPIOD_PIN13 13U
  110. #define GPIOD_PIN14 14U
  111. #define GPIOD_PIN15 15U
  112. #define GPIOE_PIN0 0U
  113. #define GPIOE_PIN1 1U
  114. #define GPIOE_PIN2 2U
  115. #define GPIOE_PIN3 3U
  116. #define GPIOE_PIN4 4U
  117. #define GPIOE_PIN5 5U
  118. #define GPIOE_PIN6 6U
  119. #define GPIOE_PIN7 7U
  120. #define GPIOE_PIN8 8U
  121. #define GPIOE_PIN9 9U
  122. #define GPIOE_PIN10 10U
  123. #define GPIOE_PIN11 11U
  124. #define GPIOE_PIN12 12U
  125. #define GPIOE_PIN13 13U
  126. #define GPIOE_PIN14 14U
  127. #define GPIOE_PIN15 15U
  128. #define GPIOH_OSC_IN 0U
  129. #define GPIOH_OSC_OUT 1U
  130. #define GPIOH_PIN2 2U
  131. #define GPIOH_PIN3 3U
  132. #define GPIOH_PIN4 4U
  133. #define GPIOH_PIN5 5U
  134. #define GPIOH_PIN6 6U
  135. #define GPIOH_PIN7 7U
  136. #define GPIOH_PIN8 8U
  137. #define GPIOH_PIN9 9U
  138. #define GPIOH_PIN10 10U
  139. #define GPIOH_PIN11 11U
  140. #define GPIOH_PIN12 12U
  141. #define GPIOH_PIN13 13U
  142. #define GPIOH_PIN14 14U
  143. #define GPIOH_PIN15 15U
  144. /*
  145. * IO lines assignments.
  146. */
  147. #define LINE_BUTTON PAL_LINE(GPIOA, 0U)
  148. #define LINE_JTAG_TMS PAL_LINE(GPIOA, 13U)
  149. #define LINE_JTAG_TCK PAL_LINE(GPIOA, 14U)
  150. #define LINE_JTAG_TDI PAL_LINE(GPIOA, 15U)
  151. #define LINE_BOOT1 PAL_LINE(GPIOB, 2U)
  152. #define LINE_JTAG_TDO PAL_LINE(GPIOB, 3U)
  153. #define LINE_JTAG_TRST PAL_LINE(GPIOB, 4U)
  154. #define LINE_LED4 PAL_LINE(GPIOB, 6U)
  155. #define LINE_LED3 PAL_LINE(GPIOB, 7U)
  156. #define LINE_OSC32_IN PAL_LINE(GPIOC, 14U)
  157. #define LINE_OSC32_OUT PAL_LINE(GPIOC, 15U)
  158. #define LINE_OSC_IN PAL_LINE(GPIOH, 0U)
  159. #define LINE_OSC_OUT PAL_LINE(GPIOH, 1U)
  160. /*===========================================================================*/
  161. /* Driver pre-compile time settings. */
  162. /*===========================================================================*/
  163. /*===========================================================================*/
  164. /* Derived constants and error checks. */
  165. /*===========================================================================*/
  166. /*===========================================================================*/
  167. /* Driver data structures and types. */
  168. /*===========================================================================*/
  169. /*===========================================================================*/
  170. /* Driver macros. */
  171. /*===========================================================================*/
  172. /*
  173. * I/O ports initial setup, this configuration is established soon after reset
  174. * in the initialization code.
  175. * Please refer to the STM32 Reference Manual for details.
  176. */
  177. #define PIN_MODE_INPUT(n) (0U << ((n) * 2U))
  178. #define PIN_MODE_OUTPUT(n) (1U << ((n) * 2U))
  179. #define PIN_MODE_ALTERNATE(n) (2U << ((n) * 2U))
  180. #define PIN_MODE_ANALOG(n) (3U << ((n) * 2U))
  181. #define PIN_ODR_LOW(n) (0U << (n))
  182. #define PIN_ODR_HIGH(n) (1U << (n))
  183. #define PIN_OTYPE_PUSHPULL(n) (0U << (n))
  184. #define PIN_OTYPE_OPENDRAIN(n) (1U << (n))
  185. #define PIN_OSPEED_VERYLOW(n) (0U << ((n) * 2U))
  186. #define PIN_OSPEED_LOW(n) (1U << ((n) * 2U))
  187. #define PIN_OSPEED_MEDIUM(n) (2U << ((n) * 2U))
  188. #define PIN_OSPEED_HIGH(n) (3U << ((n) * 2U))
  189. #define PIN_PUPDR_FLOATING(n) (0U << ((n) * 2U))
  190. #define PIN_PUPDR_PULLUP(n) (1U << ((n) * 2U))
  191. #define PIN_PUPDR_PULLDOWN(n) (2U << ((n) * 2U))
  192. #define PIN_AFIO_AF(n, v) ((v) << (((n) % 8U) * 4U))
  193. /*
  194. * GPIOA setup:
  195. *
  196. * PA0 - BUTTON (input floating).
  197. * PA1 - PIN1 (input pullup).
  198. * PA2 - PIN2 (input pullup).
  199. * PA3 - PIN3 (input pullup).
  200. * PA4 - PIN4 (input pullup).
  201. * PA5 - PIN5 (input pullup).
  202. * PA6 - PIN6 (input pullup).
  203. * PA7 - PIN7 (input pullup).
  204. * PA8 - PIN8 (input pullup).
  205. * PA9 - PIN9 (input pullup).
  206. * PA10 - PIN10 (input pullup).
  207. * PA11 - PIN11 (input pullup).
  208. * PA12 - PIN12 (input pullup).
  209. * PA13 - JTAG_TMS (alternate 0).
  210. * PA14 - JTAG_TCK (alternate 0).
  211. * PA15 - JTAG_TDI (alternate 0).
  212. */
  213. #define VAL_GPIOA_MODER (PIN_MODE_INPUT(GPIOA_BUTTON) | \
  214. PIN_MODE_INPUT(GPIOA_PIN1) | \
  215. PIN_MODE_INPUT(GPIOA_PIN2) | \
  216. PIN_MODE_INPUT(GPIOA_PIN3) | \
  217. PIN_MODE_INPUT(GPIOA_PIN4) | \
  218. PIN_MODE_INPUT(GPIOA_PIN5) | \
  219. PIN_MODE_INPUT(GPIOA_PIN6) | \
  220. PIN_MODE_INPUT(GPIOA_PIN7) | \
  221. PIN_MODE_INPUT(GPIOA_PIN8) | \
  222. PIN_MODE_INPUT(GPIOA_PIN9) | \
  223. PIN_MODE_INPUT(GPIOA_PIN10) | \
  224. PIN_MODE_INPUT(GPIOA_PIN11) | \
  225. PIN_MODE_INPUT(GPIOA_PIN12) | \
  226. PIN_MODE_ALTERNATE(GPIOA_JTAG_TMS) | \
  227. PIN_MODE_ALTERNATE(GPIOA_JTAG_TCK) | \
  228. PIN_MODE_ALTERNATE(GPIOA_JTAG_TDI))
  229. #define VAL_GPIOA_OTYPER (PIN_OTYPE_PUSHPULL(GPIOA_BUTTON) | \
  230. PIN_OTYPE_PUSHPULL(GPIOA_PIN1) | \
  231. PIN_OTYPE_PUSHPULL(GPIOA_PIN2) | \
  232. PIN_OTYPE_PUSHPULL(GPIOA_PIN3) | \
  233. PIN_OTYPE_PUSHPULL(GPIOA_PIN4) | \
  234. PIN_OTYPE_PUSHPULL(GPIOA_PIN5) | \
  235. PIN_OTYPE_PUSHPULL(GPIOA_PIN6) | \
  236. PIN_OTYPE_PUSHPULL(GPIOA_PIN7) | \
  237. PIN_OTYPE_PUSHPULL(GPIOA_PIN8) | \
  238. PIN_OTYPE_PUSHPULL(GPIOA_PIN9) | \
  239. PIN_OTYPE_PUSHPULL(GPIOA_PIN10) | \
  240. PIN_OTYPE_PUSHPULL(GPIOA_PIN11) | \
  241. PIN_OTYPE_PUSHPULL(GPIOA_PIN12) | \
  242. PIN_OTYPE_PUSHPULL(GPIOA_JTAG_TMS) | \
  243. PIN_OTYPE_PUSHPULL(GPIOA_JTAG_TCK) | \
  244. PIN_OTYPE_PUSHPULL(GPIOA_JTAG_TDI))
  245. #define VAL_GPIOA_OSPEEDR (PIN_OSPEED_VERYLOW(GPIOA_BUTTON) | \
  246. PIN_OSPEED_VERYLOW(GPIOA_PIN1) | \
  247. PIN_OSPEED_VERYLOW(GPIOA_PIN2) | \
  248. PIN_OSPEED_VERYLOW(GPIOA_PIN3) | \
  249. PIN_OSPEED_VERYLOW(GPIOA_PIN4) | \
  250. PIN_OSPEED_VERYLOW(GPIOA_PIN5) | \
  251. PIN_OSPEED_VERYLOW(GPIOA_PIN6) | \
  252. PIN_OSPEED_VERYLOW(GPIOA_PIN7) | \
  253. PIN_OSPEED_VERYLOW(GPIOA_PIN8) | \
  254. PIN_OSPEED_VERYLOW(GPIOA_PIN9) | \
  255. PIN_OSPEED_VERYLOW(GPIOA_PIN10) | \
  256. PIN_OSPEED_VERYLOW(GPIOA_PIN11) | \
  257. PIN_OSPEED_VERYLOW(GPIOA_PIN12) | \
  258. PIN_OSPEED_HIGH(GPIOA_JTAG_TMS) | \
  259. PIN_OSPEED_HIGH(GPIOA_JTAG_TCK) | \
  260. PIN_OSPEED_HIGH(GPIOA_JTAG_TDI))
  261. #define VAL_GPIOA_PUPDR (PIN_PUPDR_FLOATING(GPIOA_BUTTON) | \
  262. PIN_PUPDR_PULLUP(GPIOA_PIN1) | \
  263. PIN_PUPDR_PULLUP(GPIOA_PIN2) | \
  264. PIN_PUPDR_PULLUP(GPIOA_PIN3) | \
  265. PIN_PUPDR_PULLUP(GPIOA_PIN4) | \
  266. PIN_PUPDR_PULLUP(GPIOA_PIN5) | \
  267. PIN_PUPDR_PULLUP(GPIOA_PIN6) | \
  268. PIN_PUPDR_PULLUP(GPIOA_PIN7) | \
  269. PIN_PUPDR_PULLUP(GPIOA_PIN8) | \
  270. PIN_PUPDR_PULLUP(GPIOA_PIN9) | \
  271. PIN_PUPDR_PULLUP(GPIOA_PIN10) | \
  272. PIN_PUPDR_PULLUP(GPIOA_PIN11) | \
  273. PIN_PUPDR_PULLUP(GPIOA_PIN12) | \
  274. PIN_PUPDR_PULLUP(GPIOA_JTAG_TMS) | \
  275. PIN_PUPDR_PULLDOWN(GPIOA_JTAG_TCK) | \
  276. PIN_PUPDR_PULLUP(GPIOA_JTAG_TDI))
  277. #define VAL_GPIOA_ODR (PIN_ODR_HIGH(GPIOA_BUTTON) | \
  278. PIN_ODR_HIGH(GPIOA_PIN1) | \
  279. PIN_ODR_HIGH(GPIOA_PIN2) | \
  280. PIN_ODR_HIGH(GPIOA_PIN3) | \
  281. PIN_ODR_HIGH(GPIOA_PIN4) | \
  282. PIN_ODR_HIGH(GPIOA_PIN5) | \
  283. PIN_ODR_HIGH(GPIOA_PIN6) | \
  284. PIN_ODR_HIGH(GPIOA_PIN7) | \
  285. PIN_ODR_HIGH(GPIOA_PIN8) | \
  286. PIN_ODR_HIGH(GPIOA_PIN9) | \
  287. PIN_ODR_HIGH(GPIOA_PIN10) | \
  288. PIN_ODR_HIGH(GPIOA_PIN11) | \
  289. PIN_ODR_HIGH(GPIOA_PIN12) | \
  290. PIN_ODR_HIGH(GPIOA_JTAG_TMS) | \
  291. PIN_ODR_HIGH(GPIOA_JTAG_TCK) | \
  292. PIN_ODR_HIGH(GPIOA_JTAG_TDI))
  293. #define VAL_GPIOA_AFRL (PIN_AFIO_AF(GPIOA_BUTTON, 0U) | \
  294. PIN_AFIO_AF(GPIOA_PIN1, 0U) | \
  295. PIN_AFIO_AF(GPIOA_PIN2, 0U) | \
  296. PIN_AFIO_AF(GPIOA_PIN3, 0U) | \
  297. PIN_AFIO_AF(GPIOA_PIN4, 0U) | \
  298. PIN_AFIO_AF(GPIOA_PIN5, 0U) | \
  299. PIN_AFIO_AF(GPIOA_PIN6, 0U) | \
  300. PIN_AFIO_AF(GPIOA_PIN7, 0U))
  301. #define VAL_GPIOA_AFRH (PIN_AFIO_AF(GPIOA_PIN8, 0U) | \
  302. PIN_AFIO_AF(GPIOA_PIN9, 0U) | \
  303. PIN_AFIO_AF(GPIOA_PIN10, 0U) | \
  304. PIN_AFIO_AF(GPIOA_PIN11, 0U) | \
  305. PIN_AFIO_AF(GPIOA_PIN12, 0U) | \
  306. PIN_AFIO_AF(GPIOA_JTAG_TMS, 0U) | \
  307. PIN_AFIO_AF(GPIOA_JTAG_TCK, 0U) | \
  308. PIN_AFIO_AF(GPIOA_JTAG_TDI, 0U))
  309. /*
  310. * GPIOB setup:
  311. *
  312. * PB0 - PIN0 (input pullup).
  313. * PB1 - PIN1 (input pullup).
  314. * PB2 - BOOT1 (input floating).
  315. * PB3 - JTAG_TDO (alternate 0).
  316. * PB4 - JTAG_TRST (alternate 0).
  317. * PB5 - PIN5 (input pullup).
  318. * PB6 - LED4 (output pushpull maximum).
  319. * PB7 - LED3 (output pushpull maximum).
  320. * PB8 - PIN8 (input pullup).
  321. * PB9 - PIN9 (input pullup).
  322. * PB10 - PIN10 (input pullup).
  323. * PB11 - PIN11 (input pullup).
  324. * PB12 - PIN12 (input pullup).
  325. * PB13 - PIN13 (input pullup).
  326. * PB14 - PIN14 (input pullup).
  327. * PB15 - PIN15 (input pullup).
  328. */
  329. #define VAL_GPIOB_MODER (PIN_MODE_INPUT(GPIOB_PIN0) | \
  330. PIN_MODE_INPUT(GPIOB_PIN1) | \
  331. PIN_MODE_INPUT(GPIOB_BOOT1) | \
  332. PIN_MODE_ALTERNATE(GPIOB_JTAG_TDO) | \
  333. PIN_MODE_ALTERNATE(GPIOB_JTAG_TRST) | \
  334. PIN_MODE_INPUT(GPIOB_PIN5) | \
  335. PIN_MODE_OUTPUT(GPIOB_LED4) | \
  336. PIN_MODE_OUTPUT(GPIOB_LED3) | \
  337. PIN_MODE_INPUT(GPIOB_PIN8) | \
  338. PIN_MODE_INPUT(GPIOB_PIN9) | \
  339. PIN_MODE_INPUT(GPIOB_PIN10) | \
  340. PIN_MODE_INPUT(GPIOB_PIN11) | \
  341. PIN_MODE_INPUT(GPIOB_PIN12) | \
  342. PIN_MODE_INPUT(GPIOB_PIN13) | \
  343. PIN_MODE_INPUT(GPIOB_PIN14) | \
  344. PIN_MODE_INPUT(GPIOB_PIN15))
  345. #define VAL_GPIOB_OTYPER (PIN_OTYPE_PUSHPULL(GPIOB_PIN0) | \
  346. PIN_OTYPE_PUSHPULL(GPIOB_PIN1) | \
  347. PIN_OTYPE_PUSHPULL(GPIOB_BOOT1) | \
  348. PIN_OTYPE_PUSHPULL(GPIOB_JTAG_TDO) | \
  349. PIN_OTYPE_PUSHPULL(GPIOB_JTAG_TRST) | \
  350. PIN_OTYPE_PUSHPULL(GPIOB_PIN5) | \
  351. PIN_OTYPE_PUSHPULL(GPIOB_LED4) | \
  352. PIN_OTYPE_PUSHPULL(GPIOB_LED3) | \
  353. PIN_OTYPE_PUSHPULL(GPIOB_PIN8) | \
  354. PIN_OTYPE_PUSHPULL(GPIOB_PIN9) | \
  355. PIN_OTYPE_PUSHPULL(GPIOB_PIN10) | \
  356. PIN_OTYPE_PUSHPULL(GPIOB_PIN11) | \
  357. PIN_OTYPE_PUSHPULL(GPIOB_PIN12) | \
  358. PIN_OTYPE_PUSHPULL(GPIOB_PIN13) | \
  359. PIN_OTYPE_PUSHPULL(GPIOB_PIN14) | \
  360. PIN_OTYPE_PUSHPULL(GPIOB_PIN15))
  361. #define VAL_GPIOB_OSPEEDR (PIN_OSPEED_VERYLOW(GPIOB_PIN0) | \
  362. PIN_OSPEED_VERYLOW(GPIOB_PIN1) | \
  363. PIN_OSPEED_HIGH(GPIOB_BOOT1) | \
  364. PIN_OSPEED_HIGH(GPIOB_JTAG_TDO) | \
  365. PIN_OSPEED_HIGH(GPIOB_JTAG_TRST) | \
  366. PIN_OSPEED_VERYLOW(GPIOB_PIN5) | \
  367. PIN_OSPEED_HIGH(GPIOB_LED4) | \
  368. PIN_OSPEED_HIGH(GPIOB_LED3) | \
  369. PIN_OSPEED_VERYLOW(GPIOB_PIN8) | \
  370. PIN_OSPEED_VERYLOW(GPIOB_PIN9) | \
  371. PIN_OSPEED_VERYLOW(GPIOB_PIN10) | \
  372. PIN_OSPEED_VERYLOW(GPIOB_PIN11) | \
  373. PIN_OSPEED_VERYLOW(GPIOB_PIN12) | \
  374. PIN_OSPEED_VERYLOW(GPIOB_PIN13) | \
  375. PIN_OSPEED_VERYLOW(GPIOB_PIN14) | \
  376. PIN_OSPEED_VERYLOW(GPIOB_PIN15))
  377. #define VAL_GPIOB_PUPDR (PIN_PUPDR_PULLUP(GPIOB_PIN0) | \
  378. PIN_PUPDR_PULLUP(GPIOB_PIN1) | \
  379. PIN_PUPDR_FLOATING(GPIOB_BOOT1) | \
  380. PIN_PUPDR_FLOATING(GPIOB_JTAG_TDO) | \
  381. PIN_PUPDR_PULLUP(GPIOB_JTAG_TRST) | \
  382. PIN_PUPDR_PULLUP(GPIOB_PIN5) | \
  383. PIN_PUPDR_FLOATING(GPIOB_LED4) | \
  384. PIN_PUPDR_FLOATING(GPIOB_LED3) | \
  385. PIN_PUPDR_PULLUP(GPIOB_PIN8) | \
  386. PIN_PUPDR_PULLUP(GPIOB_PIN9) | \
  387. PIN_PUPDR_PULLUP(GPIOB_PIN10) | \
  388. PIN_PUPDR_PULLUP(GPIOB_PIN11) | \
  389. PIN_PUPDR_PULLUP(GPIOB_PIN12) | \
  390. PIN_PUPDR_PULLUP(GPIOB_PIN13) | \
  391. PIN_PUPDR_PULLUP(GPIOB_PIN14) | \
  392. PIN_PUPDR_PULLUP(GPIOB_PIN15))
  393. #define VAL_GPIOB_ODR (PIN_ODR_HIGH(GPIOB_PIN0) | \
  394. PIN_ODR_HIGH(GPIOB_PIN1) | \
  395. PIN_ODR_HIGH(GPIOB_BOOT1) | \
  396. PIN_ODR_HIGH(GPIOB_JTAG_TDO) | \
  397. PIN_ODR_HIGH(GPIOB_JTAG_TRST) | \
  398. PIN_ODR_HIGH(GPIOB_PIN5) | \
  399. PIN_ODR_LOW(GPIOB_LED4) | \
  400. PIN_ODR_LOW(GPIOB_LED3) | \
  401. PIN_ODR_HIGH(GPIOB_PIN8) | \
  402. PIN_ODR_HIGH(GPIOB_PIN9) | \
  403. PIN_ODR_HIGH(GPIOB_PIN10) | \
  404. PIN_ODR_HIGH(GPIOB_PIN11) | \
  405. PIN_ODR_HIGH(GPIOB_PIN12) | \
  406. PIN_ODR_HIGH(GPIOB_PIN13) | \
  407. PIN_ODR_HIGH(GPIOB_PIN14) | \
  408. PIN_ODR_HIGH(GPIOB_PIN15))
  409. #define VAL_GPIOB_AFRL (PIN_AFIO_AF(GPIOB_PIN0, 0U) | \
  410. PIN_AFIO_AF(GPIOB_PIN1, 0U) | \
  411. PIN_AFIO_AF(GPIOB_BOOT1, 0U) | \
  412. PIN_AFIO_AF(GPIOB_JTAG_TDO, 0U) | \
  413. PIN_AFIO_AF(GPIOB_JTAG_TRST, 0U) | \
  414. PIN_AFIO_AF(GPIOB_PIN5, 0U) | \
  415. PIN_AFIO_AF(GPIOB_LED4, 0U) | \
  416. PIN_AFIO_AF(GPIOB_LED3, 0U))
  417. #define VAL_GPIOB_AFRH (PIN_AFIO_AF(GPIOB_PIN8, 0U) | \
  418. PIN_AFIO_AF(GPIOB_PIN9, 0U) | \
  419. PIN_AFIO_AF(GPIOB_PIN10, 0U) | \
  420. PIN_AFIO_AF(GPIOB_PIN11, 0U) | \
  421. PIN_AFIO_AF(GPIOB_PIN12, 0U) | \
  422. PIN_AFIO_AF(GPIOB_PIN13, 0U) | \
  423. PIN_AFIO_AF(GPIOB_PIN14, 0U) | \
  424. PIN_AFIO_AF(GPIOB_PIN15, 0U))
  425. /*
  426. * GPIOC setup:
  427. *
  428. * PC0 - PIN0 (input pullup).
  429. * PC1 - PIN1 (input pullup).
  430. * PC2 - PIN2 (input pullup).
  431. * PC3 - PIN3 (input pullup).
  432. * PC4 - PIN4 (input pullup).
  433. * PC5 - PIN5 (input pullup).
  434. * PC6 - PIN6 (input pullup).
  435. * PC7 - PIN7 (input pullup).
  436. * PC8 - PIN8 (input pullup).
  437. * PC9 - PIN9 (input pullup).
  438. * PC10 - PIN10 (input pullup).
  439. * PC11 - PIN11 (input pullup).
  440. * PC12 - PIN12 (input pullup).
  441. * PC13 - PIN13 (input pullup).
  442. * PC14 - OSC32_IN (input floating).
  443. * PC15 - OSC32_OUT (input floating).
  444. */
  445. #define VAL_GPIOC_MODER (PIN_MODE_INPUT(GPIOC_PIN0) | \
  446. PIN_MODE_INPUT(GPIOC_PIN1) | \
  447. PIN_MODE_INPUT(GPIOC_PIN2) | \
  448. PIN_MODE_INPUT(GPIOC_PIN3) | \
  449. PIN_MODE_INPUT(GPIOC_PIN4) | \
  450. PIN_MODE_INPUT(GPIOC_PIN5) | \
  451. PIN_MODE_INPUT(GPIOC_PIN6) | \
  452. PIN_MODE_INPUT(GPIOC_PIN7) | \
  453. PIN_MODE_INPUT(GPIOC_PIN8) | \
  454. PIN_MODE_INPUT(GPIOC_PIN9) | \
  455. PIN_MODE_INPUT(GPIOC_PIN10) | \
  456. PIN_MODE_INPUT(GPIOC_PIN11) | \
  457. PIN_MODE_INPUT(GPIOC_PIN12) | \
  458. PIN_MODE_INPUT(GPIOC_PIN13) | \
  459. PIN_MODE_INPUT(GPIOC_OSC32_IN) | \
  460. PIN_MODE_INPUT(GPIOC_OSC32_OUT))
  461. #define VAL_GPIOC_OTYPER (PIN_OTYPE_PUSHPULL(GPIOC_PIN0) | \
  462. PIN_OTYPE_PUSHPULL(GPIOC_PIN1) | \
  463. PIN_OTYPE_PUSHPULL(GPIOC_PIN2) | \
  464. PIN_OTYPE_PUSHPULL(GPIOC_PIN3) | \
  465. PIN_OTYPE_PUSHPULL(GPIOC_PIN4) | \
  466. PIN_OTYPE_PUSHPULL(GPIOC_PIN5) | \
  467. PIN_OTYPE_PUSHPULL(GPIOC_PIN6) | \
  468. PIN_OTYPE_PUSHPULL(GPIOC_PIN7) | \
  469. PIN_OTYPE_PUSHPULL(GPIOC_PIN8) | \
  470. PIN_OTYPE_PUSHPULL(GPIOC_PIN9) | \
  471. PIN_OTYPE_PUSHPULL(GPIOC_PIN10) | \
  472. PIN_OTYPE_PUSHPULL(GPIOC_PIN11) | \
  473. PIN_OTYPE_PUSHPULL(GPIOC_PIN12) | \
  474. PIN_OTYPE_PUSHPULL(GPIOC_PIN13) | \
  475. PIN_OTYPE_PUSHPULL(GPIOC_OSC32_IN) | \
  476. PIN_OTYPE_PUSHPULL(GPIOC_OSC32_OUT))
  477. #define VAL_GPIOC_OSPEEDR (PIN_OSPEED_VERYLOW(GPIOC_PIN0) | \
  478. PIN_OSPEED_VERYLOW(GPIOC_PIN1) | \
  479. PIN_OSPEED_VERYLOW(GPIOC_PIN2) | \
  480. PIN_OSPEED_VERYLOW(GPIOC_PIN3) | \
  481. PIN_OSPEED_VERYLOW(GPIOC_PIN4) | \
  482. PIN_OSPEED_VERYLOW(GPIOC_PIN5) | \
  483. PIN_OSPEED_VERYLOW(GPIOC_PIN6) | \
  484. PIN_OSPEED_VERYLOW(GPIOC_PIN7) | \
  485. PIN_OSPEED_VERYLOW(GPIOC_PIN8) | \
  486. PIN_OSPEED_VERYLOW(GPIOC_PIN9) | \
  487. PIN_OSPEED_VERYLOW(GPIOC_PIN10) | \
  488. PIN_OSPEED_VERYLOW(GPIOC_PIN11) | \
  489. PIN_OSPEED_VERYLOW(GPIOC_PIN12) | \
  490. PIN_OSPEED_VERYLOW(GPIOC_PIN13) | \
  491. PIN_OSPEED_HIGH(GPIOC_OSC32_IN) | \
  492. PIN_OSPEED_HIGH(GPIOC_OSC32_OUT))
  493. #define VAL_GPIOC_PUPDR (PIN_PUPDR_PULLUP(GPIOC_PIN0) | \
  494. PIN_PUPDR_PULLUP(GPIOC_PIN1) | \
  495. PIN_PUPDR_PULLUP(GPIOC_PIN2) | \
  496. PIN_PUPDR_PULLUP(GPIOC_PIN3) | \
  497. PIN_PUPDR_PULLUP(GPIOC_PIN4) | \
  498. PIN_PUPDR_PULLUP(GPIOC_PIN5) | \
  499. PIN_PUPDR_PULLUP(GPIOC_PIN6) | \
  500. PIN_PUPDR_PULLUP(GPIOC_PIN7) | \
  501. PIN_PUPDR_PULLUP(GPIOC_PIN8) | \
  502. PIN_PUPDR_PULLUP(GPIOC_PIN9) | \
  503. PIN_PUPDR_PULLUP(GPIOC_PIN10) | \
  504. PIN_PUPDR_PULLUP(GPIOC_PIN11) | \
  505. PIN_PUPDR_PULLUP(GPIOC_PIN12) | \
  506. PIN_PUPDR_PULLUP(GPIOC_PIN13) | \
  507. PIN_PUPDR_FLOATING(GPIOC_OSC32_IN) | \
  508. PIN_PUPDR_FLOATING(GPIOC_OSC32_OUT))
  509. #define VAL_GPIOC_ODR (PIN_ODR_HIGH(GPIOC_PIN0) | \
  510. PIN_ODR_HIGH(GPIOC_PIN1) | \
  511. PIN_ODR_HIGH(GPIOC_PIN2) | \
  512. PIN_ODR_HIGH(GPIOC_PIN3) | \
  513. PIN_ODR_HIGH(GPIOC_PIN4) | \
  514. PIN_ODR_HIGH(GPIOC_PIN5) | \
  515. PIN_ODR_HIGH(GPIOC_PIN6) | \
  516. PIN_ODR_HIGH(GPIOC_PIN7) | \
  517. PIN_ODR_HIGH(GPIOC_PIN8) | \
  518. PIN_ODR_HIGH(GPIOC_PIN9) | \
  519. PIN_ODR_HIGH(GPIOC_PIN10) | \
  520. PIN_ODR_HIGH(GPIOC_PIN11) | \
  521. PIN_ODR_HIGH(GPIOC_PIN12) | \
  522. PIN_ODR_HIGH(GPIOC_PIN13) | \
  523. PIN_ODR_HIGH(GPIOC_OSC32_IN) | \
  524. PIN_ODR_HIGH(GPIOC_OSC32_OUT))
  525. #define VAL_GPIOC_AFRL (PIN_AFIO_AF(GPIOC_PIN0, 0U) | \
  526. PIN_AFIO_AF(GPIOC_PIN1, 0U) | \
  527. PIN_AFIO_AF(GPIOC_PIN2, 0U) | \
  528. PIN_AFIO_AF(GPIOC_PIN3, 0U) | \
  529. PIN_AFIO_AF(GPIOC_PIN4, 0U) | \
  530. PIN_AFIO_AF(GPIOC_PIN5, 0U) | \
  531. PIN_AFIO_AF(GPIOC_PIN6, 0U) | \
  532. PIN_AFIO_AF(GPIOC_PIN7, 0U))
  533. #define VAL_GPIOC_AFRH (PIN_AFIO_AF(GPIOC_PIN8, 0U) | \
  534. PIN_AFIO_AF(GPIOC_PIN9, 0U) | \
  535. PIN_AFIO_AF(GPIOC_PIN10, 0U) | \
  536. PIN_AFIO_AF(GPIOC_PIN11, 0U) | \
  537. PIN_AFIO_AF(GPIOC_PIN12, 0U) | \
  538. PIN_AFIO_AF(GPIOC_PIN13, 0U) | \
  539. PIN_AFIO_AF(GPIOC_OSC32_IN, 0U) | \
  540. PIN_AFIO_AF(GPIOC_OSC32_OUT, 0U))
  541. /*
  542. * GPIOD setup:
  543. *
  544. * PD0 - PIN0 (input pullup).
  545. * PD1 - PIN1 (input pullup).
  546. * PD2 - PIN2 (input pullup).
  547. * PD3 - PIN3 (input pullup).
  548. * PD4 - PIN4 (input pullup).
  549. * PD5 - PIN5 (input pullup).
  550. * PD6 - PIN6 (input pullup).
  551. * PD7 - PIN7 (input pullup).
  552. * PD8 - PIN8 (input pullup).
  553. * PD9 - PIN9 (input pullup).
  554. * PD10 - PIN10 (input pullup).
  555. * PD11 - PIN11 (input pullup).
  556. * PD12 - PIN12 (input pullup).
  557. * PD13 - PIN13 (input pullup).
  558. * PD14 - PIN14 (input pullup).
  559. * PD15 - PIN15 (input pullup).
  560. */
  561. #define VAL_GPIOD_MODER (PIN_MODE_INPUT(GPIOD_PIN0) | \
  562. PIN_MODE_INPUT(GPIOD_PIN1) | \
  563. PIN_MODE_INPUT(GPIOD_PIN2) | \
  564. PIN_MODE_INPUT(GPIOD_PIN3) | \
  565. PIN_MODE_INPUT(GPIOD_PIN4) | \
  566. PIN_MODE_INPUT(GPIOD_PIN5) | \
  567. PIN_MODE_INPUT(GPIOD_PIN6) | \
  568. PIN_MODE_INPUT(GPIOD_PIN7) | \
  569. PIN_MODE_INPUT(GPIOD_PIN8) | \
  570. PIN_MODE_INPUT(GPIOD_PIN9) | \
  571. PIN_MODE_INPUT(GPIOD_PIN10) | \
  572. PIN_MODE_INPUT(GPIOD_PIN11) | \
  573. PIN_MODE_INPUT(GPIOD_PIN12) | \
  574. PIN_MODE_INPUT(GPIOD_PIN13) | \
  575. PIN_MODE_INPUT(GPIOD_PIN14) | \
  576. PIN_MODE_INPUT(GPIOD_PIN15))
  577. #define VAL_GPIOD_OTYPER (PIN_OTYPE_PUSHPULL(GPIOD_PIN0) | \
  578. PIN_OTYPE_PUSHPULL(GPIOD_PIN1) | \
  579. PIN_OTYPE_PUSHPULL(GPIOD_PIN2) | \
  580. PIN_OTYPE_PUSHPULL(GPIOD_PIN3) | \
  581. PIN_OTYPE_PUSHPULL(GPIOD_PIN4) | \
  582. PIN_OTYPE_PUSHPULL(GPIOD_PIN5) | \
  583. PIN_OTYPE_PUSHPULL(GPIOD_PIN6) | \
  584. PIN_OTYPE_PUSHPULL(GPIOD_PIN7) | \
  585. PIN_OTYPE_PUSHPULL(GPIOD_PIN8) | \
  586. PIN_OTYPE_PUSHPULL(GPIOD_PIN9) | \
  587. PIN_OTYPE_PUSHPULL(GPIOD_PIN10) | \
  588. PIN_OTYPE_PUSHPULL(GPIOD_PIN11) | \
  589. PIN_OTYPE_PUSHPULL(GPIOD_PIN12) | \
  590. PIN_OTYPE_PUSHPULL(GPIOD_PIN13) | \
  591. PIN_OTYPE_PUSHPULL(GPIOD_PIN14) | \
  592. PIN_OTYPE_PUSHPULL(GPIOD_PIN15))
  593. #define VAL_GPIOD_OSPEEDR (PIN_OSPEED_VERYLOW(GPIOD_PIN0) | \
  594. PIN_OSPEED_VERYLOW(GPIOD_PIN1) | \
  595. PIN_OSPEED_VERYLOW(GPIOD_PIN2) | \
  596. PIN_OSPEED_VERYLOW(GPIOD_PIN3) | \
  597. PIN_OSPEED_VERYLOW(GPIOD_PIN4) | \
  598. PIN_OSPEED_VERYLOW(GPIOD_PIN5) | \
  599. PIN_OSPEED_VERYLOW(GPIOD_PIN6) | \
  600. PIN_OSPEED_VERYLOW(GPIOD_PIN7) | \
  601. PIN_OSPEED_VERYLOW(GPIOD_PIN8) | \
  602. PIN_OSPEED_VERYLOW(GPIOD_PIN9) | \
  603. PIN_OSPEED_VERYLOW(GPIOD_PIN10) | \
  604. PIN_OSPEED_VERYLOW(GPIOD_PIN11) | \
  605. PIN_OSPEED_VERYLOW(GPIOD_PIN12) | \
  606. PIN_OSPEED_VERYLOW(GPIOD_PIN13) | \
  607. PIN_OSPEED_VERYLOW(GPIOD_PIN14) | \
  608. PIN_OSPEED_VERYLOW(GPIOD_PIN15))
  609. #define VAL_GPIOD_PUPDR (PIN_PUPDR_PULLUP(GPIOD_PIN0) | \
  610. PIN_PUPDR_PULLUP(GPIOD_PIN1) | \
  611. PIN_PUPDR_PULLUP(GPIOD_PIN2) | \
  612. PIN_PUPDR_PULLUP(GPIOD_PIN3) | \
  613. PIN_PUPDR_PULLUP(GPIOD_PIN4) | \
  614. PIN_PUPDR_PULLUP(GPIOD_PIN5) | \
  615. PIN_PUPDR_PULLUP(GPIOD_PIN6) | \
  616. PIN_PUPDR_PULLUP(GPIOD_PIN7) | \
  617. PIN_PUPDR_PULLUP(GPIOD_PIN8) | \
  618. PIN_PUPDR_PULLUP(GPIOD_PIN9) | \
  619. PIN_PUPDR_PULLUP(GPIOD_PIN10) | \
  620. PIN_PUPDR_PULLUP(GPIOD_PIN11) | \
  621. PIN_PUPDR_PULLUP(GPIOD_PIN12) | \
  622. PIN_PUPDR_PULLUP(GPIOD_PIN13) | \
  623. PIN_PUPDR_PULLUP(GPIOD_PIN14) | \
  624. PIN_PUPDR_PULLUP(GPIOD_PIN15))
  625. #define VAL_GPIOD_ODR (PIN_ODR_HIGH(GPIOD_PIN0) | \
  626. PIN_ODR_HIGH(GPIOD_PIN1) | \
  627. PIN_ODR_HIGH(GPIOD_PIN2) | \
  628. PIN_ODR_HIGH(GPIOD_PIN3) | \
  629. PIN_ODR_HIGH(GPIOD_PIN4) | \
  630. PIN_ODR_HIGH(GPIOD_PIN5) | \
  631. PIN_ODR_HIGH(GPIOD_PIN6) | \
  632. PIN_ODR_HIGH(GPIOD_PIN7) | \
  633. PIN_ODR_HIGH(GPIOD_PIN8) | \
  634. PIN_ODR_HIGH(GPIOD_PIN9) | \
  635. PIN_ODR_HIGH(GPIOD_PIN10) | \
  636. PIN_ODR_HIGH(GPIOD_PIN11) | \
  637. PIN_ODR_HIGH(GPIOD_PIN12) | \
  638. PIN_ODR_HIGH(GPIOD_PIN13) | \
  639. PIN_ODR_HIGH(GPIOD_PIN14) | \
  640. PIN_ODR_HIGH(GPIOD_PIN15))
  641. #define VAL_GPIOD_AFRL (PIN_AFIO_AF(GPIOD_PIN0, 0U) | \
  642. PIN_AFIO_AF(GPIOD_PIN1, 0U) | \
  643. PIN_AFIO_AF(GPIOD_PIN2, 0U) | \
  644. PIN_AFIO_AF(GPIOD_PIN3, 0U) | \
  645. PIN_AFIO_AF(GPIOD_PIN4, 0U) | \
  646. PIN_AFIO_AF(GPIOD_PIN5, 0U) | \
  647. PIN_AFIO_AF(GPIOD_PIN6, 0U) | \
  648. PIN_AFIO_AF(GPIOD_PIN7, 0U))
  649. #define VAL_GPIOD_AFRH (PIN_AFIO_AF(GPIOD_PIN8, 0U) | \
  650. PIN_AFIO_AF(GPIOD_PIN9, 0U) | \
  651. PIN_AFIO_AF(GPIOD_PIN10, 0U) | \
  652. PIN_AFIO_AF(GPIOD_PIN11, 0U) | \
  653. PIN_AFIO_AF(GPIOD_PIN12, 0U) | \
  654. PIN_AFIO_AF(GPIOD_PIN13, 0U) | \
  655. PIN_AFIO_AF(GPIOD_PIN14, 0U) | \
  656. PIN_AFIO_AF(GPIOD_PIN15, 0U))
  657. /*
  658. * GPIOE setup:
  659. *
  660. * PE0 - PIN0 (input pullup).
  661. * PE1 - PIN1 (input pullup).
  662. * PE2 - PIN2 (input pullup).
  663. * PE3 - PIN3 (input pullup).
  664. * PE4 - PIN4 (input pullup).
  665. * PE5 - PIN5 (input pullup).
  666. * PE6 - PIN6 (input pullup).
  667. * PE7 - PIN7 (input pullup).
  668. * PE8 - PIN8 (input pullup).
  669. * PE9 - PIN9 (input pullup).
  670. * PE10 - PIN10 (input pullup).
  671. * PE11 - PIN11 (input pullup).
  672. * PE12 - PIN12 (input pullup).
  673. * PE13 - PIN13 (input pullup).
  674. * PE14 - PIN14 (input pullup).
  675. * PE15 - PIN15 (input pullup).
  676. */
  677. #define VAL_GPIOE_MODER (PIN_MODE_INPUT(GPIOE_PIN0) | \
  678. PIN_MODE_INPUT(GPIOE_PIN1) | \
  679. PIN_MODE_INPUT(GPIOE_PIN2) | \
  680. PIN_MODE_INPUT(GPIOE_PIN3) | \
  681. PIN_MODE_INPUT(GPIOE_PIN4) | \
  682. PIN_MODE_INPUT(GPIOE_PIN5) | \
  683. PIN_MODE_INPUT(GPIOE_PIN6) | \
  684. PIN_MODE_INPUT(GPIOE_PIN7) | \
  685. PIN_MODE_INPUT(GPIOE_PIN8) | \
  686. PIN_MODE_INPUT(GPIOE_PIN9) | \
  687. PIN_MODE_INPUT(GPIOE_PIN10) | \
  688. PIN_MODE_INPUT(GPIOE_PIN11) | \
  689. PIN_MODE_INPUT(GPIOE_PIN12) | \
  690. PIN_MODE_INPUT(GPIOE_PIN13) | \
  691. PIN_MODE_INPUT(GPIOE_PIN14) | \
  692. PIN_MODE_INPUT(GPIOE_PIN15))
  693. #define VAL_GPIOE_OTYPER (PIN_OTYPE_PUSHPULL(GPIOE_PIN0) | \
  694. PIN_OTYPE_PUSHPULL(GPIOE_PIN1) | \
  695. PIN_OTYPE_PUSHPULL(GPIOE_PIN2) | \
  696. PIN_OTYPE_PUSHPULL(GPIOE_PIN3) | \
  697. PIN_OTYPE_PUSHPULL(GPIOE_PIN4) | \
  698. PIN_OTYPE_PUSHPULL(GPIOE_PIN5) | \
  699. PIN_OTYPE_PUSHPULL(GPIOE_PIN6) | \
  700. PIN_OTYPE_PUSHPULL(GPIOE_PIN7) | \
  701. PIN_OTYPE_PUSHPULL(GPIOE_PIN8) | \
  702. PIN_OTYPE_PUSHPULL(GPIOE_PIN9) | \
  703. PIN_OTYPE_PUSHPULL(GPIOE_PIN10) | \
  704. PIN_OTYPE_PUSHPULL(GPIOE_PIN11) | \
  705. PIN_OTYPE_PUSHPULL(GPIOE_PIN12) | \
  706. PIN_OTYPE_PUSHPULL(GPIOE_PIN13) | \
  707. PIN_OTYPE_PUSHPULL(GPIOE_PIN14) | \
  708. PIN_OTYPE_PUSHPULL(GPIOE_PIN15))
  709. #define VAL_GPIOE_OSPEEDR (PIN_OSPEED_VERYLOW(GPIOE_PIN0) | \
  710. PIN_OSPEED_VERYLOW(GPIOE_PIN1) | \
  711. PIN_OSPEED_VERYLOW(GPIOE_PIN2) | \
  712. PIN_OSPEED_VERYLOW(GPIOE_PIN3) | \
  713. PIN_OSPEED_VERYLOW(GPIOE_PIN4) | \
  714. PIN_OSPEED_VERYLOW(GPIOE_PIN5) | \
  715. PIN_OSPEED_VERYLOW(GPIOE_PIN6) | \
  716. PIN_OSPEED_VERYLOW(GPIOE_PIN7) | \
  717. PIN_OSPEED_VERYLOW(GPIOE_PIN8) | \
  718. PIN_OSPEED_VERYLOW(GPIOE_PIN9) | \
  719. PIN_OSPEED_VERYLOW(GPIOE_PIN10) | \
  720. PIN_OSPEED_VERYLOW(GPIOE_PIN11) | \
  721. PIN_OSPEED_VERYLOW(GPIOE_PIN12) | \
  722. PIN_OSPEED_VERYLOW(GPIOE_PIN13) | \
  723. PIN_OSPEED_VERYLOW(GPIOE_PIN14) | \
  724. PIN_OSPEED_VERYLOW(GPIOE_PIN15))
  725. #define VAL_GPIOE_PUPDR (PIN_PUPDR_PULLUP(GPIOE_PIN0) | \
  726. PIN_PUPDR_PULLUP(GPIOE_PIN1) | \
  727. PIN_PUPDR_PULLUP(GPIOE_PIN2) | \
  728. PIN_PUPDR_PULLUP(GPIOE_PIN3) | \
  729. PIN_PUPDR_PULLUP(GPIOE_PIN4) | \
  730. PIN_PUPDR_PULLUP(GPIOE_PIN5) | \
  731. PIN_PUPDR_PULLUP(GPIOE_PIN6) | \
  732. PIN_PUPDR_PULLUP(GPIOE_PIN7) | \
  733. PIN_PUPDR_PULLUP(GPIOE_PIN8) | \
  734. PIN_PUPDR_PULLUP(GPIOE_PIN9) | \
  735. PIN_PUPDR_PULLUP(GPIOE_PIN10) | \
  736. PIN_PUPDR_PULLUP(GPIOE_PIN11) | \
  737. PIN_PUPDR_PULLUP(GPIOE_PIN12) | \
  738. PIN_PUPDR_PULLUP(GPIOE_PIN13) | \
  739. PIN_PUPDR_PULLUP(GPIOE_PIN14) | \
  740. PIN_PUPDR_PULLUP(GPIOE_PIN15))
  741. #define VAL_GPIOE_ODR (PIN_ODR_HIGH(GPIOE_PIN0) | \
  742. PIN_ODR_HIGH(GPIOE_PIN1) | \
  743. PIN_ODR_HIGH(GPIOE_PIN2) | \
  744. PIN_ODR_HIGH(GPIOE_PIN3) | \
  745. PIN_ODR_HIGH(GPIOE_PIN4) | \
  746. PIN_ODR_HIGH(GPIOE_PIN5) | \
  747. PIN_ODR_HIGH(GPIOE_PIN6) | \
  748. PIN_ODR_HIGH(GPIOE_PIN7) | \
  749. PIN_ODR_HIGH(GPIOE_PIN8) | \
  750. PIN_ODR_HIGH(GPIOE_PIN9) | \
  751. PIN_ODR_HIGH(GPIOE_PIN10) | \
  752. PIN_ODR_HIGH(GPIOE_PIN11) | \
  753. PIN_ODR_HIGH(GPIOE_PIN12) | \
  754. PIN_ODR_HIGH(GPIOE_PIN13) | \
  755. PIN_ODR_HIGH(GPIOE_PIN14) | \
  756. PIN_ODR_HIGH(GPIOE_PIN15))
  757. #define VAL_GPIOE_AFRL (PIN_AFIO_AF(GPIOE_PIN0, 0U) | \
  758. PIN_AFIO_AF(GPIOE_PIN1, 0U) | \
  759. PIN_AFIO_AF(GPIOE_PIN2, 0U) | \
  760. PIN_AFIO_AF(GPIOE_PIN3, 0U) | \
  761. PIN_AFIO_AF(GPIOE_PIN4, 0U) | \
  762. PIN_AFIO_AF(GPIOE_PIN5, 0U) | \
  763. PIN_AFIO_AF(GPIOE_PIN6, 0U) | \
  764. PIN_AFIO_AF(GPIOE_PIN7, 0U))
  765. #define VAL_GPIOE_AFRH (PIN_AFIO_AF(GPIOE_PIN8, 0U) | \
  766. PIN_AFIO_AF(GPIOE_PIN9, 0U) | \
  767. PIN_AFIO_AF(GPIOE_PIN10, 0U) | \
  768. PIN_AFIO_AF(GPIOE_PIN11, 0U) | \
  769. PIN_AFIO_AF(GPIOE_PIN12, 0U) | \
  770. PIN_AFIO_AF(GPIOE_PIN13, 0U) | \
  771. PIN_AFIO_AF(GPIOE_PIN14, 0U) | \
  772. PIN_AFIO_AF(GPIOE_PIN15, 0U))
  773. /*
  774. * GPIOH setup:
  775. *
  776. * PH0 - OSC_IN (input floating).
  777. * PH1 - OSC_OUT (input floating).
  778. * PH2 - PIN2 (input pullup).
  779. * PH3 - PIN3 (input pullup).
  780. * PH4 - PIN4 (input pullup).
  781. * PH5 - PIN5 (input pullup).
  782. * PH6 - PIN6 (input pullup).
  783. * PH7 - PIN7 (input pullup).
  784. * PH8 - PIN8 (input pullup).
  785. * PH9 - PIN9 (input pullup).
  786. * PH10 - PIN10 (input pullup).
  787. * PH11 - PIN11 (input pullup).
  788. * PH12 - PIN12 (input pullup).
  789. * PH13 - PIN13 (input pullup).
  790. * PH14 - PIN14 (input pullup).
  791. * PH15 - PIN15 (input pullup).
  792. */
  793. #define VAL_GPIOH_MODER (PIN_MODE_INPUT(GPIOH_OSC_IN) | \
  794. PIN_MODE_INPUT(GPIOH_OSC_OUT) | \
  795. PIN_MODE_INPUT(GPIOH_PIN2) | \
  796. PIN_MODE_INPUT(GPIOH_PIN3) | \
  797. PIN_MODE_INPUT(GPIOH_PIN4) | \
  798. PIN_MODE_INPUT(GPIOH_PIN5) | \
  799. PIN_MODE_INPUT(GPIOH_PIN6) | \
  800. PIN_MODE_INPUT(GPIOH_PIN7) | \
  801. PIN_MODE_INPUT(GPIOH_PIN8) | \
  802. PIN_MODE_INPUT(GPIOH_PIN9) | \
  803. PIN_MODE_INPUT(GPIOH_PIN10) | \
  804. PIN_MODE_INPUT(GPIOH_PIN11) | \
  805. PIN_MODE_INPUT(GPIOH_PIN12) | \
  806. PIN_MODE_INPUT(GPIOH_PIN13) | \
  807. PIN_MODE_INPUT(GPIOH_PIN14) | \
  808. PIN_MODE_INPUT(GPIOH_PIN15))
  809. #define VAL_GPIOH_OTYPER (PIN_OTYPE_PUSHPULL(GPIOH_OSC_IN) | \
  810. PIN_OTYPE_PUSHPULL(GPIOH_OSC_OUT) | \
  811. PIN_OTYPE_PUSHPULL(GPIOH_PIN2) | \
  812. PIN_OTYPE_PUSHPULL(GPIOH_PIN3) | \
  813. PIN_OTYPE_PUSHPULL(GPIOH_PIN4) | \
  814. PIN_OTYPE_PUSHPULL(GPIOH_PIN5) | \
  815. PIN_OTYPE_PUSHPULL(GPIOH_PIN6) | \
  816. PIN_OTYPE_PUSHPULL(GPIOH_PIN7) | \
  817. PIN_OTYPE_PUSHPULL(GPIOH_PIN8) | \
  818. PIN_OTYPE_PUSHPULL(GPIOH_PIN9) | \
  819. PIN_OTYPE_PUSHPULL(GPIOH_PIN10) | \
  820. PIN_OTYPE_PUSHPULL(GPIOH_PIN11) | \
  821. PIN_OTYPE_PUSHPULL(GPIOH_PIN12) | \
  822. PIN_OTYPE_PUSHPULL(GPIOH_PIN13) | \
  823. PIN_OTYPE_PUSHPULL(GPIOH_PIN14) | \
  824. PIN_OTYPE_PUSHPULL(GPIOH_PIN15))
  825. #define VAL_GPIOH_OSPEEDR (PIN_OSPEED_HIGH(GPIOH_OSC_IN) | \
  826. PIN_OSPEED_HIGH(GPIOH_OSC_OUT) | \
  827. PIN_OSPEED_VERYLOW(GPIOH_PIN2) | \
  828. PIN_OSPEED_VERYLOW(GPIOH_PIN3) | \
  829. PIN_OSPEED_VERYLOW(GPIOH_PIN4) | \
  830. PIN_OSPEED_VERYLOW(GPIOH_PIN5) | \
  831. PIN_OSPEED_VERYLOW(GPIOH_PIN6) | \
  832. PIN_OSPEED_VERYLOW(GPIOH_PIN7) | \
  833. PIN_OSPEED_VERYLOW(GPIOH_PIN8) | \
  834. PIN_OSPEED_VERYLOW(GPIOH_PIN9) | \
  835. PIN_OSPEED_VERYLOW(GPIOH_PIN10) | \
  836. PIN_OSPEED_VERYLOW(GPIOH_PIN11) | \
  837. PIN_OSPEED_VERYLOW(GPIOH_PIN12) | \
  838. PIN_OSPEED_VERYLOW(GPIOH_PIN13) | \
  839. PIN_OSPEED_VERYLOW(GPIOH_PIN14) | \
  840. PIN_OSPEED_VERYLOW(GPIOH_PIN15))
  841. #define VAL_GPIOH_PUPDR (PIN_PUPDR_FLOATING(GPIOH_OSC_IN) | \
  842. PIN_PUPDR_FLOATING(GPIOH_OSC_OUT) | \
  843. PIN_PUPDR_PULLUP(GPIOH_PIN2) | \
  844. PIN_PUPDR_PULLUP(GPIOH_PIN3) | \
  845. PIN_PUPDR_PULLUP(GPIOH_PIN4) | \
  846. PIN_PUPDR_PULLUP(GPIOH_PIN5) | \
  847. PIN_PUPDR_PULLUP(GPIOH_PIN6) | \
  848. PIN_PUPDR_PULLUP(GPIOH_PIN7) | \
  849. PIN_PUPDR_PULLUP(GPIOH_PIN8) | \
  850. PIN_PUPDR_PULLUP(GPIOH_PIN9) | \
  851. PIN_PUPDR_PULLUP(GPIOH_PIN10) | \
  852. PIN_PUPDR_PULLUP(GPIOH_PIN11) | \
  853. PIN_PUPDR_PULLUP(GPIOH_PIN12) | \
  854. PIN_PUPDR_PULLUP(GPIOH_PIN13) | \
  855. PIN_PUPDR_PULLUP(GPIOH_PIN14) | \
  856. PIN_PUPDR_PULLUP(GPIOH_PIN15))
  857. #define VAL_GPIOH_ODR (PIN_ODR_HIGH(GPIOH_OSC_IN) | \
  858. PIN_ODR_HIGH(GPIOH_OSC_OUT) | \
  859. PIN_ODR_HIGH(GPIOH_PIN2) | \
  860. PIN_ODR_HIGH(GPIOH_PIN3) | \
  861. PIN_ODR_HIGH(GPIOH_PIN4) | \
  862. PIN_ODR_HIGH(GPIOH_PIN5) | \
  863. PIN_ODR_HIGH(GPIOH_PIN6) | \
  864. PIN_ODR_HIGH(GPIOH_PIN7) | \
  865. PIN_ODR_HIGH(GPIOH_PIN8) | \
  866. PIN_ODR_HIGH(GPIOH_PIN9) | \
  867. PIN_ODR_HIGH(GPIOH_PIN10) | \
  868. PIN_ODR_HIGH(GPIOH_PIN11) | \
  869. PIN_ODR_HIGH(GPIOH_PIN12) | \
  870. PIN_ODR_HIGH(GPIOH_PIN13) | \
  871. PIN_ODR_HIGH(GPIOH_PIN14) | \
  872. PIN_ODR_HIGH(GPIOH_PIN15))
  873. #define VAL_GPIOH_AFRL (PIN_AFIO_AF(GPIOH_OSC_IN, 0U) | \
  874. PIN_AFIO_AF(GPIOH_OSC_OUT, 0U) | \
  875. PIN_AFIO_AF(GPIOH_PIN2, 0U) | \
  876. PIN_AFIO_AF(GPIOH_PIN3, 0U) | \
  877. PIN_AFIO_AF(GPIOH_PIN4, 0U) | \
  878. PIN_AFIO_AF(GPIOH_PIN5, 0U) | \
  879. PIN_AFIO_AF(GPIOH_PIN6, 0U) | \
  880. PIN_AFIO_AF(GPIOH_PIN7, 0U))
  881. #define VAL_GPIOH_AFRH (PIN_AFIO_AF(GPIOH_PIN8, 0U) | \
  882. PIN_AFIO_AF(GPIOH_PIN9, 0U) | \
  883. PIN_AFIO_AF(GPIOH_PIN10, 0U) | \
  884. PIN_AFIO_AF(GPIOH_PIN11, 0U) | \
  885. PIN_AFIO_AF(GPIOH_PIN12, 0U) | \
  886. PIN_AFIO_AF(GPIOH_PIN13, 0U) | \
  887. PIN_AFIO_AF(GPIOH_PIN14, 0U) | \
  888. PIN_AFIO_AF(GPIOH_PIN15, 0U))
  889. /*===========================================================================*/
  890. /* External declarations. */
  891. /*===========================================================================*/
  892. #if !defined(_FROM_ASM_)
  893. #ifdef __cplusplus
  894. extern "C" {
  895. #endif
  896. void boardInit(void);
  897. #ifdef __cplusplus
  898. }
  899. #endif
  900. #endif /* _FROM_ASM_ */
  901. #endif /* BOARD_H */