board.h 105 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644
  1. /*
  2. ChibiOS - Copyright (C) 2006..2017 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 STM32 Nucleo144-L496ZG board.
  24. */
  25. /*
  26. * Board identifier.
  27. */
  28. #define BOARD_ST_NUCLEO144_L496ZG
  29. #define BOARD_NAME "STMicroelectronics STM32 Nucleo144-L496ZG"
  30. /*
  31. * Board oscillators-related settings.
  32. * NOTE: LSE not fitted.
  33. * NOTE: HSE not fitted.
  34. */
  35. #if !defined(STM32_LSECLK)
  36. #define STM32_LSECLK 0U
  37. #endif
  38. #define STM32_LSEDRV (3U << 3U)
  39. #if !defined(STM32_HSECLK)
  40. #define STM32_HSECLK 0U
  41. #endif
  42. /*
  43. * Board voltages.
  44. * Required for performance limits calculation.
  45. */
  46. #define STM32_VDD 300U
  47. /*
  48. * MCU type as defined in the ST header.
  49. */
  50. #define STM32L496xx
  51. /*
  52. * IO pins assignments.
  53. */
  54. #define GPIOA_PIN0 0U
  55. #define GPIOA_PIN1 1U
  56. #define GPIOA_PIN2 2U
  57. #define GPIOA_PIN3 3U
  58. #define GPIOA_PIN4 4U
  59. #define GPIOA_PIN5 5U
  60. #define GPIOA_PIN6 6U
  61. #define GPIOA_PIN7 7U
  62. #define GPIOA_USB_SOF 8U
  63. #define GPIOA_USB_VBUS 9U
  64. #define GPIOA_USB_ID 10U
  65. #define GPIOA_USB_DM 11U
  66. #define GPIOA_USB_DP 12U
  67. #define GPIOA_SWDIO 13U
  68. #define GPIOA_SWCLK 14U
  69. #define GPIOA_PIN15 15U
  70. #define GPIOB_PIN0 0U
  71. #define GPIOB_PIN1 1U
  72. #define GPIOB_PIN2 2U
  73. #define GPIOB_SWO 3U
  74. #define GPIOB_PIN4 4U
  75. #define GPIOB_PIN5 5U
  76. #define GPIOB_PIN6 6U
  77. #define GPIOB_LED2 7U
  78. #define GPIOB_LED_BLUE 7U
  79. #define GPIOB_PIN8 8U
  80. #define GPIOB_PIN9 9U
  81. #define GPIOB_PIN10 10U
  82. #define GPIOB_PIN11 11U
  83. #define GPIOB_PIN12 12U
  84. #define GPIOB_PIN13 13U
  85. #define GPIOB_LED3 14U
  86. #define GPIOB_LED_RED 14U
  87. #define GPIOB_PIN15 15U
  88. #define GPIOC_PIN0 0U
  89. #define GPIOC_PIN1 1U
  90. #define GPIOC_PIN2 2U
  91. #define GPIOC_PIN3 3U
  92. #define GPIOC_PIN4 4U
  93. #define GPIOC_PIN5 5U
  94. #define GPIOC_PIN6 6U
  95. #define GPIOC_LED1 7U
  96. #define GPIOC_LED_GREEN 7U
  97. #define GPIOC_PIN8 8U
  98. #define GPIOC_PIN9 9U
  99. #define GPIOC_PIN10 10U
  100. #define GPIOC_PIN11 11U
  101. #define GPIOC_PIN12 12U
  102. #define GPIOC_BUTTON 13U
  103. #define GPIOC_PIN14 14U
  104. #define GPIOC_PIN15 15U
  105. #define GPIOD_PIN0 0U
  106. #define GPIOD_PIN1 1U
  107. #define GPIOD_PIN2 2U
  108. #define GPIOD_PIN3 3U
  109. #define GPIOD_PIN4 4U
  110. #define GPIOD_PIN5 5U
  111. #define GPIOD_PIN6 6U
  112. #define GPIOD_PIN7 7U
  113. #define GPIOD_PIN8 8U
  114. #define GPIOD_PIN9 9U
  115. #define GPIOD_PIN10 10U
  116. #define GPIOD_PIN11 11U
  117. #define GPIOD_PIN12 12U
  118. #define GPIOD_PIN13 13U
  119. #define GPIOD_PIN14 14U
  120. #define GPIOD_PIN15 15U
  121. #define GPIOE_PIN0 0U
  122. #define GPIOE_PIN1 1U
  123. #define GPIOE_PIN2 2U
  124. #define GPIOE_PIN3 3U
  125. #define GPIOE_PIN4 4U
  126. #define GPIOE_PIN5 5U
  127. #define GPIOE_PIN6 6U
  128. #define GPIOE_PIN7 7U
  129. #define GPIOE_PIN8 8U
  130. #define GPIOE_PIN9 9U
  131. #define GPIOE_PIN10 10U
  132. #define GPIOE_PIN11 11U
  133. #define GPIOE_PIN12 12U
  134. #define GPIOE_PIN13 13U
  135. #define GPIOE_PIN14 14U
  136. #define GPIOE_PIN15 15U
  137. #define GPIOF_PIN0 0U
  138. #define GPIOF_PIN1 1U
  139. #define GPIOF_PIN2 2U
  140. #define GPIOF_PIN3 3U
  141. #define GPIOF_PIN4 4U
  142. #define GPIOF_PIN5 5U
  143. #define GPIOF_PIN6 6U
  144. #define GPIOF_PIN7 7U
  145. #define GPIOF_PIN8 8U
  146. #define GPIOF_PIN9 9U
  147. #define GPIOF_PIN10 10U
  148. #define GPIOF_PIN11 11U
  149. #define GPIOF_PIN12 12U
  150. #define GPIOF_PIN13 13U
  151. #define GPIOF_PIN14 14U
  152. #define GPIOF_PIN15 15U
  153. #define GPIOG_PIN0 0U
  154. #define GPIOG_PIN1 1U
  155. #define GPIOG_PIN2 2U
  156. #define GPIOG_PIN3 3U
  157. #define GPIOG_PIN4 4U
  158. #define GPIOG_USB_OVER_CURRENT 5U
  159. #define GPIOG_USB_POWER_SWITCH_ON 6U
  160. #define GPIOG_LPUART1_TX 7U
  161. #define GPIOG_LPUART1_RX 8U
  162. #define GPIOG_PIN9 9U
  163. #define GPIOG_PIN10 10U
  164. #define GPIOG_PIN11 11U
  165. #define GPIOG_PIN12 12U
  166. #define GPIOG_PIN13 13U
  167. #define GPIOG_PIN14 14U
  168. #define GPIOG_PIN15 15U
  169. #define GPIOH_PIN0 0U
  170. #define GPIOH_PIN1 1U
  171. #define GPIOH_PIN2 2U
  172. #define GPIOH_PIN3 3U
  173. #define GPIOH_PIN4 4U
  174. #define GPIOH_PIN5 5U
  175. #define GPIOH_PIN6 6U
  176. #define GPIOH_PIN7 7U
  177. #define GPIOH_PIN8 8U
  178. #define GPIOH_PIN9 9U
  179. #define GPIOH_PIN10 10U
  180. #define GPIOH_PIN11 11U
  181. #define GPIOH_PIN12 12U
  182. #define GPIOH_PIN13 13U
  183. #define GPIOH_PIN14 14U
  184. #define GPIOH_PIN15 15U
  185. #define GPIOI_PIN0 0U
  186. #define GPIOI_PIN1 1U
  187. #define GPIOI_PIN2 2U
  188. #define GPIOI_PIN3 3U
  189. #define GPIOI_PIN4 4U
  190. #define GPIOI_PIN5 5U
  191. #define GPIOI_PIN6 6U
  192. #define GPIOI_PIN7 7U
  193. #define GPIOI_PIN8 8U
  194. #define GPIOI_PIN9 9U
  195. #define GPIOI_PIN10 10U
  196. #define GPIOI_PIN11 11U
  197. #define GPIOI_PIN12 12U
  198. #define GPIOI_PIN13 13U
  199. #define GPIOI_PIN14 14U
  200. #define GPIOI_PIN15 15U
  201. /*
  202. * IO lines assignments.
  203. */
  204. #define LINE_USB_SOF PAL_LINE(GPIOA, 8U)
  205. #define LINE_USB_VBUS PAL_LINE(GPIOA, 9U)
  206. #define LINE_USB_ID PAL_LINE(GPIOA, 10U)
  207. #define LINE_USB_DM PAL_LINE(GPIOA, 11U)
  208. #define LINE_USB_DP PAL_LINE(GPIOA, 12U)
  209. #define LINE_SWDIO PAL_LINE(GPIOA, 13U)
  210. #define LINE_SWCLK PAL_LINE(GPIOA, 14U)
  211. #define LINE_SWO PAL_LINE(GPIOB, 3U)
  212. #define LINE_LED2 PAL_LINE(GPIOB, 7U)
  213. #define LINE_LED_BLUE PAL_LINE(GPIOB, 7U)
  214. #define LINE_LED3 PAL_LINE(GPIOB, 14U)
  215. #define LINE_LED_RED PAL_LINE(GPIOB, 14U)
  216. #define LINE_LED1 PAL_LINE(GPIOC, 7U)
  217. #define LINE_LED_GREEN PAL_LINE(GPIOC, 7U)
  218. #define LINE_BUTTON PAL_LINE(GPIOC, 13U)
  219. #define LINE_USB_OVER_CURRENT PAL_LINE(GPIOG, 5U)
  220. #define LINE_USB_POWER_SWITCH_ON PAL_LINE(GPIOG, 6U)
  221. #define LINE_LPUART1_TX PAL_LINE(GPIOG, 7U)
  222. #define LINE_LPUART1_RX PAL_LINE(GPIOG, 8U)
  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. #define PIN_ASCR_DISABLED(n) (0U << (n))
  257. #define PIN_ASCR_ENABLED(n) (1U << (n))
  258. #define PIN_LOCKR_DISABLED(n) (0U << (n))
  259. #define PIN_LOCKR_ENABLED(n) (1U << (n))
  260. /*
  261. * GPIOA setup:
  262. *
  263. * PA0 - PIN0 (analog).
  264. * PA1 - PIN1 (analog).
  265. * PA2 - PIN2 (analog).
  266. * PA3 - PIN3 (analog).
  267. * PA4 - PIN4 (analog).
  268. * PA5 - PIN5 (analog).
  269. * PA6 - PIN6 (analog).
  270. * PA7 - PIN7 (analog).
  271. * PA8 - USB_SOF (alternate 10).
  272. * PA9 - USB_VBUS (analog).
  273. * PA10 - USB_ID (alternate 10).
  274. * PA11 - USB_DM (alternate 10).
  275. * PA12 - USB_DP (alternate 10).
  276. * PA13 - SWDIO (alternate 0).
  277. * PA14 - SWCLK (alternate 0).
  278. * PA15 - PIN15 (analog).
  279. */
  280. #define VAL_GPIOA_MODER (PIN_MODE_ANALOG(GPIOA_PIN0) | \
  281. PIN_MODE_ANALOG(GPIOA_PIN1) | \
  282. PIN_MODE_ANALOG(GPIOA_PIN2) | \
  283. PIN_MODE_ANALOG(GPIOA_PIN3) | \
  284. PIN_MODE_ANALOG(GPIOA_PIN4) | \
  285. PIN_MODE_ANALOG(GPIOA_PIN5) | \
  286. PIN_MODE_ANALOG(GPIOA_PIN6) | \
  287. PIN_MODE_ANALOG(GPIOA_PIN7) | \
  288. PIN_MODE_ALTERNATE(GPIOA_USB_SOF) | \
  289. PIN_MODE_ANALOG(GPIOA_USB_VBUS) | \
  290. PIN_MODE_ALTERNATE(GPIOA_USB_ID) | \
  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_ANALOG(GPIOA_PIN15))
  296. #define VAL_GPIOA_OTYPER (PIN_OTYPE_PUSHPULL(GPIOA_PIN0) | \
  297. PIN_OTYPE_PUSHPULL(GPIOA_PIN1) | \
  298. PIN_OTYPE_PUSHPULL(GPIOA_PIN2) | \
  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_PIN7) | \
  304. PIN_OTYPE_PUSHPULL(GPIOA_USB_SOF) | \
  305. PIN_OTYPE_PUSHPULL(GPIOA_USB_VBUS) | \
  306. PIN_OTYPE_PUSHPULL(GPIOA_USB_ID) | \
  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_PIN15))
  312. #define VAL_GPIOA_OSPEEDR (PIN_OSPEED_VERYLOW(GPIOA_PIN0) | \
  313. PIN_OSPEED_VERYLOW(GPIOA_PIN1) | \
  314. PIN_OSPEED_VERYLOW(GPIOA_PIN2) | \
  315. PIN_OSPEED_VERYLOW(GPIOA_PIN3) | \
  316. PIN_OSPEED_VERYLOW(GPIOA_PIN4) | \
  317. PIN_OSPEED_VERYLOW(GPIOA_PIN5) | \
  318. PIN_OSPEED_VERYLOW(GPIOA_PIN6) | \
  319. PIN_OSPEED_VERYLOW(GPIOA_PIN7) | \
  320. PIN_OSPEED_HIGH(GPIOA_USB_SOF) | \
  321. PIN_OSPEED_VERYLOW(GPIOA_USB_VBUS) | \
  322. PIN_OSPEED_HIGH(GPIOA_USB_ID) | \
  323. PIN_OSPEED_HIGH(GPIOA_USB_DM) | \
  324. PIN_OSPEED_HIGH(GPIOA_USB_DP) | \
  325. PIN_OSPEED_HIGH(GPIOA_SWDIO) | \
  326. PIN_OSPEED_HIGH(GPIOA_SWCLK) | \
  327. PIN_OSPEED_VERYLOW(GPIOA_PIN15))
  328. #define VAL_GPIOA_PUPDR (PIN_PUPDR_FLOATING(GPIOA_PIN0) | \
  329. PIN_PUPDR_FLOATING(GPIOA_PIN1) | \
  330. PIN_PUPDR_FLOATING(GPIOA_PIN2) | \
  331. PIN_PUPDR_FLOATING(GPIOA_PIN3) | \
  332. PIN_PUPDR_FLOATING(GPIOA_PIN4) | \
  333. PIN_PUPDR_FLOATING(GPIOA_PIN5) | \
  334. PIN_PUPDR_FLOATING(GPIOA_PIN6) | \
  335. PIN_PUPDR_FLOATING(GPIOA_PIN7) | \
  336. PIN_PUPDR_FLOATING(GPIOA_USB_SOF) | \
  337. PIN_PUPDR_FLOATING(GPIOA_USB_VBUS) | \
  338. PIN_PUPDR_FLOATING(GPIOA_USB_ID) | \
  339. PIN_PUPDR_FLOATING(GPIOA_USB_DM) | \
  340. PIN_PUPDR_FLOATING(GPIOA_USB_DP) | \
  341. PIN_PUPDR_PULLDOWN(GPIOA_SWDIO) | \
  342. PIN_PUPDR_PULLUP(GPIOA_SWCLK) | \
  343. PIN_PUPDR_FLOATING(GPIOA_PIN15))
  344. #define VAL_GPIOA_ODR (PIN_ODR_LOW(GPIOA_PIN0) | \
  345. PIN_ODR_LOW(GPIOA_PIN1) | \
  346. PIN_ODR_LOW(GPIOA_PIN2) | \
  347. PIN_ODR_LOW(GPIOA_PIN3) | \
  348. PIN_ODR_LOW(GPIOA_PIN4) | \
  349. PIN_ODR_LOW(GPIOA_PIN5) | \
  350. PIN_ODR_LOW(GPIOA_PIN6) | \
  351. PIN_ODR_LOW(GPIOA_PIN7) | \
  352. PIN_ODR_LOW(GPIOA_USB_SOF) | \
  353. PIN_ODR_LOW(GPIOA_USB_VBUS) | \
  354. PIN_ODR_LOW(GPIOA_USB_ID) | \
  355. PIN_ODR_LOW(GPIOA_USB_DM) | \
  356. PIN_ODR_LOW(GPIOA_USB_DP) | \
  357. PIN_ODR_LOW(GPIOA_SWDIO) | \
  358. PIN_ODR_LOW(GPIOA_SWCLK) | \
  359. PIN_ODR_LOW(GPIOA_PIN15))
  360. #define VAL_GPIOA_AFRL (PIN_AFIO_AF(GPIOA_PIN0, 0U) | \
  361. PIN_AFIO_AF(GPIOA_PIN1, 0U) | \
  362. PIN_AFIO_AF(GPIOA_PIN2, 0U) | \
  363. PIN_AFIO_AF(GPIOA_PIN3, 0U) | \
  364. PIN_AFIO_AF(GPIOA_PIN4, 0U) | \
  365. PIN_AFIO_AF(GPIOA_PIN5, 0U) | \
  366. PIN_AFIO_AF(GPIOA_PIN6, 0U) | \
  367. PIN_AFIO_AF(GPIOA_PIN7, 0U))
  368. #define VAL_GPIOA_AFRH (PIN_AFIO_AF(GPIOA_USB_SOF, 10U) | \
  369. PIN_AFIO_AF(GPIOA_USB_VBUS, 0U) | \
  370. PIN_AFIO_AF(GPIOA_USB_ID, 10U) | \
  371. PIN_AFIO_AF(GPIOA_USB_DM, 10U) | \
  372. PIN_AFIO_AF(GPIOA_USB_DP, 10U) | \
  373. PIN_AFIO_AF(GPIOA_SWDIO, 0U) | \
  374. PIN_AFIO_AF(GPIOA_SWCLK, 0U) | \
  375. PIN_AFIO_AF(GPIOA_PIN15, 0U))
  376. #define VAL_GPIOA_ASCR (PIN_ASCR_DISABLED(GPIOA_PIN0) | \
  377. PIN_ASCR_DISABLED(GPIOA_PIN1) | \
  378. PIN_ASCR_DISABLED(GPIOA_PIN2) | \
  379. PIN_ASCR_DISABLED(GPIOA_PIN3) | \
  380. PIN_ASCR_DISABLED(GPIOA_PIN4) | \
  381. PIN_ASCR_DISABLED(GPIOA_PIN5) | \
  382. PIN_ASCR_DISABLED(GPIOA_PIN6) | \
  383. PIN_ASCR_DISABLED(GPIOA_PIN7) | \
  384. PIN_ASCR_DISABLED(GPIOA_USB_SOF) | \
  385. PIN_ASCR_DISABLED(GPIOA_USB_VBUS) | \
  386. PIN_ASCR_DISABLED(GPIOA_USB_ID) | \
  387. PIN_ASCR_DISABLED(GPIOA_USB_DM) | \
  388. PIN_ASCR_DISABLED(GPIOA_USB_DP) | \
  389. PIN_ASCR_DISABLED(GPIOA_SWDIO) | \
  390. PIN_ASCR_DISABLED(GPIOA_SWCLK) | \
  391. PIN_ASCR_DISABLED(GPIOA_PIN15))
  392. #define VAL_GPIOA_LOCKR (PIN_LOCKR_DISABLED(GPIOA_PIN0) | \
  393. PIN_LOCKR_DISABLED(GPIOA_PIN1) | \
  394. PIN_LOCKR_DISABLED(GPIOA_PIN2) | \
  395. PIN_LOCKR_DISABLED(GPIOA_PIN3) | \
  396. PIN_LOCKR_DISABLED(GPIOA_PIN4) | \
  397. PIN_LOCKR_DISABLED(GPIOA_PIN5) | \
  398. PIN_LOCKR_DISABLED(GPIOA_PIN6) | \
  399. PIN_LOCKR_DISABLED(GPIOA_PIN7) | \
  400. PIN_LOCKR_DISABLED(GPIOA_USB_SOF) | \
  401. PIN_LOCKR_DISABLED(GPIOA_USB_VBUS) | \
  402. PIN_LOCKR_DISABLED(GPIOA_USB_ID) | \
  403. PIN_LOCKR_DISABLED(GPIOA_USB_DM) | \
  404. PIN_LOCKR_DISABLED(GPIOA_USB_DP) | \
  405. PIN_LOCKR_DISABLED(GPIOA_SWDIO) | \
  406. PIN_LOCKR_DISABLED(GPIOA_SWCLK) | \
  407. PIN_LOCKR_DISABLED(GPIOA_PIN15))
  408. /*
  409. * GPIOB setup:
  410. *
  411. * PB0 - PIN0 (analog).
  412. * PB1 - PIN1 (analog).
  413. * PB2 - PIN2 (analog).
  414. * PB3 - SWO (alternate 0).
  415. * PB4 - PIN4 (analog).
  416. * PB5 - PIN5 (analog).
  417. * PB6 - PIN6 (analog).
  418. * PB7 - LED2 LED_BLUE (output pushpull maximum).
  419. * PB8 - PIN8 (analog).
  420. * PB9 - PIN9 (analog).
  421. * PB10 - PIN10 (analog).
  422. * PB11 - PIN11 (analog).
  423. * PB12 - PIN12 (analog).
  424. * PB13 - PIN13 (analog).
  425. * PB14 - LED3 LED_RED (output pushpull maximum).
  426. * PB15 - PIN15 (analog).
  427. */
  428. #define VAL_GPIOB_MODER (PIN_MODE_ANALOG(GPIOB_PIN0) | \
  429. PIN_MODE_ANALOG(GPIOB_PIN1) | \
  430. PIN_MODE_ANALOG(GPIOB_PIN2) | \
  431. PIN_MODE_ALTERNATE(GPIOB_SWO) | \
  432. PIN_MODE_ANALOG(GPIOB_PIN4) | \
  433. PIN_MODE_ANALOG(GPIOB_PIN5) | \
  434. PIN_MODE_ANALOG(GPIOB_PIN6) | \
  435. PIN_MODE_OUTPUT(GPIOB_LED2) | \
  436. PIN_MODE_ANALOG(GPIOB_PIN8) | \
  437. PIN_MODE_ANALOG(GPIOB_PIN9) | \
  438. PIN_MODE_ANALOG(GPIOB_PIN10) | \
  439. PIN_MODE_ANALOG(GPIOB_PIN11) | \
  440. PIN_MODE_ANALOG(GPIOB_PIN12) | \
  441. PIN_MODE_ANALOG(GPIOB_PIN13) | \
  442. PIN_MODE_OUTPUT(GPIOB_LED3) | \
  443. PIN_MODE_ANALOG(GPIOB_PIN15))
  444. #define VAL_GPIOB_OTYPER (PIN_OTYPE_PUSHPULL(GPIOB_PIN0) | \
  445. PIN_OTYPE_PUSHPULL(GPIOB_PIN1) | \
  446. PIN_OTYPE_PUSHPULL(GPIOB_PIN2) | \
  447. PIN_OTYPE_PUSHPULL(GPIOB_SWO) | \
  448. PIN_OTYPE_PUSHPULL(GPIOB_PIN4) | \
  449. PIN_OTYPE_PUSHPULL(GPIOB_PIN5) | \
  450. PIN_OTYPE_PUSHPULL(GPIOB_PIN6) | \
  451. PIN_OTYPE_PUSHPULL(GPIOB_LED2) | \
  452. PIN_OTYPE_PUSHPULL(GPIOB_PIN8) | \
  453. PIN_OTYPE_PUSHPULL(GPIOB_PIN9) | \
  454. PIN_OTYPE_PUSHPULL(GPIOB_PIN10) | \
  455. PIN_OTYPE_PUSHPULL(GPIOB_PIN11) | \
  456. PIN_OTYPE_PUSHPULL(GPIOB_PIN12) | \
  457. PIN_OTYPE_PUSHPULL(GPIOB_PIN13) | \
  458. PIN_OTYPE_PUSHPULL(GPIOB_LED3) | \
  459. PIN_OTYPE_PUSHPULL(GPIOB_PIN15))
  460. #define VAL_GPIOB_OSPEEDR (PIN_OSPEED_VERYLOW(GPIOB_PIN0) | \
  461. PIN_OSPEED_VERYLOW(GPIOB_PIN1) | \
  462. PIN_OSPEED_VERYLOW(GPIOB_PIN2) | \
  463. PIN_OSPEED_HIGH(GPIOB_SWO) | \
  464. PIN_OSPEED_VERYLOW(GPIOB_PIN4) | \
  465. PIN_OSPEED_VERYLOW(GPIOB_PIN5) | \
  466. PIN_OSPEED_VERYLOW(GPIOB_PIN6) | \
  467. PIN_OSPEED_HIGH(GPIOB_LED2) | \
  468. PIN_OSPEED_VERYLOW(GPIOB_PIN8) | \
  469. PIN_OSPEED_VERYLOW(GPIOB_PIN9) | \
  470. PIN_OSPEED_VERYLOW(GPIOB_PIN10) | \
  471. PIN_OSPEED_VERYLOW(GPIOB_PIN11) | \
  472. PIN_OSPEED_VERYLOW(GPIOB_PIN12) | \
  473. PIN_OSPEED_VERYLOW(GPIOB_PIN13) | \
  474. PIN_OSPEED_HIGH(GPIOB_LED3) | \
  475. PIN_OSPEED_VERYLOW(GPIOB_PIN15))
  476. #define VAL_GPIOB_PUPDR (PIN_PUPDR_FLOATING(GPIOB_PIN0) | \
  477. PIN_PUPDR_FLOATING(GPIOB_PIN1) | \
  478. PIN_PUPDR_FLOATING(GPIOB_PIN2) | \
  479. PIN_PUPDR_FLOATING(GPIOB_SWO) | \
  480. PIN_PUPDR_FLOATING(GPIOB_PIN4) | \
  481. PIN_PUPDR_FLOATING(GPIOB_PIN5) | \
  482. PIN_PUPDR_FLOATING(GPIOB_PIN6) | \
  483. PIN_PUPDR_FLOATING(GPIOB_LED2) | \
  484. PIN_PUPDR_FLOATING(GPIOB_PIN8) | \
  485. PIN_PUPDR_FLOATING(GPIOB_PIN9) | \
  486. PIN_PUPDR_FLOATING(GPIOB_PIN10) | \
  487. PIN_PUPDR_FLOATING(GPIOB_PIN11) | \
  488. PIN_PUPDR_FLOATING(GPIOB_PIN12) | \
  489. PIN_PUPDR_FLOATING(GPIOB_PIN13) | \
  490. PIN_PUPDR_FLOATING(GPIOB_LED3) | \
  491. PIN_PUPDR_FLOATING(GPIOB_PIN15))
  492. #define VAL_GPIOB_ODR (PIN_ODR_LOW(GPIOB_PIN0) | \
  493. PIN_ODR_LOW(GPIOB_PIN1) | \
  494. PIN_ODR_LOW(GPIOB_PIN2) | \
  495. PIN_ODR_LOW(GPIOB_SWO) | \
  496. PIN_ODR_LOW(GPIOB_PIN4) | \
  497. PIN_ODR_LOW(GPIOB_PIN5) | \
  498. PIN_ODR_LOW(GPIOB_PIN6) | \
  499. PIN_ODR_LOW(GPIOB_LED2) | \
  500. PIN_ODR_LOW(GPIOB_PIN8) | \
  501. PIN_ODR_LOW(GPIOB_PIN9) | \
  502. PIN_ODR_LOW(GPIOB_PIN10) | \
  503. PIN_ODR_LOW(GPIOB_PIN11) | \
  504. PIN_ODR_LOW(GPIOB_PIN12) | \
  505. PIN_ODR_LOW(GPIOB_PIN13) | \
  506. PIN_ODR_LOW(GPIOB_LED3) | \
  507. PIN_ODR_LOW(GPIOB_PIN15))
  508. #define VAL_GPIOB_AFRL (PIN_AFIO_AF(GPIOB_PIN0, 0U) | \
  509. PIN_AFIO_AF(GPIOB_PIN1, 0U) | \
  510. PIN_AFIO_AF(GPIOB_PIN2, 0U) | \
  511. PIN_AFIO_AF(GPIOB_SWO, 0U) | \
  512. PIN_AFIO_AF(GPIOB_PIN4, 0U) | \
  513. PIN_AFIO_AF(GPIOB_PIN5, 0U) | \
  514. PIN_AFIO_AF(GPIOB_PIN6, 0U) | \
  515. PIN_AFIO_AF(GPIOB_LED2, 0U))
  516. #define VAL_GPIOB_AFRH (PIN_AFIO_AF(GPIOB_PIN8, 0U) | \
  517. PIN_AFIO_AF(GPIOB_PIN9, 0U) | \
  518. PIN_AFIO_AF(GPIOB_PIN10, 0U) | \
  519. PIN_AFIO_AF(GPIOB_PIN11, 0U) | \
  520. PIN_AFIO_AF(GPIOB_PIN12, 0U) | \
  521. PIN_AFIO_AF(GPIOB_PIN13, 0U) | \
  522. PIN_AFIO_AF(GPIOB_LED3, 0U) | \
  523. PIN_AFIO_AF(GPIOB_PIN15, 0U))
  524. #define VAL_GPIOB_ASCR (PIN_ASCR_DISABLED(GPIOB_PIN0) | \
  525. PIN_ASCR_DISABLED(GPIOB_PIN1) | \
  526. PIN_ASCR_DISABLED(GPIOB_PIN2) | \
  527. PIN_ASCR_DISABLED(GPIOB_SWO) | \
  528. PIN_ASCR_DISABLED(GPIOB_PIN4) | \
  529. PIN_ASCR_DISABLED(GPIOB_PIN5) | \
  530. PIN_ASCR_DISABLED(GPIOB_PIN6) | \
  531. PIN_ASCR_DISABLED(GPIOB_LED2) | \
  532. PIN_ASCR_DISABLED(GPIOB_PIN8) | \
  533. PIN_ASCR_DISABLED(GPIOB_PIN9) | \
  534. PIN_ASCR_DISABLED(GPIOB_PIN10) | \
  535. PIN_ASCR_DISABLED(GPIOB_PIN11) | \
  536. PIN_ASCR_DISABLED(GPIOB_PIN12) | \
  537. PIN_ASCR_DISABLED(GPIOB_PIN13) | \
  538. PIN_ASCR_DISABLED(GPIOB_LED3) | \
  539. PIN_ASCR_DISABLED(GPIOB_PIN15))
  540. #define VAL_GPIOB_LOCKR (PIN_LOCKR_DISABLED(GPIOB_PIN0) | \
  541. PIN_LOCKR_DISABLED(GPIOB_PIN1) | \
  542. PIN_LOCKR_DISABLED(GPIOB_PIN2) | \
  543. PIN_LOCKR_DISABLED(GPIOB_SWO) | \
  544. PIN_LOCKR_DISABLED(GPIOB_PIN4) | \
  545. PIN_LOCKR_DISABLED(GPIOB_PIN5) | \
  546. PIN_LOCKR_DISABLED(GPIOB_PIN6) | \
  547. PIN_LOCKR_DISABLED(GPIOB_LED2) | \
  548. PIN_LOCKR_DISABLED(GPIOB_PIN8) | \
  549. PIN_LOCKR_DISABLED(GPIOB_PIN9) | \
  550. PIN_LOCKR_DISABLED(GPIOB_PIN10) | \
  551. PIN_LOCKR_DISABLED(GPIOB_PIN11) | \
  552. PIN_LOCKR_DISABLED(GPIOB_PIN12) | \
  553. PIN_LOCKR_DISABLED(GPIOB_PIN13) | \
  554. PIN_LOCKR_DISABLED(GPIOB_LED3) | \
  555. PIN_LOCKR_DISABLED(GPIOB_PIN15))
  556. /*
  557. * GPIOC setup:
  558. *
  559. * PC0 - PIN0 (analog).
  560. * PC1 - PIN1 (analog).
  561. * PC2 - PIN2 (analog).
  562. * PC3 - PIN3 (analog).
  563. * PC4 - PIN4 (analog).
  564. * PC5 - PIN5 (analog).
  565. * PC6 - PIN6 (analog).
  566. * PC7 - LED1 LED_GREEN (output pushpull maximum).
  567. * PC8 - PIN8 (analog).
  568. * PC9 - PIN9 (analog).
  569. * PC10 - PIN10 (analog).
  570. * PC11 - PIN11 (analog).
  571. * PC12 - PIN12 (analog).
  572. * PC13 - BUTTON (input floating).
  573. * PC14 - PIN14 (analog).
  574. * PC15 - PIN15 (analog).
  575. */
  576. #define VAL_GPIOC_MODER (PIN_MODE_ANALOG(GPIOC_PIN0) | \
  577. PIN_MODE_ANALOG(GPIOC_PIN1) | \
  578. PIN_MODE_ANALOG(GPIOC_PIN2) | \
  579. PIN_MODE_ANALOG(GPIOC_PIN3) | \
  580. PIN_MODE_ANALOG(GPIOC_PIN4) | \
  581. PIN_MODE_ANALOG(GPIOC_PIN5) | \
  582. PIN_MODE_ANALOG(GPIOC_PIN6) | \
  583. PIN_MODE_OUTPUT(GPIOC_LED1) | \
  584. PIN_MODE_ANALOG(GPIOC_PIN8) | \
  585. PIN_MODE_ANALOG(GPIOC_PIN9) | \
  586. PIN_MODE_ANALOG(GPIOC_PIN10) | \
  587. PIN_MODE_ANALOG(GPIOC_PIN11) | \
  588. PIN_MODE_ANALOG(GPIOC_PIN12) | \
  589. PIN_MODE_INPUT(GPIOC_BUTTON) | \
  590. PIN_MODE_ANALOG(GPIOC_PIN14) | \
  591. PIN_MODE_ANALOG(GPIOC_PIN15))
  592. #define VAL_GPIOC_OTYPER (PIN_OTYPE_PUSHPULL(GPIOC_PIN0) | \
  593. PIN_OTYPE_PUSHPULL(GPIOC_PIN1) | \
  594. PIN_OTYPE_PUSHPULL(GPIOC_PIN2) | \
  595. PIN_OTYPE_PUSHPULL(GPIOC_PIN3) | \
  596. PIN_OTYPE_PUSHPULL(GPIOC_PIN4) | \
  597. PIN_OTYPE_PUSHPULL(GPIOC_PIN5) | \
  598. PIN_OTYPE_PUSHPULL(GPIOC_PIN6) | \
  599. PIN_OTYPE_PUSHPULL(GPIOC_LED1) | \
  600. PIN_OTYPE_PUSHPULL(GPIOC_PIN8) | \
  601. PIN_OTYPE_PUSHPULL(GPIOC_PIN9) | \
  602. PIN_OTYPE_PUSHPULL(GPIOC_PIN10) | \
  603. PIN_OTYPE_PUSHPULL(GPIOC_PIN11) | \
  604. PIN_OTYPE_PUSHPULL(GPIOC_PIN12) | \
  605. PIN_OTYPE_PUSHPULL(GPIOC_BUTTON) | \
  606. PIN_OTYPE_PUSHPULL(GPIOC_PIN14) | \
  607. PIN_OTYPE_PUSHPULL(GPIOC_PIN15))
  608. #define VAL_GPIOC_OSPEEDR (PIN_OSPEED_VERYLOW(GPIOC_PIN0) | \
  609. PIN_OSPEED_VERYLOW(GPIOC_PIN1) | \
  610. PIN_OSPEED_VERYLOW(GPIOC_PIN2) | \
  611. PIN_OSPEED_VERYLOW(GPIOC_PIN3) | \
  612. PIN_OSPEED_VERYLOW(GPIOC_PIN4) | \
  613. PIN_OSPEED_VERYLOW(GPIOC_PIN5) | \
  614. PIN_OSPEED_VERYLOW(GPIOC_PIN6) | \
  615. PIN_OSPEED_HIGH(GPIOC_LED1) | \
  616. PIN_OSPEED_VERYLOW(GPIOC_PIN8) | \
  617. PIN_OSPEED_VERYLOW(GPIOC_PIN9) | \
  618. PIN_OSPEED_VERYLOW(GPIOC_PIN10) | \
  619. PIN_OSPEED_VERYLOW(GPIOC_PIN11) | \
  620. PIN_OSPEED_VERYLOW(GPIOC_PIN12) | \
  621. PIN_OSPEED_VERYLOW(GPIOC_BUTTON) | \
  622. PIN_OSPEED_VERYLOW(GPIOC_PIN14) | \
  623. PIN_OSPEED_VERYLOW(GPIOC_PIN15))
  624. #define VAL_GPIOC_PUPDR (PIN_PUPDR_FLOATING(GPIOC_PIN0) | \
  625. PIN_PUPDR_FLOATING(GPIOC_PIN1) | \
  626. PIN_PUPDR_FLOATING(GPIOC_PIN2) | \
  627. PIN_PUPDR_FLOATING(GPIOC_PIN3) | \
  628. PIN_PUPDR_FLOATING(GPIOC_PIN4) | \
  629. PIN_PUPDR_FLOATING(GPIOC_PIN5) | \
  630. PIN_PUPDR_FLOATING(GPIOC_PIN6) | \
  631. PIN_PUPDR_FLOATING(GPIOC_LED1) | \
  632. PIN_PUPDR_FLOATING(GPIOC_PIN8) | \
  633. PIN_PUPDR_FLOATING(GPIOC_PIN9) | \
  634. PIN_PUPDR_FLOATING(GPIOC_PIN10) | \
  635. PIN_PUPDR_FLOATING(GPIOC_PIN11) | \
  636. PIN_PUPDR_FLOATING(GPIOC_PIN12) | \
  637. PIN_PUPDR_FLOATING(GPIOC_BUTTON) | \
  638. PIN_PUPDR_FLOATING(GPIOC_PIN14) | \
  639. PIN_PUPDR_FLOATING(GPIOC_PIN15))
  640. #define VAL_GPIOC_ODR (PIN_ODR_LOW(GPIOC_PIN0) | \
  641. PIN_ODR_LOW(GPIOC_PIN1) | \
  642. PIN_ODR_LOW(GPIOC_PIN2) | \
  643. PIN_ODR_LOW(GPIOC_PIN3) | \
  644. PIN_ODR_LOW(GPIOC_PIN4) | \
  645. PIN_ODR_LOW(GPIOC_PIN5) | \
  646. PIN_ODR_LOW(GPIOC_PIN6) | \
  647. PIN_ODR_LOW(GPIOC_LED1) | \
  648. PIN_ODR_LOW(GPIOC_PIN8) | \
  649. PIN_ODR_LOW(GPIOC_PIN9) | \
  650. PIN_ODR_LOW(GPIOC_PIN10) | \
  651. PIN_ODR_LOW(GPIOC_PIN11) | \
  652. PIN_ODR_LOW(GPIOC_PIN12) | \
  653. PIN_ODR_LOW(GPIOC_BUTTON) | \
  654. PIN_ODR_LOW(GPIOC_PIN14) | \
  655. PIN_ODR_LOW(GPIOC_PIN15))
  656. #define VAL_GPIOC_AFRL (PIN_AFIO_AF(GPIOC_PIN0, 0U) | \
  657. PIN_AFIO_AF(GPIOC_PIN1, 0U) | \
  658. PIN_AFIO_AF(GPIOC_PIN2, 0U) | \
  659. PIN_AFIO_AF(GPIOC_PIN3, 0U) | \
  660. PIN_AFIO_AF(GPIOC_PIN4, 0U) | \
  661. PIN_AFIO_AF(GPIOC_PIN5, 0U) | \
  662. PIN_AFIO_AF(GPIOC_PIN6, 0U) | \
  663. PIN_AFIO_AF(GPIOC_LED1, 0U))
  664. #define VAL_GPIOC_AFRH (PIN_AFIO_AF(GPIOC_PIN8, 0U) | \
  665. PIN_AFIO_AF(GPIOC_PIN9, 0U) | \
  666. PIN_AFIO_AF(GPIOC_PIN10, 0U) | \
  667. PIN_AFIO_AF(GPIOC_PIN11, 0U) | \
  668. PIN_AFIO_AF(GPIOC_PIN12, 0U) | \
  669. PIN_AFIO_AF(GPIOC_BUTTON, 0U) | \
  670. PIN_AFIO_AF(GPIOC_PIN14, 0U) | \
  671. PIN_AFIO_AF(GPIOC_PIN15, 0U))
  672. #define VAL_GPIOC_ASCR (PIN_ASCR_DISABLED(GPIOC_PIN0) | \
  673. PIN_ASCR_DISABLED(GPIOC_PIN1) | \
  674. PIN_ASCR_DISABLED(GPIOC_PIN2) | \
  675. PIN_ASCR_DISABLED(GPIOC_PIN3) | \
  676. PIN_ASCR_DISABLED(GPIOC_PIN4) | \
  677. PIN_ASCR_DISABLED(GPIOC_PIN5) | \
  678. PIN_ASCR_DISABLED(GPIOC_PIN6) | \
  679. PIN_ASCR_DISABLED(GPIOC_LED1) | \
  680. PIN_ASCR_DISABLED(GPIOC_PIN8) | \
  681. PIN_ASCR_DISABLED(GPIOC_PIN9) | \
  682. PIN_ASCR_DISABLED(GPIOC_PIN10) | \
  683. PIN_ASCR_DISABLED(GPIOC_PIN11) | \
  684. PIN_ASCR_DISABLED(GPIOC_PIN12) | \
  685. PIN_ASCR_DISABLED(GPIOC_BUTTON) | \
  686. PIN_ASCR_DISABLED(GPIOC_PIN14) | \
  687. PIN_ASCR_DISABLED(GPIOC_PIN15))
  688. #define VAL_GPIOC_LOCKR (PIN_LOCKR_DISABLED(GPIOC_PIN0) | \
  689. PIN_LOCKR_DISABLED(GPIOC_PIN1) | \
  690. PIN_LOCKR_DISABLED(GPIOC_PIN2) | \
  691. PIN_LOCKR_DISABLED(GPIOC_PIN3) | \
  692. PIN_LOCKR_DISABLED(GPIOC_PIN4) | \
  693. PIN_LOCKR_DISABLED(GPIOC_PIN5) | \
  694. PIN_LOCKR_DISABLED(GPIOC_PIN6) | \
  695. PIN_LOCKR_DISABLED(GPIOC_LED1) | \
  696. PIN_LOCKR_DISABLED(GPIOC_PIN8) | \
  697. PIN_LOCKR_DISABLED(GPIOC_PIN9) | \
  698. PIN_LOCKR_DISABLED(GPIOC_PIN10) | \
  699. PIN_LOCKR_DISABLED(GPIOC_PIN11) | \
  700. PIN_LOCKR_DISABLED(GPIOC_PIN12) | \
  701. PIN_LOCKR_DISABLED(GPIOC_BUTTON) | \
  702. PIN_LOCKR_DISABLED(GPIOC_PIN14) | \
  703. PIN_LOCKR_DISABLED(GPIOC_PIN15))
  704. /*
  705. * GPIOD setup:
  706. *
  707. * PD0 - PIN0 (analog).
  708. * PD1 - PIN1 (analog).
  709. * PD2 - PIN2 (analog).
  710. * PD3 - PIN3 (analog).
  711. * PD4 - PIN4 (analog).
  712. * PD5 - PIN5 (analog).
  713. * PD6 - PIN6 (analog).
  714. * PD7 - PIN7 (analog).
  715. * PD8 - PIN8 (analog).
  716. * PD9 - PIN9 (analog).
  717. * PD10 - PIN10 (analog).
  718. * PD11 - PIN11 (analog).
  719. * PD12 - PIN12 (analog).
  720. * PD13 - PIN13 (analog).
  721. * PD14 - PIN14 (analog).
  722. * PD15 - PIN15 (analog).
  723. */
  724. #define VAL_GPIOD_MODER (PIN_MODE_ANALOG(GPIOD_PIN0) | \
  725. PIN_MODE_ANALOG(GPIOD_PIN1) | \
  726. PIN_MODE_ANALOG(GPIOD_PIN2) | \
  727. PIN_MODE_ANALOG(GPIOD_PIN3) | \
  728. PIN_MODE_ANALOG(GPIOD_PIN4) | \
  729. PIN_MODE_ANALOG(GPIOD_PIN5) | \
  730. PIN_MODE_ANALOG(GPIOD_PIN6) | \
  731. PIN_MODE_ANALOG(GPIOD_PIN7) | \
  732. PIN_MODE_ANALOG(GPIOD_PIN8) | \
  733. PIN_MODE_ANALOG(GPIOD_PIN9) | \
  734. PIN_MODE_ANALOG(GPIOD_PIN10) | \
  735. PIN_MODE_ANALOG(GPIOD_PIN11) | \
  736. PIN_MODE_ANALOG(GPIOD_PIN12) | \
  737. PIN_MODE_ANALOG(GPIOD_PIN13) | \
  738. PIN_MODE_ANALOG(GPIOD_PIN14) | \
  739. PIN_MODE_ANALOG(GPIOD_PIN15))
  740. #define VAL_GPIOD_OTYPER (PIN_OTYPE_PUSHPULL(GPIOD_PIN0) | \
  741. PIN_OTYPE_PUSHPULL(GPIOD_PIN1) | \
  742. PIN_OTYPE_PUSHPULL(GPIOD_PIN2) | \
  743. PIN_OTYPE_PUSHPULL(GPIOD_PIN3) | \
  744. PIN_OTYPE_PUSHPULL(GPIOD_PIN4) | \
  745. PIN_OTYPE_PUSHPULL(GPIOD_PIN5) | \
  746. PIN_OTYPE_PUSHPULL(GPIOD_PIN6) | \
  747. PIN_OTYPE_PUSHPULL(GPIOD_PIN7) | \
  748. PIN_OTYPE_PUSHPULL(GPIOD_PIN8) | \
  749. PIN_OTYPE_PUSHPULL(GPIOD_PIN9) | \
  750. PIN_OTYPE_PUSHPULL(GPIOD_PIN10) | \
  751. PIN_OTYPE_PUSHPULL(GPIOD_PIN11) | \
  752. PIN_OTYPE_PUSHPULL(GPIOD_PIN12) | \
  753. PIN_OTYPE_PUSHPULL(GPIOD_PIN13) | \
  754. PIN_OTYPE_PUSHPULL(GPIOD_PIN14) | \
  755. PIN_OTYPE_PUSHPULL(GPIOD_PIN15))
  756. #define VAL_GPIOD_OSPEEDR (PIN_OSPEED_VERYLOW(GPIOD_PIN0) | \
  757. PIN_OSPEED_VERYLOW(GPIOD_PIN1) | \
  758. PIN_OSPEED_VERYLOW(GPIOD_PIN2) | \
  759. PIN_OSPEED_VERYLOW(GPIOD_PIN3) | \
  760. PIN_OSPEED_VERYLOW(GPIOD_PIN4) | \
  761. PIN_OSPEED_VERYLOW(GPIOD_PIN5) | \
  762. PIN_OSPEED_VERYLOW(GPIOD_PIN6) | \
  763. PIN_OSPEED_VERYLOW(GPIOD_PIN7) | \
  764. PIN_OSPEED_VERYLOW(GPIOD_PIN8) | \
  765. PIN_OSPEED_VERYLOW(GPIOD_PIN9) | \
  766. PIN_OSPEED_VERYLOW(GPIOD_PIN10) | \
  767. PIN_OSPEED_VERYLOW(GPIOD_PIN11) | \
  768. PIN_OSPEED_VERYLOW(GPIOD_PIN12) | \
  769. PIN_OSPEED_VERYLOW(GPIOD_PIN13) | \
  770. PIN_OSPEED_VERYLOW(GPIOD_PIN14) | \
  771. PIN_OSPEED_VERYLOW(GPIOD_PIN15))
  772. #define VAL_GPIOD_PUPDR (PIN_PUPDR_FLOATING(GPIOD_PIN0) | \
  773. PIN_PUPDR_FLOATING(GPIOD_PIN1) | \
  774. PIN_PUPDR_FLOATING(GPIOD_PIN2) | \
  775. PIN_PUPDR_FLOATING(GPIOD_PIN3) | \
  776. PIN_PUPDR_FLOATING(GPIOD_PIN4) | \
  777. PIN_PUPDR_FLOATING(GPIOD_PIN5) | \
  778. PIN_PUPDR_FLOATING(GPIOD_PIN6) | \
  779. PIN_PUPDR_FLOATING(GPIOD_PIN7) | \
  780. PIN_PUPDR_FLOATING(GPIOD_PIN8) | \
  781. PIN_PUPDR_FLOATING(GPIOD_PIN9) | \
  782. PIN_PUPDR_FLOATING(GPIOD_PIN10) | \
  783. PIN_PUPDR_FLOATING(GPIOD_PIN11) | \
  784. PIN_PUPDR_FLOATING(GPIOD_PIN12) | \
  785. PIN_PUPDR_FLOATING(GPIOD_PIN13) | \
  786. PIN_PUPDR_FLOATING(GPIOD_PIN14) | \
  787. PIN_PUPDR_FLOATING(GPIOD_PIN15))
  788. #define VAL_GPIOD_ODR (PIN_ODR_LOW(GPIOD_PIN0) | \
  789. PIN_ODR_LOW(GPIOD_PIN1) | \
  790. PIN_ODR_LOW(GPIOD_PIN2) | \
  791. PIN_ODR_LOW(GPIOD_PIN3) | \
  792. PIN_ODR_LOW(GPIOD_PIN4) | \
  793. PIN_ODR_LOW(GPIOD_PIN5) | \
  794. PIN_ODR_LOW(GPIOD_PIN6) | \
  795. PIN_ODR_LOW(GPIOD_PIN7) | \
  796. PIN_ODR_LOW(GPIOD_PIN8) | \
  797. PIN_ODR_LOW(GPIOD_PIN9) | \
  798. PIN_ODR_LOW(GPIOD_PIN10) | \
  799. PIN_ODR_LOW(GPIOD_PIN11) | \
  800. PIN_ODR_LOW(GPIOD_PIN12) | \
  801. PIN_ODR_LOW(GPIOD_PIN13) | \
  802. PIN_ODR_LOW(GPIOD_PIN14) | \
  803. PIN_ODR_LOW(GPIOD_PIN15))
  804. #define VAL_GPIOD_AFRL (PIN_AFIO_AF(GPIOD_PIN0, 0U) | \
  805. PIN_AFIO_AF(GPIOD_PIN1, 0U) | \
  806. PIN_AFIO_AF(GPIOD_PIN2, 0U) | \
  807. PIN_AFIO_AF(GPIOD_PIN3, 0U) | \
  808. PIN_AFIO_AF(GPIOD_PIN4, 0U) | \
  809. PIN_AFIO_AF(GPIOD_PIN5, 0U) | \
  810. PIN_AFIO_AF(GPIOD_PIN6, 0U) | \
  811. PIN_AFIO_AF(GPIOD_PIN7, 0U))
  812. #define VAL_GPIOD_AFRH (PIN_AFIO_AF(GPIOD_PIN8, 0U) | \
  813. PIN_AFIO_AF(GPIOD_PIN9, 0U) | \
  814. PIN_AFIO_AF(GPIOD_PIN10, 0U) | \
  815. PIN_AFIO_AF(GPIOD_PIN11, 0U) | \
  816. PIN_AFIO_AF(GPIOD_PIN12, 0U) | \
  817. PIN_AFIO_AF(GPIOD_PIN13, 0U) | \
  818. PIN_AFIO_AF(GPIOD_PIN14, 0U) | \
  819. PIN_AFIO_AF(GPIOD_PIN15, 0U))
  820. #define VAL_GPIOD_ASCR (PIN_ASCR_DISABLED(GPIOD_PIN0) | \
  821. PIN_ASCR_DISABLED(GPIOD_PIN1) | \
  822. PIN_ASCR_DISABLED(GPIOD_PIN2) | \
  823. PIN_ASCR_DISABLED(GPIOD_PIN3) | \
  824. PIN_ASCR_DISABLED(GPIOD_PIN4) | \
  825. PIN_ASCR_DISABLED(GPIOD_PIN5) | \
  826. PIN_ASCR_DISABLED(GPIOD_PIN6) | \
  827. PIN_ASCR_DISABLED(GPIOD_PIN7) | \
  828. PIN_ASCR_DISABLED(GPIOD_PIN8) | \
  829. PIN_ASCR_DISABLED(GPIOD_PIN9) | \
  830. PIN_ASCR_DISABLED(GPIOD_PIN10) | \
  831. PIN_ASCR_DISABLED(GPIOD_PIN11) | \
  832. PIN_ASCR_DISABLED(GPIOD_PIN12) | \
  833. PIN_ASCR_DISABLED(GPIOD_PIN13) | \
  834. PIN_ASCR_DISABLED(GPIOD_PIN14) | \
  835. PIN_ASCR_DISABLED(GPIOD_PIN15))
  836. #define VAL_GPIOD_LOCKR (PIN_LOCKR_DISABLED(GPIOD_PIN0) | \
  837. PIN_LOCKR_DISABLED(GPIOD_PIN1) | \
  838. PIN_LOCKR_DISABLED(GPIOD_PIN2) | \
  839. PIN_LOCKR_DISABLED(GPIOD_PIN3) | \
  840. PIN_LOCKR_DISABLED(GPIOD_PIN4) | \
  841. PIN_LOCKR_DISABLED(GPIOD_PIN5) | \
  842. PIN_LOCKR_DISABLED(GPIOD_PIN6) | \
  843. PIN_LOCKR_DISABLED(GPIOD_PIN7) | \
  844. PIN_LOCKR_DISABLED(GPIOD_PIN8) | \
  845. PIN_LOCKR_DISABLED(GPIOD_PIN9) | \
  846. PIN_LOCKR_DISABLED(GPIOD_PIN10) | \
  847. PIN_LOCKR_DISABLED(GPIOD_PIN11) | \
  848. PIN_LOCKR_DISABLED(GPIOD_PIN12) | \
  849. PIN_LOCKR_DISABLED(GPIOD_PIN13) | \
  850. PIN_LOCKR_DISABLED(GPIOD_PIN14) | \
  851. PIN_LOCKR_DISABLED(GPIOD_PIN15))
  852. /*
  853. * GPIOE setup:
  854. *
  855. * PE0 - PIN0 (analog).
  856. * PE1 - PIN1 (analog).
  857. * PE2 - PIN2 (analog).
  858. * PE3 - PIN3 (analog).
  859. * PE4 - PIN4 (analog).
  860. * PE5 - PIN5 (analog).
  861. * PE6 - PIN6 (analog).
  862. * PE7 - PIN7 (analog).
  863. * PE8 - PIN8 (analog).
  864. * PE9 - PIN9 (analog).
  865. * PE10 - PIN10 (analog).
  866. * PE11 - PIN11 (analog).
  867. * PE12 - PIN12 (analog).
  868. * PE13 - PIN13 (analog).
  869. * PE14 - PIN14 (analog).
  870. * PE15 - PIN15 (analog).
  871. */
  872. #define VAL_GPIOE_MODER (PIN_MODE_ANALOG(GPIOE_PIN0) | \
  873. PIN_MODE_ANALOG(GPIOE_PIN1) | \
  874. PIN_MODE_ANALOG(GPIOE_PIN2) | \
  875. PIN_MODE_ANALOG(GPIOE_PIN3) | \
  876. PIN_MODE_ANALOG(GPIOE_PIN4) | \
  877. PIN_MODE_ANALOG(GPIOE_PIN5) | \
  878. PIN_MODE_ANALOG(GPIOE_PIN6) | \
  879. PIN_MODE_ANALOG(GPIOE_PIN7) | \
  880. PIN_MODE_ANALOG(GPIOE_PIN8) | \
  881. PIN_MODE_ANALOG(GPIOE_PIN9) | \
  882. PIN_MODE_ANALOG(GPIOE_PIN10) | \
  883. PIN_MODE_ANALOG(GPIOE_PIN11) | \
  884. PIN_MODE_ANALOG(GPIOE_PIN12) | \
  885. PIN_MODE_ANALOG(GPIOE_PIN13) | \
  886. PIN_MODE_ANALOG(GPIOE_PIN14) | \
  887. PIN_MODE_ANALOG(GPIOE_PIN15))
  888. #define VAL_GPIOE_OTYPER (PIN_OTYPE_PUSHPULL(GPIOE_PIN0) | \
  889. PIN_OTYPE_PUSHPULL(GPIOE_PIN1) | \
  890. PIN_OTYPE_PUSHPULL(GPIOE_PIN2) | \
  891. PIN_OTYPE_PUSHPULL(GPIOE_PIN3) | \
  892. PIN_OTYPE_PUSHPULL(GPIOE_PIN4) | \
  893. PIN_OTYPE_PUSHPULL(GPIOE_PIN5) | \
  894. PIN_OTYPE_PUSHPULL(GPIOE_PIN6) | \
  895. PIN_OTYPE_PUSHPULL(GPIOE_PIN7) | \
  896. PIN_OTYPE_PUSHPULL(GPIOE_PIN8) | \
  897. PIN_OTYPE_PUSHPULL(GPIOE_PIN9) | \
  898. PIN_OTYPE_PUSHPULL(GPIOE_PIN10) | \
  899. PIN_OTYPE_PUSHPULL(GPIOE_PIN11) | \
  900. PIN_OTYPE_PUSHPULL(GPIOE_PIN12) | \
  901. PIN_OTYPE_PUSHPULL(GPIOE_PIN13) | \
  902. PIN_OTYPE_PUSHPULL(GPIOE_PIN14) | \
  903. PIN_OTYPE_PUSHPULL(GPIOE_PIN15))
  904. #define VAL_GPIOE_OSPEEDR (PIN_OSPEED_VERYLOW(GPIOE_PIN0) | \
  905. PIN_OSPEED_VERYLOW(GPIOE_PIN1) | \
  906. PIN_OSPEED_VERYLOW(GPIOE_PIN2) | \
  907. PIN_OSPEED_VERYLOW(GPIOE_PIN3) | \
  908. PIN_OSPEED_VERYLOW(GPIOE_PIN4) | \
  909. PIN_OSPEED_VERYLOW(GPIOE_PIN5) | \
  910. PIN_OSPEED_VERYLOW(GPIOE_PIN6) | \
  911. PIN_OSPEED_VERYLOW(GPIOE_PIN7) | \
  912. PIN_OSPEED_VERYLOW(GPIOE_PIN8) | \
  913. PIN_OSPEED_VERYLOW(GPIOE_PIN9) | \
  914. PIN_OSPEED_VERYLOW(GPIOE_PIN10) | \
  915. PIN_OSPEED_VERYLOW(GPIOE_PIN11) | \
  916. PIN_OSPEED_VERYLOW(GPIOE_PIN12) | \
  917. PIN_OSPEED_VERYLOW(GPIOE_PIN13) | \
  918. PIN_OSPEED_VERYLOW(GPIOE_PIN14) | \
  919. PIN_OSPEED_VERYLOW(GPIOE_PIN15))
  920. #define VAL_GPIOE_PUPDR (PIN_PUPDR_FLOATING(GPIOE_PIN0) | \
  921. PIN_PUPDR_FLOATING(GPIOE_PIN1) | \
  922. PIN_PUPDR_FLOATING(GPIOE_PIN2) | \
  923. PIN_PUPDR_FLOATING(GPIOE_PIN3) | \
  924. PIN_PUPDR_FLOATING(GPIOE_PIN4) | \
  925. PIN_PUPDR_FLOATING(GPIOE_PIN5) | \
  926. PIN_PUPDR_FLOATING(GPIOE_PIN6) | \
  927. PIN_PUPDR_FLOATING(GPIOE_PIN7) | \
  928. PIN_PUPDR_FLOATING(GPIOE_PIN8) | \
  929. PIN_PUPDR_FLOATING(GPIOE_PIN9) | \
  930. PIN_PUPDR_FLOATING(GPIOE_PIN10) | \
  931. PIN_PUPDR_FLOATING(GPIOE_PIN11) | \
  932. PIN_PUPDR_FLOATING(GPIOE_PIN12) | \
  933. PIN_PUPDR_FLOATING(GPIOE_PIN13) | \
  934. PIN_PUPDR_FLOATING(GPIOE_PIN14) | \
  935. PIN_PUPDR_FLOATING(GPIOE_PIN15))
  936. #define VAL_GPIOE_ODR (PIN_ODR_LOW(GPIOE_PIN0) | \
  937. PIN_ODR_LOW(GPIOE_PIN1) | \
  938. PIN_ODR_LOW(GPIOE_PIN2) | \
  939. PIN_ODR_LOW(GPIOE_PIN3) | \
  940. PIN_ODR_LOW(GPIOE_PIN4) | \
  941. PIN_ODR_LOW(GPIOE_PIN5) | \
  942. PIN_ODR_LOW(GPIOE_PIN6) | \
  943. PIN_ODR_LOW(GPIOE_PIN7) | \
  944. PIN_ODR_LOW(GPIOE_PIN8) | \
  945. PIN_ODR_LOW(GPIOE_PIN9) | \
  946. PIN_ODR_LOW(GPIOE_PIN10) | \
  947. PIN_ODR_LOW(GPIOE_PIN11) | \
  948. PIN_ODR_LOW(GPIOE_PIN12) | \
  949. PIN_ODR_LOW(GPIOE_PIN13) | \
  950. PIN_ODR_LOW(GPIOE_PIN14) | \
  951. PIN_ODR_LOW(GPIOE_PIN15))
  952. #define VAL_GPIOE_AFRL (PIN_AFIO_AF(GPIOE_PIN0, 0U) | \
  953. PIN_AFIO_AF(GPIOE_PIN1, 0U) | \
  954. PIN_AFIO_AF(GPIOE_PIN2, 0U) | \
  955. PIN_AFIO_AF(GPIOE_PIN3, 0U) | \
  956. PIN_AFIO_AF(GPIOE_PIN4, 0U) | \
  957. PIN_AFIO_AF(GPIOE_PIN5, 0U) | \
  958. PIN_AFIO_AF(GPIOE_PIN6, 0U) | \
  959. PIN_AFIO_AF(GPIOE_PIN7, 0U))
  960. #define VAL_GPIOE_AFRH (PIN_AFIO_AF(GPIOE_PIN8, 0U) | \
  961. PIN_AFIO_AF(GPIOE_PIN9, 0U) | \
  962. PIN_AFIO_AF(GPIOE_PIN10, 0U) | \
  963. PIN_AFIO_AF(GPIOE_PIN11, 0U) | \
  964. PIN_AFIO_AF(GPIOE_PIN12, 0U) | \
  965. PIN_AFIO_AF(GPIOE_PIN13, 0U) | \
  966. PIN_AFIO_AF(GPIOE_PIN14, 0U) | \
  967. PIN_AFIO_AF(GPIOE_PIN15, 0U))
  968. #define VAL_GPIOE_ASCR (PIN_ASCR_DISABLED(GPIOE_PIN0) | \
  969. PIN_ASCR_DISABLED(GPIOE_PIN1) | \
  970. PIN_ASCR_DISABLED(GPIOE_PIN2) | \
  971. PIN_ASCR_DISABLED(GPIOE_PIN3) | \
  972. PIN_ASCR_DISABLED(GPIOE_PIN4) | \
  973. PIN_ASCR_DISABLED(GPIOE_PIN5) | \
  974. PIN_ASCR_DISABLED(GPIOE_PIN6) | \
  975. PIN_ASCR_DISABLED(GPIOE_PIN7) | \
  976. PIN_ASCR_DISABLED(GPIOE_PIN8) | \
  977. PIN_ASCR_DISABLED(GPIOE_PIN9) | \
  978. PIN_ASCR_DISABLED(GPIOE_PIN10) | \
  979. PIN_ASCR_DISABLED(GPIOE_PIN11) | \
  980. PIN_ASCR_DISABLED(GPIOE_PIN12) | \
  981. PIN_ASCR_DISABLED(GPIOE_PIN13) | \
  982. PIN_ASCR_DISABLED(GPIOE_PIN14) | \
  983. PIN_ASCR_DISABLED(GPIOE_PIN15))
  984. #define VAL_GPIOE_LOCKR (PIN_LOCKR_DISABLED(GPIOE_PIN0) | \
  985. PIN_LOCKR_DISABLED(GPIOE_PIN1) | \
  986. PIN_LOCKR_DISABLED(GPIOE_PIN2) | \
  987. PIN_LOCKR_DISABLED(GPIOE_PIN3) | \
  988. PIN_LOCKR_DISABLED(GPIOE_PIN4) | \
  989. PIN_LOCKR_DISABLED(GPIOE_PIN5) | \
  990. PIN_LOCKR_DISABLED(GPIOE_PIN6) | \
  991. PIN_LOCKR_DISABLED(GPIOE_PIN7) | \
  992. PIN_LOCKR_DISABLED(GPIOE_PIN8) | \
  993. PIN_LOCKR_DISABLED(GPIOE_PIN9) | \
  994. PIN_LOCKR_DISABLED(GPIOE_PIN10) | \
  995. PIN_LOCKR_DISABLED(GPIOE_PIN11) | \
  996. PIN_LOCKR_DISABLED(GPIOE_PIN12) | \
  997. PIN_LOCKR_DISABLED(GPIOE_PIN13) | \
  998. PIN_LOCKR_DISABLED(GPIOE_PIN14) | \
  999. PIN_LOCKR_DISABLED(GPIOE_PIN15))
  1000. /*
  1001. * GPIOF setup:
  1002. *
  1003. * PF0 - PIN0 (analog).
  1004. * PF1 - PIN1 (analog).
  1005. * PF2 - PIN2 (analog).
  1006. * PF3 - PIN3 (analog).
  1007. * PF4 - PIN4 (analog).
  1008. * PF5 - PIN5 (analog).
  1009. * PF6 - PIN6 (analog).
  1010. * PF7 - PIN7 (analog).
  1011. * PF8 - PIN8 (analog).
  1012. * PF9 - PIN9 (analog).
  1013. * PF10 - PIN10 (analog).
  1014. * PF11 - PIN11 (analog).
  1015. * PF12 - PIN12 (analog).
  1016. * PF13 - PIN13 (analog).
  1017. * PF14 - PIN14 (analog).
  1018. * PF15 - PIN15 (analog).
  1019. */
  1020. #define VAL_GPIOF_MODER (PIN_MODE_ANALOG(GPIOF_PIN0) | \
  1021. PIN_MODE_ANALOG(GPIOF_PIN1) | \
  1022. PIN_MODE_ANALOG(GPIOF_PIN2) | \
  1023. PIN_MODE_ANALOG(GPIOF_PIN3) | \
  1024. PIN_MODE_ANALOG(GPIOF_PIN4) | \
  1025. PIN_MODE_ANALOG(GPIOF_PIN5) | \
  1026. PIN_MODE_ANALOG(GPIOF_PIN6) | \
  1027. PIN_MODE_ANALOG(GPIOF_PIN7) | \
  1028. PIN_MODE_ANALOG(GPIOF_PIN8) | \
  1029. PIN_MODE_ANALOG(GPIOF_PIN9) | \
  1030. PIN_MODE_ANALOG(GPIOF_PIN10) | \
  1031. PIN_MODE_ANALOG(GPIOF_PIN11) | \
  1032. PIN_MODE_ANALOG(GPIOF_PIN12) | \
  1033. PIN_MODE_ANALOG(GPIOF_PIN13) | \
  1034. PIN_MODE_ANALOG(GPIOF_PIN14) | \
  1035. PIN_MODE_ANALOG(GPIOF_PIN15))
  1036. #define VAL_GPIOF_OTYPER (PIN_OTYPE_PUSHPULL(GPIOF_PIN0) | \
  1037. PIN_OTYPE_PUSHPULL(GPIOF_PIN1) | \
  1038. PIN_OTYPE_PUSHPULL(GPIOF_PIN2) | \
  1039. PIN_OTYPE_PUSHPULL(GPIOF_PIN3) | \
  1040. PIN_OTYPE_PUSHPULL(GPIOF_PIN4) | \
  1041. PIN_OTYPE_PUSHPULL(GPIOF_PIN5) | \
  1042. PIN_OTYPE_PUSHPULL(GPIOF_PIN6) | \
  1043. PIN_OTYPE_PUSHPULL(GPIOF_PIN7) | \
  1044. PIN_OTYPE_PUSHPULL(GPIOF_PIN8) | \
  1045. PIN_OTYPE_PUSHPULL(GPIOF_PIN9) | \
  1046. PIN_OTYPE_PUSHPULL(GPIOF_PIN10) | \
  1047. PIN_OTYPE_PUSHPULL(GPIOF_PIN11) | \
  1048. PIN_OTYPE_PUSHPULL(GPIOF_PIN12) | \
  1049. PIN_OTYPE_PUSHPULL(GPIOF_PIN13) | \
  1050. PIN_OTYPE_PUSHPULL(GPIOF_PIN14) | \
  1051. PIN_OTYPE_PUSHPULL(GPIOF_PIN15))
  1052. #define VAL_GPIOF_OSPEEDR (PIN_OSPEED_VERYLOW(GPIOF_PIN0) | \
  1053. PIN_OSPEED_VERYLOW(GPIOF_PIN1) | \
  1054. PIN_OSPEED_VERYLOW(GPIOF_PIN2) | \
  1055. PIN_OSPEED_VERYLOW(GPIOF_PIN3) | \
  1056. PIN_OSPEED_VERYLOW(GPIOF_PIN4) | \
  1057. PIN_OSPEED_VERYLOW(GPIOF_PIN5) | \
  1058. PIN_OSPEED_VERYLOW(GPIOF_PIN6) | \
  1059. PIN_OSPEED_VERYLOW(GPIOF_PIN7) | \
  1060. PIN_OSPEED_VERYLOW(GPIOF_PIN8) | \
  1061. PIN_OSPEED_VERYLOW(GPIOF_PIN9) | \
  1062. PIN_OSPEED_VERYLOW(GPIOF_PIN10) | \
  1063. PIN_OSPEED_VERYLOW(GPIOF_PIN11) | \
  1064. PIN_OSPEED_VERYLOW(GPIOF_PIN12) | \
  1065. PIN_OSPEED_VERYLOW(GPIOF_PIN13) | \
  1066. PIN_OSPEED_VERYLOW(GPIOF_PIN14) | \
  1067. PIN_OSPEED_VERYLOW(GPIOF_PIN15))
  1068. #define VAL_GPIOF_PUPDR (PIN_PUPDR_FLOATING(GPIOF_PIN0) | \
  1069. PIN_PUPDR_FLOATING(GPIOF_PIN1) | \
  1070. PIN_PUPDR_FLOATING(GPIOF_PIN2) | \
  1071. PIN_PUPDR_FLOATING(GPIOF_PIN3) | \
  1072. PIN_PUPDR_FLOATING(GPIOF_PIN4) | \
  1073. PIN_PUPDR_FLOATING(GPIOF_PIN5) | \
  1074. PIN_PUPDR_FLOATING(GPIOF_PIN6) | \
  1075. PIN_PUPDR_FLOATING(GPIOF_PIN7) | \
  1076. PIN_PUPDR_FLOATING(GPIOF_PIN8) | \
  1077. PIN_PUPDR_FLOATING(GPIOF_PIN9) | \
  1078. PIN_PUPDR_FLOATING(GPIOF_PIN10) | \
  1079. PIN_PUPDR_FLOATING(GPIOF_PIN11) | \
  1080. PIN_PUPDR_FLOATING(GPIOF_PIN12) | \
  1081. PIN_PUPDR_FLOATING(GPIOF_PIN13) | \
  1082. PIN_PUPDR_FLOATING(GPIOF_PIN14) | \
  1083. PIN_PUPDR_FLOATING(GPIOF_PIN15))
  1084. #define VAL_GPIOF_ODR (PIN_ODR_LOW(GPIOF_PIN0) | \
  1085. PIN_ODR_LOW(GPIOF_PIN1) | \
  1086. PIN_ODR_LOW(GPIOF_PIN2) | \
  1087. PIN_ODR_LOW(GPIOF_PIN3) | \
  1088. PIN_ODR_LOW(GPIOF_PIN4) | \
  1089. PIN_ODR_LOW(GPIOF_PIN5) | \
  1090. PIN_ODR_LOW(GPIOF_PIN6) | \
  1091. PIN_ODR_LOW(GPIOF_PIN7) | \
  1092. PIN_ODR_LOW(GPIOF_PIN8) | \
  1093. PIN_ODR_LOW(GPIOF_PIN9) | \
  1094. PIN_ODR_LOW(GPIOF_PIN10) | \
  1095. PIN_ODR_LOW(GPIOF_PIN11) | \
  1096. PIN_ODR_LOW(GPIOF_PIN12) | \
  1097. PIN_ODR_LOW(GPIOF_PIN13) | \
  1098. PIN_ODR_LOW(GPIOF_PIN14) | \
  1099. PIN_ODR_LOW(GPIOF_PIN15))
  1100. #define VAL_GPIOF_AFRL (PIN_AFIO_AF(GPIOF_PIN0, 0U) | \
  1101. PIN_AFIO_AF(GPIOF_PIN1, 0U) | \
  1102. PIN_AFIO_AF(GPIOF_PIN2, 0U) | \
  1103. PIN_AFIO_AF(GPIOF_PIN3, 0U) | \
  1104. PIN_AFIO_AF(GPIOF_PIN4, 0U) | \
  1105. PIN_AFIO_AF(GPIOF_PIN5, 0U) | \
  1106. PIN_AFIO_AF(GPIOF_PIN6, 0U) | \
  1107. PIN_AFIO_AF(GPIOF_PIN7, 0U))
  1108. #define VAL_GPIOF_AFRH (PIN_AFIO_AF(GPIOF_PIN8, 0U) | \
  1109. PIN_AFIO_AF(GPIOF_PIN9, 0U) | \
  1110. PIN_AFIO_AF(GPIOF_PIN10, 0U) | \
  1111. PIN_AFIO_AF(GPIOF_PIN11, 0U) | \
  1112. PIN_AFIO_AF(GPIOF_PIN12, 0U) | \
  1113. PIN_AFIO_AF(GPIOF_PIN13, 0U) | \
  1114. PIN_AFIO_AF(GPIOF_PIN14, 0U) | \
  1115. PIN_AFIO_AF(GPIOF_PIN15, 0U))
  1116. #define VAL_GPIOF_ASCR (PIN_ASCR_DISABLED(GPIOF_PIN0) | \
  1117. PIN_ASCR_DISABLED(GPIOF_PIN1) | \
  1118. PIN_ASCR_DISABLED(GPIOF_PIN2) | \
  1119. PIN_ASCR_DISABLED(GPIOF_PIN3) | \
  1120. PIN_ASCR_DISABLED(GPIOF_PIN4) | \
  1121. PIN_ASCR_DISABLED(GPIOF_PIN5) | \
  1122. PIN_ASCR_DISABLED(GPIOF_PIN6) | \
  1123. PIN_ASCR_DISABLED(GPIOF_PIN7) | \
  1124. PIN_ASCR_DISABLED(GPIOF_PIN8) | \
  1125. PIN_ASCR_DISABLED(GPIOF_PIN9) | \
  1126. PIN_ASCR_DISABLED(GPIOF_PIN10) | \
  1127. PIN_ASCR_DISABLED(GPIOF_PIN11) | \
  1128. PIN_ASCR_DISABLED(GPIOF_PIN12) | \
  1129. PIN_ASCR_DISABLED(GPIOF_PIN13) | \
  1130. PIN_ASCR_DISABLED(GPIOF_PIN14) | \
  1131. PIN_ASCR_DISABLED(GPIOF_PIN15))
  1132. #define VAL_GPIOF_LOCKR (PIN_LOCKR_DISABLED(GPIOF_PIN0) | \
  1133. PIN_LOCKR_DISABLED(GPIOF_PIN1) | \
  1134. PIN_LOCKR_DISABLED(GPIOF_PIN2) | \
  1135. PIN_LOCKR_DISABLED(GPIOF_PIN3) | \
  1136. PIN_LOCKR_DISABLED(GPIOF_PIN4) | \
  1137. PIN_LOCKR_DISABLED(GPIOF_PIN5) | \
  1138. PIN_LOCKR_DISABLED(GPIOF_PIN6) | \
  1139. PIN_LOCKR_DISABLED(GPIOF_PIN7) | \
  1140. PIN_LOCKR_DISABLED(GPIOF_PIN8) | \
  1141. PIN_LOCKR_DISABLED(GPIOF_PIN9) | \
  1142. PIN_LOCKR_DISABLED(GPIOF_PIN10) | \
  1143. PIN_LOCKR_DISABLED(GPIOF_PIN11) | \
  1144. PIN_LOCKR_DISABLED(GPIOF_PIN12) | \
  1145. PIN_LOCKR_DISABLED(GPIOF_PIN13) | \
  1146. PIN_LOCKR_DISABLED(GPIOF_PIN14) | \
  1147. PIN_LOCKR_DISABLED(GPIOF_PIN15))
  1148. /*
  1149. * GPIOG setup:
  1150. *
  1151. * PG0 - PIN0 (analog).
  1152. * PG1 - PIN1 (analog).
  1153. * PG2 - PIN2 (analog).
  1154. * PG3 - PIN3 (analog).
  1155. * PG4 - PIN4 (analog).
  1156. * PG5 - USB_OVER_CURRENT (input floating).
  1157. * PG6 - USB_POWER_SWITCH_ON (output pushpull maximum).
  1158. * PG7 - LPUART1_TX (alternate 8).
  1159. * PG8 - LPUART1_RX (alternate 8).
  1160. * PG9 - PIN9 (analog).
  1161. * PG10 - PIN10 (analog).
  1162. * PG11 - PIN11 (analog).
  1163. * PG12 - PIN12 (analog).
  1164. * PG13 - PIN13 (analog).
  1165. * PG14 - PIN14 (analog).
  1166. * PG15 - PIN15 (analog).
  1167. */
  1168. #define VAL_GPIOG_MODER (PIN_MODE_ANALOG(GPIOG_PIN0) | \
  1169. PIN_MODE_ANALOG(GPIOG_PIN1) | \
  1170. PIN_MODE_ANALOG(GPIOG_PIN2) | \
  1171. PIN_MODE_ANALOG(GPIOG_PIN3) | \
  1172. PIN_MODE_ANALOG(GPIOG_PIN4) | \
  1173. PIN_MODE_INPUT(GPIOG_USB_OVER_CURRENT) |\
  1174. PIN_MODE_OUTPUT(GPIOG_USB_POWER_SWITCH_ON) |\
  1175. PIN_MODE_ALTERNATE(GPIOG_LPUART1_TX) | \
  1176. PIN_MODE_ALTERNATE(GPIOG_LPUART1_RX) | \
  1177. PIN_MODE_ANALOG(GPIOG_PIN9) | \
  1178. PIN_MODE_ANALOG(GPIOG_PIN10) | \
  1179. PIN_MODE_ANALOG(GPIOG_PIN11) | \
  1180. PIN_MODE_ANALOG(GPIOG_PIN12) | \
  1181. PIN_MODE_ANALOG(GPIOG_PIN13) | \
  1182. PIN_MODE_ANALOG(GPIOG_PIN14) | \
  1183. PIN_MODE_ANALOG(GPIOG_PIN15))
  1184. #define VAL_GPIOG_OTYPER (PIN_OTYPE_PUSHPULL(GPIOG_PIN0) | \
  1185. PIN_OTYPE_PUSHPULL(GPIOG_PIN1) | \
  1186. PIN_OTYPE_PUSHPULL(GPIOG_PIN2) | \
  1187. PIN_OTYPE_PUSHPULL(GPIOG_PIN3) | \
  1188. PIN_OTYPE_PUSHPULL(GPIOG_PIN4) | \
  1189. PIN_OTYPE_PUSHPULL(GPIOG_USB_OVER_CURRENT) |\
  1190. PIN_OTYPE_PUSHPULL(GPIOG_USB_POWER_SWITCH_ON) |\
  1191. PIN_OTYPE_PUSHPULL(GPIOG_LPUART1_TX) | \
  1192. PIN_OTYPE_PUSHPULL(GPIOG_LPUART1_RX) | \
  1193. PIN_OTYPE_PUSHPULL(GPIOG_PIN9) | \
  1194. PIN_OTYPE_PUSHPULL(GPIOG_PIN10) | \
  1195. PIN_OTYPE_PUSHPULL(GPIOG_PIN11) | \
  1196. PIN_OTYPE_PUSHPULL(GPIOG_PIN12) | \
  1197. PIN_OTYPE_PUSHPULL(GPIOG_PIN13) | \
  1198. PIN_OTYPE_PUSHPULL(GPIOG_PIN14) | \
  1199. PIN_OTYPE_PUSHPULL(GPIOG_PIN15))
  1200. #define VAL_GPIOG_OSPEEDR (PIN_OSPEED_VERYLOW(GPIOG_PIN0) | \
  1201. PIN_OSPEED_VERYLOW(GPIOG_PIN1) | \
  1202. PIN_OSPEED_VERYLOW(GPIOG_PIN2) | \
  1203. PIN_OSPEED_VERYLOW(GPIOG_PIN3) | \
  1204. PIN_OSPEED_VERYLOW(GPIOG_PIN4) | \
  1205. PIN_OSPEED_VERYLOW(GPIOG_USB_OVER_CURRENT) |\
  1206. PIN_OSPEED_HIGH(GPIOG_USB_POWER_SWITCH_ON) |\
  1207. PIN_OSPEED_VERYLOW(GPIOG_LPUART1_TX) | \
  1208. PIN_OSPEED_VERYLOW(GPIOG_LPUART1_RX) | \
  1209. PIN_OSPEED_VERYLOW(GPIOG_PIN9) | \
  1210. PIN_OSPEED_VERYLOW(GPIOG_PIN10) | \
  1211. PIN_OSPEED_VERYLOW(GPIOG_PIN11) | \
  1212. PIN_OSPEED_VERYLOW(GPIOG_PIN12) | \
  1213. PIN_OSPEED_VERYLOW(GPIOG_PIN13) | \
  1214. PIN_OSPEED_VERYLOW(GPIOG_PIN14) | \
  1215. PIN_OSPEED_VERYLOW(GPIOG_PIN15))
  1216. #define VAL_GPIOG_PUPDR (PIN_PUPDR_FLOATING(GPIOG_PIN0) | \
  1217. PIN_PUPDR_FLOATING(GPIOG_PIN1) | \
  1218. PIN_PUPDR_FLOATING(GPIOG_PIN2) | \
  1219. PIN_PUPDR_FLOATING(GPIOG_PIN3) | \
  1220. PIN_PUPDR_FLOATING(GPIOG_PIN4) | \
  1221. PIN_PUPDR_FLOATING(GPIOG_USB_OVER_CURRENT) |\
  1222. PIN_PUPDR_FLOATING(GPIOG_USB_POWER_SWITCH_ON) |\
  1223. PIN_PUPDR_FLOATING(GPIOG_LPUART1_TX) | \
  1224. PIN_PUPDR_FLOATING(GPIOG_LPUART1_RX) | \
  1225. PIN_PUPDR_FLOATING(GPIOG_PIN9) | \
  1226. PIN_PUPDR_FLOATING(GPIOG_PIN10) | \
  1227. PIN_PUPDR_FLOATING(GPIOG_PIN11) | \
  1228. PIN_PUPDR_FLOATING(GPIOG_PIN12) | \
  1229. PIN_PUPDR_FLOATING(GPIOG_PIN13) | \
  1230. PIN_PUPDR_FLOATING(GPIOG_PIN14) | \
  1231. PIN_PUPDR_FLOATING(GPIOG_PIN15))
  1232. #define VAL_GPIOG_ODR (PIN_ODR_LOW(GPIOG_PIN0) | \
  1233. PIN_ODR_LOW(GPIOG_PIN1) | \
  1234. PIN_ODR_LOW(GPIOG_PIN2) | \
  1235. PIN_ODR_LOW(GPIOG_PIN3) | \
  1236. PIN_ODR_LOW(GPIOG_PIN4) | \
  1237. PIN_ODR_LOW(GPIOG_USB_OVER_CURRENT) | \
  1238. PIN_ODR_LOW(GPIOG_USB_POWER_SWITCH_ON) |\
  1239. PIN_ODR_LOW(GPIOG_LPUART1_TX) | \
  1240. PIN_ODR_LOW(GPIOG_LPUART1_RX) | \
  1241. PIN_ODR_LOW(GPIOG_PIN9) | \
  1242. PIN_ODR_LOW(GPIOG_PIN10) | \
  1243. PIN_ODR_LOW(GPIOG_PIN11) | \
  1244. PIN_ODR_LOW(GPIOG_PIN12) | \
  1245. PIN_ODR_LOW(GPIOG_PIN13) | \
  1246. PIN_ODR_LOW(GPIOG_PIN14) | \
  1247. PIN_ODR_LOW(GPIOG_PIN15))
  1248. #define VAL_GPIOG_AFRL (PIN_AFIO_AF(GPIOG_PIN0, 0U) | \
  1249. PIN_AFIO_AF(GPIOG_PIN1, 0U) | \
  1250. PIN_AFIO_AF(GPIOG_PIN2, 0U) | \
  1251. PIN_AFIO_AF(GPIOG_PIN3, 0U) | \
  1252. PIN_AFIO_AF(GPIOG_PIN4, 0U) | \
  1253. PIN_AFIO_AF(GPIOG_USB_OVER_CURRENT, 0U) |\
  1254. PIN_AFIO_AF(GPIOG_USB_POWER_SWITCH_ON, 0U) |\
  1255. PIN_AFIO_AF(GPIOG_LPUART1_TX, 8U))
  1256. #define VAL_GPIOG_AFRH (PIN_AFIO_AF(GPIOG_LPUART1_RX, 8U) | \
  1257. PIN_AFIO_AF(GPIOG_PIN9, 0U) | \
  1258. PIN_AFIO_AF(GPIOG_PIN10, 0U) | \
  1259. PIN_AFIO_AF(GPIOG_PIN11, 0U) | \
  1260. PIN_AFIO_AF(GPIOG_PIN12, 0U) | \
  1261. PIN_AFIO_AF(GPIOG_PIN13, 0U) | \
  1262. PIN_AFIO_AF(GPIOG_PIN14, 0U) | \
  1263. PIN_AFIO_AF(GPIOG_PIN15, 0U))
  1264. #define VAL_GPIOG_ASCR (PIN_ASCR_DISABLED(GPIOG_PIN0) | \
  1265. PIN_ASCR_DISABLED(GPIOG_PIN1) | \
  1266. PIN_ASCR_DISABLED(GPIOG_PIN2) | \
  1267. PIN_ASCR_DISABLED(GPIOG_PIN3) | \
  1268. PIN_ASCR_DISABLED(GPIOG_PIN4) | \
  1269. PIN_ASCR_DISABLED(GPIOG_USB_OVER_CURRENT) |\
  1270. PIN_ASCR_DISABLED(GPIOG_USB_POWER_SWITCH_ON) |\
  1271. PIN_ASCR_DISABLED(GPIOG_LPUART1_TX) | \
  1272. PIN_ASCR_DISABLED(GPIOG_LPUART1_RX) | \
  1273. PIN_ASCR_DISABLED(GPIOG_PIN9) | \
  1274. PIN_ASCR_DISABLED(GPIOG_PIN10) | \
  1275. PIN_ASCR_DISABLED(GPIOG_PIN11) | \
  1276. PIN_ASCR_DISABLED(GPIOG_PIN12) | \
  1277. PIN_ASCR_DISABLED(GPIOG_PIN13) | \
  1278. PIN_ASCR_DISABLED(GPIOG_PIN14) | \
  1279. PIN_ASCR_DISABLED(GPIOG_PIN15))
  1280. #define VAL_GPIOG_LOCKR (PIN_LOCKR_DISABLED(GPIOG_PIN0) | \
  1281. PIN_LOCKR_DISABLED(GPIOG_PIN1) | \
  1282. PIN_LOCKR_DISABLED(GPIOG_PIN2) | \
  1283. PIN_LOCKR_DISABLED(GPIOG_PIN3) | \
  1284. PIN_LOCKR_DISABLED(GPIOG_PIN4) | \
  1285. PIN_LOCKR_DISABLED(GPIOG_USB_OVER_CURRENT) |\
  1286. PIN_LOCKR_DISABLED(GPIOG_USB_POWER_SWITCH_ON) |\
  1287. PIN_LOCKR_DISABLED(GPIOG_LPUART1_TX) | \
  1288. PIN_LOCKR_DISABLED(GPIOG_LPUART1_RX) | \
  1289. PIN_LOCKR_DISABLED(GPIOG_PIN9) | \
  1290. PIN_LOCKR_DISABLED(GPIOG_PIN10) | \
  1291. PIN_LOCKR_DISABLED(GPIOG_PIN11) | \
  1292. PIN_LOCKR_DISABLED(GPIOG_PIN12) | \
  1293. PIN_LOCKR_DISABLED(GPIOG_PIN13) | \
  1294. PIN_LOCKR_DISABLED(GPIOG_PIN14) | \
  1295. PIN_LOCKR_DISABLED(GPIOG_PIN15))
  1296. /*
  1297. * GPIOH setup:
  1298. *
  1299. * PH0 - PIN0 (analog).
  1300. * PH1 - PIN1 (analog).
  1301. * PH2 - PIN2 (input floating).
  1302. * PH3 - PIN3 (input floating).
  1303. * PH4 - PIN4 (input floating).
  1304. * PH5 - PIN5 (input floating).
  1305. * PH6 - PIN6 (input floating).
  1306. * PH7 - PIN7 (input floating).
  1307. * PH8 - PIN8 (input floating).
  1308. * PH9 - PIN9 (input floating).
  1309. * PH10 - PIN10 (input floating).
  1310. * PH11 - PIN11 (input floating).
  1311. * PH12 - PIN12 (input floating).
  1312. * PH13 - PIN13 (input floating).
  1313. * PH14 - PIN14 (input floating).
  1314. * PH15 - PIN15 (input floating).
  1315. */
  1316. #define VAL_GPIOH_MODER (PIN_MODE_ANALOG(GPIOH_PIN0) | \
  1317. PIN_MODE_ANALOG(GPIOH_PIN1) | \
  1318. PIN_MODE_INPUT(GPIOH_PIN2) | \
  1319. PIN_MODE_INPUT(GPIOH_PIN3) | \
  1320. PIN_MODE_INPUT(GPIOH_PIN4) | \
  1321. PIN_MODE_INPUT(GPIOH_PIN5) | \
  1322. PIN_MODE_INPUT(GPIOH_PIN6) | \
  1323. PIN_MODE_INPUT(GPIOH_PIN7) | \
  1324. PIN_MODE_INPUT(GPIOH_PIN8) | \
  1325. PIN_MODE_INPUT(GPIOH_PIN9) | \
  1326. PIN_MODE_INPUT(GPIOH_PIN10) | \
  1327. PIN_MODE_INPUT(GPIOH_PIN11) | \
  1328. PIN_MODE_INPUT(GPIOH_PIN12) | \
  1329. PIN_MODE_INPUT(GPIOH_PIN13) | \
  1330. PIN_MODE_INPUT(GPIOH_PIN14) | \
  1331. PIN_MODE_INPUT(GPIOH_PIN15))
  1332. #define VAL_GPIOH_OTYPER (PIN_OTYPE_PUSHPULL(GPIOH_PIN0) | \
  1333. PIN_OTYPE_PUSHPULL(GPIOH_PIN1) | \
  1334. PIN_OTYPE_PUSHPULL(GPIOH_PIN2) | \
  1335. PIN_OTYPE_PUSHPULL(GPIOH_PIN3) | \
  1336. PIN_OTYPE_PUSHPULL(GPIOH_PIN4) | \
  1337. PIN_OTYPE_PUSHPULL(GPIOH_PIN5) | \
  1338. PIN_OTYPE_PUSHPULL(GPIOH_PIN6) | \
  1339. PIN_OTYPE_PUSHPULL(GPIOH_PIN7) | \
  1340. PIN_OTYPE_PUSHPULL(GPIOH_PIN8) | \
  1341. PIN_OTYPE_PUSHPULL(GPIOH_PIN9) | \
  1342. PIN_OTYPE_PUSHPULL(GPIOH_PIN10) | \
  1343. PIN_OTYPE_PUSHPULL(GPIOH_PIN11) | \
  1344. PIN_OTYPE_PUSHPULL(GPIOH_PIN12) | \
  1345. PIN_OTYPE_PUSHPULL(GPIOH_PIN13) | \
  1346. PIN_OTYPE_PUSHPULL(GPIOH_PIN14) | \
  1347. PIN_OTYPE_PUSHPULL(GPIOH_PIN15))
  1348. #define VAL_GPIOH_OSPEEDR (PIN_OSPEED_VERYLOW(GPIOH_PIN0) | \
  1349. PIN_OSPEED_VERYLOW(GPIOH_PIN1) | \
  1350. PIN_OSPEED_VERYLOW(GPIOH_PIN2) | \
  1351. PIN_OSPEED_VERYLOW(GPIOH_PIN3) | \
  1352. PIN_OSPEED_VERYLOW(GPIOH_PIN4) | \
  1353. PIN_OSPEED_VERYLOW(GPIOH_PIN5) | \
  1354. PIN_OSPEED_VERYLOW(GPIOH_PIN6) | \
  1355. PIN_OSPEED_VERYLOW(GPIOH_PIN7) | \
  1356. PIN_OSPEED_VERYLOW(GPIOH_PIN8) | \
  1357. PIN_OSPEED_VERYLOW(GPIOH_PIN9) | \
  1358. PIN_OSPEED_VERYLOW(GPIOH_PIN10) | \
  1359. PIN_OSPEED_VERYLOW(GPIOH_PIN11) | \
  1360. PIN_OSPEED_VERYLOW(GPIOH_PIN12) | \
  1361. PIN_OSPEED_VERYLOW(GPIOH_PIN13) | \
  1362. PIN_OSPEED_VERYLOW(GPIOH_PIN14) | \
  1363. PIN_OSPEED_VERYLOW(GPIOH_PIN15))
  1364. #define VAL_GPIOH_PUPDR (PIN_PUPDR_FLOATING(GPIOH_PIN0) | \
  1365. PIN_PUPDR_FLOATING(GPIOH_PIN1) | \
  1366. PIN_PUPDR_FLOATING(GPIOH_PIN2) | \
  1367. PIN_PUPDR_FLOATING(GPIOH_PIN3) | \
  1368. PIN_PUPDR_FLOATING(GPIOH_PIN4) | \
  1369. PIN_PUPDR_FLOATING(GPIOH_PIN5) | \
  1370. PIN_PUPDR_FLOATING(GPIOH_PIN6) | \
  1371. PIN_PUPDR_FLOATING(GPIOH_PIN7) | \
  1372. PIN_PUPDR_FLOATING(GPIOH_PIN8) | \
  1373. PIN_PUPDR_FLOATING(GPIOH_PIN9) | \
  1374. PIN_PUPDR_FLOATING(GPIOH_PIN10) | \
  1375. PIN_PUPDR_FLOATING(GPIOH_PIN11) | \
  1376. PIN_PUPDR_FLOATING(GPIOH_PIN12) | \
  1377. PIN_PUPDR_FLOATING(GPIOH_PIN13) | \
  1378. PIN_PUPDR_FLOATING(GPIOH_PIN14) | \
  1379. PIN_PUPDR_FLOATING(GPIOH_PIN15))
  1380. #define VAL_GPIOH_ODR (PIN_ODR_LOW(GPIOH_PIN0) | \
  1381. PIN_ODR_LOW(GPIOH_PIN1) | \
  1382. PIN_ODR_LOW(GPIOH_PIN2) | \
  1383. PIN_ODR_LOW(GPIOH_PIN3) | \
  1384. PIN_ODR_LOW(GPIOH_PIN4) | \
  1385. PIN_ODR_LOW(GPIOH_PIN5) | \
  1386. PIN_ODR_LOW(GPIOH_PIN6) | \
  1387. PIN_ODR_LOW(GPIOH_PIN7) | \
  1388. PIN_ODR_LOW(GPIOH_PIN8) | \
  1389. PIN_ODR_LOW(GPIOH_PIN9) | \
  1390. PIN_ODR_LOW(GPIOH_PIN10) | \
  1391. PIN_ODR_LOW(GPIOH_PIN11) | \
  1392. PIN_ODR_LOW(GPIOH_PIN12) | \
  1393. PIN_ODR_LOW(GPIOH_PIN13) | \
  1394. PIN_ODR_LOW(GPIOH_PIN14) | \
  1395. PIN_ODR_LOW(GPIOH_PIN15))
  1396. #define VAL_GPIOH_AFRL (PIN_AFIO_AF(GPIOH_PIN0, 0U) | \
  1397. PIN_AFIO_AF(GPIOH_PIN1, 0U) | \
  1398. PIN_AFIO_AF(GPIOH_PIN2, 0U) | \
  1399. PIN_AFIO_AF(GPIOH_PIN3, 0U) | \
  1400. PIN_AFIO_AF(GPIOH_PIN4, 0U) | \
  1401. PIN_AFIO_AF(GPIOH_PIN5, 0U) | \
  1402. PIN_AFIO_AF(GPIOH_PIN6, 0U) | \
  1403. PIN_AFIO_AF(GPIOH_PIN7, 0U))
  1404. #define VAL_GPIOH_AFRH (PIN_AFIO_AF(GPIOH_PIN8, 0U) | \
  1405. PIN_AFIO_AF(GPIOH_PIN9, 0U) | \
  1406. PIN_AFIO_AF(GPIOH_PIN10, 0U) | \
  1407. PIN_AFIO_AF(GPIOH_PIN11, 0U) | \
  1408. PIN_AFIO_AF(GPIOH_PIN12, 0U) | \
  1409. PIN_AFIO_AF(GPIOH_PIN13, 0U) | \
  1410. PIN_AFIO_AF(GPIOH_PIN14, 0U) | \
  1411. PIN_AFIO_AF(GPIOH_PIN15, 0U))
  1412. #define VAL_GPIOH_ASCR (PIN_ASCR_DISABLED(GPIOH_PIN0) | \
  1413. PIN_ASCR_DISABLED(GPIOH_PIN1) | \
  1414. PIN_ASCR_DISABLED(GPIOH_PIN2) | \
  1415. PIN_ASCR_DISABLED(GPIOH_PIN3) | \
  1416. PIN_ASCR_DISABLED(GPIOH_PIN4) | \
  1417. PIN_ASCR_DISABLED(GPIOH_PIN5) | \
  1418. PIN_ASCR_DISABLED(GPIOH_PIN6) | \
  1419. PIN_ASCR_DISABLED(GPIOH_PIN7) | \
  1420. PIN_ASCR_DISABLED(GPIOH_PIN8) | \
  1421. PIN_ASCR_DISABLED(GPIOH_PIN9) | \
  1422. PIN_ASCR_DISABLED(GPIOH_PIN10) | \
  1423. PIN_ASCR_DISABLED(GPIOH_PIN11) | \
  1424. PIN_ASCR_DISABLED(GPIOH_PIN12) | \
  1425. PIN_ASCR_DISABLED(GPIOH_PIN13) | \
  1426. PIN_ASCR_DISABLED(GPIOH_PIN14) | \
  1427. PIN_ASCR_DISABLED(GPIOH_PIN15))
  1428. #define VAL_GPIOH_LOCKR (PIN_LOCKR_DISABLED(GPIOH_PIN0) | \
  1429. PIN_LOCKR_DISABLED(GPIOH_PIN1) | \
  1430. PIN_LOCKR_DISABLED(GPIOH_PIN2) | \
  1431. PIN_LOCKR_DISABLED(GPIOH_PIN3) | \
  1432. PIN_LOCKR_DISABLED(GPIOH_PIN4) | \
  1433. PIN_LOCKR_DISABLED(GPIOH_PIN5) | \
  1434. PIN_LOCKR_DISABLED(GPIOH_PIN6) | \
  1435. PIN_LOCKR_DISABLED(GPIOH_PIN7) | \
  1436. PIN_LOCKR_DISABLED(GPIOH_PIN8) | \
  1437. PIN_LOCKR_DISABLED(GPIOH_PIN9) | \
  1438. PIN_LOCKR_DISABLED(GPIOH_PIN10) | \
  1439. PIN_LOCKR_DISABLED(GPIOH_PIN11) | \
  1440. PIN_LOCKR_DISABLED(GPIOH_PIN12) | \
  1441. PIN_LOCKR_DISABLED(GPIOH_PIN13) | \
  1442. PIN_LOCKR_DISABLED(GPIOH_PIN14) | \
  1443. PIN_LOCKR_DISABLED(GPIOH_PIN15))
  1444. /*
  1445. * GPIOI setup:
  1446. *
  1447. * PI0 - PIN0 (analog).
  1448. * PI1 - PIN1 (analog).
  1449. * PI2 - PIN2 (analog).
  1450. * PI3 - PIN3 (analog).
  1451. * PI4 - PIN4 (analog).
  1452. * PI5 - PIN5 (analog).
  1453. * PI6 - PIN6 (analog).
  1454. * PI7 - PIN7 (analog).
  1455. * PI8 - PIN8 (analog).
  1456. * PI9 - PIN9 (analog).
  1457. * PI10 - PIN10 (analog).
  1458. * PI11 - PIN11 (analog).
  1459. * PI12 - PIN12 (analog).
  1460. * PI13 - PIN13 (analog).
  1461. * PI14 - PIN14 (analog).
  1462. * PI15 - PIN15 (analog).
  1463. */
  1464. #define VAL_GPIOI_MODER (PIN_MODE_ANALOG(GPIOI_PIN0) | \
  1465. PIN_MODE_ANALOG(GPIOI_PIN1) | \
  1466. PIN_MODE_ANALOG(GPIOI_PIN2) | \
  1467. PIN_MODE_ANALOG(GPIOI_PIN3) | \
  1468. PIN_MODE_ANALOG(GPIOI_PIN4) | \
  1469. PIN_MODE_ANALOG(GPIOI_PIN5) | \
  1470. PIN_MODE_ANALOG(GPIOI_PIN6) | \
  1471. PIN_MODE_ANALOG(GPIOI_PIN7) | \
  1472. PIN_MODE_ANALOG(GPIOI_PIN8) | \
  1473. PIN_MODE_ANALOG(GPIOI_PIN9) | \
  1474. PIN_MODE_ANALOG(GPIOI_PIN10) | \
  1475. PIN_MODE_ANALOG(GPIOI_PIN11) | \
  1476. PIN_MODE_ANALOG(GPIOI_PIN12) | \
  1477. PIN_MODE_ANALOG(GPIOI_PIN13) | \
  1478. PIN_MODE_ANALOG(GPIOI_PIN14) | \
  1479. PIN_MODE_ANALOG(GPIOI_PIN15))
  1480. #define VAL_GPIOI_OTYPER (PIN_OTYPE_PUSHPULL(GPIOI_PIN0) | \
  1481. PIN_OTYPE_PUSHPULL(GPIOI_PIN1) | \
  1482. PIN_OTYPE_PUSHPULL(GPIOI_PIN2) | \
  1483. PIN_OTYPE_PUSHPULL(GPIOI_PIN3) | \
  1484. PIN_OTYPE_PUSHPULL(GPIOI_PIN4) | \
  1485. PIN_OTYPE_PUSHPULL(GPIOI_PIN5) | \
  1486. PIN_OTYPE_PUSHPULL(GPIOI_PIN6) | \
  1487. PIN_OTYPE_PUSHPULL(GPIOI_PIN7) | \
  1488. PIN_OTYPE_PUSHPULL(GPIOI_PIN8) | \
  1489. PIN_OTYPE_PUSHPULL(GPIOI_PIN9) | \
  1490. PIN_OTYPE_PUSHPULL(GPIOI_PIN10) | \
  1491. PIN_OTYPE_PUSHPULL(GPIOI_PIN11) | \
  1492. PIN_OTYPE_PUSHPULL(GPIOI_PIN12) | \
  1493. PIN_OTYPE_PUSHPULL(GPIOI_PIN13) | \
  1494. PIN_OTYPE_PUSHPULL(GPIOI_PIN14) | \
  1495. PIN_OTYPE_PUSHPULL(GPIOI_PIN15))
  1496. #define VAL_GPIOI_OSPEEDR (PIN_OSPEED_VERYLOW(GPIOI_PIN0) | \
  1497. PIN_OSPEED_VERYLOW(GPIOI_PIN1) | \
  1498. PIN_OSPEED_VERYLOW(GPIOI_PIN2) | \
  1499. PIN_OSPEED_VERYLOW(GPIOI_PIN3) | \
  1500. PIN_OSPEED_VERYLOW(GPIOI_PIN4) | \
  1501. PIN_OSPEED_VERYLOW(GPIOI_PIN5) | \
  1502. PIN_OSPEED_VERYLOW(GPIOI_PIN6) | \
  1503. PIN_OSPEED_VERYLOW(GPIOI_PIN7) | \
  1504. PIN_OSPEED_VERYLOW(GPIOI_PIN8) | \
  1505. PIN_OSPEED_VERYLOW(GPIOI_PIN9) | \
  1506. PIN_OSPEED_VERYLOW(GPIOI_PIN10) | \
  1507. PIN_OSPEED_VERYLOW(GPIOI_PIN11) | \
  1508. PIN_OSPEED_VERYLOW(GPIOI_PIN12) | \
  1509. PIN_OSPEED_VERYLOW(GPIOI_PIN13) | \
  1510. PIN_OSPEED_VERYLOW(GPIOI_PIN14) | \
  1511. PIN_OSPEED_VERYLOW(GPIOI_PIN15))
  1512. #define VAL_GPIOI_PUPDR (PIN_PUPDR_FLOATING(GPIOI_PIN0) | \
  1513. PIN_PUPDR_FLOATING(GPIOI_PIN1) | \
  1514. PIN_PUPDR_FLOATING(GPIOI_PIN2) | \
  1515. PIN_PUPDR_FLOATING(GPIOI_PIN3) | \
  1516. PIN_PUPDR_FLOATING(GPIOI_PIN4) | \
  1517. PIN_PUPDR_FLOATING(GPIOI_PIN5) | \
  1518. PIN_PUPDR_FLOATING(GPIOI_PIN6) | \
  1519. PIN_PUPDR_FLOATING(GPIOI_PIN7) | \
  1520. PIN_PUPDR_FLOATING(GPIOI_PIN8) | \
  1521. PIN_PUPDR_FLOATING(GPIOI_PIN9) | \
  1522. PIN_PUPDR_FLOATING(GPIOI_PIN10) | \
  1523. PIN_PUPDR_FLOATING(GPIOI_PIN11) | \
  1524. PIN_PUPDR_FLOATING(GPIOI_PIN12) | \
  1525. PIN_PUPDR_FLOATING(GPIOI_PIN13) | \
  1526. PIN_PUPDR_FLOATING(GPIOI_PIN14) | \
  1527. PIN_PUPDR_FLOATING(GPIOI_PIN15))
  1528. #define VAL_GPIOI_ODR (PIN_ODR_LOW(GPIOI_PIN0) | \
  1529. PIN_ODR_LOW(GPIOI_PIN1) | \
  1530. PIN_ODR_LOW(GPIOI_PIN2) | \
  1531. PIN_ODR_LOW(GPIOI_PIN3) | \
  1532. PIN_ODR_LOW(GPIOI_PIN4) | \
  1533. PIN_ODR_LOW(GPIOI_PIN5) | \
  1534. PIN_ODR_LOW(GPIOI_PIN6) | \
  1535. PIN_ODR_LOW(GPIOI_PIN7) | \
  1536. PIN_ODR_LOW(GPIOI_PIN8) | \
  1537. PIN_ODR_LOW(GPIOI_PIN9) | \
  1538. PIN_ODR_LOW(GPIOI_PIN10) | \
  1539. PIN_ODR_LOW(GPIOI_PIN11) | \
  1540. PIN_ODR_LOW(GPIOI_PIN12) | \
  1541. PIN_ODR_LOW(GPIOI_PIN13) | \
  1542. PIN_ODR_LOW(GPIOI_PIN14) | \
  1543. PIN_ODR_LOW(GPIOI_PIN15))
  1544. #define VAL_GPIOI_AFRL (PIN_AFIO_AF(GPIOI_PIN0, 0U) | \
  1545. PIN_AFIO_AF(GPIOI_PIN1, 0U) | \
  1546. PIN_AFIO_AF(GPIOI_PIN2, 0U) | \
  1547. PIN_AFIO_AF(GPIOI_PIN3, 0U) | \
  1548. PIN_AFIO_AF(GPIOI_PIN4, 0U) | \
  1549. PIN_AFIO_AF(GPIOI_PIN5, 0U) | \
  1550. PIN_AFIO_AF(GPIOI_PIN6, 0U) | \
  1551. PIN_AFIO_AF(GPIOI_PIN7, 0U))
  1552. #define VAL_GPIOI_AFRH (PIN_AFIO_AF(GPIOI_PIN8, 0U) | \
  1553. PIN_AFIO_AF(GPIOI_PIN9, 0U) | \
  1554. PIN_AFIO_AF(GPIOI_PIN10, 0U) | \
  1555. PIN_AFIO_AF(GPIOI_PIN11, 0U) | \
  1556. PIN_AFIO_AF(GPIOI_PIN12, 0U) | \
  1557. PIN_AFIO_AF(GPIOI_PIN13, 0U) | \
  1558. PIN_AFIO_AF(GPIOI_PIN14, 0U) | \
  1559. PIN_AFIO_AF(GPIOI_PIN15, 0U))
  1560. #define VAL_GPIOI_ASCR (PIN_ASCR_DISABLED(GPIOI_PIN0) | \
  1561. PIN_ASCR_DISABLED(GPIOI_PIN1) | \
  1562. PIN_ASCR_DISABLED(GPIOI_PIN2) | \
  1563. PIN_ASCR_DISABLED(GPIOI_PIN3) | \
  1564. PIN_ASCR_DISABLED(GPIOI_PIN4) | \
  1565. PIN_ASCR_DISABLED(GPIOI_PIN5) | \
  1566. PIN_ASCR_DISABLED(GPIOI_PIN6) | \
  1567. PIN_ASCR_DISABLED(GPIOI_PIN7) | \
  1568. PIN_ASCR_DISABLED(GPIOI_PIN8) | \
  1569. PIN_ASCR_DISABLED(GPIOI_PIN9) | \
  1570. PIN_ASCR_DISABLED(GPIOI_PIN10) | \
  1571. PIN_ASCR_DISABLED(GPIOI_PIN11) | \
  1572. PIN_ASCR_DISABLED(GPIOI_PIN12) | \
  1573. PIN_ASCR_DISABLED(GPIOI_PIN13) | \
  1574. PIN_ASCR_DISABLED(GPIOI_PIN14) | \
  1575. PIN_ASCR_DISABLED(GPIOI_PIN15))
  1576. #define VAL_GPIOI_LOCKR (PIN_LOCKR_DISABLED(GPIOI_PIN0) | \
  1577. PIN_LOCKR_DISABLED(GPIOI_PIN1) | \
  1578. PIN_LOCKR_DISABLED(GPIOI_PIN2) | \
  1579. PIN_LOCKR_DISABLED(GPIOI_PIN3) | \
  1580. PIN_LOCKR_DISABLED(GPIOI_PIN4) | \
  1581. PIN_LOCKR_DISABLED(GPIOI_PIN5) | \
  1582. PIN_LOCKR_DISABLED(GPIOI_PIN6) | \
  1583. PIN_LOCKR_DISABLED(GPIOI_PIN7) | \
  1584. PIN_LOCKR_DISABLED(GPIOI_PIN8) | \
  1585. PIN_LOCKR_DISABLED(GPIOI_PIN9) | \
  1586. PIN_LOCKR_DISABLED(GPIOI_PIN10) | \
  1587. PIN_LOCKR_DISABLED(GPIOI_PIN11) | \
  1588. PIN_LOCKR_DISABLED(GPIOI_PIN12) | \
  1589. PIN_LOCKR_DISABLED(GPIOI_PIN13) | \
  1590. PIN_LOCKR_DISABLED(GPIOI_PIN14) | \
  1591. PIN_LOCKR_DISABLED(GPIOI_PIN15))
  1592. /*===========================================================================*/
  1593. /* External declarations. */
  1594. /*===========================================================================*/
  1595. #if !defined(_FROM_ASM_)
  1596. #ifdef __cplusplus
  1597. extern "C" {
  1598. #endif
  1599. void boardInit(void);
  1600. #ifdef __cplusplus
  1601. }
  1602. #endif
  1603. #endif /* _FROM_ASM_ */
  1604. #endif /* BOARD_H */