board.h 76 KB

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