board.h 76 KB

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