board.h 84 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358
  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 STM32F4-Discovery board.
  24. */
  25. /*
  26. * Board identifier.
  27. */
  28. #define BOARD_ST_STM32F4_DISCOVERY
  29. #define BOARD_NAME "STMicroelectronics STM32F4-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. #if !defined(STM32_HSECLK)
  38. #define STM32_HSECLK 8000000U
  39. #endif
  40. /*
  41. * Board voltages.
  42. * Required for performance limits calculation.
  43. */
  44. #define STM32_VDD 300U
  45. /*
  46. * MCU type as defined in the ST header.
  47. */
  48. #define STM32F407xx
  49. /*
  50. * IO pins assignments.
  51. */
  52. #define GPIOA_BUTTON 0U
  53. #define GPIOA_PIN1 1U
  54. #define GPIOA_PIN2 2U
  55. #define GPIOA_PIN3 3U
  56. #define GPIOA_LRCK 4U
  57. #define GPIOA_SPC 5U
  58. #define GPIOA_SDO 6U
  59. #define GPIOA_SDI 7U
  60. #define GPIOA_PIN8 8U
  61. #define GPIOA_VBUS_FS 9U
  62. #define GPIOA_OTG_FS_ID 10U
  63. #define GPIOA_OTG_FS_DM 11U
  64. #define GPIOA_OTG_FS_DP 12U
  65. #define GPIOA_SWDIO 13U
  66. #define GPIOA_SWCLK 14U
  67. #define GPIOA_PIN15 15U
  68. #define GPIOB_PIN0 0U
  69. #define GPIOB_PIN1 1U
  70. #define GPIOB_PIN2 2U
  71. #define GPIOB_SWO 3U
  72. #define GPIOB_PIN4 4U
  73. #define GPIOB_PIN5 5U
  74. #define GPIOB_SCL 6U
  75. #define GPIOB_PIN7 7U
  76. #define GPIOB_PIN8 8U
  77. #define GPIOB_SDA 9U
  78. #define GPIOB_CLK_IN 10U
  79. #define GPIOB_PIN11 11U
  80. #define GPIOB_PIN12 12U
  81. #define GPIOB_PIN13 13U
  82. #define GPIOB_PIN14 14U
  83. #define GPIOB_PIN15 15U
  84. #define GPIOC_OTG_FS_POWER_ON 0U
  85. #define GPIOC_PIN1 1U
  86. #define GPIOC_PIN2 2U
  87. #define GPIOC_PDM_OUT 3U
  88. #define GPIOC_PIN4 4U
  89. #define GPIOC_PIN5 5U
  90. #define GPIOC_PIN6 6U
  91. #define GPIOC_MCLK 7U
  92. #define GPIOC_PIN8 8U
  93. #define GPIOC_PIN9 9U
  94. #define GPIOC_SCLK 10U
  95. #define GPIOC_PIN11 11U
  96. #define GPIOC_SDIN 12U
  97. #define GPIOC_PIN13 13U
  98. #define GPIOC_PIN14 14U
  99. #define GPIOC_PIN15 15U
  100. #define GPIOD_PIN0 0U
  101. #define GPIOD_PIN1 1U
  102. #define GPIOD_PIN2 2U
  103. #define GPIOD_PIN3 3U
  104. #define GPIOD_RESET 4U
  105. #define GPIOD_OVER_CURRENT 5U
  106. #define GPIOD_PIN6 6U
  107. #define GPIOD_PIN7 7U
  108. #define GPIOD_PIN8 8U
  109. #define GPIOD_PIN9 9U
  110. #define GPIOD_PIN10 10U
  111. #define GPIOD_PIN11 11U
  112. #define GPIOD_LED4 12U
  113. #define GPIOD_LED3 13U
  114. #define GPIOD_LED5 14U
  115. #define GPIOD_LED6 15U
  116. #define GPIOE_INT1 0U
  117. #define GPIOE_INT2 1U
  118. #define GPIOE_PIN2 2U
  119. #define GPIOE_CS_SPI 3U
  120. #define GPIOE_PIN4 4U
  121. #define GPIOE_PIN5 5U
  122. #define GPIOE_PIN6 6U
  123. #define GPIOE_PIN7 7U
  124. #define GPIOE_PIN8 8U
  125. #define GPIOE_PIN9 9U
  126. #define GPIOE_PIN10 10U
  127. #define GPIOE_PIN11 11U
  128. #define GPIOE_PIN12 12U
  129. #define GPIOE_PIN13 13U
  130. #define GPIOE_PIN14 14U
  131. #define GPIOE_PIN15 15U
  132. #define GPIOF_PIN0 0U
  133. #define GPIOF_PIN1 1U
  134. #define GPIOF_PIN2 2U
  135. #define GPIOF_PIN3 3U
  136. #define GPIOF_PIN4 4U
  137. #define GPIOF_PIN5 5U
  138. #define GPIOF_PIN6 6U
  139. #define GPIOF_PIN7 7U
  140. #define GPIOF_PIN8 8U
  141. #define GPIOF_PIN9 9U
  142. #define GPIOF_PIN10 10U
  143. #define GPIOF_PIN11 11U
  144. #define GPIOF_PIN12 12U
  145. #define GPIOF_PIN13 13U
  146. #define GPIOF_PIN14 14U
  147. #define GPIOF_PIN15 15U
  148. #define GPIOG_PIN0 0U
  149. #define GPIOG_PIN1 1U
  150. #define GPIOG_PIN2 2U
  151. #define GPIOG_PIN3 3U
  152. #define GPIOG_PIN4 4U
  153. #define GPIOG_PIN5 5U
  154. #define GPIOG_PIN6 6U
  155. #define GPIOG_PIN7 7U
  156. #define GPIOG_PIN8 8U
  157. #define GPIOG_PIN9 9U
  158. #define GPIOG_PIN10 10U
  159. #define GPIOG_PIN11 11U
  160. #define GPIOG_PIN12 12U
  161. #define GPIOG_PIN13 13U
  162. #define GPIOG_PIN14 14U
  163. #define GPIOG_PIN15 15U
  164. #define GPIOH_OSC_IN 0U
  165. #define GPIOH_OSC_OUT 1U
  166. #define GPIOH_PIN2 2U
  167. #define GPIOH_PIN3 3U
  168. #define GPIOH_PIN4 4U
  169. #define GPIOH_PIN5 5U
  170. #define GPIOH_PIN6 6U
  171. #define GPIOH_PIN7 7U
  172. #define GPIOH_PIN8 8U
  173. #define GPIOH_PIN9 9U
  174. #define GPIOH_PIN10 10U
  175. #define GPIOH_PIN11 11U
  176. #define GPIOH_PIN12 12U
  177. #define GPIOH_PIN13 13U
  178. #define GPIOH_PIN14 14U
  179. #define GPIOH_PIN15 15U
  180. #define GPIOI_PIN0 0U
  181. #define GPIOI_PIN1 1U
  182. #define GPIOI_PIN2 2U
  183. #define GPIOI_PIN3 3U
  184. #define GPIOI_PIN4 4U
  185. #define GPIOI_PIN5 5U
  186. #define GPIOI_PIN6 6U
  187. #define GPIOI_PIN7 7U
  188. #define GPIOI_PIN8 8U
  189. #define GPIOI_PIN9 9U
  190. #define GPIOI_PIN10 10U
  191. #define GPIOI_PIN11 11U
  192. #define GPIOI_PIN12 12U
  193. #define GPIOI_PIN13 13U
  194. #define GPIOI_PIN14 14U
  195. #define GPIOI_PIN15 15U
  196. /*
  197. * IO lines assignments.
  198. */
  199. #define LINE_BUTTON PAL_LINE(GPIOA, 0U)
  200. #define LINE_LRCK PAL_LINE(GPIOA, 4U)
  201. #define LINE_SPC PAL_LINE(GPIOA, 5U)
  202. #define LINE_SDO PAL_LINE(GPIOA, 6U)
  203. #define LINE_SDI PAL_LINE(GPIOA, 7U)
  204. #define LINE_VBUS_FS PAL_LINE(GPIOA, 9U)
  205. #define LINE_OTG_FS_ID PAL_LINE(GPIOA, 10U)
  206. #define LINE_OTG_FS_DM PAL_LINE(GPIOA, 11U)
  207. #define LINE_OTG_FS_DP PAL_LINE(GPIOA, 12U)
  208. #define LINE_SWDIO PAL_LINE(GPIOA, 13U)
  209. #define LINE_SWCLK PAL_LINE(GPIOA, 14U)
  210. #define LINE_SWO PAL_LINE(GPIOB, 3U)
  211. #define LINE_SCL PAL_LINE(GPIOB, 6U)
  212. #define LINE_SDA PAL_LINE(GPIOB, 9U)
  213. #define LINE_CLK_IN PAL_LINE(GPIOB, 10U)
  214. #define LINE_OTG_FS_POWER_ON PAL_LINE(GPIOC, 0U)
  215. #define LINE_PDM_OUT PAL_LINE(GPIOC, 3U)
  216. #define LINE_MCLK PAL_LINE(GPIOC, 7U)
  217. #define LINE_SCLK PAL_LINE(GPIOC, 10U)
  218. #define LINE_SDIN PAL_LINE(GPIOC, 12U)
  219. #define LINE_RESET PAL_LINE(GPIOD, 4U)
  220. #define LINE_OVER_CURRENT PAL_LINE(GPIOD, 5U)
  221. #define LINE_LED4 PAL_LINE(GPIOD, 12U)
  222. #define LINE_LED3 PAL_LINE(GPIOD, 13U)
  223. #define LINE_LED5 PAL_LINE(GPIOD, 14U)
  224. #define LINE_LED6 PAL_LINE(GPIOD, 15U)
  225. #define LINE_INT1 PAL_LINE(GPIOE, 0U)
  226. #define LINE_INT2 PAL_LINE(GPIOE, 1U)
  227. #define LINE_CS_SPI PAL_LINE(GPIOE, 3U)
  228. #define LINE_OSC_IN PAL_LINE(GPIOH, 0U)
  229. #define LINE_OSC_OUT PAL_LINE(GPIOH, 1U)
  230. /*===========================================================================*/
  231. /* Driver pre-compile time settings. */
  232. /*===========================================================================*/
  233. /*===========================================================================*/
  234. /* Derived constants and error checks. */
  235. /*===========================================================================*/
  236. /*===========================================================================*/
  237. /* Driver data structures and types. */
  238. /*===========================================================================*/
  239. /*===========================================================================*/
  240. /* Driver macros. */
  241. /*===========================================================================*/
  242. /*
  243. * I/O ports initial setup, this configuration is established soon after reset
  244. * in the initialization code.
  245. * Please refer to the STM32 Reference Manual for details.
  246. */
  247. #define PIN_MODE_INPUT(n) (0U << ((n) * 2U))
  248. #define PIN_MODE_OUTPUT(n) (1U << ((n) * 2U))
  249. #define PIN_MODE_ALTERNATE(n) (2U << ((n) * 2U))
  250. #define PIN_MODE_ANALOG(n) (3U << ((n) * 2U))
  251. #define PIN_ODR_LOW(n) (0U << (n))
  252. #define PIN_ODR_HIGH(n) (1U << (n))
  253. #define PIN_OTYPE_PUSHPULL(n) (0U << (n))
  254. #define PIN_OTYPE_OPENDRAIN(n) (1U << (n))
  255. #define PIN_OSPEED_VERYLOW(n) (0U << ((n) * 2U))
  256. #define PIN_OSPEED_LOW(n) (1U << ((n) * 2U))
  257. #define PIN_OSPEED_MEDIUM(n) (2U << ((n) * 2U))
  258. #define PIN_OSPEED_HIGH(n) (3U << ((n) * 2U))
  259. #define PIN_PUPDR_FLOATING(n) (0U << ((n) * 2U))
  260. #define PIN_PUPDR_PULLUP(n) (1U << ((n) * 2U))
  261. #define PIN_PUPDR_PULLDOWN(n) (2U << ((n) * 2U))
  262. #define PIN_AFIO_AF(n, v) ((v) << (((n) % 8U) * 4U))
  263. /*
  264. * GPIOA setup:
  265. *
  266. * PA0 - BUTTON (input floating).
  267. * PA1 - PIN1 (input pullup).
  268. * PA2 - PIN2 (input pullup).
  269. * PA3 - PIN3 (input pullup).
  270. * PA4 - LRCK (alternate 6).
  271. * PA5 - SPC (alternate 5).
  272. * PA6 - SDO (alternate 5).
  273. * PA7 - SDI (alternate 5).
  274. * PA8 - PIN8 (input pullup).
  275. * PA9 - VBUS_FS (input floating).
  276. * PA10 - OTG_FS_ID (alternate 10).
  277. * PA11 - OTG_FS_DM (alternate 10).
  278. * PA12 - OTG_FS_DP (alternate 10).
  279. * PA13 - SWDIO (alternate 0).
  280. * PA14 - SWCLK (alternate 0).
  281. * PA15 - PIN15 (input pullup).
  282. */
  283. #define VAL_GPIOA_MODER (PIN_MODE_INPUT(GPIOA_BUTTON) | \
  284. PIN_MODE_INPUT(GPIOA_PIN1) | \
  285. PIN_MODE_INPUT(GPIOA_PIN2) | \
  286. PIN_MODE_INPUT(GPIOA_PIN3) | \
  287. PIN_MODE_ALTERNATE(GPIOA_LRCK) | \
  288. PIN_MODE_ALTERNATE(GPIOA_SPC) | \
  289. PIN_MODE_ALTERNATE(GPIOA_SDO) | \
  290. PIN_MODE_ALTERNATE(GPIOA_SDI) | \
  291. PIN_MODE_INPUT(GPIOA_PIN8) | \
  292. PIN_MODE_INPUT(GPIOA_VBUS_FS) | \
  293. PIN_MODE_ALTERNATE(GPIOA_OTG_FS_ID) | \
  294. PIN_MODE_ALTERNATE(GPIOA_OTG_FS_DM) | \
  295. PIN_MODE_ALTERNATE(GPIOA_OTG_FS_DP) | \
  296. PIN_MODE_ALTERNATE(GPIOA_SWDIO) | \
  297. PIN_MODE_ALTERNATE(GPIOA_SWCLK) | \
  298. PIN_MODE_INPUT(GPIOA_PIN15))
  299. #define VAL_GPIOA_OTYPER (PIN_OTYPE_PUSHPULL(GPIOA_BUTTON) | \
  300. PIN_OTYPE_PUSHPULL(GPIOA_PIN1) | \
  301. PIN_OTYPE_PUSHPULL(GPIOA_PIN2) | \
  302. PIN_OTYPE_PUSHPULL(GPIOA_PIN3) | \
  303. PIN_OTYPE_PUSHPULL(GPIOA_LRCK) | \
  304. PIN_OTYPE_PUSHPULL(GPIOA_SPC) | \
  305. PIN_OTYPE_PUSHPULL(GPIOA_SDO) | \
  306. PIN_OTYPE_PUSHPULL(GPIOA_SDI) | \
  307. PIN_OTYPE_PUSHPULL(GPIOA_PIN8) | \
  308. PIN_OTYPE_PUSHPULL(GPIOA_VBUS_FS) | \
  309. PIN_OTYPE_PUSHPULL(GPIOA_OTG_FS_ID) | \
  310. PIN_OTYPE_PUSHPULL(GPIOA_OTG_FS_DM) | \
  311. PIN_OTYPE_PUSHPULL(GPIOA_OTG_FS_DP) | \
  312. PIN_OTYPE_PUSHPULL(GPIOA_SWDIO) | \
  313. PIN_OTYPE_PUSHPULL(GPIOA_SWCLK) | \
  314. PIN_OTYPE_PUSHPULL(GPIOA_PIN15))
  315. #define VAL_GPIOA_OSPEEDR (PIN_OSPEED_HIGH(GPIOA_BUTTON) | \
  316. PIN_OSPEED_HIGH(GPIOA_PIN1) | \
  317. PIN_OSPEED_HIGH(GPIOA_PIN2) | \
  318. PIN_OSPEED_HIGH(GPIOA_PIN3) | \
  319. PIN_OSPEED_HIGH(GPIOA_LRCK) | \
  320. PIN_OSPEED_MEDIUM(GPIOA_SPC) | \
  321. PIN_OSPEED_MEDIUM(GPIOA_SDO) | \
  322. PIN_OSPEED_MEDIUM(GPIOA_SDI) | \
  323. PIN_OSPEED_HIGH(GPIOA_PIN8) | \
  324. PIN_OSPEED_HIGH(GPIOA_VBUS_FS) | \
  325. PIN_OSPEED_HIGH(GPIOA_OTG_FS_ID) | \
  326. PIN_OSPEED_HIGH(GPIOA_OTG_FS_DM) | \
  327. PIN_OSPEED_HIGH(GPIOA_OTG_FS_DP) | \
  328. PIN_OSPEED_HIGH(GPIOA_SWDIO) | \
  329. PIN_OSPEED_HIGH(GPIOA_SWCLK) | \
  330. PIN_OSPEED_HIGH(GPIOA_PIN15))
  331. #define VAL_GPIOA_PUPDR (PIN_PUPDR_FLOATING(GPIOA_BUTTON) | \
  332. PIN_PUPDR_PULLUP(GPIOA_PIN1) | \
  333. PIN_PUPDR_PULLUP(GPIOA_PIN2) | \
  334. PIN_PUPDR_PULLUP(GPIOA_PIN3) | \
  335. PIN_PUPDR_FLOATING(GPIOA_LRCK) | \
  336. PIN_PUPDR_FLOATING(GPIOA_SPC) | \
  337. PIN_PUPDR_FLOATING(GPIOA_SDO) | \
  338. PIN_PUPDR_FLOATING(GPIOA_SDI) | \
  339. PIN_PUPDR_PULLUP(GPIOA_PIN8) | \
  340. PIN_PUPDR_FLOATING(GPIOA_VBUS_FS) | \
  341. PIN_PUPDR_FLOATING(GPIOA_OTG_FS_ID) | \
  342. PIN_PUPDR_FLOATING(GPIOA_OTG_FS_DM) | \
  343. PIN_PUPDR_FLOATING(GPIOA_OTG_FS_DP) | \
  344. PIN_PUPDR_FLOATING(GPIOA_SWDIO) | \
  345. PIN_PUPDR_FLOATING(GPIOA_SWCLK) | \
  346. PIN_PUPDR_PULLUP(GPIOA_PIN15))
  347. #define VAL_GPIOA_ODR (PIN_ODR_HIGH(GPIOA_BUTTON) | \
  348. PIN_ODR_HIGH(GPIOA_PIN1) | \
  349. PIN_ODR_HIGH(GPIOA_PIN2) | \
  350. PIN_ODR_HIGH(GPIOA_PIN3) | \
  351. PIN_ODR_HIGH(GPIOA_LRCK) | \
  352. PIN_ODR_HIGH(GPIOA_SPC) | \
  353. PIN_ODR_HIGH(GPIOA_SDO) | \
  354. PIN_ODR_HIGH(GPIOA_SDI) | \
  355. PIN_ODR_HIGH(GPIOA_PIN8) | \
  356. PIN_ODR_HIGH(GPIOA_VBUS_FS) | \
  357. PIN_ODR_HIGH(GPIOA_OTG_FS_ID) | \
  358. PIN_ODR_HIGH(GPIOA_OTG_FS_DM) | \
  359. PIN_ODR_HIGH(GPIOA_OTG_FS_DP) | \
  360. PIN_ODR_HIGH(GPIOA_SWDIO) | \
  361. PIN_ODR_HIGH(GPIOA_SWCLK) | \
  362. PIN_ODR_HIGH(GPIOA_PIN15))
  363. #define VAL_GPIOA_AFRL (PIN_AFIO_AF(GPIOA_BUTTON, 0U) | \
  364. PIN_AFIO_AF(GPIOA_PIN1, 0U) | \
  365. PIN_AFIO_AF(GPIOA_PIN2, 0U) | \
  366. PIN_AFIO_AF(GPIOA_PIN3, 0U) | \
  367. PIN_AFIO_AF(GPIOA_LRCK, 6U) | \
  368. PIN_AFIO_AF(GPIOA_SPC, 5U) | \
  369. PIN_AFIO_AF(GPIOA_SDO, 5U) | \
  370. PIN_AFIO_AF(GPIOA_SDI, 5U))
  371. #define VAL_GPIOA_AFRH (PIN_AFIO_AF(GPIOA_PIN8, 0U) | \
  372. PIN_AFIO_AF(GPIOA_VBUS_FS, 0U) | \
  373. PIN_AFIO_AF(GPIOA_OTG_FS_ID, 10U) | \
  374. PIN_AFIO_AF(GPIOA_OTG_FS_DM, 10U) | \
  375. PIN_AFIO_AF(GPIOA_OTG_FS_DP, 10U) | \
  376. PIN_AFIO_AF(GPIOA_SWDIO, 0U) | \
  377. PIN_AFIO_AF(GPIOA_SWCLK, 0U) | \
  378. PIN_AFIO_AF(GPIOA_PIN15, 0U))
  379. /*
  380. * GPIOB setup:
  381. *
  382. * PB0 - PIN0 (input pullup).
  383. * PB1 - PIN1 (input pullup).
  384. * PB2 - PIN2 (input pullup).
  385. * PB3 - SWO (alternate 0).
  386. * PB4 - PIN4 (input pullup).
  387. * PB5 - PIN5 (input pullup).
  388. * PB6 - SCL (alternate 4).
  389. * PB7 - PIN7 (input pullup).
  390. * PB8 - PIN8 (input pullup).
  391. * PB9 - SDA (alternate 4).
  392. * PB10 - CLK_IN (input pullup).
  393. * PB11 - PIN11 (input pullup).
  394. * PB12 - PIN12 (input pullup).
  395. * PB13 - PIN13 (input pullup).
  396. * PB14 - PIN14 (input pullup).
  397. * PB15 - PIN15 (input pullup).
  398. */
  399. #define VAL_GPIOB_MODER (PIN_MODE_INPUT(GPIOB_PIN0) | \
  400. PIN_MODE_INPUT(GPIOB_PIN1) | \
  401. PIN_MODE_INPUT(GPIOB_PIN2) | \
  402. PIN_MODE_ALTERNATE(GPIOB_SWO) | \
  403. PIN_MODE_INPUT(GPIOB_PIN4) | \
  404. PIN_MODE_INPUT(GPIOB_PIN5) | \
  405. PIN_MODE_ALTERNATE(GPIOB_SCL) | \
  406. PIN_MODE_INPUT(GPIOB_PIN7) | \
  407. PIN_MODE_INPUT(GPIOB_PIN8) | \
  408. PIN_MODE_ALTERNATE(GPIOB_SDA) | \
  409. PIN_MODE_INPUT(GPIOB_CLK_IN) | \
  410. PIN_MODE_INPUT(GPIOB_PIN11) | \
  411. PIN_MODE_INPUT(GPIOB_PIN12) | \
  412. PIN_MODE_INPUT(GPIOB_PIN13) | \
  413. PIN_MODE_INPUT(GPIOB_PIN14) | \
  414. PIN_MODE_INPUT(GPIOB_PIN15))
  415. #define VAL_GPIOB_OTYPER (PIN_OTYPE_PUSHPULL(GPIOB_PIN0) | \
  416. PIN_OTYPE_PUSHPULL(GPIOB_PIN1) | \
  417. PIN_OTYPE_PUSHPULL(GPIOB_PIN2) | \
  418. PIN_OTYPE_PUSHPULL(GPIOB_SWO) | \
  419. PIN_OTYPE_PUSHPULL(GPIOB_PIN4) | \
  420. PIN_OTYPE_PUSHPULL(GPIOB_PIN5) | \
  421. PIN_OTYPE_OPENDRAIN(GPIOB_SCL) | \
  422. PIN_OTYPE_PUSHPULL(GPIOB_PIN7) | \
  423. PIN_OTYPE_PUSHPULL(GPIOB_PIN8) | \
  424. PIN_OTYPE_OPENDRAIN(GPIOB_SDA) | \
  425. PIN_OTYPE_PUSHPULL(GPIOB_CLK_IN) | \
  426. PIN_OTYPE_PUSHPULL(GPIOB_PIN11) | \
  427. PIN_OTYPE_PUSHPULL(GPIOB_PIN12) | \
  428. PIN_OTYPE_PUSHPULL(GPIOB_PIN13) | \
  429. PIN_OTYPE_PUSHPULL(GPIOB_PIN14) | \
  430. PIN_OTYPE_PUSHPULL(GPIOB_PIN15))
  431. #define VAL_GPIOB_OSPEEDR (PIN_OSPEED_HIGH(GPIOB_PIN0) | \
  432. PIN_OSPEED_HIGH(GPIOB_PIN1) | \
  433. PIN_OSPEED_HIGH(GPIOB_PIN2) | \
  434. PIN_OSPEED_HIGH(GPIOB_SWO) | \
  435. PIN_OSPEED_HIGH(GPIOB_PIN4) | \
  436. PIN_OSPEED_HIGH(GPIOB_PIN5) | \
  437. PIN_OSPEED_HIGH(GPIOB_SCL) | \
  438. PIN_OSPEED_HIGH(GPIOB_PIN7) | \
  439. PIN_OSPEED_HIGH(GPIOB_PIN8) | \
  440. PIN_OSPEED_HIGH(GPIOB_SDA) | \
  441. PIN_OSPEED_HIGH(GPIOB_CLK_IN) | \
  442. PIN_OSPEED_HIGH(GPIOB_PIN11) | \
  443. PIN_OSPEED_HIGH(GPIOB_PIN12) | \
  444. PIN_OSPEED_HIGH(GPIOB_PIN13) | \
  445. PIN_OSPEED_HIGH(GPIOB_PIN14) | \
  446. PIN_OSPEED_HIGH(GPIOB_PIN15))
  447. #define VAL_GPIOB_PUPDR (PIN_PUPDR_PULLUP(GPIOB_PIN0) | \
  448. PIN_PUPDR_PULLUP(GPIOB_PIN1) | \
  449. PIN_PUPDR_PULLUP(GPIOB_PIN2) | \
  450. PIN_PUPDR_FLOATING(GPIOB_SWO) | \
  451. PIN_PUPDR_PULLUP(GPIOB_PIN4) | \
  452. PIN_PUPDR_PULLUP(GPIOB_PIN5) | \
  453. PIN_PUPDR_FLOATING(GPIOB_SCL) | \
  454. PIN_PUPDR_PULLUP(GPIOB_PIN7) | \
  455. PIN_PUPDR_PULLUP(GPIOB_PIN8) | \
  456. PIN_PUPDR_FLOATING(GPIOB_SDA) | \
  457. PIN_PUPDR_PULLUP(GPIOB_CLK_IN) | \
  458. PIN_PUPDR_PULLUP(GPIOB_PIN11) | \
  459. PIN_PUPDR_PULLUP(GPIOB_PIN12) | \
  460. PIN_PUPDR_PULLUP(GPIOB_PIN13) | \
  461. PIN_PUPDR_PULLUP(GPIOB_PIN14) | \
  462. PIN_PUPDR_PULLUP(GPIOB_PIN15))
  463. #define VAL_GPIOB_ODR (PIN_ODR_HIGH(GPIOB_PIN0) | \
  464. PIN_ODR_HIGH(GPIOB_PIN1) | \
  465. PIN_ODR_HIGH(GPIOB_PIN2) | \
  466. PIN_ODR_HIGH(GPIOB_SWO) | \
  467. PIN_ODR_HIGH(GPIOB_PIN4) | \
  468. PIN_ODR_HIGH(GPIOB_PIN5) | \
  469. PIN_ODR_HIGH(GPIOB_SCL) | \
  470. PIN_ODR_HIGH(GPIOB_PIN7) | \
  471. PIN_ODR_HIGH(GPIOB_PIN8) | \
  472. PIN_ODR_HIGH(GPIOB_SDA) | \
  473. PIN_ODR_HIGH(GPIOB_CLK_IN) | \
  474. PIN_ODR_HIGH(GPIOB_PIN11) | \
  475. PIN_ODR_HIGH(GPIOB_PIN12) | \
  476. PIN_ODR_HIGH(GPIOB_PIN13) | \
  477. PIN_ODR_HIGH(GPIOB_PIN14) | \
  478. PIN_ODR_HIGH(GPIOB_PIN15))
  479. #define VAL_GPIOB_AFRL (PIN_AFIO_AF(GPIOB_PIN0, 0U) | \
  480. PIN_AFIO_AF(GPIOB_PIN1, 0U) | \
  481. PIN_AFIO_AF(GPIOB_PIN2, 0U) | \
  482. PIN_AFIO_AF(GPIOB_SWO, 0U) | \
  483. PIN_AFIO_AF(GPIOB_PIN4, 0U) | \
  484. PIN_AFIO_AF(GPIOB_PIN5, 0U) | \
  485. PIN_AFIO_AF(GPIOB_SCL, 4U) | \
  486. PIN_AFIO_AF(GPIOB_PIN7, 0U))
  487. #define VAL_GPIOB_AFRH (PIN_AFIO_AF(GPIOB_PIN8, 0U) | \
  488. PIN_AFIO_AF(GPIOB_SDA, 4U) | \
  489. PIN_AFIO_AF(GPIOB_CLK_IN, 0U) | \
  490. PIN_AFIO_AF(GPIOB_PIN11, 0U) | \
  491. PIN_AFIO_AF(GPIOB_PIN12, 0U) | \
  492. PIN_AFIO_AF(GPIOB_PIN13, 0U) | \
  493. PIN_AFIO_AF(GPIOB_PIN14, 0U) | \
  494. PIN_AFIO_AF(GPIOB_PIN15, 0U))
  495. /*
  496. * GPIOC setup:
  497. *
  498. * PC0 - OTG_FS_POWER_ON (output pushpull maximum).
  499. * PC1 - PIN1 (input pullup).
  500. * PC2 - PIN2 (input pullup).
  501. * PC3 - PDM_OUT (input pullup).
  502. * PC4 - PIN4 (input pullup).
  503. * PC5 - PIN5 (input pullup).
  504. * PC6 - PIN6 (input pullup).
  505. * PC7 - MCLK (alternate 6).
  506. * PC8 - PIN8 (input pullup).
  507. * PC9 - PIN9 (input pullup).
  508. * PC10 - SCLK (alternate 6).
  509. * PC11 - PIN11 (input pullup).
  510. * PC12 - SDIN (alternate 6).
  511. * PC13 - PIN13 (input pullup).
  512. * PC14 - PIN14 (input pullup).
  513. * PC15 - PIN15 (input pullup).
  514. */
  515. #define VAL_GPIOC_MODER (PIN_MODE_OUTPUT(GPIOC_OTG_FS_POWER_ON) |\
  516. PIN_MODE_INPUT(GPIOC_PIN1) | \
  517. PIN_MODE_INPUT(GPIOC_PIN2) | \
  518. PIN_MODE_INPUT(GPIOC_PDM_OUT) | \
  519. PIN_MODE_INPUT(GPIOC_PIN4) | \
  520. PIN_MODE_INPUT(GPIOC_PIN5) | \
  521. PIN_MODE_INPUT(GPIOC_PIN6) | \
  522. PIN_MODE_ALTERNATE(GPIOC_MCLK) | \
  523. PIN_MODE_INPUT(GPIOC_PIN8) | \
  524. PIN_MODE_INPUT(GPIOC_PIN9) | \
  525. PIN_MODE_ALTERNATE(GPIOC_SCLK) | \
  526. PIN_MODE_INPUT(GPIOC_PIN11) | \
  527. PIN_MODE_ALTERNATE(GPIOC_SDIN) | \
  528. PIN_MODE_INPUT(GPIOC_PIN13) | \
  529. PIN_MODE_INPUT(GPIOC_PIN14) | \
  530. PIN_MODE_INPUT(GPIOC_PIN15))
  531. #define VAL_GPIOC_OTYPER (PIN_OTYPE_PUSHPULL(GPIOC_OTG_FS_POWER_ON) |\
  532. PIN_OTYPE_PUSHPULL(GPIOC_PIN1) | \
  533. PIN_OTYPE_PUSHPULL(GPIOC_PIN2) | \
  534. PIN_OTYPE_PUSHPULL(GPIOC_PDM_OUT) | \
  535. PIN_OTYPE_PUSHPULL(GPIOC_PIN4) | \
  536. PIN_OTYPE_PUSHPULL(GPIOC_PIN5) | \
  537. PIN_OTYPE_PUSHPULL(GPIOC_PIN6) | \
  538. PIN_OTYPE_PUSHPULL(GPIOC_MCLK) | \
  539. PIN_OTYPE_PUSHPULL(GPIOC_PIN8) | \
  540. PIN_OTYPE_PUSHPULL(GPIOC_PIN9) | \
  541. PIN_OTYPE_PUSHPULL(GPIOC_SCLK) | \
  542. PIN_OTYPE_PUSHPULL(GPIOC_PIN11) | \
  543. PIN_OTYPE_PUSHPULL(GPIOC_SDIN) | \
  544. PIN_OTYPE_PUSHPULL(GPIOC_PIN13) | \
  545. PIN_OTYPE_PUSHPULL(GPIOC_PIN14) | \
  546. PIN_OTYPE_PUSHPULL(GPIOC_PIN15))
  547. #define VAL_GPIOC_OSPEEDR (PIN_OSPEED_HIGH(GPIOC_OTG_FS_POWER_ON) |\
  548. PIN_OSPEED_HIGH(GPIOC_PIN1) | \
  549. PIN_OSPEED_HIGH(GPIOC_PIN2) | \
  550. PIN_OSPEED_HIGH(GPIOC_PDM_OUT) | \
  551. PIN_OSPEED_HIGH(GPIOC_PIN4) | \
  552. PIN_OSPEED_HIGH(GPIOC_PIN5) | \
  553. PIN_OSPEED_HIGH(GPIOC_PIN6) | \
  554. PIN_OSPEED_HIGH(GPIOC_MCLK) | \
  555. PIN_OSPEED_HIGH(GPIOC_PIN8) | \
  556. PIN_OSPEED_HIGH(GPIOC_PIN9) | \
  557. PIN_OSPEED_HIGH(GPIOC_SCLK) | \
  558. PIN_OSPEED_HIGH(GPIOC_PIN11) | \
  559. PIN_OSPEED_HIGH(GPIOC_SDIN) | \
  560. PIN_OSPEED_HIGH(GPIOC_PIN13) | \
  561. PIN_OSPEED_HIGH(GPIOC_PIN14) | \
  562. PIN_OSPEED_HIGH(GPIOC_PIN15))
  563. #define VAL_GPIOC_PUPDR (PIN_PUPDR_FLOATING(GPIOC_OTG_FS_POWER_ON) |\
  564. PIN_PUPDR_PULLUP(GPIOC_PIN1) | \
  565. PIN_PUPDR_PULLUP(GPIOC_PIN2) | \
  566. PIN_PUPDR_PULLUP(GPIOC_PDM_OUT) | \
  567. PIN_PUPDR_PULLUP(GPIOC_PIN4) | \
  568. PIN_PUPDR_PULLUP(GPIOC_PIN5) | \
  569. PIN_PUPDR_PULLUP(GPIOC_PIN6) | \
  570. PIN_PUPDR_FLOATING(GPIOC_MCLK) | \
  571. PIN_PUPDR_PULLUP(GPIOC_PIN8) | \
  572. PIN_PUPDR_PULLUP(GPIOC_PIN9) | \
  573. PIN_PUPDR_FLOATING(GPIOC_SCLK) | \
  574. PIN_PUPDR_PULLUP(GPIOC_PIN11) | \
  575. PIN_PUPDR_FLOATING(GPIOC_SDIN) | \
  576. PIN_PUPDR_PULLUP(GPIOC_PIN13) | \
  577. PIN_PUPDR_PULLUP(GPIOC_PIN14) | \
  578. PIN_PUPDR_PULLUP(GPIOC_PIN15))
  579. #define VAL_GPIOC_ODR (PIN_ODR_HIGH(GPIOC_OTG_FS_POWER_ON) | \
  580. PIN_ODR_HIGH(GPIOC_PIN1) | \
  581. PIN_ODR_HIGH(GPIOC_PIN2) | \
  582. PIN_ODR_HIGH(GPIOC_PDM_OUT) | \
  583. PIN_ODR_HIGH(GPIOC_PIN4) | \
  584. PIN_ODR_HIGH(GPIOC_PIN5) | \
  585. PIN_ODR_HIGH(GPIOC_PIN6) | \
  586. PIN_ODR_HIGH(GPIOC_MCLK) | \
  587. PIN_ODR_HIGH(GPIOC_PIN8) | \
  588. PIN_ODR_HIGH(GPIOC_PIN9) | \
  589. PIN_ODR_HIGH(GPIOC_SCLK) | \
  590. PIN_ODR_HIGH(GPIOC_PIN11) | \
  591. PIN_ODR_HIGH(GPIOC_SDIN) | \
  592. PIN_ODR_HIGH(GPIOC_PIN13) | \
  593. PIN_ODR_HIGH(GPIOC_PIN14) | \
  594. PIN_ODR_HIGH(GPIOC_PIN15))
  595. #define VAL_GPIOC_AFRL (PIN_AFIO_AF(GPIOC_OTG_FS_POWER_ON, 0U) |\
  596. PIN_AFIO_AF(GPIOC_PIN1, 0U) | \
  597. PIN_AFIO_AF(GPIOC_PIN2, 0U) | \
  598. PIN_AFIO_AF(GPIOC_PDM_OUT, 0U) | \
  599. PIN_AFIO_AF(GPIOC_PIN4, 0U) | \
  600. PIN_AFIO_AF(GPIOC_PIN5, 0U) | \
  601. PIN_AFIO_AF(GPIOC_PIN6, 0U) | \
  602. PIN_AFIO_AF(GPIOC_MCLK, 6U))
  603. #define VAL_GPIOC_AFRH (PIN_AFIO_AF(GPIOC_PIN8, 0U) | \
  604. PIN_AFIO_AF(GPIOC_PIN9, 0U) | \
  605. PIN_AFIO_AF(GPIOC_SCLK, 6U) | \
  606. PIN_AFIO_AF(GPIOC_PIN11, 0U) | \
  607. PIN_AFIO_AF(GPIOC_SDIN, 6U) | \
  608. PIN_AFIO_AF(GPIOC_PIN13, 0U) | \
  609. PIN_AFIO_AF(GPIOC_PIN14, 0U) | \
  610. PIN_AFIO_AF(GPIOC_PIN15, 0U))
  611. /*
  612. * GPIOD setup:
  613. *
  614. * PD0 - PIN0 (input pullup).
  615. * PD1 - PIN1 (input pullup).
  616. * PD2 - PIN2 (input pullup).
  617. * PD3 - PIN3 (input pullup).
  618. * PD4 - RESET (output pushpull maximum).
  619. * PD5 - OVER_CURRENT (input floating).
  620. * PD6 - PIN6 (input pullup).
  621. * PD7 - PIN7 (input pullup).
  622. * PD8 - PIN8 (input pullup).
  623. * PD9 - PIN9 (input pullup).
  624. * PD10 - PIN10 (input pullup).
  625. * PD11 - PIN11 (input pullup).
  626. * PD12 - LED4 (output pushpull maximum).
  627. * PD13 - LED3 (output pushpull maximum).
  628. * PD14 - LED5 (output pushpull maximum).
  629. * PD15 - LED6 (output pushpull maximum).
  630. */
  631. #define VAL_GPIOD_MODER (PIN_MODE_INPUT(GPIOD_PIN0) | \
  632. PIN_MODE_INPUT(GPIOD_PIN1) | \
  633. PIN_MODE_INPUT(GPIOD_PIN2) | \
  634. PIN_MODE_INPUT(GPIOD_PIN3) | \
  635. PIN_MODE_OUTPUT(GPIOD_RESET) | \
  636. PIN_MODE_INPUT(GPIOD_OVER_CURRENT) | \
  637. PIN_MODE_INPUT(GPIOD_PIN6) | \
  638. PIN_MODE_INPUT(GPIOD_PIN7) | \
  639. PIN_MODE_INPUT(GPIOD_PIN8) | \
  640. PIN_MODE_INPUT(GPIOD_PIN9) | \
  641. PIN_MODE_INPUT(GPIOD_PIN10) | \
  642. PIN_MODE_INPUT(GPIOD_PIN11) | \
  643. PIN_MODE_OUTPUT(GPIOD_LED4) | \
  644. PIN_MODE_OUTPUT(GPIOD_LED3) | \
  645. PIN_MODE_OUTPUT(GPIOD_LED5) | \
  646. PIN_MODE_OUTPUT(GPIOD_LED6))
  647. #define VAL_GPIOD_OTYPER (PIN_OTYPE_PUSHPULL(GPIOD_PIN0) | \
  648. PIN_OTYPE_PUSHPULL(GPIOD_PIN1) | \
  649. PIN_OTYPE_PUSHPULL(GPIOD_PIN2) | \
  650. PIN_OTYPE_PUSHPULL(GPIOD_PIN3) | \
  651. PIN_OTYPE_PUSHPULL(GPIOD_RESET) | \
  652. PIN_OTYPE_PUSHPULL(GPIOD_OVER_CURRENT) |\
  653. PIN_OTYPE_PUSHPULL(GPIOD_PIN6) | \
  654. PIN_OTYPE_PUSHPULL(GPIOD_PIN7) | \
  655. PIN_OTYPE_PUSHPULL(GPIOD_PIN8) | \
  656. PIN_OTYPE_PUSHPULL(GPIOD_PIN9) | \
  657. PIN_OTYPE_PUSHPULL(GPIOD_PIN10) | \
  658. PIN_OTYPE_PUSHPULL(GPIOD_PIN11) | \
  659. PIN_OTYPE_PUSHPULL(GPIOD_LED4) | \
  660. PIN_OTYPE_PUSHPULL(GPIOD_LED3) | \
  661. PIN_OTYPE_PUSHPULL(GPIOD_LED5) | \
  662. PIN_OTYPE_PUSHPULL(GPIOD_LED6))
  663. #define VAL_GPIOD_OSPEEDR (PIN_OSPEED_HIGH(GPIOD_PIN0) | \
  664. PIN_OSPEED_HIGH(GPIOD_PIN1) | \
  665. PIN_OSPEED_HIGH(GPIOD_PIN2) | \
  666. PIN_OSPEED_HIGH(GPIOD_PIN3) | \
  667. PIN_OSPEED_HIGH(GPIOD_RESET) | \
  668. PIN_OSPEED_HIGH(GPIOD_OVER_CURRENT) | \
  669. PIN_OSPEED_HIGH(GPIOD_PIN6) | \
  670. PIN_OSPEED_HIGH(GPIOD_PIN7) | \
  671. PIN_OSPEED_HIGH(GPIOD_PIN8) | \
  672. PIN_OSPEED_HIGH(GPIOD_PIN9) | \
  673. PIN_OSPEED_HIGH(GPIOD_PIN10) | \
  674. PIN_OSPEED_HIGH(GPIOD_PIN11) | \
  675. PIN_OSPEED_HIGH(GPIOD_LED4) | \
  676. PIN_OSPEED_HIGH(GPIOD_LED3) | \
  677. PIN_OSPEED_HIGH(GPIOD_LED5) | \
  678. PIN_OSPEED_HIGH(GPIOD_LED6))
  679. #define VAL_GPIOD_PUPDR (PIN_PUPDR_PULLUP(GPIOD_PIN0) | \
  680. PIN_PUPDR_PULLUP(GPIOD_PIN1) | \
  681. PIN_PUPDR_PULLUP(GPIOD_PIN2) | \
  682. PIN_PUPDR_PULLUP(GPIOD_PIN3) | \
  683. PIN_PUPDR_FLOATING(GPIOD_RESET) | \
  684. PIN_PUPDR_FLOATING(GPIOD_OVER_CURRENT) |\
  685. PIN_PUPDR_PULLUP(GPIOD_PIN6) | \
  686. PIN_PUPDR_PULLUP(GPIOD_PIN7) | \
  687. PIN_PUPDR_PULLUP(GPIOD_PIN8) | \
  688. PIN_PUPDR_PULLUP(GPIOD_PIN9) | \
  689. PIN_PUPDR_PULLUP(GPIOD_PIN10) | \
  690. PIN_PUPDR_PULLUP(GPIOD_PIN11) | \
  691. PIN_PUPDR_FLOATING(GPIOD_LED4) | \
  692. PIN_PUPDR_FLOATING(GPIOD_LED3) | \
  693. PIN_PUPDR_FLOATING(GPIOD_LED5) | \
  694. PIN_PUPDR_FLOATING(GPIOD_LED6))
  695. #define VAL_GPIOD_ODR (PIN_ODR_HIGH(GPIOD_PIN0) | \
  696. PIN_ODR_HIGH(GPIOD_PIN1) | \
  697. PIN_ODR_HIGH(GPIOD_PIN2) | \
  698. PIN_ODR_HIGH(GPIOD_PIN3) | \
  699. PIN_ODR_HIGH(GPIOD_RESET) | \
  700. PIN_ODR_HIGH(GPIOD_OVER_CURRENT) | \
  701. PIN_ODR_HIGH(GPIOD_PIN6) | \
  702. PIN_ODR_HIGH(GPIOD_PIN7) | \
  703. PIN_ODR_HIGH(GPIOD_PIN8) | \
  704. PIN_ODR_HIGH(GPIOD_PIN9) | \
  705. PIN_ODR_HIGH(GPIOD_PIN10) | \
  706. PIN_ODR_HIGH(GPIOD_PIN11) | \
  707. PIN_ODR_LOW(GPIOD_LED4) | \
  708. PIN_ODR_LOW(GPIOD_LED3) | \
  709. PIN_ODR_LOW(GPIOD_LED5) | \
  710. PIN_ODR_LOW(GPIOD_LED6))
  711. #define VAL_GPIOD_AFRL (PIN_AFIO_AF(GPIOD_PIN0, 0U) | \
  712. PIN_AFIO_AF(GPIOD_PIN1, 0U) | \
  713. PIN_AFIO_AF(GPIOD_PIN2, 0U) | \
  714. PIN_AFIO_AF(GPIOD_PIN3, 0U) | \
  715. PIN_AFIO_AF(GPIOD_RESET, 0U) | \
  716. PIN_AFIO_AF(GPIOD_OVER_CURRENT, 0U) | \
  717. PIN_AFIO_AF(GPIOD_PIN6, 0U) | \
  718. PIN_AFIO_AF(GPIOD_PIN7, 0U))
  719. #define VAL_GPIOD_AFRH (PIN_AFIO_AF(GPIOD_PIN8, 0U) | \
  720. PIN_AFIO_AF(GPIOD_PIN9, 0U) | \
  721. PIN_AFIO_AF(GPIOD_PIN10, 0U) | \
  722. PIN_AFIO_AF(GPIOD_PIN11, 0U) | \
  723. PIN_AFIO_AF(GPIOD_LED4, 0U) | \
  724. PIN_AFIO_AF(GPIOD_LED3, 0U) | \
  725. PIN_AFIO_AF(GPIOD_LED5, 0U) | \
  726. PIN_AFIO_AF(GPIOD_LED6, 0U))
  727. /*
  728. * GPIOE setup:
  729. *
  730. * PE0 - INT1 (input floating).
  731. * PE1 - INT2 (input floating).
  732. * PE2 - PIN2 (input floating).
  733. * PE3 - CS_SPI (output pushpull maximum).
  734. * PE4 - PIN4 (input floating).
  735. * PE5 - PIN5 (input floating).
  736. * PE6 - PIN6 (input floating).
  737. * PE7 - PIN7 (input floating).
  738. * PE8 - PIN8 (input floating).
  739. * PE9 - PIN9 (input floating).
  740. * PE10 - PIN10 (input floating).
  741. * PE11 - PIN11 (input floating).
  742. * PE12 - PIN12 (input floating).
  743. * PE13 - PIN13 (input floating).
  744. * PE14 - PIN14 (input floating).
  745. * PE15 - PIN15 (input floating).
  746. */
  747. #define VAL_GPIOE_MODER (PIN_MODE_INPUT(GPIOE_INT1) | \
  748. PIN_MODE_INPUT(GPIOE_INT2) | \
  749. PIN_MODE_INPUT(GPIOE_PIN2) | \
  750. PIN_MODE_OUTPUT(GPIOE_CS_SPI) | \
  751. PIN_MODE_INPUT(GPIOE_PIN4) | \
  752. PIN_MODE_INPUT(GPIOE_PIN5) | \
  753. PIN_MODE_INPUT(GPIOE_PIN6) | \
  754. PIN_MODE_INPUT(GPIOE_PIN7) | \
  755. PIN_MODE_INPUT(GPIOE_PIN8) | \
  756. PIN_MODE_INPUT(GPIOE_PIN9) | \
  757. PIN_MODE_INPUT(GPIOE_PIN10) | \
  758. PIN_MODE_INPUT(GPIOE_PIN11) | \
  759. PIN_MODE_INPUT(GPIOE_PIN12) | \
  760. PIN_MODE_INPUT(GPIOE_PIN13) | \
  761. PIN_MODE_INPUT(GPIOE_PIN14) | \
  762. PIN_MODE_INPUT(GPIOE_PIN15))
  763. #define VAL_GPIOE_OTYPER (PIN_OTYPE_PUSHPULL(GPIOE_INT1) | \
  764. PIN_OTYPE_PUSHPULL(GPIOE_INT2) | \
  765. PIN_OTYPE_PUSHPULL(GPIOE_PIN2) | \
  766. PIN_OTYPE_PUSHPULL(GPIOE_CS_SPI) | \
  767. PIN_OTYPE_PUSHPULL(GPIOE_PIN4) | \
  768. PIN_OTYPE_PUSHPULL(GPIOE_PIN5) | \
  769. PIN_OTYPE_PUSHPULL(GPIOE_PIN6) | \
  770. PIN_OTYPE_PUSHPULL(GPIOE_PIN7) | \
  771. PIN_OTYPE_PUSHPULL(GPIOE_PIN8) | \
  772. PIN_OTYPE_PUSHPULL(GPIOE_PIN9) | \
  773. PIN_OTYPE_PUSHPULL(GPIOE_PIN10) | \
  774. PIN_OTYPE_PUSHPULL(GPIOE_PIN11) | \
  775. PIN_OTYPE_PUSHPULL(GPIOE_PIN12) | \
  776. PIN_OTYPE_PUSHPULL(GPIOE_PIN13) | \
  777. PIN_OTYPE_PUSHPULL(GPIOE_PIN14) | \
  778. PIN_OTYPE_PUSHPULL(GPIOE_PIN15))
  779. #define VAL_GPIOE_OSPEEDR (PIN_OSPEED_HIGH(GPIOE_INT1) | \
  780. PIN_OSPEED_HIGH(GPIOE_INT2) | \
  781. PIN_OSPEED_HIGH(GPIOE_PIN2) | \
  782. PIN_OSPEED_HIGH(GPIOE_CS_SPI) | \
  783. PIN_OSPEED_HIGH(GPIOE_PIN4) | \
  784. PIN_OSPEED_HIGH(GPIOE_PIN5) | \
  785. PIN_OSPEED_HIGH(GPIOE_PIN6) | \
  786. PIN_OSPEED_HIGH(GPIOE_PIN7) | \
  787. PIN_OSPEED_HIGH(GPIOE_PIN8) | \
  788. PIN_OSPEED_HIGH(GPIOE_PIN9) | \
  789. PIN_OSPEED_HIGH(GPIOE_PIN10) | \
  790. PIN_OSPEED_HIGH(GPIOE_PIN11) | \
  791. PIN_OSPEED_HIGH(GPIOE_PIN12) | \
  792. PIN_OSPEED_HIGH(GPIOE_PIN13) | \
  793. PIN_OSPEED_HIGH(GPIOE_PIN14) | \
  794. PIN_OSPEED_HIGH(GPIOE_PIN15))
  795. #define VAL_GPIOE_PUPDR (PIN_PUPDR_FLOATING(GPIOE_INT1) | \
  796. PIN_PUPDR_FLOATING(GPIOE_INT2) | \
  797. PIN_PUPDR_FLOATING(GPIOE_PIN2) | \
  798. PIN_PUPDR_FLOATING(GPIOE_CS_SPI) | \
  799. PIN_PUPDR_FLOATING(GPIOE_PIN4) | \
  800. PIN_PUPDR_FLOATING(GPIOE_PIN5) | \
  801. PIN_PUPDR_FLOATING(GPIOE_PIN6) | \
  802. PIN_PUPDR_FLOATING(GPIOE_PIN7) | \
  803. PIN_PUPDR_FLOATING(GPIOE_PIN8) | \
  804. PIN_PUPDR_FLOATING(GPIOE_PIN9) | \
  805. PIN_PUPDR_FLOATING(GPIOE_PIN10) | \
  806. PIN_PUPDR_FLOATING(GPIOE_PIN11) | \
  807. PIN_PUPDR_FLOATING(GPIOE_PIN12) | \
  808. PIN_PUPDR_FLOATING(GPIOE_PIN13) | \
  809. PIN_PUPDR_FLOATING(GPIOE_PIN14) | \
  810. PIN_PUPDR_FLOATING(GPIOE_PIN15))
  811. #define VAL_GPIOE_ODR (PIN_ODR_HIGH(GPIOE_INT1) | \
  812. PIN_ODR_HIGH(GPIOE_INT2) | \
  813. PIN_ODR_HIGH(GPIOE_PIN2) | \
  814. PIN_ODR_HIGH(GPIOE_CS_SPI) | \
  815. PIN_ODR_HIGH(GPIOE_PIN4) | \
  816. PIN_ODR_HIGH(GPIOE_PIN5) | \
  817. PIN_ODR_HIGH(GPIOE_PIN6) | \
  818. PIN_ODR_HIGH(GPIOE_PIN7) | \
  819. PIN_ODR_HIGH(GPIOE_PIN8) | \
  820. PIN_ODR_HIGH(GPIOE_PIN9) | \
  821. PIN_ODR_HIGH(GPIOE_PIN10) | \
  822. PIN_ODR_HIGH(GPIOE_PIN11) | \
  823. PIN_ODR_HIGH(GPIOE_PIN12) | \
  824. PIN_ODR_HIGH(GPIOE_PIN13) | \
  825. PIN_ODR_HIGH(GPIOE_PIN14) | \
  826. PIN_ODR_HIGH(GPIOE_PIN15))
  827. #define VAL_GPIOE_AFRL (PIN_AFIO_AF(GPIOE_INT1, 0U) | \
  828. PIN_AFIO_AF(GPIOE_INT2, 0U) | \
  829. PIN_AFIO_AF(GPIOE_PIN2, 0U) | \
  830. PIN_AFIO_AF(GPIOE_CS_SPI, 0U) | \
  831. PIN_AFIO_AF(GPIOE_PIN4, 0U) | \
  832. PIN_AFIO_AF(GPIOE_PIN5, 0U) | \
  833. PIN_AFIO_AF(GPIOE_PIN6, 0U) | \
  834. PIN_AFIO_AF(GPIOE_PIN7, 0U))
  835. #define VAL_GPIOE_AFRH (PIN_AFIO_AF(GPIOE_PIN8, 0U) | \
  836. PIN_AFIO_AF(GPIOE_PIN9, 0U) | \
  837. PIN_AFIO_AF(GPIOE_PIN10, 0U) | \
  838. PIN_AFIO_AF(GPIOE_PIN11, 0U) | \
  839. PIN_AFIO_AF(GPIOE_PIN12, 0U) | \
  840. PIN_AFIO_AF(GPIOE_PIN13, 0U) | \
  841. PIN_AFIO_AF(GPIOE_PIN14, 0U) | \
  842. PIN_AFIO_AF(GPIOE_PIN15, 0U))
  843. /*
  844. * GPIOF setup:
  845. *
  846. * PF0 - PIN0 (input floating).
  847. * PF1 - PIN1 (input floating).
  848. * PF2 - PIN2 (input floating).
  849. * PF3 - PIN3 (input floating).
  850. * PF4 - PIN4 (input floating).
  851. * PF5 - PIN5 (input floating).
  852. * PF6 - PIN6 (input floating).
  853. * PF7 - PIN7 (input floating).
  854. * PF8 - PIN8 (input floating).
  855. * PF9 - PIN9 (input floating).
  856. * PF10 - PIN10 (input floating).
  857. * PF11 - PIN11 (input floating).
  858. * PF12 - PIN12 (input floating).
  859. * PF13 - PIN13 (input floating).
  860. * PF14 - PIN14 (input floating).
  861. * PF15 - PIN15 (input floating).
  862. */
  863. #define VAL_GPIOF_MODER (PIN_MODE_INPUT(GPIOF_PIN0) | \
  864. PIN_MODE_INPUT(GPIOF_PIN1) | \
  865. PIN_MODE_INPUT(GPIOF_PIN2) | \
  866. PIN_MODE_INPUT(GPIOF_PIN3) | \
  867. PIN_MODE_INPUT(GPIOF_PIN4) | \
  868. PIN_MODE_INPUT(GPIOF_PIN5) | \
  869. PIN_MODE_INPUT(GPIOF_PIN6) | \
  870. PIN_MODE_INPUT(GPIOF_PIN7) | \
  871. PIN_MODE_INPUT(GPIOF_PIN8) | \
  872. PIN_MODE_INPUT(GPIOF_PIN9) | \
  873. PIN_MODE_INPUT(GPIOF_PIN10) | \
  874. PIN_MODE_INPUT(GPIOF_PIN11) | \
  875. PIN_MODE_INPUT(GPIOF_PIN12) | \
  876. PIN_MODE_INPUT(GPIOF_PIN13) | \
  877. PIN_MODE_INPUT(GPIOF_PIN14) | \
  878. PIN_MODE_INPUT(GPIOF_PIN15))
  879. #define VAL_GPIOF_OTYPER (PIN_OTYPE_PUSHPULL(GPIOF_PIN0) | \
  880. PIN_OTYPE_PUSHPULL(GPIOF_PIN1) | \
  881. PIN_OTYPE_PUSHPULL(GPIOF_PIN2) | \
  882. PIN_OTYPE_PUSHPULL(GPIOF_PIN3) | \
  883. PIN_OTYPE_PUSHPULL(GPIOF_PIN4) | \
  884. PIN_OTYPE_PUSHPULL(GPIOF_PIN5) | \
  885. PIN_OTYPE_PUSHPULL(GPIOF_PIN6) | \
  886. PIN_OTYPE_PUSHPULL(GPIOF_PIN7) | \
  887. PIN_OTYPE_PUSHPULL(GPIOF_PIN8) | \
  888. PIN_OTYPE_PUSHPULL(GPIOF_PIN9) | \
  889. PIN_OTYPE_PUSHPULL(GPIOF_PIN10) | \
  890. PIN_OTYPE_PUSHPULL(GPIOF_PIN11) | \
  891. PIN_OTYPE_PUSHPULL(GPIOF_PIN12) | \
  892. PIN_OTYPE_PUSHPULL(GPIOF_PIN13) | \
  893. PIN_OTYPE_PUSHPULL(GPIOF_PIN14) | \
  894. PIN_OTYPE_PUSHPULL(GPIOF_PIN15))
  895. #define VAL_GPIOF_OSPEEDR (PIN_OSPEED_HIGH(GPIOF_PIN0) | \
  896. PIN_OSPEED_HIGH(GPIOF_PIN1) | \
  897. PIN_OSPEED_HIGH(GPIOF_PIN2) | \
  898. PIN_OSPEED_HIGH(GPIOF_PIN3) | \
  899. PIN_OSPEED_HIGH(GPIOF_PIN4) | \
  900. PIN_OSPEED_HIGH(GPIOF_PIN5) | \
  901. PIN_OSPEED_HIGH(GPIOF_PIN6) | \
  902. PIN_OSPEED_HIGH(GPIOF_PIN7) | \
  903. PIN_OSPEED_HIGH(GPIOF_PIN8) | \
  904. PIN_OSPEED_HIGH(GPIOF_PIN9) | \
  905. PIN_OSPEED_HIGH(GPIOF_PIN10) | \
  906. PIN_OSPEED_HIGH(GPIOF_PIN11) | \
  907. PIN_OSPEED_HIGH(GPIOF_PIN12) | \
  908. PIN_OSPEED_HIGH(GPIOF_PIN13) | \
  909. PIN_OSPEED_HIGH(GPIOF_PIN14) | \
  910. PIN_OSPEED_HIGH(GPIOF_PIN15))
  911. #define VAL_GPIOF_PUPDR (PIN_PUPDR_FLOATING(GPIOF_PIN0) | \
  912. PIN_PUPDR_FLOATING(GPIOF_PIN1) | \
  913. PIN_PUPDR_FLOATING(GPIOF_PIN2) | \
  914. PIN_PUPDR_FLOATING(GPIOF_PIN3) | \
  915. PIN_PUPDR_FLOATING(GPIOF_PIN4) | \
  916. PIN_PUPDR_FLOATING(GPIOF_PIN5) | \
  917. PIN_PUPDR_FLOATING(GPIOF_PIN6) | \
  918. PIN_PUPDR_FLOATING(GPIOF_PIN7) | \
  919. PIN_PUPDR_FLOATING(GPIOF_PIN8) | \
  920. PIN_PUPDR_FLOATING(GPIOF_PIN9) | \
  921. PIN_PUPDR_FLOATING(GPIOF_PIN10) | \
  922. PIN_PUPDR_FLOATING(GPIOF_PIN11) | \
  923. PIN_PUPDR_FLOATING(GPIOF_PIN12) | \
  924. PIN_PUPDR_FLOATING(GPIOF_PIN13) | \
  925. PIN_PUPDR_FLOATING(GPIOF_PIN14) | \
  926. PIN_PUPDR_FLOATING(GPIOF_PIN15))
  927. #define VAL_GPIOF_ODR (PIN_ODR_HIGH(GPIOF_PIN0) | \
  928. PIN_ODR_HIGH(GPIOF_PIN1) | \
  929. PIN_ODR_HIGH(GPIOF_PIN2) | \
  930. PIN_ODR_HIGH(GPIOF_PIN3) | \
  931. PIN_ODR_HIGH(GPIOF_PIN4) | \
  932. PIN_ODR_HIGH(GPIOF_PIN5) | \
  933. PIN_ODR_HIGH(GPIOF_PIN6) | \
  934. PIN_ODR_HIGH(GPIOF_PIN7) | \
  935. PIN_ODR_HIGH(GPIOF_PIN8) | \
  936. PIN_ODR_HIGH(GPIOF_PIN9) | \
  937. PIN_ODR_HIGH(GPIOF_PIN10) | \
  938. PIN_ODR_HIGH(GPIOF_PIN11) | \
  939. PIN_ODR_HIGH(GPIOF_PIN12) | \
  940. PIN_ODR_HIGH(GPIOF_PIN13) | \
  941. PIN_ODR_HIGH(GPIOF_PIN14) | \
  942. PIN_ODR_HIGH(GPIOF_PIN15))
  943. #define VAL_GPIOF_AFRL (PIN_AFIO_AF(GPIOF_PIN0, 0U) | \
  944. PIN_AFIO_AF(GPIOF_PIN1, 0U) | \
  945. PIN_AFIO_AF(GPIOF_PIN2, 0U) | \
  946. PIN_AFIO_AF(GPIOF_PIN3, 0U) | \
  947. PIN_AFIO_AF(GPIOF_PIN4, 0U) | \
  948. PIN_AFIO_AF(GPIOF_PIN5, 0U) | \
  949. PIN_AFIO_AF(GPIOF_PIN6, 0U) | \
  950. PIN_AFIO_AF(GPIOF_PIN7, 0U))
  951. #define VAL_GPIOF_AFRH (PIN_AFIO_AF(GPIOF_PIN8, 0U) | \
  952. PIN_AFIO_AF(GPIOF_PIN9, 0U) | \
  953. PIN_AFIO_AF(GPIOF_PIN10, 0U) | \
  954. PIN_AFIO_AF(GPIOF_PIN11, 0U) | \
  955. PIN_AFIO_AF(GPIOF_PIN12, 0U) | \
  956. PIN_AFIO_AF(GPIOF_PIN13, 0U) | \
  957. PIN_AFIO_AF(GPIOF_PIN14, 0U) | \
  958. PIN_AFIO_AF(GPIOF_PIN15, 0U))
  959. /*
  960. * GPIOG setup:
  961. *
  962. * PG0 - PIN0 (input floating).
  963. * PG1 - PIN1 (input floating).
  964. * PG2 - PIN2 (input floating).
  965. * PG3 - PIN3 (input floating).
  966. * PG4 - PIN4 (input floating).
  967. * PG5 - PIN5 (input floating).
  968. * PG6 - PIN6 (input floating).
  969. * PG7 - PIN7 (input floating).
  970. * PG8 - PIN8 (input floating).
  971. * PG9 - PIN9 (input floating).
  972. * PG10 - PIN10 (input floating).
  973. * PG11 - PIN11 (input floating).
  974. * PG12 - PIN12 (input floating).
  975. * PG13 - PIN13 (input floating).
  976. * PG14 - PIN14 (input floating).
  977. * PG15 - PIN15 (input floating).
  978. */
  979. #define VAL_GPIOG_MODER (PIN_MODE_INPUT(GPIOG_PIN0) | \
  980. PIN_MODE_INPUT(GPIOG_PIN1) | \
  981. PIN_MODE_INPUT(GPIOG_PIN2) | \
  982. PIN_MODE_INPUT(GPIOG_PIN3) | \
  983. PIN_MODE_INPUT(GPIOG_PIN4) | \
  984. PIN_MODE_INPUT(GPIOG_PIN5) | \
  985. PIN_MODE_INPUT(GPIOG_PIN6) | \
  986. PIN_MODE_INPUT(GPIOG_PIN7) | \
  987. PIN_MODE_INPUT(GPIOG_PIN8) | \
  988. PIN_MODE_INPUT(GPIOG_PIN9) | \
  989. PIN_MODE_INPUT(GPIOG_PIN10) | \
  990. PIN_MODE_INPUT(GPIOG_PIN11) | \
  991. PIN_MODE_INPUT(GPIOG_PIN12) | \
  992. PIN_MODE_INPUT(GPIOG_PIN13) | \
  993. PIN_MODE_INPUT(GPIOG_PIN14) | \
  994. PIN_MODE_INPUT(GPIOG_PIN15))
  995. #define VAL_GPIOG_OTYPER (PIN_OTYPE_PUSHPULL(GPIOG_PIN0) | \
  996. PIN_OTYPE_PUSHPULL(GPIOG_PIN1) | \
  997. PIN_OTYPE_PUSHPULL(GPIOG_PIN2) | \
  998. PIN_OTYPE_PUSHPULL(GPIOG_PIN3) | \
  999. PIN_OTYPE_PUSHPULL(GPIOG_PIN4) | \
  1000. PIN_OTYPE_PUSHPULL(GPIOG_PIN5) | \
  1001. PIN_OTYPE_PUSHPULL(GPIOG_PIN6) | \
  1002. PIN_OTYPE_PUSHPULL(GPIOG_PIN7) | \
  1003. PIN_OTYPE_PUSHPULL(GPIOG_PIN8) | \
  1004. PIN_OTYPE_PUSHPULL(GPIOG_PIN9) | \
  1005. PIN_OTYPE_PUSHPULL(GPIOG_PIN10) | \
  1006. PIN_OTYPE_PUSHPULL(GPIOG_PIN11) | \
  1007. PIN_OTYPE_PUSHPULL(GPIOG_PIN12) | \
  1008. PIN_OTYPE_PUSHPULL(GPIOG_PIN13) | \
  1009. PIN_OTYPE_PUSHPULL(GPIOG_PIN14) | \
  1010. PIN_OTYPE_PUSHPULL(GPIOG_PIN15))
  1011. #define VAL_GPIOG_OSPEEDR (PIN_OSPEED_HIGH(GPIOG_PIN0) | \
  1012. PIN_OSPEED_HIGH(GPIOG_PIN1) | \
  1013. PIN_OSPEED_HIGH(GPIOG_PIN2) | \
  1014. PIN_OSPEED_HIGH(GPIOG_PIN3) | \
  1015. PIN_OSPEED_HIGH(GPIOG_PIN4) | \
  1016. PIN_OSPEED_HIGH(GPIOG_PIN5) | \
  1017. PIN_OSPEED_HIGH(GPIOG_PIN6) | \
  1018. PIN_OSPEED_HIGH(GPIOG_PIN7) | \
  1019. PIN_OSPEED_HIGH(GPIOG_PIN8) | \
  1020. PIN_OSPEED_HIGH(GPIOG_PIN9) | \
  1021. PIN_OSPEED_HIGH(GPIOG_PIN10) | \
  1022. PIN_OSPEED_HIGH(GPIOG_PIN11) | \
  1023. PIN_OSPEED_HIGH(GPIOG_PIN12) | \
  1024. PIN_OSPEED_HIGH(GPIOG_PIN13) | \
  1025. PIN_OSPEED_HIGH(GPIOG_PIN14) | \
  1026. PIN_OSPEED_HIGH(GPIOG_PIN15))
  1027. #define VAL_GPIOG_PUPDR (PIN_PUPDR_FLOATING(GPIOG_PIN0) | \
  1028. PIN_PUPDR_FLOATING(GPIOG_PIN1) | \
  1029. PIN_PUPDR_FLOATING(GPIOG_PIN2) | \
  1030. PIN_PUPDR_FLOATING(GPIOG_PIN3) | \
  1031. PIN_PUPDR_FLOATING(GPIOG_PIN4) | \
  1032. PIN_PUPDR_FLOATING(GPIOG_PIN5) | \
  1033. PIN_PUPDR_FLOATING(GPIOG_PIN6) | \
  1034. PIN_PUPDR_FLOATING(GPIOG_PIN7) | \
  1035. PIN_PUPDR_FLOATING(GPIOG_PIN8) | \
  1036. PIN_PUPDR_FLOATING(GPIOG_PIN9) | \
  1037. PIN_PUPDR_FLOATING(GPIOG_PIN10) | \
  1038. PIN_PUPDR_FLOATING(GPIOG_PIN11) | \
  1039. PIN_PUPDR_FLOATING(GPIOG_PIN12) | \
  1040. PIN_PUPDR_FLOATING(GPIOG_PIN13) | \
  1041. PIN_PUPDR_FLOATING(GPIOG_PIN14) | \
  1042. PIN_PUPDR_FLOATING(GPIOG_PIN15))
  1043. #define VAL_GPIOG_ODR (PIN_ODR_HIGH(GPIOG_PIN0) | \
  1044. PIN_ODR_HIGH(GPIOG_PIN1) | \
  1045. PIN_ODR_HIGH(GPIOG_PIN2) | \
  1046. PIN_ODR_HIGH(GPIOG_PIN3) | \
  1047. PIN_ODR_HIGH(GPIOG_PIN4) | \
  1048. PIN_ODR_HIGH(GPIOG_PIN5) | \
  1049. PIN_ODR_HIGH(GPIOG_PIN6) | \
  1050. PIN_ODR_HIGH(GPIOG_PIN7) | \
  1051. PIN_ODR_HIGH(GPIOG_PIN8) | \
  1052. PIN_ODR_HIGH(GPIOG_PIN9) | \
  1053. PIN_ODR_HIGH(GPIOG_PIN10) | \
  1054. PIN_ODR_HIGH(GPIOG_PIN11) | \
  1055. PIN_ODR_HIGH(GPIOG_PIN12) | \
  1056. PIN_ODR_HIGH(GPIOG_PIN13) | \
  1057. PIN_ODR_HIGH(GPIOG_PIN14) | \
  1058. PIN_ODR_HIGH(GPIOG_PIN15))
  1059. #define VAL_GPIOG_AFRL (PIN_AFIO_AF(GPIOG_PIN0, 0U) | \
  1060. PIN_AFIO_AF(GPIOG_PIN1, 0U) | \
  1061. PIN_AFIO_AF(GPIOG_PIN2, 0U) | \
  1062. PIN_AFIO_AF(GPIOG_PIN3, 0U) | \
  1063. PIN_AFIO_AF(GPIOG_PIN4, 0U) | \
  1064. PIN_AFIO_AF(GPIOG_PIN5, 0U) | \
  1065. PIN_AFIO_AF(GPIOG_PIN6, 0U) | \
  1066. PIN_AFIO_AF(GPIOG_PIN7, 0U))
  1067. #define VAL_GPIOG_AFRH (PIN_AFIO_AF(GPIOG_PIN8, 0U) | \
  1068. PIN_AFIO_AF(GPIOG_PIN9, 0U) | \
  1069. PIN_AFIO_AF(GPIOG_PIN10, 0U) | \
  1070. PIN_AFIO_AF(GPIOG_PIN11, 0U) | \
  1071. PIN_AFIO_AF(GPIOG_PIN12, 0U) | \
  1072. PIN_AFIO_AF(GPIOG_PIN13, 0U) | \
  1073. PIN_AFIO_AF(GPIOG_PIN14, 0U) | \
  1074. PIN_AFIO_AF(GPIOG_PIN15, 0U))
  1075. /*
  1076. * GPIOH setup:
  1077. *
  1078. * PH0 - OSC_IN (input floating).
  1079. * PH1 - OSC_OUT (input floating).
  1080. * PH2 - PIN2 (input floating).
  1081. * PH3 - PIN3 (input floating).
  1082. * PH4 - PIN4 (input floating).
  1083. * PH5 - PIN5 (input floating).
  1084. * PH6 - PIN6 (input floating).
  1085. * PH7 - PIN7 (input floating).
  1086. * PH8 - PIN8 (input floating).
  1087. * PH9 - PIN9 (input floating).
  1088. * PH10 - PIN10 (input floating).
  1089. * PH11 - PIN11 (input floating).
  1090. * PH12 - PIN12 (input floating).
  1091. * PH13 - PIN13 (input floating).
  1092. * PH14 - PIN14 (input floating).
  1093. * PH15 - PIN15 (input floating).
  1094. */
  1095. #define VAL_GPIOH_MODER (PIN_MODE_INPUT(GPIOH_OSC_IN) | \
  1096. PIN_MODE_INPUT(GPIOH_OSC_OUT) | \
  1097. PIN_MODE_INPUT(GPIOH_PIN2) | \
  1098. PIN_MODE_INPUT(GPIOH_PIN3) | \
  1099. PIN_MODE_INPUT(GPIOH_PIN4) | \
  1100. PIN_MODE_INPUT(GPIOH_PIN5) | \
  1101. PIN_MODE_INPUT(GPIOH_PIN6) | \
  1102. PIN_MODE_INPUT(GPIOH_PIN7) | \
  1103. PIN_MODE_INPUT(GPIOH_PIN8) | \
  1104. PIN_MODE_INPUT(GPIOH_PIN9) | \
  1105. PIN_MODE_INPUT(GPIOH_PIN10) | \
  1106. PIN_MODE_INPUT(GPIOH_PIN11) | \
  1107. PIN_MODE_INPUT(GPIOH_PIN12) | \
  1108. PIN_MODE_INPUT(GPIOH_PIN13) | \
  1109. PIN_MODE_INPUT(GPIOH_PIN14) | \
  1110. PIN_MODE_INPUT(GPIOH_PIN15))
  1111. #define VAL_GPIOH_OTYPER (PIN_OTYPE_PUSHPULL(GPIOH_OSC_IN) | \
  1112. PIN_OTYPE_PUSHPULL(GPIOH_OSC_OUT) | \
  1113. PIN_OTYPE_PUSHPULL(GPIOH_PIN2) | \
  1114. PIN_OTYPE_PUSHPULL(GPIOH_PIN3) | \
  1115. PIN_OTYPE_PUSHPULL(GPIOH_PIN4) | \
  1116. PIN_OTYPE_PUSHPULL(GPIOH_PIN5) | \
  1117. PIN_OTYPE_PUSHPULL(GPIOH_PIN6) | \
  1118. PIN_OTYPE_PUSHPULL(GPIOH_PIN7) | \
  1119. PIN_OTYPE_PUSHPULL(GPIOH_PIN8) | \
  1120. PIN_OTYPE_PUSHPULL(GPIOH_PIN9) | \
  1121. PIN_OTYPE_PUSHPULL(GPIOH_PIN10) | \
  1122. PIN_OTYPE_PUSHPULL(GPIOH_PIN11) | \
  1123. PIN_OTYPE_PUSHPULL(GPIOH_PIN12) | \
  1124. PIN_OTYPE_PUSHPULL(GPIOH_PIN13) | \
  1125. PIN_OTYPE_PUSHPULL(GPIOH_PIN14) | \
  1126. PIN_OTYPE_PUSHPULL(GPIOH_PIN15))
  1127. #define VAL_GPIOH_OSPEEDR (PIN_OSPEED_HIGH(GPIOH_OSC_IN) | \
  1128. PIN_OSPEED_HIGH(GPIOH_OSC_OUT) | \
  1129. PIN_OSPEED_HIGH(GPIOH_PIN2) | \
  1130. PIN_OSPEED_HIGH(GPIOH_PIN3) | \
  1131. PIN_OSPEED_HIGH(GPIOH_PIN4) | \
  1132. PIN_OSPEED_HIGH(GPIOH_PIN5) | \
  1133. PIN_OSPEED_HIGH(GPIOH_PIN6) | \
  1134. PIN_OSPEED_HIGH(GPIOH_PIN7) | \
  1135. PIN_OSPEED_HIGH(GPIOH_PIN8) | \
  1136. PIN_OSPEED_HIGH(GPIOH_PIN9) | \
  1137. PIN_OSPEED_HIGH(GPIOH_PIN10) | \
  1138. PIN_OSPEED_HIGH(GPIOH_PIN11) | \
  1139. PIN_OSPEED_HIGH(GPIOH_PIN12) | \
  1140. PIN_OSPEED_HIGH(GPIOH_PIN13) | \
  1141. PIN_OSPEED_HIGH(GPIOH_PIN14) | \
  1142. PIN_OSPEED_HIGH(GPIOH_PIN15))
  1143. #define VAL_GPIOH_PUPDR (PIN_PUPDR_FLOATING(GPIOH_OSC_IN) | \
  1144. PIN_PUPDR_FLOATING(GPIOH_OSC_OUT) | \
  1145. PIN_PUPDR_FLOATING(GPIOH_PIN2) | \
  1146. PIN_PUPDR_FLOATING(GPIOH_PIN3) | \
  1147. PIN_PUPDR_FLOATING(GPIOH_PIN4) | \
  1148. PIN_PUPDR_FLOATING(GPIOH_PIN5) | \
  1149. PIN_PUPDR_FLOATING(GPIOH_PIN6) | \
  1150. PIN_PUPDR_FLOATING(GPIOH_PIN7) | \
  1151. PIN_PUPDR_FLOATING(GPIOH_PIN8) | \
  1152. PIN_PUPDR_FLOATING(GPIOH_PIN9) | \
  1153. PIN_PUPDR_FLOATING(GPIOH_PIN10) | \
  1154. PIN_PUPDR_FLOATING(GPIOH_PIN11) | \
  1155. PIN_PUPDR_FLOATING(GPIOH_PIN12) | \
  1156. PIN_PUPDR_FLOATING(GPIOH_PIN13) | \
  1157. PIN_PUPDR_FLOATING(GPIOH_PIN14) | \
  1158. PIN_PUPDR_FLOATING(GPIOH_PIN15))
  1159. #define VAL_GPIOH_ODR (PIN_ODR_HIGH(GPIOH_OSC_IN) | \
  1160. PIN_ODR_HIGH(GPIOH_OSC_OUT) | \
  1161. PIN_ODR_HIGH(GPIOH_PIN2) | \
  1162. PIN_ODR_HIGH(GPIOH_PIN3) | \
  1163. PIN_ODR_HIGH(GPIOH_PIN4) | \
  1164. PIN_ODR_HIGH(GPIOH_PIN5) | \
  1165. PIN_ODR_HIGH(GPIOH_PIN6) | \
  1166. PIN_ODR_HIGH(GPIOH_PIN7) | \
  1167. PIN_ODR_HIGH(GPIOH_PIN8) | \
  1168. PIN_ODR_HIGH(GPIOH_PIN9) | \
  1169. PIN_ODR_HIGH(GPIOH_PIN10) | \
  1170. PIN_ODR_HIGH(GPIOH_PIN11) | \
  1171. PIN_ODR_HIGH(GPIOH_PIN12) | \
  1172. PIN_ODR_HIGH(GPIOH_PIN13) | \
  1173. PIN_ODR_HIGH(GPIOH_PIN14) | \
  1174. PIN_ODR_HIGH(GPIOH_PIN15))
  1175. #define VAL_GPIOH_AFRL (PIN_AFIO_AF(GPIOH_OSC_IN, 0U) | \
  1176. PIN_AFIO_AF(GPIOH_OSC_OUT, 0U) | \
  1177. PIN_AFIO_AF(GPIOH_PIN2, 0U) | \
  1178. PIN_AFIO_AF(GPIOH_PIN3, 0U) | \
  1179. PIN_AFIO_AF(GPIOH_PIN4, 0U) | \
  1180. PIN_AFIO_AF(GPIOH_PIN5, 0U) | \
  1181. PIN_AFIO_AF(GPIOH_PIN6, 0U) | \
  1182. PIN_AFIO_AF(GPIOH_PIN7, 0U))
  1183. #define VAL_GPIOH_AFRH (PIN_AFIO_AF(GPIOH_PIN8, 0U) | \
  1184. PIN_AFIO_AF(GPIOH_PIN9, 0U) | \
  1185. PIN_AFIO_AF(GPIOH_PIN10, 0U) | \
  1186. PIN_AFIO_AF(GPIOH_PIN11, 0U) | \
  1187. PIN_AFIO_AF(GPIOH_PIN12, 0U) | \
  1188. PIN_AFIO_AF(GPIOH_PIN13, 0U) | \
  1189. PIN_AFIO_AF(GPIOH_PIN14, 0U) | \
  1190. PIN_AFIO_AF(GPIOH_PIN15, 0U))
  1191. /*
  1192. * GPIOI setup:
  1193. *
  1194. * PI0 - PIN0 (input floating).
  1195. * PI1 - PIN1 (input floating).
  1196. * PI2 - PIN2 (input floating).
  1197. * PI3 - PIN3 (input floating).
  1198. * PI4 - PIN4 (input floating).
  1199. * PI5 - PIN5 (input floating).
  1200. * PI6 - PIN6 (input floating).
  1201. * PI7 - PIN7 (input floating).
  1202. * PI8 - PIN8 (input floating).
  1203. * PI9 - PIN9 (input floating).
  1204. * PI10 - PIN10 (input floating).
  1205. * PI11 - PIN11 (input floating).
  1206. * PI12 - PIN12 (input floating).
  1207. * PI13 - PIN13 (input floating).
  1208. * PI14 - PIN14 (input floating).
  1209. * PI15 - PIN15 (input floating).
  1210. */
  1211. #define VAL_GPIOI_MODER (PIN_MODE_INPUT(GPIOI_PIN0) | \
  1212. PIN_MODE_INPUT(GPIOI_PIN1) | \
  1213. PIN_MODE_INPUT(GPIOI_PIN2) | \
  1214. PIN_MODE_INPUT(GPIOI_PIN3) | \
  1215. PIN_MODE_INPUT(GPIOI_PIN4) | \
  1216. PIN_MODE_INPUT(GPIOI_PIN5) | \
  1217. PIN_MODE_INPUT(GPIOI_PIN6) | \
  1218. PIN_MODE_INPUT(GPIOI_PIN7) | \
  1219. PIN_MODE_INPUT(GPIOI_PIN8) | \
  1220. PIN_MODE_INPUT(GPIOI_PIN9) | \
  1221. PIN_MODE_INPUT(GPIOI_PIN10) | \
  1222. PIN_MODE_INPUT(GPIOI_PIN11) | \
  1223. PIN_MODE_INPUT(GPIOI_PIN12) | \
  1224. PIN_MODE_INPUT(GPIOI_PIN13) | \
  1225. PIN_MODE_INPUT(GPIOI_PIN14) | \
  1226. PIN_MODE_INPUT(GPIOI_PIN15))
  1227. #define VAL_GPIOI_OTYPER (PIN_OTYPE_PUSHPULL(GPIOI_PIN0) | \
  1228. PIN_OTYPE_PUSHPULL(GPIOI_PIN1) | \
  1229. PIN_OTYPE_PUSHPULL(GPIOI_PIN2) | \
  1230. PIN_OTYPE_PUSHPULL(GPIOI_PIN3) | \
  1231. PIN_OTYPE_PUSHPULL(GPIOI_PIN4) | \
  1232. PIN_OTYPE_PUSHPULL(GPIOI_PIN5) | \
  1233. PIN_OTYPE_PUSHPULL(GPIOI_PIN6) | \
  1234. PIN_OTYPE_PUSHPULL(GPIOI_PIN7) | \
  1235. PIN_OTYPE_PUSHPULL(GPIOI_PIN8) | \
  1236. PIN_OTYPE_PUSHPULL(GPIOI_PIN9) | \
  1237. PIN_OTYPE_PUSHPULL(GPIOI_PIN10) | \
  1238. PIN_OTYPE_PUSHPULL(GPIOI_PIN11) | \
  1239. PIN_OTYPE_PUSHPULL(GPIOI_PIN12) | \
  1240. PIN_OTYPE_PUSHPULL(GPIOI_PIN13) | \
  1241. PIN_OTYPE_PUSHPULL(GPIOI_PIN14) | \
  1242. PIN_OTYPE_PUSHPULL(GPIOI_PIN15))
  1243. #define VAL_GPIOI_OSPEEDR (PIN_OSPEED_HIGH(GPIOI_PIN0) | \
  1244. PIN_OSPEED_HIGH(GPIOI_PIN1) | \
  1245. PIN_OSPEED_HIGH(GPIOI_PIN2) | \
  1246. PIN_OSPEED_HIGH(GPIOI_PIN3) | \
  1247. PIN_OSPEED_HIGH(GPIOI_PIN4) | \
  1248. PIN_OSPEED_HIGH(GPIOI_PIN5) | \
  1249. PIN_OSPEED_HIGH(GPIOI_PIN6) | \
  1250. PIN_OSPEED_HIGH(GPIOI_PIN7) | \
  1251. PIN_OSPEED_HIGH(GPIOI_PIN8) | \
  1252. PIN_OSPEED_HIGH(GPIOI_PIN9) | \
  1253. PIN_OSPEED_HIGH(GPIOI_PIN10) | \
  1254. PIN_OSPEED_HIGH(GPIOI_PIN11) | \
  1255. PIN_OSPEED_HIGH(GPIOI_PIN12) | \
  1256. PIN_OSPEED_HIGH(GPIOI_PIN13) | \
  1257. PIN_OSPEED_HIGH(GPIOI_PIN14) | \
  1258. PIN_OSPEED_HIGH(GPIOI_PIN15))
  1259. #define VAL_GPIOI_PUPDR (PIN_PUPDR_FLOATING(GPIOI_PIN0) | \
  1260. PIN_PUPDR_FLOATING(GPIOI_PIN1) | \
  1261. PIN_PUPDR_FLOATING(GPIOI_PIN2) | \
  1262. PIN_PUPDR_FLOATING(GPIOI_PIN3) | \
  1263. PIN_PUPDR_FLOATING(GPIOI_PIN4) | \
  1264. PIN_PUPDR_FLOATING(GPIOI_PIN5) | \
  1265. PIN_PUPDR_FLOATING(GPIOI_PIN6) | \
  1266. PIN_PUPDR_FLOATING(GPIOI_PIN7) | \
  1267. PIN_PUPDR_FLOATING(GPIOI_PIN8) | \
  1268. PIN_PUPDR_FLOATING(GPIOI_PIN9) | \
  1269. PIN_PUPDR_FLOATING(GPIOI_PIN10) | \
  1270. PIN_PUPDR_FLOATING(GPIOI_PIN11) | \
  1271. PIN_PUPDR_FLOATING(GPIOI_PIN12) | \
  1272. PIN_PUPDR_FLOATING(GPIOI_PIN13) | \
  1273. PIN_PUPDR_FLOATING(GPIOI_PIN14) | \
  1274. PIN_PUPDR_FLOATING(GPIOI_PIN15))
  1275. #define VAL_GPIOI_ODR (PIN_ODR_HIGH(GPIOI_PIN0) | \
  1276. PIN_ODR_HIGH(GPIOI_PIN1) | \
  1277. PIN_ODR_HIGH(GPIOI_PIN2) | \
  1278. PIN_ODR_HIGH(GPIOI_PIN3) | \
  1279. PIN_ODR_HIGH(GPIOI_PIN4) | \
  1280. PIN_ODR_HIGH(GPIOI_PIN5) | \
  1281. PIN_ODR_HIGH(GPIOI_PIN6) | \
  1282. PIN_ODR_HIGH(GPIOI_PIN7) | \
  1283. PIN_ODR_HIGH(GPIOI_PIN8) | \
  1284. PIN_ODR_HIGH(GPIOI_PIN9) | \
  1285. PIN_ODR_HIGH(GPIOI_PIN10) | \
  1286. PIN_ODR_HIGH(GPIOI_PIN11) | \
  1287. PIN_ODR_HIGH(GPIOI_PIN12) | \
  1288. PIN_ODR_HIGH(GPIOI_PIN13) | \
  1289. PIN_ODR_HIGH(GPIOI_PIN14) | \
  1290. PIN_ODR_HIGH(GPIOI_PIN15))
  1291. #define VAL_GPIOI_AFRL (PIN_AFIO_AF(GPIOI_PIN0, 0U) | \
  1292. PIN_AFIO_AF(GPIOI_PIN1, 0U) | \
  1293. PIN_AFIO_AF(GPIOI_PIN2, 0U) | \
  1294. PIN_AFIO_AF(GPIOI_PIN3, 0U) | \
  1295. PIN_AFIO_AF(GPIOI_PIN4, 0U) | \
  1296. PIN_AFIO_AF(GPIOI_PIN5, 0U) | \
  1297. PIN_AFIO_AF(GPIOI_PIN6, 0U) | \
  1298. PIN_AFIO_AF(GPIOI_PIN7, 0U))
  1299. #define VAL_GPIOI_AFRH (PIN_AFIO_AF(GPIOI_PIN8, 0U) | \
  1300. PIN_AFIO_AF(GPIOI_PIN9, 0U) | \
  1301. PIN_AFIO_AF(GPIOI_PIN10, 0U) | \
  1302. PIN_AFIO_AF(GPIOI_PIN11, 0U) | \
  1303. PIN_AFIO_AF(GPIOI_PIN12, 0U) | \
  1304. PIN_AFIO_AF(GPIOI_PIN13, 0U) | \
  1305. PIN_AFIO_AF(GPIOI_PIN14, 0U) | \
  1306. PIN_AFIO_AF(GPIOI_PIN15, 0U))
  1307. /*===========================================================================*/
  1308. /* External declarations. */
  1309. /*===========================================================================*/
  1310. #if !defined(_FROM_ASM_)
  1311. #ifdef __cplusplus
  1312. extern "C" {
  1313. #endif
  1314. void boardInit(void);
  1315. #ifdef __cplusplus
  1316. }
  1317. #endif
  1318. #endif /* _FROM_ASM_ */
  1319. #endif /* BOARD_H */