PD Buddy Sink Firmware
Du kannst nicht mehr als 25 Themen auswählen Themen müssen mit entweder einem Buchstaben oder einer Ziffer beginnen. Sie können Bindestriche („-“) enthalten und bis zu 35 Zeichen lang sein.

board.h 56KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934
  1. /*
  2. * PD Buddy Sink Firmware - Smart power jack for USB Power Delivery
  3. * Copyright (C) 2017-2018 Clayton G. Hobbs <clay@lakeserv.net>
  4. *
  5. * This program is free software: you can redistribute it and/or modify
  6. * it under the terms of the GNU General Public License as published by
  7. * the Free Software Foundation, either version 3 of the License, or
  8. * (at your option) any later version.
  9. *
  10. * This program is distributed in the hope that it will be useful,
  11. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  12. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  13. * GNU General Public License for more details.
  14. *
  15. * You should have received a copy of the GNU General Public License
  16. * along with this program. If not, see <http://www.gnu.org/licenses/>.
  17. */
  18. /*
  19. ChibiOS - Copyright (C) 2006..2016 Giovanni Di Sirio
  20. Licensed under the Apache License, Version 2.0 (the "License");
  21. you may not use this file except in compliance with the License.
  22. You may obtain a copy of the License at
  23. http://www.apache.org/licenses/LICENSE-2.0
  24. Unless required by applicable law or agreed to in writing, software
  25. distributed under the License is distributed on an "AS IS" BASIS,
  26. WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  27. See the License for the specific language governing permissions and
  28. limitations under the License.
  29. */
  30. /*
  31. * This file has been automatically generated using ChibiStudio board
  32. * generator plugin. Do not edit manually.
  33. */
  34. #ifndef BOARD_H
  35. #define BOARD_H
  36. /*
  37. * Setup for PD Buddy Sink board.
  38. */
  39. /*
  40. * Board identifier.
  41. */
  42. #define BOARD_PD_BUDDY_SINK
  43. #define BOARD_NAME "PD Buddy Sink"
  44. /*
  45. * Board oscillators-related settings.
  46. * NOTE: LSE not fitted.
  47. * NOTE: HSE not fitted.
  48. */
  49. #if !defined(STM32_LSECLK)
  50. #define STM32_LSECLK 0U
  51. #endif
  52. #define STM32_LSEDRV (3U << 3U)
  53. #if !defined(STM32_HSECLK)
  54. #define STM32_HSECLK 0U
  55. #endif
  56. #define STM32_HSE_BYPASS
  57. /*
  58. * MCU type as defined in the ST header.
  59. */
  60. #define STM32F072xB
  61. /*
  62. * IO pins assignments.
  63. */
  64. #define GPIOA_PIN0 0U
  65. #define GPIOA_PIN1 1U
  66. #define GPIOA_PIN2 2U
  67. #define GPIOA_PIN3 3U
  68. #define GPIOA_PIN4 4U
  69. #define GPIOA_PIN5 5U
  70. #define GPIOA_PIN6 6U
  71. #define GPIOA_PIN7 7U
  72. #define GPIOA_PIN8 8U
  73. #define GPIOA_PIN9 9U
  74. #define GPIOA_PIN10 10U
  75. #define GPIOA_USB_DM 11U
  76. #define GPIOA_USB_DP 12U
  77. #define GPIOA_SWDIO 13U
  78. #define GPIOA_SWCLK 14U
  79. #define GPIOA_LED 15U
  80. #define GPIOB_PIN0 0U
  81. #define GPIOB_PIN1 1U
  82. #define GPIOB_PIN2 2U
  83. #define GPIOB_BUTTON 3U
  84. #define GPIOB_PIN4 4U
  85. #define GPIOB_PIN5 5U
  86. #define GPIOB_PIN6 6U
  87. #define GPIOB_PIN7 7U
  88. #define GPIOB_OUT_CTRL 8U
  89. #define GPIOB_PIN9 9U
  90. #define GPIOB_SCL 10U
  91. #define GPIOB_SDA 11U
  92. #define GPIOB_INT_N 12U
  93. #define GPIOB_PIN13 13U
  94. #define GPIOB_PIN14 14U
  95. #define GPIOB_PIN15 15U
  96. #define GPIOC_PIN0 0U
  97. #define GPIOC_PIN1 1U
  98. #define GPIOC_PIN2 2U
  99. #define GPIOC_PIN3 3U
  100. #define GPIOC_PIN4 4U
  101. #define GPIOC_PIN5 5U
  102. #define GPIOC_PIN6 6U
  103. #define GPIOC_PIN7 7U
  104. #define GPIOC_PIN8 8U
  105. #define GPIOC_PIN9 9U
  106. #define GPIOC_PIN10 10U
  107. #define GPIOC_PIN11 11U
  108. #define GPIOC_PIN12 12U
  109. #define GPIOC_PIN13 13U
  110. #define GPIOC_PIN14 14U
  111. #define GPIOC_PIN15 15U
  112. #define GPIOD_PIN0 0U
  113. #define GPIOD_PIN1 1U
  114. #define GPIOD_PIN2 2U
  115. #define GPIOD_PIN3 3U
  116. #define GPIOD_PIN4 4U
  117. #define GPIOD_PIN5 5U
  118. #define GPIOD_PIN6 6U
  119. #define GPIOD_PIN7 7U
  120. #define GPIOD_PIN8 8U
  121. #define GPIOD_PIN9 9U
  122. #define GPIOD_PIN10 10U
  123. #define GPIOD_PIN11 11U
  124. #define GPIOD_PIN12 12U
  125. #define GPIOD_PIN13 13U
  126. #define GPIOD_PIN14 14U
  127. #define GPIOD_PIN15 15U
  128. #define GPIOE_PIN0 0U
  129. #define GPIOE_PIN1 1U
  130. #define GPIOE_PIN2 2U
  131. #define GPIOE_PIN3 3U
  132. #define GPIOE_PIN4 4U
  133. #define GPIOE_PIN5 5U
  134. #define GPIOE_PIN6 6U
  135. #define GPIOE_PIN7 7U
  136. #define GPIOE_PIN8 8U
  137. #define GPIOE_PIN9 9U
  138. #define GPIOE_PIN10 10U
  139. #define GPIOE_PIN11 11U
  140. #define GPIOE_PIN12 12U
  141. #define GPIOE_PIN13 13U
  142. #define GPIOE_PIN14 14U
  143. #define GPIOE_PIN15 15U
  144. #define GPIOF_PIN0 0U
  145. #define GPIOF_PIN1 1U
  146. #define GPIOF_PIN2 2U
  147. #define GPIOF_PIN3 3U
  148. #define GPIOF_PIN4 4U
  149. #define GPIOF_PIN5 5U
  150. #define GPIOF_PIN6 6U
  151. #define GPIOF_PIN7 7U
  152. #define GPIOF_PIN8 8U
  153. #define GPIOF_PIN9 9U
  154. #define GPIOF_PIN10 10U
  155. #define GPIOF_PIN11 11U
  156. #define GPIOF_PIN12 12U
  157. #define GPIOF_PIN13 13U
  158. #define GPIOF_PIN14 14U
  159. #define GPIOF_PIN15 15U
  160. /*
  161. * IO lines assignments.
  162. */
  163. #define LINE_USB_DM PAL_LINE(GPIOA, 11U)
  164. #define LINE_USB_DP PAL_LINE(GPIOA, 12U)
  165. #define LINE_SWDIO PAL_LINE(GPIOA, 13U)
  166. #define LINE_SWCLK PAL_LINE(GPIOA, 14U)
  167. #define LINE_LED PAL_LINE(GPIOA, 15U)
  168. #define LINE_BUTTON PAL_LINE(GPIOB, 3U)
  169. #define LINE_OUT_CTRL PAL_LINE(GPIOB, 8U)
  170. #define LINE_SCL PAL_LINE(GPIOB, 10U)
  171. #define LINE_SDA PAL_LINE(GPIOB, 11U)
  172. #define LINE_INT_N PAL_LINE(GPIOB, 12U)
  173. /*
  174. * I/O ports initial setup, this configuration is established soon after reset
  175. * in the initialization code.
  176. * Please refer to the STM32 Reference Manual for details.
  177. */
  178. #define PIN_MODE_INPUT(n) (0U << ((n) * 2U))
  179. #define PIN_MODE_OUTPUT(n) (1U << ((n) * 2U))
  180. #define PIN_MODE_ALTERNATE(n) (2U << ((n) * 2U))
  181. #define PIN_MODE_ANALOG(n) (3U << ((n) * 2U))
  182. #define PIN_ODR_LOW(n) (0U << (n))
  183. #define PIN_ODR_HIGH(n) (1U << (n))
  184. #define PIN_OTYPE_PUSHPULL(n) (0U << (n))
  185. #define PIN_OTYPE_OPENDRAIN(n) (1U << (n))
  186. #define PIN_OSPEED_VERYLOW(n) (0U << ((n) * 2U))
  187. #define PIN_OSPEED_LOW(n) (1U << ((n) * 2U))
  188. #define PIN_OSPEED_MEDIUM(n) (2U << ((n) * 2U))
  189. #define PIN_OSPEED_HIGH(n) (3U << ((n) * 2U))
  190. #define PIN_PUPDR_FLOATING(n) (0U << ((n) * 2U))
  191. #define PIN_PUPDR_PULLUP(n) (1U << ((n) * 2U))
  192. #define PIN_PUPDR_PULLDOWN(n) (2U << ((n) * 2U))
  193. #define PIN_AFIO_AF(n, v) ((v) << (((n) % 8U) * 4U))
  194. /*
  195. * GPIOA setup:
  196. *
  197. * PA0 - PIN0 (input pullup).
  198. * PA1 - PIN1 (input pullup).
  199. * PA2 - PIN2 (input pullup).
  200. * PA3 - PIN3 (input pullup).
  201. * PA4 - PIN4 (input pullup).
  202. * PA5 - PIN5 (input pullup).
  203. * PA6 - PIN6 (input pullup).
  204. * PA7 - PIN7 (input pullup).
  205. * PA8 - PIN8 (input pullup).
  206. * PA9 - PIN9 (input pullup).
  207. * PA10 - PIN10 (input pullup).
  208. * PA11 - USB_DM (input floating).
  209. * PA12 - USB_DP (input floating).
  210. * PA13 - SWDIO (alternate 0).
  211. * PA14 - SWCLK (alternate 0).
  212. * PA15 - LED (output pushpull maximum).
  213. */
  214. #define VAL_GPIOA_MODER (PIN_MODE_INPUT(GPIOA_PIN0) | \
  215. PIN_MODE_INPUT(GPIOA_PIN1) | \
  216. PIN_MODE_INPUT(GPIOA_PIN2) | \
  217. PIN_MODE_INPUT(GPIOA_PIN3) | \
  218. PIN_MODE_INPUT(GPIOA_PIN4) | \
  219. PIN_MODE_INPUT(GPIOA_PIN5) | \
  220. PIN_MODE_INPUT(GPIOA_PIN6) | \
  221. PIN_MODE_INPUT(GPIOA_PIN7) | \
  222. PIN_MODE_INPUT(GPIOA_PIN8) | \
  223. PIN_MODE_INPUT(GPIOA_PIN9) | \
  224. PIN_MODE_INPUT(GPIOA_PIN10) | \
  225. PIN_MODE_INPUT(GPIOA_USB_DM) | \
  226. PIN_MODE_INPUT(GPIOA_USB_DP) | \
  227. PIN_MODE_ALTERNATE(GPIOA_SWDIO) | \
  228. PIN_MODE_ALTERNATE(GPIOA_SWCLK) | \
  229. PIN_MODE_OUTPUT(GPIOA_LED))
  230. #define VAL_GPIOA_OTYPER (PIN_OTYPE_PUSHPULL(GPIOA_PIN0) | \
  231. PIN_OTYPE_PUSHPULL(GPIOA_PIN1) | \
  232. PIN_OTYPE_PUSHPULL(GPIOA_PIN2) | \
  233. PIN_OTYPE_PUSHPULL(GPIOA_PIN3) | \
  234. PIN_OTYPE_PUSHPULL(GPIOA_PIN4) | \
  235. PIN_OTYPE_PUSHPULL(GPIOA_PIN5) | \
  236. PIN_OTYPE_PUSHPULL(GPIOA_PIN6) | \
  237. PIN_OTYPE_PUSHPULL(GPIOA_PIN7) | \
  238. PIN_OTYPE_PUSHPULL(GPIOA_PIN8) | \
  239. PIN_OTYPE_PUSHPULL(GPIOA_PIN9) | \
  240. PIN_OTYPE_PUSHPULL(GPIOA_PIN10) | \
  241. PIN_OTYPE_PUSHPULL(GPIOA_USB_DM) | \
  242. PIN_OTYPE_PUSHPULL(GPIOA_USB_DP) | \
  243. PIN_OTYPE_PUSHPULL(GPIOA_SWDIO) | \
  244. PIN_OTYPE_PUSHPULL(GPIOA_SWCLK) | \
  245. PIN_OTYPE_PUSHPULL(GPIOA_LED))
  246. #define VAL_GPIOA_OSPEEDR (PIN_OSPEED_VERYLOW(GPIOA_PIN0) | \
  247. PIN_OSPEED_VERYLOW(GPIOA_PIN1) | \
  248. PIN_OSPEED_VERYLOW(GPIOA_PIN2) | \
  249. PIN_OSPEED_VERYLOW(GPIOA_PIN3) | \
  250. PIN_OSPEED_VERYLOW(GPIOA_PIN4) | \
  251. PIN_OSPEED_VERYLOW(GPIOA_PIN5) | \
  252. PIN_OSPEED_VERYLOW(GPIOA_PIN6) | \
  253. PIN_OSPEED_VERYLOW(GPIOA_PIN7) | \
  254. PIN_OSPEED_VERYLOW(GPIOA_PIN8) | \
  255. PIN_OSPEED_VERYLOW(GPIOA_PIN9) | \
  256. PIN_OSPEED_VERYLOW(GPIOA_PIN10) | \
  257. PIN_OSPEED_VERYLOW(GPIOA_USB_DM) | \
  258. PIN_OSPEED_VERYLOW(GPIOA_USB_DP) | \
  259. PIN_OSPEED_HIGH(GPIOA_SWDIO) | \
  260. PIN_OSPEED_HIGH(GPIOA_SWCLK) | \
  261. PIN_OSPEED_HIGH(GPIOA_LED))
  262. #define VAL_GPIOA_PUPDR (PIN_PUPDR_PULLUP(GPIOA_PIN0) | \
  263. PIN_PUPDR_PULLUP(GPIOA_PIN1) | \
  264. PIN_PUPDR_PULLUP(GPIOA_PIN2) | \
  265. PIN_PUPDR_PULLUP(GPIOA_PIN3) | \
  266. PIN_PUPDR_PULLUP(GPIOA_PIN4) | \
  267. PIN_PUPDR_PULLUP(GPIOA_PIN5) | \
  268. PIN_PUPDR_PULLUP(GPIOA_PIN6) | \
  269. PIN_PUPDR_PULLUP(GPIOA_PIN7) | \
  270. PIN_PUPDR_PULLUP(GPIOA_PIN8) | \
  271. PIN_PUPDR_PULLUP(GPIOA_PIN9) | \
  272. PIN_PUPDR_PULLUP(GPIOA_PIN10) | \
  273. PIN_PUPDR_FLOATING(GPIOA_USB_DM) | \
  274. PIN_PUPDR_FLOATING(GPIOA_USB_DP) | \
  275. PIN_PUPDR_PULLUP(GPIOA_SWDIO) | \
  276. PIN_PUPDR_PULLDOWN(GPIOA_SWCLK) | \
  277. PIN_PUPDR_FLOATING(GPIOA_LED))
  278. #define VAL_GPIOA_ODR (PIN_ODR_HIGH(GPIOA_PIN0) | \
  279. PIN_ODR_HIGH(GPIOA_PIN1) | \
  280. PIN_ODR_HIGH(GPIOA_PIN2) | \
  281. PIN_ODR_HIGH(GPIOA_PIN3) | \
  282. PIN_ODR_HIGH(GPIOA_PIN4) | \
  283. PIN_ODR_HIGH(GPIOA_PIN5) | \
  284. PIN_ODR_HIGH(GPIOA_PIN6) | \
  285. PIN_ODR_HIGH(GPIOA_PIN7) | \
  286. PIN_ODR_HIGH(GPIOA_PIN8) | \
  287. PIN_ODR_HIGH(GPIOA_PIN9) | \
  288. PIN_ODR_HIGH(GPIOA_PIN10) | \
  289. PIN_ODR_HIGH(GPIOA_USB_DM) | \
  290. PIN_ODR_HIGH(GPIOA_USB_DP) | \
  291. PIN_ODR_HIGH(GPIOA_SWDIO) | \
  292. PIN_ODR_HIGH(GPIOA_SWCLK) | \
  293. PIN_ODR_LOW(GPIOA_LED))
  294. #define VAL_GPIOA_AFRL (PIN_AFIO_AF(GPIOA_PIN0, 0U) | \
  295. PIN_AFIO_AF(GPIOA_PIN1, 0U) | \
  296. PIN_AFIO_AF(GPIOA_PIN2, 0U) | \
  297. PIN_AFIO_AF(GPIOA_PIN3, 0U) | \
  298. PIN_AFIO_AF(GPIOA_PIN4, 0U) | \
  299. PIN_AFIO_AF(GPIOA_PIN5, 0U) | \
  300. PIN_AFIO_AF(GPIOA_PIN6, 0U) | \
  301. PIN_AFIO_AF(GPIOA_PIN7, 0U))
  302. #define VAL_GPIOA_AFRH (PIN_AFIO_AF(GPIOA_PIN8, 0U) | \
  303. PIN_AFIO_AF(GPIOA_PIN9, 0U) | \
  304. PIN_AFIO_AF(GPIOA_PIN10, 0U) | \
  305. PIN_AFIO_AF(GPIOA_USB_DM, 0U) | \
  306. PIN_AFIO_AF(GPIOA_USB_DP, 0U) | \
  307. PIN_AFIO_AF(GPIOA_SWDIO, 0U) | \
  308. PIN_AFIO_AF(GPIOA_SWCLK, 0U) | \
  309. PIN_AFIO_AF(GPIOA_LED, 0U))
  310. /*
  311. * GPIOB setup:
  312. *
  313. * PB0 - PIN0 (input pullup).
  314. * PB1 - PIN1 (input pullup).
  315. * PB2 - PIN2 (input pullup).
  316. * PB3 - BUTTON (input floating).
  317. * PB4 - PIN4 (input pullup).
  318. * PB5 - PIN5 (input pullup).
  319. * PB6 - PIN6 (input pullup).
  320. * PB7 - PIN7 (input pullup).
  321. * PB8 - OUT_CTRL (output pushpull minimum).
  322. * PB9 - PIN9 (input pullup).
  323. * PB10 - SCL (alternate 1).
  324. * PB11 - SDA (alternate 1).
  325. * PB12 - INT_N (input floating).
  326. * PB13 - PIN13 (input pullup).
  327. * PB14 - PIN14 (input pullup).
  328. * PB15 - PIN15 (input pullup).
  329. */
  330. #define VAL_GPIOB_MODER (PIN_MODE_INPUT(GPIOB_PIN0) | \
  331. PIN_MODE_INPUT(GPIOB_PIN1) | \
  332. PIN_MODE_INPUT(GPIOB_PIN2) | \
  333. PIN_MODE_INPUT(GPIOB_BUTTON) | \
  334. PIN_MODE_INPUT(GPIOB_PIN4) | \
  335. PIN_MODE_INPUT(GPIOB_PIN5) | \
  336. PIN_MODE_INPUT(GPIOB_PIN6) | \
  337. PIN_MODE_INPUT(GPIOB_PIN7) | \
  338. PIN_MODE_OUTPUT(GPIOB_OUT_CTRL) | \
  339. PIN_MODE_INPUT(GPIOB_PIN9) | \
  340. PIN_MODE_ALTERNATE(GPIOB_SCL) | \
  341. PIN_MODE_ALTERNATE(GPIOB_SDA) | \
  342. PIN_MODE_INPUT(GPIOB_INT_N) | \
  343. PIN_MODE_INPUT(GPIOB_PIN13) | \
  344. PIN_MODE_INPUT(GPIOB_PIN14) | \
  345. PIN_MODE_INPUT(GPIOB_PIN15))
  346. #define VAL_GPIOB_OTYPER (PIN_OTYPE_PUSHPULL(GPIOB_PIN0) | \
  347. PIN_OTYPE_PUSHPULL(GPIOB_PIN1) | \
  348. PIN_OTYPE_PUSHPULL(GPIOB_PIN2) | \
  349. PIN_OTYPE_PUSHPULL(GPIOB_BUTTON) | \
  350. PIN_OTYPE_PUSHPULL(GPIOB_PIN4) | \
  351. PIN_OTYPE_PUSHPULL(GPIOB_PIN5) | \
  352. PIN_OTYPE_PUSHPULL(GPIOB_PIN6) | \
  353. PIN_OTYPE_PUSHPULL(GPIOB_PIN7) | \
  354. PIN_OTYPE_PUSHPULL(GPIOB_OUT_CTRL) | \
  355. PIN_OTYPE_PUSHPULL(GPIOB_PIN9) | \
  356. PIN_OTYPE_OPENDRAIN(GPIOB_SCL) | \
  357. PIN_OTYPE_OPENDRAIN(GPIOB_SDA) | \
  358. PIN_OTYPE_PUSHPULL(GPIOB_INT_N) | \
  359. PIN_OTYPE_PUSHPULL(GPIOB_PIN13) | \
  360. PIN_OTYPE_PUSHPULL(GPIOB_PIN14) | \
  361. PIN_OTYPE_PUSHPULL(GPIOB_PIN15))
  362. #define VAL_GPIOB_OSPEEDR (PIN_OSPEED_VERYLOW(GPIOB_PIN0) | \
  363. PIN_OSPEED_VERYLOW(GPIOB_PIN1) | \
  364. PIN_OSPEED_HIGH(GPIOB_PIN2) | \
  365. PIN_OSPEED_VERYLOW(GPIOB_BUTTON) | \
  366. PIN_OSPEED_HIGH(GPIOB_PIN4) | \
  367. PIN_OSPEED_VERYLOW(GPIOB_PIN5) | \
  368. PIN_OSPEED_VERYLOW(GPIOB_PIN6) | \
  369. PIN_OSPEED_VERYLOW(GPIOB_PIN7) | \
  370. PIN_OSPEED_VERYLOW(GPIOB_OUT_CTRL) | \
  371. PIN_OSPEED_VERYLOW(GPIOB_PIN9) | \
  372. PIN_OSPEED_HIGH(GPIOB_SCL) | \
  373. PIN_OSPEED_HIGH(GPIOB_SDA) | \
  374. PIN_OSPEED_LOW(GPIOB_INT_N) | \
  375. PIN_OSPEED_VERYLOW(GPIOB_PIN13) | \
  376. PIN_OSPEED_VERYLOW(GPIOB_PIN14) | \
  377. PIN_OSPEED_VERYLOW(GPIOB_PIN15))
  378. #define VAL_GPIOB_PUPDR (PIN_PUPDR_PULLUP(GPIOB_PIN0) | \
  379. PIN_PUPDR_PULLUP(GPIOB_PIN1) | \
  380. PIN_PUPDR_PULLUP(GPIOB_PIN2) | \
  381. PIN_PUPDR_FLOATING(GPIOB_BUTTON) | \
  382. PIN_PUPDR_PULLUP(GPIOB_PIN4) | \
  383. PIN_PUPDR_PULLUP(GPIOB_PIN5) | \
  384. PIN_PUPDR_PULLUP(GPIOB_PIN6) | \
  385. PIN_PUPDR_PULLUP(GPIOB_PIN7) | \
  386. PIN_PUPDR_FLOATING(GPIOB_OUT_CTRL) | \
  387. PIN_PUPDR_PULLUP(GPIOB_PIN9) | \
  388. PIN_PUPDR_FLOATING(GPIOB_SCL) | \
  389. PIN_PUPDR_FLOATING(GPIOB_SDA) | \
  390. PIN_PUPDR_FLOATING(GPIOB_INT_N) | \
  391. PIN_PUPDR_PULLUP(GPIOB_PIN13) | \
  392. PIN_PUPDR_PULLUP(GPIOB_PIN14) | \
  393. PIN_PUPDR_PULLUP(GPIOB_PIN15))
  394. #define VAL_GPIOB_ODR (PIN_ODR_HIGH(GPIOB_PIN0) | \
  395. PIN_ODR_HIGH(GPIOB_PIN1) | \
  396. PIN_ODR_HIGH(GPIOB_PIN2) | \
  397. PIN_ODR_HIGH(GPIOB_BUTTON) | \
  398. PIN_ODR_HIGH(GPIOB_PIN4) | \
  399. PIN_ODR_HIGH(GPIOB_PIN5) | \
  400. PIN_ODR_HIGH(GPIOB_PIN6) | \
  401. PIN_ODR_HIGH(GPIOB_PIN7) | \
  402. PIN_ODR_LOW(GPIOB_OUT_CTRL) | \
  403. PIN_ODR_HIGH(GPIOB_PIN9) | \
  404. PIN_ODR_HIGH(GPIOB_SCL) | \
  405. PIN_ODR_HIGH(GPIOB_SDA) | \
  406. PIN_ODR_LOW(GPIOB_INT_N) | \
  407. PIN_ODR_HIGH(GPIOB_PIN13) | \
  408. PIN_ODR_HIGH(GPIOB_PIN14) | \
  409. PIN_ODR_HIGH(GPIOB_PIN15))
  410. #define VAL_GPIOB_AFRL (PIN_AFIO_AF(GPIOB_PIN0, 0U) | \
  411. PIN_AFIO_AF(GPIOB_PIN1, 0U) | \
  412. PIN_AFIO_AF(GPIOB_PIN2, 0U) | \
  413. PIN_AFIO_AF(GPIOB_BUTTON, 0U) | \
  414. PIN_AFIO_AF(GPIOB_PIN4, 0U) | \
  415. PIN_AFIO_AF(GPIOB_PIN5, 0U) | \
  416. PIN_AFIO_AF(GPIOB_PIN6, 0U) | \
  417. PIN_AFIO_AF(GPIOB_PIN7, 0U))
  418. #define VAL_GPIOB_AFRH (PIN_AFIO_AF(GPIOB_OUT_CTRL, 0U) | \
  419. PIN_AFIO_AF(GPIOB_PIN9, 0U) | \
  420. PIN_AFIO_AF(GPIOB_SCL, 1U) | \
  421. PIN_AFIO_AF(GPIOB_SDA, 1U) | \
  422. PIN_AFIO_AF(GPIOB_INT_N, 0U) | \
  423. PIN_AFIO_AF(GPIOB_PIN13, 0U) | \
  424. PIN_AFIO_AF(GPIOB_PIN14, 0U) | \
  425. PIN_AFIO_AF(GPIOB_PIN15, 0U))
  426. /*
  427. * GPIOC setup:
  428. *
  429. * PC0 - PIN0 (input pullup).
  430. * PC1 - PIN1 (input pullup).
  431. * PC2 - PIN2 (input pullup).
  432. * PC3 - PIN3 (input pullup).
  433. * PC4 - PIN4 (input pullup).
  434. * PC5 - PIN5 (input pullup).
  435. * PC6 - PIN6 (input pullup).
  436. * PC7 - PIN7 (input pullup).
  437. * PC8 - PIN8 (input pullup).
  438. * PC9 - PIN9 (input pullup).
  439. * PC10 - PIN10 (input pullup).
  440. * PC11 - PIN11 (input pullup).
  441. * PC12 - PIN12 (input pullup).
  442. * PC13 - PIN13 (input pullup).
  443. * PC14 - PIN14 (input pullup).
  444. * PC15 - PIN15 (input pullup).
  445. */
  446. #define VAL_GPIOC_MODER (PIN_MODE_INPUT(GPIOC_PIN0) | \
  447. PIN_MODE_INPUT(GPIOC_PIN1) | \
  448. PIN_MODE_INPUT(GPIOC_PIN2) | \
  449. PIN_MODE_INPUT(GPIOC_PIN3) | \
  450. PIN_MODE_INPUT(GPIOC_PIN4) | \
  451. PIN_MODE_INPUT(GPIOC_PIN5) | \
  452. PIN_MODE_INPUT(GPIOC_PIN6) | \
  453. PIN_MODE_INPUT(GPIOC_PIN7) | \
  454. PIN_MODE_INPUT(GPIOC_PIN8) | \
  455. PIN_MODE_INPUT(GPIOC_PIN9) | \
  456. PIN_MODE_INPUT(GPIOC_PIN10) | \
  457. PIN_MODE_INPUT(GPIOC_PIN11) | \
  458. PIN_MODE_INPUT(GPIOC_PIN12) | \
  459. PIN_MODE_INPUT(GPIOC_PIN13) | \
  460. PIN_MODE_INPUT(GPIOC_PIN14) | \
  461. PIN_MODE_INPUT(GPIOC_PIN15))
  462. #define VAL_GPIOC_OTYPER (PIN_OTYPE_PUSHPULL(GPIOC_PIN0) | \
  463. PIN_OTYPE_PUSHPULL(GPIOC_PIN1) | \
  464. PIN_OTYPE_PUSHPULL(GPIOC_PIN2) | \
  465. PIN_OTYPE_PUSHPULL(GPIOC_PIN3) | \
  466. PIN_OTYPE_PUSHPULL(GPIOC_PIN4) | \
  467. PIN_OTYPE_PUSHPULL(GPIOC_PIN5) | \
  468. PIN_OTYPE_PUSHPULL(GPIOC_PIN6) | \
  469. PIN_OTYPE_PUSHPULL(GPIOC_PIN7) | \
  470. PIN_OTYPE_PUSHPULL(GPIOC_PIN8) | \
  471. PIN_OTYPE_PUSHPULL(GPIOC_PIN9) | \
  472. PIN_OTYPE_PUSHPULL(GPIOC_PIN10) | \
  473. PIN_OTYPE_PUSHPULL(GPIOC_PIN11) | \
  474. PIN_OTYPE_PUSHPULL(GPIOC_PIN12) | \
  475. PIN_OTYPE_PUSHPULL(GPIOC_PIN13) | \
  476. PIN_OTYPE_PUSHPULL(GPIOC_PIN14) | \
  477. PIN_OTYPE_PUSHPULL(GPIOC_PIN15))
  478. #define VAL_GPIOC_OSPEEDR (PIN_OSPEED_HIGH(GPIOC_PIN0) | \
  479. PIN_OSPEED_VERYLOW(GPIOC_PIN1) | \
  480. PIN_OSPEED_VERYLOW(GPIOC_PIN2) | \
  481. PIN_OSPEED_VERYLOW(GPIOC_PIN3) | \
  482. PIN_OSPEED_VERYLOW(GPIOC_PIN4) | \
  483. PIN_OSPEED_VERYLOW(GPIOC_PIN5) | \
  484. PIN_OSPEED_VERYLOW(GPIOC_PIN6) | \
  485. PIN_OSPEED_VERYLOW(GPIOC_PIN7) | \
  486. PIN_OSPEED_VERYLOW(GPIOC_PIN8) | \
  487. PIN_OSPEED_VERYLOW(GPIOC_PIN9) | \
  488. PIN_OSPEED_VERYLOW(GPIOC_PIN10) | \
  489. PIN_OSPEED_VERYLOW(GPIOC_PIN11) | \
  490. PIN_OSPEED_VERYLOW(GPIOC_PIN12) | \
  491. PIN_OSPEED_VERYLOW(GPIOC_PIN13) | \
  492. PIN_OSPEED_VERYLOW(GPIOC_PIN14) | \
  493. PIN_OSPEED_VERYLOW(GPIOC_PIN15))
  494. #define VAL_GPIOC_PUPDR (PIN_PUPDR_PULLUP(GPIOC_PIN0) | \
  495. PIN_PUPDR_PULLUP(GPIOC_PIN1) | \
  496. PIN_PUPDR_PULLUP(GPIOC_PIN2) | \
  497. PIN_PUPDR_PULLUP(GPIOC_PIN3) | \
  498. PIN_PUPDR_PULLUP(GPIOC_PIN4) | \
  499. PIN_PUPDR_PULLUP(GPIOC_PIN5) | \
  500. PIN_PUPDR_PULLUP(GPIOC_PIN6) | \
  501. PIN_PUPDR_PULLUP(GPIOC_PIN7) | \
  502. PIN_PUPDR_PULLUP(GPIOC_PIN8) | \
  503. PIN_PUPDR_PULLUP(GPIOC_PIN9) | \
  504. PIN_PUPDR_PULLUP(GPIOC_PIN10) | \
  505. PIN_PUPDR_PULLUP(GPIOC_PIN11) | \
  506. PIN_PUPDR_PULLUP(GPIOC_PIN12) | \
  507. PIN_PUPDR_PULLUP(GPIOC_PIN13) | \
  508. PIN_PUPDR_PULLUP(GPIOC_PIN14) | \
  509. PIN_PUPDR_PULLUP(GPIOC_PIN15))
  510. #define VAL_GPIOC_ODR (PIN_ODR_HIGH(GPIOC_PIN0) | \
  511. PIN_ODR_HIGH(GPIOC_PIN1) | \
  512. PIN_ODR_HIGH(GPIOC_PIN2) | \
  513. PIN_ODR_HIGH(GPIOC_PIN3) | \
  514. PIN_ODR_HIGH(GPIOC_PIN4) | \
  515. PIN_ODR_HIGH(GPIOC_PIN5) | \
  516. PIN_ODR_HIGH(GPIOC_PIN6) | \
  517. PIN_ODR_HIGH(GPIOC_PIN7) | \
  518. PIN_ODR_HIGH(GPIOC_PIN8) | \
  519. PIN_ODR_HIGH(GPIOC_PIN9) | \
  520. PIN_ODR_HIGH(GPIOC_PIN10) | \
  521. PIN_ODR_HIGH(GPIOC_PIN11) | \
  522. PIN_ODR_HIGH(GPIOC_PIN12) | \
  523. PIN_ODR_HIGH(GPIOC_PIN13) | \
  524. PIN_ODR_HIGH(GPIOC_PIN14) | \
  525. PIN_ODR_HIGH(GPIOC_PIN15))
  526. #define VAL_GPIOC_AFRL (PIN_AFIO_AF(GPIOC_PIN0, 0U) | \
  527. PIN_AFIO_AF(GPIOC_PIN1, 0U) | \
  528. PIN_AFIO_AF(GPIOC_PIN2, 0U) | \
  529. PIN_AFIO_AF(GPIOC_PIN3, 0U) | \
  530. PIN_AFIO_AF(GPIOC_PIN4, 0U) | \
  531. PIN_AFIO_AF(GPIOC_PIN5, 0U) | \
  532. PIN_AFIO_AF(GPIOC_PIN6, 0U) | \
  533. PIN_AFIO_AF(GPIOC_PIN7, 0U))
  534. #define VAL_GPIOC_AFRH (PIN_AFIO_AF(GPIOC_PIN8, 0U) | \
  535. PIN_AFIO_AF(GPIOC_PIN9, 0U) | \
  536. PIN_AFIO_AF(GPIOC_PIN10, 0U) | \
  537. PIN_AFIO_AF(GPIOC_PIN11, 0U) | \
  538. PIN_AFIO_AF(GPIOC_PIN12, 0U) | \
  539. PIN_AFIO_AF(GPIOC_PIN13, 0U) | \
  540. PIN_AFIO_AF(GPIOC_PIN14, 0U) | \
  541. PIN_AFIO_AF(GPIOC_PIN15, 0U))
  542. /*
  543. * GPIOD setup:
  544. *
  545. * PD0 - PIN0 (input pullup).
  546. * PD1 - PIN1 (input pullup).
  547. * PD2 - PIN2 (input pullup).
  548. * PD3 - PIN3 (input pullup).
  549. * PD4 - PIN4 (input pullup).
  550. * PD5 - PIN5 (input pullup).
  551. * PD6 - PIN6 (input pullup).
  552. * PD7 - PIN7 (input pullup).
  553. * PD8 - PIN8 (input pullup).
  554. * PD9 - PIN9 (input pullup).
  555. * PD10 - PIN10 (input pullup).
  556. * PD11 - PIN11 (input pullup).
  557. * PD12 - PIN12 (input pullup).
  558. * PD13 - PIN13 (input pullup).
  559. * PD14 - PIN14 (input pullup).
  560. * PD15 - PIN15 (input pullup).
  561. */
  562. #define VAL_GPIOD_MODER (PIN_MODE_INPUT(GPIOD_PIN0) | \
  563. PIN_MODE_INPUT(GPIOD_PIN1) | \
  564. PIN_MODE_INPUT(GPIOD_PIN2) | \
  565. PIN_MODE_INPUT(GPIOD_PIN3) | \
  566. PIN_MODE_INPUT(GPIOD_PIN4) | \
  567. PIN_MODE_INPUT(GPIOD_PIN5) | \
  568. PIN_MODE_INPUT(GPIOD_PIN6) | \
  569. PIN_MODE_INPUT(GPIOD_PIN7) | \
  570. PIN_MODE_INPUT(GPIOD_PIN8) | \
  571. PIN_MODE_INPUT(GPIOD_PIN9) | \
  572. PIN_MODE_INPUT(GPIOD_PIN10) | \
  573. PIN_MODE_INPUT(GPIOD_PIN11) | \
  574. PIN_MODE_INPUT(GPIOD_PIN12) | \
  575. PIN_MODE_INPUT(GPIOD_PIN13) | \
  576. PIN_MODE_INPUT(GPIOD_PIN14) | \
  577. PIN_MODE_INPUT(GPIOD_PIN15))
  578. #define VAL_GPIOD_OTYPER (PIN_OTYPE_PUSHPULL(GPIOD_PIN0) | \
  579. PIN_OTYPE_PUSHPULL(GPIOD_PIN1) | \
  580. PIN_OTYPE_PUSHPULL(GPIOD_PIN2) | \
  581. PIN_OTYPE_PUSHPULL(GPIOD_PIN3) | \
  582. PIN_OTYPE_PUSHPULL(GPIOD_PIN4) | \
  583. PIN_OTYPE_PUSHPULL(GPIOD_PIN5) | \
  584. PIN_OTYPE_PUSHPULL(GPIOD_PIN6) | \
  585. PIN_OTYPE_PUSHPULL(GPIOD_PIN7) | \
  586. PIN_OTYPE_PUSHPULL(GPIOD_PIN8) | \
  587. PIN_OTYPE_PUSHPULL(GPIOD_PIN9) | \
  588. PIN_OTYPE_PUSHPULL(GPIOD_PIN10) | \
  589. PIN_OTYPE_PUSHPULL(GPIOD_PIN11) | \
  590. PIN_OTYPE_PUSHPULL(GPIOD_PIN12) | \
  591. PIN_OTYPE_PUSHPULL(GPIOD_PIN13) | \
  592. PIN_OTYPE_PUSHPULL(GPIOD_PIN14) | \
  593. PIN_OTYPE_PUSHPULL(GPIOD_PIN15))
  594. #define VAL_GPIOD_OSPEEDR (PIN_OSPEED_VERYLOW(GPIOD_PIN0) | \
  595. PIN_OSPEED_VERYLOW(GPIOD_PIN1) | \
  596. PIN_OSPEED_VERYLOW(GPIOD_PIN2) | \
  597. PIN_OSPEED_VERYLOW(GPIOD_PIN3) | \
  598. PIN_OSPEED_VERYLOW(GPIOD_PIN4) | \
  599. PIN_OSPEED_VERYLOW(GPIOD_PIN5) | \
  600. PIN_OSPEED_VERYLOW(GPIOD_PIN6) | \
  601. PIN_OSPEED_VERYLOW(GPIOD_PIN7) | \
  602. PIN_OSPEED_VERYLOW(GPIOD_PIN8) | \
  603. PIN_OSPEED_VERYLOW(GPIOD_PIN9) | \
  604. PIN_OSPEED_VERYLOW(GPIOD_PIN10) | \
  605. PIN_OSPEED_VERYLOW(GPIOD_PIN11) | \
  606. PIN_OSPEED_VERYLOW(GPIOD_PIN12) | \
  607. PIN_OSPEED_VERYLOW(GPIOD_PIN13) | \
  608. PIN_OSPEED_VERYLOW(GPIOD_PIN14) | \
  609. PIN_OSPEED_VERYLOW(GPIOD_PIN15))
  610. #define VAL_GPIOD_PUPDR (PIN_PUPDR_PULLUP(GPIOD_PIN0) | \
  611. PIN_PUPDR_PULLUP(GPIOD_PIN1) | \
  612. PIN_PUPDR_PULLUP(GPIOD_PIN2) | \
  613. PIN_PUPDR_PULLUP(GPIOD_PIN3) | \
  614. PIN_PUPDR_PULLUP(GPIOD_PIN4) | \
  615. PIN_PUPDR_PULLUP(GPIOD_PIN5) | \
  616. PIN_PUPDR_PULLUP(GPIOD_PIN6) | \
  617. PIN_PUPDR_PULLUP(GPIOD_PIN7) | \
  618. PIN_PUPDR_PULLUP(GPIOD_PIN8) | \
  619. PIN_PUPDR_PULLUP(GPIOD_PIN9) | \
  620. PIN_PUPDR_PULLUP(GPIOD_PIN10) | \
  621. PIN_PUPDR_PULLUP(GPIOD_PIN11) | \
  622. PIN_PUPDR_PULLUP(GPIOD_PIN12) | \
  623. PIN_PUPDR_PULLUP(GPIOD_PIN13) | \
  624. PIN_PUPDR_PULLUP(GPIOD_PIN14) | \
  625. PIN_PUPDR_PULLUP(GPIOD_PIN15))
  626. #define VAL_GPIOD_ODR (PIN_ODR_HIGH(GPIOD_PIN0) | \
  627. PIN_ODR_HIGH(GPIOD_PIN1) | \
  628. PIN_ODR_HIGH(GPIOD_PIN2) | \
  629. PIN_ODR_HIGH(GPIOD_PIN3) | \
  630. PIN_ODR_HIGH(GPIOD_PIN4) | \
  631. PIN_ODR_HIGH(GPIOD_PIN5) | \
  632. PIN_ODR_HIGH(GPIOD_PIN6) | \
  633. PIN_ODR_HIGH(GPIOD_PIN7) | \
  634. PIN_ODR_HIGH(GPIOD_PIN8) | \
  635. PIN_ODR_HIGH(GPIOD_PIN9) | \
  636. PIN_ODR_HIGH(GPIOD_PIN10) | \
  637. PIN_ODR_HIGH(GPIOD_PIN11) | \
  638. PIN_ODR_HIGH(GPIOD_PIN12) | \
  639. PIN_ODR_HIGH(GPIOD_PIN13) | \
  640. PIN_ODR_HIGH(GPIOD_PIN14) | \
  641. PIN_ODR_HIGH(GPIOD_PIN15))
  642. #define VAL_GPIOD_AFRL (PIN_AFIO_AF(GPIOD_PIN0, 0U) | \
  643. PIN_AFIO_AF(GPIOD_PIN1, 0U) | \
  644. PIN_AFIO_AF(GPIOD_PIN2, 0U) | \
  645. PIN_AFIO_AF(GPIOD_PIN3, 0U) | \
  646. PIN_AFIO_AF(GPIOD_PIN4, 0U) | \
  647. PIN_AFIO_AF(GPIOD_PIN5, 0U) | \
  648. PIN_AFIO_AF(GPIOD_PIN6, 0U) | \
  649. PIN_AFIO_AF(GPIOD_PIN7, 0U))
  650. #define VAL_GPIOD_AFRH (PIN_AFIO_AF(GPIOD_PIN8, 0U) | \
  651. PIN_AFIO_AF(GPIOD_PIN9, 0U) | \
  652. PIN_AFIO_AF(GPIOD_PIN10, 0U) | \
  653. PIN_AFIO_AF(GPIOD_PIN11, 0U) | \
  654. PIN_AFIO_AF(GPIOD_PIN12, 0U) | \
  655. PIN_AFIO_AF(GPIOD_PIN13, 0U) | \
  656. PIN_AFIO_AF(GPIOD_PIN14, 0U) | \
  657. PIN_AFIO_AF(GPIOD_PIN15, 0U))
  658. /*
  659. * GPIOE setup:
  660. *
  661. * PE0 - PIN0 (input pullup).
  662. * PE1 - PIN1 (input pullup).
  663. * PE2 - PIN2 (input pullup).
  664. * PE3 - PIN3 (input pullup).
  665. * PE4 - PIN4 (input pullup).
  666. * PE5 - PIN5 (input pullup).
  667. * PE6 - PIN6 (input pullup).
  668. * PE7 - PIN7 (input pullup).
  669. * PE8 - PIN8 (input pullup).
  670. * PE9 - PIN9 (input pullup).
  671. * PE10 - PIN10 (input pullup).
  672. * PE11 - PIN11 (input pullup).
  673. * PE12 - PIN12 (input pullup).
  674. * PE13 - PIN13 (input pullup).
  675. * PE14 - PIN14 (input pullup).
  676. * PE15 - PIN15 (input pullup).
  677. */
  678. #define VAL_GPIOE_MODER (PIN_MODE_INPUT(GPIOE_PIN0) | \
  679. PIN_MODE_INPUT(GPIOE_PIN1) | \
  680. PIN_MODE_INPUT(GPIOE_PIN2) | \
  681. PIN_MODE_INPUT(GPIOE_PIN3) | \
  682. PIN_MODE_INPUT(GPIOE_PIN4) | \
  683. PIN_MODE_INPUT(GPIOE_PIN5) | \
  684. PIN_MODE_INPUT(GPIOE_PIN6) | \
  685. PIN_MODE_INPUT(GPIOE_PIN7) | \
  686. PIN_MODE_INPUT(GPIOE_PIN8) | \
  687. PIN_MODE_INPUT(GPIOE_PIN9) | \
  688. PIN_MODE_INPUT(GPIOE_PIN10) | \
  689. PIN_MODE_INPUT(GPIOE_PIN11) | \
  690. PIN_MODE_INPUT(GPIOE_PIN12) | \
  691. PIN_MODE_INPUT(GPIOE_PIN13) | \
  692. PIN_MODE_INPUT(GPIOE_PIN14) | \
  693. PIN_MODE_INPUT(GPIOE_PIN15))
  694. #define VAL_GPIOE_OTYPER (PIN_OTYPE_PUSHPULL(GPIOE_PIN0) | \
  695. PIN_OTYPE_PUSHPULL(GPIOE_PIN1) | \
  696. PIN_OTYPE_PUSHPULL(GPIOE_PIN2) | \
  697. PIN_OTYPE_PUSHPULL(GPIOE_PIN3) | \
  698. PIN_OTYPE_PUSHPULL(GPIOE_PIN4) | \
  699. PIN_OTYPE_PUSHPULL(GPIOE_PIN5) | \
  700. PIN_OTYPE_PUSHPULL(GPIOE_PIN6) | \
  701. PIN_OTYPE_PUSHPULL(GPIOE_PIN7) | \
  702. PIN_OTYPE_PUSHPULL(GPIOE_PIN8) | \
  703. PIN_OTYPE_PUSHPULL(GPIOE_PIN9) | \
  704. PIN_OTYPE_PUSHPULL(GPIOE_PIN10) | \
  705. PIN_OTYPE_PUSHPULL(GPIOE_PIN11) | \
  706. PIN_OTYPE_PUSHPULL(GPIOE_PIN12) | \
  707. PIN_OTYPE_PUSHPULL(GPIOE_PIN13) | \
  708. PIN_OTYPE_PUSHPULL(GPIOE_PIN14) | \
  709. PIN_OTYPE_PUSHPULL(GPIOE_PIN15))
  710. #define VAL_GPIOE_OSPEEDR (PIN_OSPEED_VERYLOW(GPIOE_PIN0) | \
  711. PIN_OSPEED_VERYLOW(GPIOE_PIN1) | \
  712. PIN_OSPEED_VERYLOW(GPIOE_PIN2) | \
  713. PIN_OSPEED_VERYLOW(GPIOE_PIN3) | \
  714. PIN_OSPEED_VERYLOW(GPIOE_PIN4) | \
  715. PIN_OSPEED_VERYLOW(GPIOE_PIN5) | \
  716. PIN_OSPEED_VERYLOW(GPIOE_PIN6) | \
  717. PIN_OSPEED_VERYLOW(GPIOE_PIN7) | \
  718. PIN_OSPEED_VERYLOW(GPIOE_PIN8) | \
  719. PIN_OSPEED_VERYLOW(GPIOE_PIN9) | \
  720. PIN_OSPEED_VERYLOW(GPIOE_PIN10) | \
  721. PIN_OSPEED_VERYLOW(GPIOE_PIN11) | \
  722. PIN_OSPEED_VERYLOW(GPIOE_PIN12) | \
  723. PIN_OSPEED_VERYLOW(GPIOE_PIN13) | \
  724. PIN_OSPEED_VERYLOW(GPIOE_PIN14) | \
  725. PIN_OSPEED_VERYLOW(GPIOE_PIN15))
  726. #define VAL_GPIOE_PUPDR (PIN_PUPDR_PULLUP(GPIOE_PIN0) | \
  727. PIN_PUPDR_PULLUP(GPIOE_PIN1) | \
  728. PIN_PUPDR_PULLUP(GPIOE_PIN2) | \
  729. PIN_PUPDR_PULLUP(GPIOE_PIN3) | \
  730. PIN_PUPDR_PULLUP(GPIOE_PIN4) | \
  731. PIN_PUPDR_PULLUP(GPIOE_PIN5) | \
  732. PIN_PUPDR_PULLUP(GPIOE_PIN6) | \
  733. PIN_PUPDR_PULLUP(GPIOE_PIN7) | \
  734. PIN_PUPDR_PULLUP(GPIOE_PIN8) | \
  735. PIN_PUPDR_PULLUP(GPIOE_PIN9) | \
  736. PIN_PUPDR_PULLUP(GPIOE_PIN10) | \
  737. PIN_PUPDR_PULLUP(GPIOE_PIN11) | \
  738. PIN_PUPDR_PULLUP(GPIOE_PIN12) | \
  739. PIN_PUPDR_PULLUP(GPIOE_PIN13) | \
  740. PIN_PUPDR_PULLUP(GPIOE_PIN14) | \
  741. PIN_PUPDR_PULLUP(GPIOE_PIN15))
  742. #define VAL_GPIOE_ODR (PIN_ODR_HIGH(GPIOE_PIN0) | \
  743. PIN_ODR_HIGH(GPIOE_PIN1) | \
  744. PIN_ODR_HIGH(GPIOE_PIN2) | \
  745. PIN_ODR_HIGH(GPIOE_PIN3) | \
  746. PIN_ODR_HIGH(GPIOE_PIN4) | \
  747. PIN_ODR_HIGH(GPIOE_PIN5) | \
  748. PIN_ODR_HIGH(GPIOE_PIN6) | \
  749. PIN_ODR_HIGH(GPIOE_PIN7) | \
  750. PIN_ODR_HIGH(GPIOE_PIN8) | \
  751. PIN_ODR_HIGH(GPIOE_PIN9) | \
  752. PIN_ODR_HIGH(GPIOE_PIN10) | \
  753. PIN_ODR_HIGH(GPIOE_PIN11) | \
  754. PIN_ODR_HIGH(GPIOE_PIN12) | \
  755. PIN_ODR_HIGH(GPIOE_PIN13) | \
  756. PIN_ODR_HIGH(GPIOE_PIN14) | \
  757. PIN_ODR_HIGH(GPIOE_PIN15))
  758. #define VAL_GPIOE_AFRL (PIN_AFIO_AF(GPIOE_PIN0, 0U) | \
  759. PIN_AFIO_AF(GPIOE_PIN1, 0U) | \
  760. PIN_AFIO_AF(GPIOE_PIN2, 0U) | \
  761. PIN_AFIO_AF(GPIOE_PIN3, 0U) | \
  762. PIN_AFIO_AF(GPIOE_PIN4, 0U) | \
  763. PIN_AFIO_AF(GPIOE_PIN5, 0U) | \
  764. PIN_AFIO_AF(GPIOE_PIN6, 0U) | \
  765. PIN_AFIO_AF(GPIOE_PIN7, 0U))
  766. #define VAL_GPIOE_AFRH (PIN_AFIO_AF(GPIOE_PIN8, 0U) | \
  767. PIN_AFIO_AF(GPIOE_PIN9, 0U) | \
  768. PIN_AFIO_AF(GPIOE_PIN10, 0U) | \
  769. PIN_AFIO_AF(GPIOE_PIN11, 0U) | \
  770. PIN_AFIO_AF(GPIOE_PIN12, 0U) | \
  771. PIN_AFIO_AF(GPIOE_PIN13, 0U) | \
  772. PIN_AFIO_AF(GPIOE_PIN14, 0U) | \
  773. PIN_AFIO_AF(GPIOE_PIN15, 0U))
  774. /*
  775. * GPIOF setup:
  776. *
  777. * PF0 - PIN0 (input pullup).
  778. * PF1 - PIN1 (input pullup).
  779. * PF2 - PIN2 (input pullup).
  780. * PF3 - PIN3 (input pullup).
  781. * PF4 - PIN4 (input pullup).
  782. * PF5 - PIN5 (input pullup).
  783. * PF6 - PIN6 (input pullup).
  784. * PF7 - PIN7 (input pullup).
  785. * PF8 - PIN8 (input pullup).
  786. * PF9 - PIN9 (input pullup).
  787. * PF10 - PIN10 (input pullup).
  788. * PF11 - PIN11 (input pullup).
  789. * PF12 - PIN12 (input pullup).
  790. * PF13 - PIN13 (input pullup).
  791. * PF14 - PIN14 (input pullup).
  792. * PF15 - PIN15 (input pullup).
  793. */
  794. #define VAL_GPIOF_MODER (PIN_MODE_INPUT(GPIOF_PIN0) | \
  795. PIN_MODE_INPUT(GPIOF_PIN1) | \
  796. PIN_MODE_INPUT(GPIOF_PIN2) | \
  797. PIN_MODE_INPUT(GPIOF_PIN3) | \
  798. PIN_MODE_INPUT(GPIOF_PIN4) | \
  799. PIN_MODE_INPUT(GPIOF_PIN5) | \
  800. PIN_MODE_INPUT(GPIOF_PIN6) | \
  801. PIN_MODE_INPUT(GPIOF_PIN7) | \
  802. PIN_MODE_INPUT(GPIOF_PIN8) | \
  803. PIN_MODE_INPUT(GPIOF_PIN9) | \
  804. PIN_MODE_INPUT(GPIOF_PIN10) | \
  805. PIN_MODE_INPUT(GPIOF_PIN11) | \
  806. PIN_MODE_INPUT(GPIOF_PIN12) | \
  807. PIN_MODE_INPUT(GPIOF_PIN13) | \
  808. PIN_MODE_INPUT(GPIOF_PIN14) | \
  809. PIN_MODE_INPUT(GPIOF_PIN15))
  810. #define VAL_GPIOF_OTYPER (PIN_OTYPE_PUSHPULL(GPIOF_PIN0) | \
  811. PIN_OTYPE_PUSHPULL(GPIOF_PIN1) | \
  812. PIN_OTYPE_PUSHPULL(GPIOF_PIN2) | \
  813. PIN_OTYPE_PUSHPULL(GPIOF_PIN3) | \
  814. PIN_OTYPE_PUSHPULL(GPIOF_PIN4) | \
  815. PIN_OTYPE_PUSHPULL(GPIOF_PIN5) | \
  816. PIN_OTYPE_PUSHPULL(GPIOF_PIN6) | \
  817. PIN_OTYPE_PUSHPULL(GPIOF_PIN7) | \
  818. PIN_OTYPE_PUSHPULL(GPIOF_PIN8) | \
  819. PIN_OTYPE_PUSHPULL(GPIOF_PIN9) | \
  820. PIN_OTYPE_PUSHPULL(GPIOF_PIN10) | \
  821. PIN_OTYPE_PUSHPULL(GPIOF_PIN11) | \
  822. PIN_OTYPE_PUSHPULL(GPIOF_PIN12) | \
  823. PIN_OTYPE_PUSHPULL(GPIOF_PIN13) | \
  824. PIN_OTYPE_PUSHPULL(GPIOF_PIN14) | \
  825. PIN_OTYPE_PUSHPULL(GPIOF_PIN15))
  826. #define VAL_GPIOF_OSPEEDR (PIN_OSPEED_VERYLOW(GPIOF_PIN0) | \
  827. PIN_OSPEED_VERYLOW(GPIOF_PIN1) | \
  828. PIN_OSPEED_VERYLOW(GPIOF_PIN2) | \
  829. PIN_OSPEED_VERYLOW(GPIOF_PIN3) | \
  830. PIN_OSPEED_VERYLOW(GPIOF_PIN4) | \
  831. PIN_OSPEED_VERYLOW(GPIOF_PIN5) | \
  832. PIN_OSPEED_VERYLOW(GPIOF_PIN6) | \
  833. PIN_OSPEED_VERYLOW(GPIOF_PIN7) | \
  834. PIN_OSPEED_VERYLOW(GPIOF_PIN8) | \
  835. PIN_OSPEED_VERYLOW(GPIOF_PIN9) | \
  836. PIN_OSPEED_VERYLOW(GPIOF_PIN10) | \
  837. PIN_OSPEED_VERYLOW(GPIOF_PIN11) | \
  838. PIN_OSPEED_VERYLOW(GPIOF_PIN12) | \
  839. PIN_OSPEED_VERYLOW(GPIOF_PIN13) | \
  840. PIN_OSPEED_VERYLOW(GPIOF_PIN14) | \
  841. PIN_OSPEED_VERYLOW(GPIOF_PIN15))
  842. #define VAL_GPIOF_PUPDR (PIN_PUPDR_PULLUP(GPIOF_PIN0) | \
  843. PIN_PUPDR_PULLUP(GPIOF_PIN1) | \
  844. PIN_PUPDR_PULLUP(GPIOF_PIN2) | \
  845. PIN_PUPDR_PULLUP(GPIOF_PIN3) | \
  846. PIN_PUPDR_PULLUP(GPIOF_PIN4) | \
  847. PIN_PUPDR_PULLUP(GPIOF_PIN5) | \
  848. PIN_PUPDR_PULLUP(GPIOF_PIN6) | \
  849. PIN_PUPDR_PULLUP(GPIOF_PIN7) | \
  850. PIN_PUPDR_PULLUP(GPIOF_PIN8) | \
  851. PIN_PUPDR_PULLUP(GPIOF_PIN9) | \
  852. PIN_PUPDR_PULLUP(GPIOF_PIN10) | \
  853. PIN_PUPDR_PULLUP(GPIOF_PIN11) | \
  854. PIN_PUPDR_PULLUP(GPIOF_PIN12) | \
  855. PIN_PUPDR_PULLUP(GPIOF_PIN13) | \
  856. PIN_PUPDR_PULLUP(GPIOF_PIN14) | \
  857. PIN_PUPDR_PULLUP(GPIOF_PIN15))
  858. #define VAL_GPIOF_ODR (PIN_ODR_HIGH(GPIOF_PIN0) | \
  859. PIN_ODR_HIGH(GPIOF_PIN1) | \
  860. PIN_ODR_HIGH(GPIOF_PIN2) | \
  861. PIN_ODR_HIGH(GPIOF_PIN3) | \
  862. PIN_ODR_HIGH(GPIOF_PIN4) | \
  863. PIN_ODR_HIGH(GPIOF_PIN5) | \
  864. PIN_ODR_HIGH(GPIOF_PIN6) | \
  865. PIN_ODR_HIGH(GPIOF_PIN7) | \
  866. PIN_ODR_HIGH(GPIOF_PIN8) | \
  867. PIN_ODR_HIGH(GPIOF_PIN9) | \
  868. PIN_ODR_HIGH(GPIOF_PIN10) | \
  869. PIN_ODR_HIGH(GPIOF_PIN11) | \
  870. PIN_ODR_HIGH(GPIOF_PIN12) | \
  871. PIN_ODR_HIGH(GPIOF_PIN13) | \
  872. PIN_ODR_HIGH(GPIOF_PIN14) | \
  873. PIN_ODR_HIGH(GPIOF_PIN15))
  874. #define VAL_GPIOF_AFRL (PIN_AFIO_AF(GPIOF_PIN0, 0U) | \
  875. PIN_AFIO_AF(GPIOF_PIN1, 0U) | \
  876. PIN_AFIO_AF(GPIOF_PIN2, 0U) | \
  877. PIN_AFIO_AF(GPIOF_PIN3, 0U) | \
  878. PIN_AFIO_AF(GPIOF_PIN4, 0U) | \
  879. PIN_AFIO_AF(GPIOF_PIN5, 0U) | \
  880. PIN_AFIO_AF(GPIOF_PIN6, 0U) | \
  881. PIN_AFIO_AF(GPIOF_PIN7, 0U))
  882. #define VAL_GPIOF_AFRH (PIN_AFIO_AF(GPIOF_PIN8, 0U) | \
  883. PIN_AFIO_AF(GPIOF_PIN9, 0U) | \
  884. PIN_AFIO_AF(GPIOF_PIN10, 0U) | \
  885. PIN_AFIO_AF(GPIOF_PIN11, 0U) | \
  886. PIN_AFIO_AF(GPIOF_PIN12, 0U) | \
  887. PIN_AFIO_AF(GPIOF_PIN13, 0U) | \
  888. PIN_AFIO_AF(GPIOF_PIN14, 0U) | \
  889. PIN_AFIO_AF(GPIOF_PIN15, 0U))
  890. #if !defined(_FROM_ASM_)
  891. #ifdef __cplusplus
  892. extern "C" {
  893. #endif
  894. void boardInit(void);
  895. #ifdef __cplusplus
  896. }
  897. #endif
  898. #endif /* _FROM_ASM_ */
  899. #endif /* BOARD_H */