board.h 50 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823
  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 STM32L053-Discovery board.
  24. */
  25. /*
  26. * Board identifier.
  27. */
  28. #define BOARD_ST_STM32L053_DISCOVERY
  29. #define BOARD_NAME "STMicroelectronics STM32L053-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 << 11U)
  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 STM32L053xx
  46. /*
  47. * IO pins assignments.
  48. */
  49. #define GPIOA_BUTTON 0U
  50. #define GPIOA_MFX_WAKEUP 1U
  51. #define GPIOA_TS_G1_IO3 2U
  52. #define GPIOA_TS_G1_IO4 3U
  53. #define GPIOA_PIN4 4U
  54. #define GPIOA_LED_RED 5U
  55. #define GPIOA_TS_G2_IO3 6U
  56. #define GPIOA_TS_G2_IO4 7U
  57. #define GPIOA_EPD1_BUSY 8U
  58. #define GPIOA_USART1_TX 9U
  59. #define GPIOA_USART1_RX 10U
  60. #define GPIOA_USB1_DM 11U
  61. #define GPIOA_USB1_DP 12U
  62. #define GPIOA_SWDIO 13U
  63. #define GPIOA_SWCLK 14U
  64. #define GPIOA_EPD1_CS 15U
  65. #define GPIOB_TS_G3_IO2 0U
  66. #define GPIOB_TS_G3_IO3 1U
  67. #define GPIOB_EPD1_RESET 2U
  68. #define GPIOB_EPD1_SCK 3U
  69. #define GPIOB_LED_GREEN 4U
  70. #define GPIOB_EPD1_MOSI 5U
  71. #define GPIOB_NFC_IRQINN 6U
  72. #define GPIOB_NFC_IRQOUTN 7U
  73. #define GPIOB_MFX_I2C1_SCL 8U
  74. #define GPIOB_MFX_I2C1_SDA 9U
  75. #define GPIOB_EPD1_PWR_ENN 10U
  76. #define GPIOB_EPD1_D_C 11U
  77. #define GPIOB_NFC_NSS 12U
  78. #define GPIOB_NFC_SCK 13U
  79. #define GPIOB_NFC_MISO 14U
  80. #define GPIOB_NFC_MOSI 15U
  81. #define GPIOC_PIN0 0U
  82. #define GPIOC_PIN1 1U
  83. #define GPIOC_PIN2 2U
  84. #define GPIOC_PIN3 3U
  85. #define GPIOC_PIN4 4U
  86. #define GPIOC_PIN5 5U
  87. #define GPIOC_PIN6 6U
  88. #define GPIOC_PIN7 7U
  89. #define GPIOC_PIN8 8U
  90. #define GPIOC_PIN9 9U
  91. #define GPIOC_PIN10 10U
  92. #define GPIOC_PIN11 11U
  93. #define GPIOC_PIN12 12U
  94. #define GPIOC_MFX_IRQ_OUT 13U
  95. #define GPIOC_OSC32_IN 14U
  96. #define GPIOC_OSC32_OUT 15U
  97. #define GPIOD_PIN0 0U
  98. #define GPIOD_PIN1 1U
  99. #define GPIOD_PIN2 2U
  100. #define GPIOD_PIN3 3U
  101. #define GPIOD_PIN4 4U
  102. #define GPIOD_PIN5 5U
  103. #define GPIOD_PIN6 6U
  104. #define GPIOD_PIN7 7U
  105. #define GPIOD_PIN8 8U
  106. #define GPIOD_PIN9 9U
  107. #define GPIOD_PIN10 10U
  108. #define GPIOD_PIN11 11U
  109. #define GPIOD_PIN12 12U
  110. #define GPIOD_PIN13 13U
  111. #define GPIOD_PIN14 14U
  112. #define GPIOD_PIN15 15U
  113. #define GPIOH_PIN0 0U
  114. #define GPIOH_PIN1 1U
  115. #define GPIOH_PIN2 2U
  116. #define GPIOH_PIN3 3U
  117. #define GPIOH_PIN4 4U
  118. #define GPIOH_PIN5 5U
  119. #define GPIOH_PIN6 6U
  120. #define GPIOH_PIN7 7U
  121. #define GPIOH_PIN8 8U
  122. #define GPIOH_PIN9 9U
  123. #define GPIOH_PIN10 10U
  124. #define GPIOH_PIN11 11U
  125. #define GPIOH_PIN12 12U
  126. #define GPIOH_PIN13 13U
  127. #define GPIOH_PIN14 14U
  128. #define GPIOH_PIN15 15U
  129. /*
  130. * IO lines assignments.
  131. */
  132. #define LINE_BUTTON PAL_LINE(GPIOA, 0U)
  133. #define LINE_MFX_WAKEUP PAL_LINE(GPIOA, 1U)
  134. #define LINE_TS_G1_IO3 PAL_LINE(GPIOA, 2U)
  135. #define LINE_TS_G1_IO4 PAL_LINE(GPIOA, 3U)
  136. #define LINE_LED_RED PAL_LINE(GPIOA, 5U)
  137. #define LINE_TS_G2_IO3 PAL_LINE(GPIOA, 6U)
  138. #define LINE_TS_G2_IO4 PAL_LINE(GPIOA, 7U)
  139. #define LINE_EPD1_BUSY PAL_LINE(GPIOA, 8U)
  140. #define LINE_USART1_TX PAL_LINE(GPIOA, 9U)
  141. #define LINE_USART1_RX PAL_LINE(GPIOA, 10U)
  142. #define LINE_USB1_DM PAL_LINE(GPIOA, 11U)
  143. #define LINE_USB1_DP PAL_LINE(GPIOA, 12U)
  144. #define LINE_SWDIO PAL_LINE(GPIOA, 13U)
  145. #define LINE_SWCLK PAL_LINE(GPIOA, 14U)
  146. #define LINE_EPD1_CS PAL_LINE(GPIOA, 15U)
  147. #define LINE_TS_G3_IO2 PAL_LINE(GPIOB, 0U)
  148. #define LINE_TS_G3_IO3 PAL_LINE(GPIOB, 1U)
  149. #define LINE_EPD1_RESET PAL_LINE(GPIOB, 2U)
  150. #define LINE_EPD1_SCK PAL_LINE(GPIOB, 3U)
  151. #define LINE_LED_GREEN PAL_LINE(GPIOB, 4U)
  152. #define LINE_EPD1_MOSI PAL_LINE(GPIOB, 5U)
  153. #define LINE_NFC_IRQINN PAL_LINE(GPIOB, 6U)
  154. #define LINE_NFC_IRQOUTN PAL_LINE(GPIOB, 7U)
  155. #define LINE_MFX_I2C1_SCL PAL_LINE(GPIOB, 8U)
  156. #define LINE_MFX_I2C1_SDA PAL_LINE(GPIOB, 9U)
  157. #define LINE_EPD1_PWR_ENN PAL_LINE(GPIOB, 10U)
  158. #define LINE_EPD1_D_C PAL_LINE(GPIOB, 11U)
  159. #define LINE_NFC_NSS PAL_LINE(GPIOB, 12U)
  160. #define LINE_NFC_SCK PAL_LINE(GPIOB, 13U)
  161. #define LINE_NFC_MISO PAL_LINE(GPIOB, 14U)
  162. #define LINE_NFC_MOSI PAL_LINE(GPIOB, 15U)
  163. #define LINE_MFX_IRQ_OUT PAL_LINE(GPIOC, 13U)
  164. #define LINE_OSC32_IN PAL_LINE(GPIOC, 14U)
  165. #define LINE_OSC32_OUT PAL_LINE(GPIOC, 15U)
  166. /*===========================================================================*/
  167. /* Driver pre-compile time settings. */
  168. /*===========================================================================*/
  169. /*===========================================================================*/
  170. /* Derived constants and error checks. */
  171. /*===========================================================================*/
  172. /*===========================================================================*/
  173. /* Driver data structures and types. */
  174. /*===========================================================================*/
  175. /*===========================================================================*/
  176. /* Driver macros. */
  177. /*===========================================================================*/
  178. /*
  179. * I/O ports initial setup, this configuration is established soon after reset
  180. * in the initialization code.
  181. * Please refer to the STM32 Reference Manual for details.
  182. */
  183. #define PIN_MODE_INPUT(n) (0U << ((n) * 2U))
  184. #define PIN_MODE_OUTPUT(n) (1U << ((n) * 2U))
  185. #define PIN_MODE_ALTERNATE(n) (2U << ((n) * 2U))
  186. #define PIN_MODE_ANALOG(n) (3U << ((n) * 2U))
  187. #define PIN_ODR_LOW(n) (0U << (n))
  188. #define PIN_ODR_HIGH(n) (1U << (n))
  189. #define PIN_OTYPE_PUSHPULL(n) (0U << (n))
  190. #define PIN_OTYPE_OPENDRAIN(n) (1U << (n))
  191. #define PIN_OSPEED_VERYLOW(n) (0U << ((n) * 2U))
  192. #define PIN_OSPEED_LOW(n) (1U << ((n) * 2U))
  193. #define PIN_OSPEED_MEDIUM(n) (2U << ((n) * 2U))
  194. #define PIN_OSPEED_HIGH(n) (3U << ((n) * 2U))
  195. #define PIN_PUPDR_FLOATING(n) (0U << ((n) * 2U))
  196. #define PIN_PUPDR_PULLUP(n) (1U << ((n) * 2U))
  197. #define PIN_PUPDR_PULLDOWN(n) (2U << ((n) * 2U))
  198. #define PIN_AFIO_AF(n, v) ((v) << (((n) % 8U) * 4U))
  199. /*
  200. * GPIOA setup:
  201. *
  202. * PA0 - BUTTON (input floating).
  203. * PA1 - MFX_WAKEUP (alternate 0).
  204. * PA2 - TS_G1_IO3 (alternate 3).
  205. * PA3 - TS_G1_IO4 (alternate 3).
  206. * PA4 - PIN4 (input pullup).
  207. * PA5 - LED_RED (output pushpull maximum).
  208. * PA6 - TS_G2_IO3 (alternate 3).
  209. * PA7 - TS_G2_IO4 (alternate 3).
  210. * PA8 - EPD1_BUSY (input floating).
  211. * PA9 - USART1_TX (alternate 4).
  212. * PA10 - USART1_RX (alternate 4).
  213. * PA11 - USB1_DM (input floating).
  214. * PA12 - USB1_DP (input floating).
  215. * PA13 - SWDIO (alternate 0).
  216. * PA14 - SWCLK (alternate 0).
  217. * PA15 - EPD1_CS (output pushpull maximum).
  218. */
  219. #define VAL_GPIOA_MODER (PIN_MODE_INPUT(GPIOA_BUTTON) | \
  220. PIN_MODE_ALTERNATE(GPIOA_MFX_WAKEUP) | \
  221. PIN_MODE_ALTERNATE(GPIOA_TS_G1_IO3) | \
  222. PIN_MODE_ALTERNATE(GPIOA_TS_G1_IO4) | \
  223. PIN_MODE_INPUT(GPIOA_PIN4) | \
  224. PIN_MODE_OUTPUT(GPIOA_LED_RED) | \
  225. PIN_MODE_ALTERNATE(GPIOA_TS_G2_IO3) | \
  226. PIN_MODE_ALTERNATE(GPIOA_TS_G2_IO4) | \
  227. PIN_MODE_INPUT(GPIOA_EPD1_BUSY) | \
  228. PIN_MODE_ALTERNATE(GPIOA_USART1_TX) | \
  229. PIN_MODE_ALTERNATE(GPIOA_USART1_RX) | \
  230. PIN_MODE_INPUT(GPIOA_USB1_DM) | \
  231. PIN_MODE_INPUT(GPIOA_USB1_DP) | \
  232. PIN_MODE_ALTERNATE(GPIOA_SWDIO) | \
  233. PIN_MODE_ALTERNATE(GPIOA_SWCLK) | \
  234. PIN_MODE_OUTPUT(GPIOA_EPD1_CS))
  235. #define VAL_GPIOA_OTYPER (PIN_OTYPE_PUSHPULL(GPIOA_BUTTON) | \
  236. PIN_OTYPE_PUSHPULL(GPIOA_MFX_WAKEUP) | \
  237. PIN_OTYPE_PUSHPULL(GPIOA_TS_G1_IO3) | \
  238. PIN_OTYPE_PUSHPULL(GPIOA_TS_G1_IO4) | \
  239. PIN_OTYPE_PUSHPULL(GPIOA_PIN4) | \
  240. PIN_OTYPE_PUSHPULL(GPIOA_LED_RED) | \
  241. PIN_OTYPE_PUSHPULL(GPIOA_TS_G2_IO3) | \
  242. PIN_OTYPE_PUSHPULL(GPIOA_TS_G2_IO4) | \
  243. PIN_OTYPE_PUSHPULL(GPIOA_EPD1_BUSY) | \
  244. PIN_OTYPE_PUSHPULL(GPIOA_USART1_TX) | \
  245. PIN_OTYPE_PUSHPULL(GPIOA_USART1_RX) | \
  246. PIN_OTYPE_PUSHPULL(GPIOA_USB1_DM) | \
  247. PIN_OTYPE_PUSHPULL(GPIOA_USB1_DP) | \
  248. PIN_OTYPE_PUSHPULL(GPIOA_SWDIO) | \
  249. PIN_OTYPE_PUSHPULL(GPIOA_SWCLK) | \
  250. PIN_OTYPE_PUSHPULL(GPIOA_EPD1_CS))
  251. #define VAL_GPIOA_OSPEEDR (PIN_OSPEED_HIGH(GPIOA_BUTTON) | \
  252. PIN_OSPEED_HIGH(GPIOA_MFX_WAKEUP) | \
  253. PIN_OSPEED_HIGH(GPIOA_TS_G1_IO3) | \
  254. PIN_OSPEED_HIGH(GPIOA_TS_G1_IO4) | \
  255. PIN_OSPEED_HIGH(GPIOA_PIN4) | \
  256. PIN_OSPEED_HIGH(GPIOA_LED_RED) | \
  257. PIN_OSPEED_HIGH(GPIOA_TS_G2_IO3) | \
  258. PIN_OSPEED_HIGH(GPIOA_TS_G2_IO4) | \
  259. PIN_OSPEED_HIGH(GPIOA_EPD1_BUSY) | \
  260. PIN_OSPEED_HIGH(GPIOA_USART1_TX) | \
  261. PIN_OSPEED_HIGH(GPIOA_USART1_RX) | \
  262. PIN_OSPEED_HIGH(GPIOA_USB1_DM) | \
  263. PIN_OSPEED_HIGH(GPIOA_USB1_DP) | \
  264. PIN_OSPEED_HIGH(GPIOA_SWDIO) | \
  265. PIN_OSPEED_HIGH(GPIOA_SWCLK) | \
  266. PIN_OSPEED_HIGH(GPIOA_EPD1_CS))
  267. #define VAL_GPIOA_PUPDR (PIN_PUPDR_FLOATING(GPIOA_BUTTON) | \
  268. PIN_PUPDR_FLOATING(GPIOA_MFX_WAKEUP) | \
  269. PIN_PUPDR_FLOATING(GPIOA_TS_G1_IO3) | \
  270. PIN_PUPDR_FLOATING(GPIOA_TS_G1_IO4) | \
  271. PIN_PUPDR_PULLUP(GPIOA_PIN4) | \
  272. PIN_PUPDR_FLOATING(GPIOA_LED_RED) | \
  273. PIN_PUPDR_FLOATING(GPIOA_TS_G2_IO3) | \
  274. PIN_PUPDR_FLOATING(GPIOA_TS_G2_IO4) | \
  275. PIN_PUPDR_FLOATING(GPIOA_EPD1_BUSY) | \
  276. PIN_PUPDR_FLOATING(GPIOA_USART1_TX) | \
  277. PIN_PUPDR_FLOATING(GPIOA_USART1_RX) | \
  278. PIN_PUPDR_FLOATING(GPIOA_USB1_DM) | \
  279. PIN_PUPDR_FLOATING(GPIOA_USB1_DP) | \
  280. PIN_PUPDR_PULLUP(GPIOA_SWDIO) | \
  281. PIN_PUPDR_PULLDOWN(GPIOA_SWCLK) | \
  282. PIN_PUPDR_PULLDOWN(GPIOA_EPD1_CS))
  283. #define VAL_GPIOA_ODR (PIN_ODR_HIGH(GPIOA_BUTTON) | \
  284. PIN_ODR_HIGH(GPIOA_MFX_WAKEUP) | \
  285. PIN_ODR_HIGH(GPIOA_TS_G1_IO3) | \
  286. PIN_ODR_HIGH(GPIOA_TS_G1_IO4) | \
  287. PIN_ODR_HIGH(GPIOA_PIN4) | \
  288. PIN_ODR_LOW(GPIOA_LED_RED) | \
  289. PIN_ODR_HIGH(GPIOA_TS_G2_IO3) | \
  290. PIN_ODR_HIGH(GPIOA_TS_G2_IO4) | \
  291. PIN_ODR_HIGH(GPIOA_EPD1_BUSY) | \
  292. PIN_ODR_HIGH(GPIOA_USART1_TX) | \
  293. PIN_ODR_HIGH(GPIOA_USART1_RX) | \
  294. PIN_ODR_HIGH(GPIOA_USB1_DM) | \
  295. PIN_ODR_HIGH(GPIOA_USB1_DP) | \
  296. PIN_ODR_HIGH(GPIOA_SWDIO) | \
  297. PIN_ODR_HIGH(GPIOA_SWCLK) | \
  298. PIN_ODR_HIGH(GPIOA_EPD1_CS))
  299. #define VAL_GPIOA_AFRL (PIN_AFIO_AF(GPIOA_BUTTON, 0U) | \
  300. PIN_AFIO_AF(GPIOA_MFX_WAKEUP, 0U) | \
  301. PIN_AFIO_AF(GPIOA_TS_G1_IO3, 3U) | \
  302. PIN_AFIO_AF(GPIOA_TS_G1_IO4, 3U) | \
  303. PIN_AFIO_AF(GPIOA_PIN4, 0U) | \
  304. PIN_AFIO_AF(GPIOA_LED_RED, 0U) | \
  305. PIN_AFIO_AF(GPIOA_TS_G2_IO3, 3U) | \
  306. PIN_AFIO_AF(GPIOA_TS_G2_IO4, 3U))
  307. #define VAL_GPIOA_AFRH (PIN_AFIO_AF(GPIOA_EPD1_BUSY, 0U) | \
  308. PIN_AFIO_AF(GPIOA_USART1_TX, 4U) | \
  309. PIN_AFIO_AF(GPIOA_USART1_RX, 4U) | \
  310. PIN_AFIO_AF(GPIOA_USB1_DM, 0U) | \
  311. PIN_AFIO_AF(GPIOA_USB1_DP, 0U) | \
  312. PIN_AFIO_AF(GPIOA_SWDIO, 0U) | \
  313. PIN_AFIO_AF(GPIOA_SWCLK, 0U) | \
  314. PIN_AFIO_AF(GPIOA_EPD1_CS, 0U))
  315. /*
  316. * GPIOB setup:
  317. *
  318. * PB0 - TS_G3_IO2 (alternate 3).
  319. * PB1 - TS_G3_IO3 (alternate 3).
  320. * PB2 - EPD1_RESET (output pushpull maximum).
  321. * PB3 - EPD1_SCK (alternate 0).
  322. * PB4 - LED_GREEN (output pushpull maximum).
  323. * PB5 - EPD1_MOSI (alternate 0).
  324. * PB6 - NFC_IRQINN (input pulldown).
  325. * PB7 - NFC_IRQOUTN (output pushpull maximum).
  326. * PB8 - MFX_I2C1_SCL (alternate 4).
  327. * PB9 - MFX_I2C1_SDA (alternate 4).
  328. * PB10 - EPD1_PWR_ENN (output pushpull maximum).
  329. * PB11 - EPD1_D_C (output pushpull maximum).
  330. * PB12 - NFC_NSS (output pushpull maximum).
  331. * PB13 - NFC_SCK (alternate 0).
  332. * PB14 - NFC_MISO (alternate 0).
  333. * PB15 - NFC_MOSI (alternate 0).
  334. */
  335. #define VAL_GPIOB_MODER (PIN_MODE_ALTERNATE(GPIOB_TS_G3_IO2) | \
  336. PIN_MODE_ALTERNATE(GPIOB_TS_G3_IO3) | \
  337. PIN_MODE_OUTPUT(GPIOB_EPD1_RESET) | \
  338. PIN_MODE_ALTERNATE(GPIOB_EPD1_SCK) | \
  339. PIN_MODE_OUTPUT(GPIOB_LED_GREEN) | \
  340. PIN_MODE_ALTERNATE(GPIOB_EPD1_MOSI) | \
  341. PIN_MODE_INPUT(GPIOB_NFC_IRQINN) | \
  342. PIN_MODE_OUTPUT(GPIOB_NFC_IRQOUTN) | \
  343. PIN_MODE_ALTERNATE(GPIOB_MFX_I2C1_SCL) |\
  344. PIN_MODE_ALTERNATE(GPIOB_MFX_I2C1_SDA) |\
  345. PIN_MODE_OUTPUT(GPIOB_EPD1_PWR_ENN) | \
  346. PIN_MODE_OUTPUT(GPIOB_EPD1_D_C) | \
  347. PIN_MODE_OUTPUT(GPIOB_NFC_NSS) | \
  348. PIN_MODE_ALTERNATE(GPIOB_NFC_SCK) | \
  349. PIN_MODE_ALTERNATE(GPIOB_NFC_MISO) | \
  350. PIN_MODE_ALTERNATE(GPIOB_NFC_MOSI))
  351. #define VAL_GPIOB_OTYPER (PIN_OTYPE_PUSHPULL(GPIOB_TS_G3_IO2) | \
  352. PIN_OTYPE_PUSHPULL(GPIOB_TS_G3_IO3) | \
  353. PIN_OTYPE_PUSHPULL(GPIOB_EPD1_RESET) | \
  354. PIN_OTYPE_PUSHPULL(GPIOB_EPD1_SCK) | \
  355. PIN_OTYPE_PUSHPULL(GPIOB_LED_GREEN) | \
  356. PIN_OTYPE_PUSHPULL(GPIOB_EPD1_MOSI) | \
  357. PIN_OTYPE_PUSHPULL(GPIOB_NFC_IRQINN) | \
  358. PIN_OTYPE_PUSHPULL(GPIOB_NFC_IRQOUTN) |\
  359. PIN_OTYPE_PUSHPULL(GPIOB_MFX_I2C1_SCL) |\
  360. PIN_OTYPE_PUSHPULL(GPIOB_MFX_I2C1_SDA) |\
  361. PIN_OTYPE_PUSHPULL(GPIOB_EPD1_PWR_ENN) |\
  362. PIN_OTYPE_PUSHPULL(GPIOB_EPD1_D_C) | \
  363. PIN_OTYPE_PUSHPULL(GPIOB_NFC_NSS) | \
  364. PIN_OTYPE_PUSHPULL(GPIOB_NFC_SCK) | \
  365. PIN_OTYPE_PUSHPULL(GPIOB_NFC_MISO) | \
  366. PIN_OTYPE_PUSHPULL(GPIOB_NFC_MOSI))
  367. #define VAL_GPIOB_OSPEEDR (PIN_OSPEED_HIGH(GPIOB_TS_G3_IO2) | \
  368. PIN_OSPEED_HIGH(GPIOB_TS_G3_IO3) | \
  369. PIN_OSPEED_HIGH(GPIOB_EPD1_RESET) | \
  370. PIN_OSPEED_HIGH(GPIOB_EPD1_SCK) | \
  371. PIN_OSPEED_HIGH(GPIOB_LED_GREEN) | \
  372. PIN_OSPEED_HIGH(GPIOB_EPD1_MOSI) | \
  373. PIN_OSPEED_HIGH(GPIOB_NFC_IRQINN) | \
  374. PIN_OSPEED_HIGH(GPIOB_NFC_IRQOUTN) | \
  375. PIN_OSPEED_HIGH(GPIOB_MFX_I2C1_SCL) | \
  376. PIN_OSPEED_HIGH(GPIOB_MFX_I2C1_SDA) | \
  377. PIN_OSPEED_HIGH(GPIOB_EPD1_PWR_ENN) | \
  378. PIN_OSPEED_HIGH(GPIOB_EPD1_D_C) | \
  379. PIN_OSPEED_HIGH(GPIOB_NFC_NSS) | \
  380. PIN_OSPEED_HIGH(GPIOB_NFC_SCK) | \
  381. PIN_OSPEED_HIGH(GPIOB_NFC_MISO) | \
  382. PIN_OSPEED_HIGH(GPIOB_NFC_MOSI))
  383. #define VAL_GPIOB_PUPDR (PIN_PUPDR_PULLDOWN(GPIOB_TS_G3_IO2) | \
  384. PIN_PUPDR_PULLDOWN(GPIOB_TS_G3_IO3) | \
  385. PIN_PUPDR_PULLUP(GPIOB_EPD1_RESET) | \
  386. PIN_PUPDR_PULLDOWN(GPIOB_EPD1_SCK) | \
  387. PIN_PUPDR_FLOATING(GPIOB_LED_GREEN) | \
  388. PIN_PUPDR_PULLDOWN(GPIOB_EPD1_MOSI) | \
  389. PIN_PUPDR_PULLDOWN(GPIOB_NFC_IRQINN) | \
  390. PIN_PUPDR_PULLDOWN(GPIOB_NFC_IRQOUTN) |\
  391. PIN_PUPDR_FLOATING(GPIOB_MFX_I2C1_SCL) |\
  392. PIN_PUPDR_FLOATING(GPIOB_MFX_I2C1_SDA) |\
  393. PIN_PUPDR_PULLDOWN(GPIOB_EPD1_PWR_ENN) |\
  394. PIN_PUPDR_PULLDOWN(GPIOB_EPD1_D_C) | \
  395. PIN_PUPDR_PULLUP(GPIOB_NFC_NSS) | \
  396. PIN_PUPDR_PULLUP(GPIOB_NFC_SCK) | \
  397. PIN_PUPDR_PULLUP(GPIOB_NFC_MISO) | \
  398. PIN_PUPDR_PULLUP(GPIOB_NFC_MOSI))
  399. #define VAL_GPIOB_ODR (PIN_ODR_HIGH(GPIOB_TS_G3_IO2) | \
  400. PIN_ODR_HIGH(GPIOB_TS_G3_IO3) | \
  401. PIN_ODR_HIGH(GPIOB_EPD1_RESET) | \
  402. PIN_ODR_HIGH(GPIOB_EPD1_SCK) | \
  403. PIN_ODR_LOW(GPIOB_LED_GREEN) | \
  404. PIN_ODR_HIGH(GPIOB_EPD1_MOSI) | \
  405. PIN_ODR_HIGH(GPIOB_NFC_IRQINN) | \
  406. PIN_ODR_LOW(GPIOB_NFC_IRQOUTN) | \
  407. PIN_ODR_HIGH(GPIOB_MFX_I2C1_SCL) | \
  408. PIN_ODR_HIGH(GPIOB_MFX_I2C1_SDA) | \
  409. PIN_ODR_LOW(GPIOB_EPD1_PWR_ENN) | \
  410. PIN_ODR_LOW(GPIOB_EPD1_D_C) | \
  411. PIN_ODR_HIGH(GPIOB_NFC_NSS) | \
  412. PIN_ODR_HIGH(GPIOB_NFC_SCK) | \
  413. PIN_ODR_HIGH(GPIOB_NFC_MISO) | \
  414. PIN_ODR_HIGH(GPIOB_NFC_MOSI))
  415. #define VAL_GPIOB_AFRL (PIN_AFIO_AF(GPIOB_TS_G3_IO2, 3U) | \
  416. PIN_AFIO_AF(GPIOB_TS_G3_IO3, 3U) | \
  417. PIN_AFIO_AF(GPIOB_EPD1_RESET, 0U) | \
  418. PIN_AFIO_AF(GPIOB_EPD1_SCK, 0U) | \
  419. PIN_AFIO_AF(GPIOB_LED_GREEN, 0U) | \
  420. PIN_AFIO_AF(GPIOB_EPD1_MOSI, 0U) | \
  421. PIN_AFIO_AF(GPIOB_NFC_IRQINN, 0U) | \
  422. PIN_AFIO_AF(GPIOB_NFC_IRQOUTN, 0U))
  423. #define VAL_GPIOB_AFRH (PIN_AFIO_AF(GPIOB_MFX_I2C1_SCL, 4U) | \
  424. PIN_AFIO_AF(GPIOB_MFX_I2C1_SDA, 4U) | \
  425. PIN_AFIO_AF(GPIOB_EPD1_PWR_ENN, 0U) | \
  426. PIN_AFIO_AF(GPIOB_EPD1_D_C, 0U) | \
  427. PIN_AFIO_AF(GPIOB_NFC_NSS, 0U) | \
  428. PIN_AFIO_AF(GPIOB_NFC_SCK, 0U) | \
  429. PIN_AFIO_AF(GPIOB_NFC_MISO, 0U) | \
  430. PIN_AFIO_AF(GPIOB_NFC_MOSI, 0U))
  431. /*
  432. * GPIOC setup:
  433. *
  434. * PC0 - PIN0 (input pulldown).
  435. * PC1 - PIN1 (input pulldown).
  436. * PC2 - PIN2 (input pulldown).
  437. * PC3 - PIN3 (input pulldown).
  438. * PC4 - PIN4 (input pulldown).
  439. * PC5 - PIN5 (input pulldown).
  440. * PC6 - PIN6 (input pulldown).
  441. * PC7 - PIN7 (input pulldown).
  442. * PC8 - PIN8 (input pulldown).
  443. * PC9 - PIN9 (input pulldown).
  444. * PC10 - PIN10 (input pulldown).
  445. * PC11 - PIN11 (input pulldown).
  446. * PC12 - PIN12 (input pulldown).
  447. * PC13 - MFX_IRQ_OUT (output pushpull maximum).
  448. * PC14 - OSC32_IN (input floating).
  449. * PC15 - OSC32_OUT (input floating).
  450. */
  451. #define VAL_GPIOC_MODER (PIN_MODE_INPUT(GPIOC_PIN0) | \
  452. PIN_MODE_INPUT(GPIOC_PIN1) | \
  453. PIN_MODE_INPUT(GPIOC_PIN2) | \
  454. PIN_MODE_INPUT(GPIOC_PIN3) | \
  455. PIN_MODE_INPUT(GPIOC_PIN4) | \
  456. PIN_MODE_INPUT(GPIOC_PIN5) | \
  457. PIN_MODE_INPUT(GPIOC_PIN6) | \
  458. PIN_MODE_INPUT(GPIOC_PIN7) | \
  459. PIN_MODE_INPUT(GPIOC_PIN8) | \
  460. PIN_MODE_INPUT(GPIOC_PIN9) | \
  461. PIN_MODE_INPUT(GPIOC_PIN10) | \
  462. PIN_MODE_INPUT(GPIOC_PIN11) | \
  463. PIN_MODE_INPUT(GPIOC_PIN12) | \
  464. PIN_MODE_OUTPUT(GPIOC_MFX_IRQ_OUT) | \
  465. PIN_MODE_INPUT(GPIOC_OSC32_IN) | \
  466. PIN_MODE_INPUT(GPIOC_OSC32_OUT))
  467. #define VAL_GPIOC_OTYPER (PIN_OTYPE_PUSHPULL(GPIOC_PIN0) | \
  468. PIN_OTYPE_PUSHPULL(GPIOC_PIN1) | \
  469. PIN_OTYPE_PUSHPULL(GPIOC_PIN2) | \
  470. PIN_OTYPE_PUSHPULL(GPIOC_PIN3) | \
  471. PIN_OTYPE_PUSHPULL(GPIOC_PIN4) | \
  472. PIN_OTYPE_PUSHPULL(GPIOC_PIN5) | \
  473. PIN_OTYPE_PUSHPULL(GPIOC_PIN6) | \
  474. PIN_OTYPE_PUSHPULL(GPIOC_PIN7) | \
  475. PIN_OTYPE_PUSHPULL(GPIOC_PIN8) | \
  476. PIN_OTYPE_PUSHPULL(GPIOC_PIN9) | \
  477. PIN_OTYPE_PUSHPULL(GPIOC_PIN10) | \
  478. PIN_OTYPE_PUSHPULL(GPIOC_PIN11) | \
  479. PIN_OTYPE_PUSHPULL(GPIOC_PIN12) | \
  480. PIN_OTYPE_PUSHPULL(GPIOC_MFX_IRQ_OUT) |\
  481. PIN_OTYPE_PUSHPULL(GPIOC_OSC32_IN) | \
  482. PIN_OTYPE_PUSHPULL(GPIOC_OSC32_OUT))
  483. #define VAL_GPIOC_OSPEEDR (PIN_OSPEED_HIGH(GPIOC_PIN0) | \
  484. PIN_OSPEED_HIGH(GPIOC_PIN1) | \
  485. PIN_OSPEED_HIGH(GPIOC_PIN2) | \
  486. PIN_OSPEED_HIGH(GPIOC_PIN3) | \
  487. PIN_OSPEED_HIGH(GPIOC_PIN4) | \
  488. PIN_OSPEED_HIGH(GPIOC_PIN5) | \
  489. PIN_OSPEED_HIGH(GPIOC_PIN6) | \
  490. PIN_OSPEED_HIGH(GPIOC_PIN7) | \
  491. PIN_OSPEED_HIGH(GPIOC_PIN8) | \
  492. PIN_OSPEED_HIGH(GPIOC_PIN9) | \
  493. PIN_OSPEED_HIGH(GPIOC_PIN10) | \
  494. PIN_OSPEED_HIGH(GPIOC_PIN11) | \
  495. PIN_OSPEED_HIGH(GPIOC_PIN12) | \
  496. PIN_OSPEED_HIGH(GPIOC_MFX_IRQ_OUT) | \
  497. PIN_OSPEED_HIGH(GPIOC_OSC32_IN) | \
  498. PIN_OSPEED_HIGH(GPIOC_OSC32_OUT))
  499. #define VAL_GPIOC_PUPDR (PIN_PUPDR_PULLDOWN(GPIOC_PIN0) | \
  500. PIN_PUPDR_PULLDOWN(GPIOC_PIN1) | \
  501. PIN_PUPDR_PULLDOWN(GPIOC_PIN2) | \
  502. PIN_PUPDR_PULLDOWN(GPIOC_PIN3) | \
  503. PIN_PUPDR_PULLDOWN(GPIOC_PIN4) | \
  504. PIN_PUPDR_PULLDOWN(GPIOC_PIN5) | \
  505. PIN_PUPDR_PULLDOWN(GPIOC_PIN6) | \
  506. PIN_PUPDR_PULLDOWN(GPIOC_PIN7) | \
  507. PIN_PUPDR_PULLDOWN(GPIOC_PIN8) | \
  508. PIN_PUPDR_PULLDOWN(GPIOC_PIN9) | \
  509. PIN_PUPDR_PULLDOWN(GPIOC_PIN10) | \
  510. PIN_PUPDR_PULLDOWN(GPIOC_PIN11) | \
  511. PIN_PUPDR_PULLDOWN(GPIOC_PIN12) | \
  512. PIN_PUPDR_PULLUP(GPIOC_MFX_IRQ_OUT) | \
  513. PIN_PUPDR_FLOATING(GPIOC_OSC32_IN) | \
  514. PIN_PUPDR_FLOATING(GPIOC_OSC32_OUT))
  515. #define VAL_GPIOC_ODR (PIN_ODR_HIGH(GPIOC_PIN0) | \
  516. PIN_ODR_HIGH(GPIOC_PIN1) | \
  517. PIN_ODR_HIGH(GPIOC_PIN2) | \
  518. PIN_ODR_HIGH(GPIOC_PIN3) | \
  519. PIN_ODR_HIGH(GPIOC_PIN4) | \
  520. PIN_ODR_HIGH(GPIOC_PIN5) | \
  521. PIN_ODR_HIGH(GPIOC_PIN6) | \
  522. PIN_ODR_HIGH(GPIOC_PIN7) | \
  523. PIN_ODR_HIGH(GPIOC_PIN8) | \
  524. PIN_ODR_HIGH(GPIOC_PIN9) | \
  525. PIN_ODR_HIGH(GPIOC_PIN10) | \
  526. PIN_ODR_HIGH(GPIOC_PIN11) | \
  527. PIN_ODR_HIGH(GPIOC_PIN12) | \
  528. PIN_ODR_HIGH(GPIOC_MFX_IRQ_OUT) | \
  529. PIN_ODR_HIGH(GPIOC_OSC32_IN) | \
  530. PIN_ODR_HIGH(GPIOC_OSC32_OUT))
  531. #define VAL_GPIOC_AFRL (PIN_AFIO_AF(GPIOC_PIN0, 0U) | \
  532. PIN_AFIO_AF(GPIOC_PIN1, 0U) | \
  533. PIN_AFIO_AF(GPIOC_PIN2, 0U) | \
  534. PIN_AFIO_AF(GPIOC_PIN3, 0U) | \
  535. PIN_AFIO_AF(GPIOC_PIN4, 0U) | \
  536. PIN_AFIO_AF(GPIOC_PIN5, 0U) | \
  537. PIN_AFIO_AF(GPIOC_PIN6, 0U) | \
  538. PIN_AFIO_AF(GPIOC_PIN7, 0U))
  539. #define VAL_GPIOC_AFRH (PIN_AFIO_AF(GPIOC_PIN8, 0U) | \
  540. PIN_AFIO_AF(GPIOC_PIN9, 0U) | \
  541. PIN_AFIO_AF(GPIOC_PIN10, 0U) | \
  542. PIN_AFIO_AF(GPIOC_PIN11, 0U) | \
  543. PIN_AFIO_AF(GPIOC_PIN12, 0U) | \
  544. PIN_AFIO_AF(GPIOC_MFX_IRQ_OUT, 0U) | \
  545. PIN_AFIO_AF(GPIOC_OSC32_IN, 0U) | \
  546. PIN_AFIO_AF(GPIOC_OSC32_OUT, 0U))
  547. /*
  548. * GPIOD setup:
  549. *
  550. * PD0 - PIN0 (input pulldown).
  551. * PD1 - PIN1 (input pulldown).
  552. * PD2 - PIN2 (input pulldown).
  553. * PD3 - PIN3 (input pulldown).
  554. * PD4 - PIN4 (input pulldown).
  555. * PD5 - PIN5 (input pulldown).
  556. * PD6 - PIN6 (input pulldown).
  557. * PD7 - PIN7 (input pulldown).
  558. * PD8 - PIN8 (input pulldown).
  559. * PD9 - PIN9 (input pulldown).
  560. * PD10 - PIN10 (input pulldown).
  561. * PD11 - PIN11 (input pulldown).
  562. * PD12 - PIN12 (input pulldown).
  563. * PD13 - PIN13 (input pulldown).
  564. * PD14 - PIN14 (input pulldown).
  565. * PD15 - PIN15 (input pulldown).
  566. */
  567. #define VAL_GPIOD_MODER (PIN_MODE_INPUT(GPIOD_PIN0) | \
  568. PIN_MODE_INPUT(GPIOD_PIN1) | \
  569. PIN_MODE_INPUT(GPIOD_PIN2) | \
  570. PIN_MODE_INPUT(GPIOD_PIN3) | \
  571. PIN_MODE_INPUT(GPIOD_PIN4) | \
  572. PIN_MODE_INPUT(GPIOD_PIN5) | \
  573. PIN_MODE_INPUT(GPIOD_PIN6) | \
  574. PIN_MODE_INPUT(GPIOD_PIN7) | \
  575. PIN_MODE_INPUT(GPIOD_PIN8) | \
  576. PIN_MODE_INPUT(GPIOD_PIN9) | \
  577. PIN_MODE_INPUT(GPIOD_PIN10) | \
  578. PIN_MODE_INPUT(GPIOD_PIN11) | \
  579. PIN_MODE_INPUT(GPIOD_PIN12) | \
  580. PIN_MODE_INPUT(GPIOD_PIN13) | \
  581. PIN_MODE_INPUT(GPIOD_PIN14) | \
  582. PIN_MODE_INPUT(GPIOD_PIN15))
  583. #define VAL_GPIOD_OTYPER (PIN_OTYPE_PUSHPULL(GPIOD_PIN0) | \
  584. PIN_OTYPE_PUSHPULL(GPIOD_PIN1) | \
  585. PIN_OTYPE_PUSHPULL(GPIOD_PIN2) | \
  586. PIN_OTYPE_PUSHPULL(GPIOD_PIN3) | \
  587. PIN_OTYPE_PUSHPULL(GPIOD_PIN4) | \
  588. PIN_OTYPE_PUSHPULL(GPIOD_PIN5) | \
  589. PIN_OTYPE_PUSHPULL(GPIOD_PIN6) | \
  590. PIN_OTYPE_PUSHPULL(GPIOD_PIN7) | \
  591. PIN_OTYPE_PUSHPULL(GPIOD_PIN8) | \
  592. PIN_OTYPE_PUSHPULL(GPIOD_PIN9) | \
  593. PIN_OTYPE_PUSHPULL(GPIOD_PIN10) | \
  594. PIN_OTYPE_PUSHPULL(GPIOD_PIN11) | \
  595. PIN_OTYPE_PUSHPULL(GPIOD_PIN12) | \
  596. PIN_OTYPE_PUSHPULL(GPIOD_PIN13) | \
  597. PIN_OTYPE_PUSHPULL(GPIOD_PIN14) | \
  598. PIN_OTYPE_PUSHPULL(GPIOD_PIN15))
  599. #define VAL_GPIOD_OSPEEDR (PIN_OSPEED_HIGH(GPIOD_PIN0) | \
  600. PIN_OSPEED_HIGH(GPIOD_PIN1) | \
  601. PIN_OSPEED_HIGH(GPIOD_PIN2) | \
  602. PIN_OSPEED_HIGH(GPIOD_PIN3) | \
  603. PIN_OSPEED_HIGH(GPIOD_PIN4) | \
  604. PIN_OSPEED_HIGH(GPIOD_PIN5) | \
  605. PIN_OSPEED_HIGH(GPIOD_PIN6) | \
  606. PIN_OSPEED_HIGH(GPIOD_PIN7) | \
  607. PIN_OSPEED_HIGH(GPIOD_PIN8) | \
  608. PIN_OSPEED_HIGH(GPIOD_PIN9) | \
  609. PIN_OSPEED_HIGH(GPIOD_PIN10) | \
  610. PIN_OSPEED_HIGH(GPIOD_PIN11) | \
  611. PIN_OSPEED_HIGH(GPIOD_PIN12) | \
  612. PIN_OSPEED_HIGH(GPIOD_PIN13) | \
  613. PIN_OSPEED_HIGH(GPIOD_PIN14) | \
  614. PIN_OSPEED_HIGH(GPIOD_PIN15))
  615. #define VAL_GPIOD_PUPDR (PIN_PUPDR_PULLDOWN(GPIOD_PIN0) | \
  616. PIN_PUPDR_PULLDOWN(GPIOD_PIN1) | \
  617. PIN_PUPDR_PULLDOWN(GPIOD_PIN2) | \
  618. PIN_PUPDR_PULLDOWN(GPIOD_PIN3) | \
  619. PIN_PUPDR_PULLDOWN(GPIOD_PIN4) | \
  620. PIN_PUPDR_PULLDOWN(GPIOD_PIN5) | \
  621. PIN_PUPDR_PULLDOWN(GPIOD_PIN6) | \
  622. PIN_PUPDR_PULLDOWN(GPIOD_PIN7) | \
  623. PIN_PUPDR_PULLDOWN(GPIOD_PIN8) | \
  624. PIN_PUPDR_PULLDOWN(GPIOD_PIN9) | \
  625. PIN_PUPDR_PULLDOWN(GPIOD_PIN10) | \
  626. PIN_PUPDR_PULLDOWN(GPIOD_PIN11) | \
  627. PIN_PUPDR_PULLDOWN(GPIOD_PIN12) | \
  628. PIN_PUPDR_PULLDOWN(GPIOD_PIN13) | \
  629. PIN_PUPDR_PULLDOWN(GPIOD_PIN14) | \
  630. PIN_PUPDR_PULLDOWN(GPIOD_PIN15))
  631. #define VAL_GPIOD_ODR (PIN_ODR_HIGH(GPIOD_PIN0) | \
  632. PIN_ODR_HIGH(GPIOD_PIN1) | \
  633. PIN_ODR_HIGH(GPIOD_PIN2) | \
  634. PIN_ODR_HIGH(GPIOD_PIN3) | \
  635. PIN_ODR_HIGH(GPIOD_PIN4) | \
  636. PIN_ODR_HIGH(GPIOD_PIN5) | \
  637. PIN_ODR_HIGH(GPIOD_PIN6) | \
  638. PIN_ODR_HIGH(GPIOD_PIN7) | \
  639. PIN_ODR_HIGH(GPIOD_PIN8) | \
  640. PIN_ODR_HIGH(GPIOD_PIN9) | \
  641. PIN_ODR_HIGH(GPIOD_PIN10) | \
  642. PIN_ODR_HIGH(GPIOD_PIN11) | \
  643. PIN_ODR_HIGH(GPIOD_PIN12) | \
  644. PIN_ODR_HIGH(GPIOD_PIN13) | \
  645. PIN_ODR_HIGH(GPIOD_PIN14) | \
  646. PIN_ODR_HIGH(GPIOD_PIN15))
  647. #define VAL_GPIOD_AFRL (PIN_AFIO_AF(GPIOD_PIN0, 0U) | \
  648. PIN_AFIO_AF(GPIOD_PIN1, 0U) | \
  649. PIN_AFIO_AF(GPIOD_PIN2, 0U) | \
  650. PIN_AFIO_AF(GPIOD_PIN3, 0U) | \
  651. PIN_AFIO_AF(GPIOD_PIN4, 0U) | \
  652. PIN_AFIO_AF(GPIOD_PIN5, 0U) | \
  653. PIN_AFIO_AF(GPIOD_PIN6, 0U) | \
  654. PIN_AFIO_AF(GPIOD_PIN7, 0U))
  655. #define VAL_GPIOD_AFRH (PIN_AFIO_AF(GPIOD_PIN8, 0U) | \
  656. PIN_AFIO_AF(GPIOD_PIN9, 0U) | \
  657. PIN_AFIO_AF(GPIOD_PIN10, 0U) | \
  658. PIN_AFIO_AF(GPIOD_PIN11, 0U) | \
  659. PIN_AFIO_AF(GPIOD_PIN12, 0U) | \
  660. PIN_AFIO_AF(GPIOD_PIN13, 0U) | \
  661. PIN_AFIO_AF(GPIOD_PIN14, 0U) | \
  662. PIN_AFIO_AF(GPIOD_PIN15, 0U))
  663. /*
  664. * GPIOH setup:
  665. *
  666. * PH0 - PIN0 (input pulldown).
  667. * PH1 - PIN1 (input pulldown).
  668. * PH2 - PIN2 (input pulldown).
  669. * PH3 - PIN3 (input pulldown).
  670. * PH4 - PIN4 (input pulldown).
  671. * PH5 - PIN5 (input pulldown).
  672. * PH6 - PIN6 (input pulldown).
  673. * PH7 - PIN7 (input pulldown).
  674. * PH8 - PIN8 (input pulldown).
  675. * PH9 - PIN9 (input pulldown).
  676. * PH10 - PIN10 (input pulldown).
  677. * PH11 - PIN11 (input pulldown).
  678. * PH12 - PIN12 (input pulldown).
  679. * PH13 - PIN13 (input pulldown).
  680. * PH14 - PIN14 (input pulldown).
  681. * PH15 - PIN15 (input pulldown).
  682. */
  683. #define VAL_GPIOH_MODER (PIN_MODE_INPUT(GPIOH_PIN0) | \
  684. PIN_MODE_INPUT(GPIOH_PIN1) | \
  685. PIN_MODE_INPUT(GPIOH_PIN2) | \
  686. PIN_MODE_INPUT(GPIOH_PIN3) | \
  687. PIN_MODE_INPUT(GPIOH_PIN4) | \
  688. PIN_MODE_INPUT(GPIOH_PIN5) | \
  689. PIN_MODE_INPUT(GPIOH_PIN6) | \
  690. PIN_MODE_INPUT(GPIOH_PIN7) | \
  691. PIN_MODE_INPUT(GPIOH_PIN8) | \
  692. PIN_MODE_INPUT(GPIOH_PIN9) | \
  693. PIN_MODE_INPUT(GPIOH_PIN10) | \
  694. PIN_MODE_INPUT(GPIOH_PIN11) | \
  695. PIN_MODE_INPUT(GPIOH_PIN12) | \
  696. PIN_MODE_INPUT(GPIOH_PIN13) | \
  697. PIN_MODE_INPUT(GPIOH_PIN14) | \
  698. PIN_MODE_INPUT(GPIOH_PIN15))
  699. #define VAL_GPIOH_OTYPER (PIN_OTYPE_PUSHPULL(GPIOH_PIN0) | \
  700. PIN_OTYPE_PUSHPULL(GPIOH_PIN1) | \
  701. PIN_OTYPE_PUSHPULL(GPIOH_PIN2) | \
  702. PIN_OTYPE_PUSHPULL(GPIOH_PIN3) | \
  703. PIN_OTYPE_PUSHPULL(GPIOH_PIN4) | \
  704. PIN_OTYPE_PUSHPULL(GPIOH_PIN5) | \
  705. PIN_OTYPE_PUSHPULL(GPIOH_PIN6) | \
  706. PIN_OTYPE_PUSHPULL(GPIOH_PIN7) | \
  707. PIN_OTYPE_PUSHPULL(GPIOH_PIN8) | \
  708. PIN_OTYPE_PUSHPULL(GPIOH_PIN9) | \
  709. PIN_OTYPE_PUSHPULL(GPIOH_PIN10) | \
  710. PIN_OTYPE_PUSHPULL(GPIOH_PIN11) | \
  711. PIN_OTYPE_PUSHPULL(GPIOH_PIN12) | \
  712. PIN_OTYPE_PUSHPULL(GPIOH_PIN13) | \
  713. PIN_OTYPE_PUSHPULL(GPIOH_PIN14) | \
  714. PIN_OTYPE_PUSHPULL(GPIOH_PIN15))
  715. #define VAL_GPIOH_OSPEEDR (PIN_OSPEED_HIGH(GPIOH_PIN0) | \
  716. PIN_OSPEED_HIGH(GPIOH_PIN1) | \
  717. PIN_OSPEED_HIGH(GPIOH_PIN2) | \
  718. PIN_OSPEED_HIGH(GPIOH_PIN3) | \
  719. PIN_OSPEED_HIGH(GPIOH_PIN4) | \
  720. PIN_OSPEED_HIGH(GPIOH_PIN5) | \
  721. PIN_OSPEED_HIGH(GPIOH_PIN6) | \
  722. PIN_OSPEED_HIGH(GPIOH_PIN7) | \
  723. PIN_OSPEED_HIGH(GPIOH_PIN8) | \
  724. PIN_OSPEED_HIGH(GPIOH_PIN9) | \
  725. PIN_OSPEED_HIGH(GPIOH_PIN10) | \
  726. PIN_OSPEED_HIGH(GPIOH_PIN11) | \
  727. PIN_OSPEED_HIGH(GPIOH_PIN12) | \
  728. PIN_OSPEED_HIGH(GPIOH_PIN13) | \
  729. PIN_OSPEED_HIGH(GPIOH_PIN14) | \
  730. PIN_OSPEED_HIGH(GPIOH_PIN15))
  731. #define VAL_GPIOH_PUPDR (PIN_PUPDR_PULLDOWN(GPIOH_PIN0) | \
  732. PIN_PUPDR_PULLDOWN(GPIOH_PIN1) | \
  733. PIN_PUPDR_PULLDOWN(GPIOH_PIN2) | \
  734. PIN_PUPDR_PULLDOWN(GPIOH_PIN3) | \
  735. PIN_PUPDR_PULLDOWN(GPIOH_PIN4) | \
  736. PIN_PUPDR_PULLDOWN(GPIOH_PIN5) | \
  737. PIN_PUPDR_PULLDOWN(GPIOH_PIN6) | \
  738. PIN_PUPDR_PULLDOWN(GPIOH_PIN7) | \
  739. PIN_PUPDR_PULLDOWN(GPIOH_PIN8) | \
  740. PIN_PUPDR_PULLDOWN(GPIOH_PIN9) | \
  741. PIN_PUPDR_PULLDOWN(GPIOH_PIN10) | \
  742. PIN_PUPDR_PULLDOWN(GPIOH_PIN11) | \
  743. PIN_PUPDR_PULLDOWN(GPIOH_PIN12) | \
  744. PIN_PUPDR_PULLDOWN(GPIOH_PIN13) | \
  745. PIN_PUPDR_PULLDOWN(GPIOH_PIN14) | \
  746. PIN_PUPDR_PULLDOWN(GPIOH_PIN15))
  747. #define VAL_GPIOH_ODR (PIN_ODR_HIGH(GPIOH_PIN0) | \
  748. PIN_ODR_HIGH(GPIOH_PIN1) | \
  749. PIN_ODR_HIGH(GPIOH_PIN2) | \
  750. PIN_ODR_HIGH(GPIOH_PIN3) | \
  751. PIN_ODR_HIGH(GPIOH_PIN4) | \
  752. PIN_ODR_HIGH(GPIOH_PIN5) | \
  753. PIN_ODR_HIGH(GPIOH_PIN6) | \
  754. PIN_ODR_HIGH(GPIOH_PIN7) | \
  755. PIN_ODR_HIGH(GPIOH_PIN8) | \
  756. PIN_ODR_HIGH(GPIOH_PIN9) | \
  757. PIN_ODR_HIGH(GPIOH_PIN10) | \
  758. PIN_ODR_HIGH(GPIOH_PIN11) | \
  759. PIN_ODR_HIGH(GPIOH_PIN12) | \
  760. PIN_ODR_HIGH(GPIOH_PIN13) | \
  761. PIN_ODR_HIGH(GPIOH_PIN14) | \
  762. PIN_ODR_HIGH(GPIOH_PIN15))
  763. #define VAL_GPIOH_AFRL (PIN_AFIO_AF(GPIOH_PIN0, 0U) | \
  764. PIN_AFIO_AF(GPIOH_PIN1, 0U) | \
  765. PIN_AFIO_AF(GPIOH_PIN2, 0U) | \
  766. PIN_AFIO_AF(GPIOH_PIN3, 0U) | \
  767. PIN_AFIO_AF(GPIOH_PIN4, 0U) | \
  768. PIN_AFIO_AF(GPIOH_PIN5, 0U) | \
  769. PIN_AFIO_AF(GPIOH_PIN6, 0U) | \
  770. PIN_AFIO_AF(GPIOH_PIN7, 0U))
  771. #define VAL_GPIOH_AFRH (PIN_AFIO_AF(GPIOH_PIN8, 0U) | \
  772. PIN_AFIO_AF(GPIOH_PIN9, 0U) | \
  773. PIN_AFIO_AF(GPIOH_PIN10, 0U) | \
  774. PIN_AFIO_AF(GPIOH_PIN11, 0U) | \
  775. PIN_AFIO_AF(GPIOH_PIN12, 0U) | \
  776. PIN_AFIO_AF(GPIOH_PIN13, 0U) | \
  777. PIN_AFIO_AF(GPIOH_PIN14, 0U) | \
  778. PIN_AFIO_AF(GPIOH_PIN15, 0U))
  779. /*===========================================================================*/
  780. /* External declarations. */
  781. /*===========================================================================*/
  782. #if !defined(_FROM_ASM_)
  783. #ifdef __cplusplus
  784. extern "C" {
  785. #endif
  786. void boardInit(void);
  787. #ifdef __cplusplus
  788. }
  789. #endif
  790. #endif /* _FROM_ASM_ */
  791. #endif /* BOARD_H */