board.h 98 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542
  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 STM32L476-Discovery board.
  24. */
  25. /*
  26. * Board identifier.
  27. */
  28. #define BOARD_ST_STM32L476_DISCOVERY
  29. #define BOARD_NAME "STMicroelectronics STM32L476-Discovery"
  30. /*
  31. * Board oscillators-related settings.
  32. * NOTE: HSE not fitted.
  33. */
  34. #if !defined(STM32_LSECLK)
  35. #define STM32_LSECLK 32768U
  36. #endif
  37. #define STM32_LSEDRV (3U << 3U)
  38. #if !defined(STM32_HSECLK)
  39. #define STM32_HSECLK 0U
  40. #endif
  41. /*
  42. * Board voltages.
  43. * Required for performance limits calculation.
  44. */
  45. #define STM32_VDD 300U
  46. /*
  47. * MCU type as defined in the ST header.
  48. */
  49. #define STM32L476xx
  50. /*
  51. * IO pins assignments.
  52. */
  53. #define GPIOA_JOY_CENTER 0U
  54. #define GPIOA_JOY_LEFT 1U
  55. #define GPIOA_JOY_RIGHT 2U
  56. #define GPIOA_JOY_UP 3U
  57. #define GPIOA_MFX_WAKEUP 4U
  58. #define GPIOA_JOY_DOWN 5U
  59. #define GPIOA_LCD_SEG23 6U
  60. #define GPIOA_LCD_SEG0 7U
  61. #define GPIOA_LCD_COM0 8U
  62. #define GPIOA_LCD_COM1 9U
  63. #define GPIOA_LCD_COM2 10U
  64. #define GPIOA_OTG_FS_DM 11U
  65. #define GPIOA_OTG_FS_DP 12U
  66. #define GPIOA_SWDIO 13U
  67. #define GPIOA_SWCLK 14U
  68. #define GPIOA_PIN15 15U
  69. #define GPIOB_LCD_SEG21 0U
  70. #define GPIOB_LCD_SEG2 1U
  71. #define GPIOB_LED_RED 2U
  72. #define GPIOB_SWO 3U
  73. #define GPIOB_REG_ON_3V3 3U
  74. #define GPIOB_LCD_SEG11 4U
  75. #define GPIOB_LCD_SEG12 5U
  76. #define GPIOB_I2C1_SCL 6U
  77. #define GPIOB_I2C1_SDA 7U
  78. #define GPIOB_GYRO_INT2 8U
  79. #define GPIOB_LCD_COM3 9U
  80. #define GPIOB_MFX_I2C_SCL 10U
  81. #define GPIOB_I2C2_SCL 10U
  82. #define GPIOB_MFX_I2C_SDA 11U
  83. #define GPIOB_I2C2_SDA 11U
  84. #define GPIOB_LCD_SEG20 12U
  85. #define GPIOB_LCD_SEG3 13U
  86. #define GPIOB_LCD_SEG19 14U
  87. #define GPIOB_LCD_SEG4 15U
  88. #define GPIOC_MAG_CS 0U
  89. #define GPIOC_MAG_INT 1U
  90. #define GPIOC_MAG_DRDY 2U
  91. #define GPIOC_LCD_VLCD 3U
  92. #define GPIOC_LCD_SEG22 4U
  93. #define GPIOC_LCD_SEG1 5U
  94. #define GPIOC_LCD_SEG14 6U
  95. #define GPIOC_LCD_SEG9 7U
  96. #define GPIOC_LCD_SEG13 8U
  97. #define GPIOC_OTG_FS_PSON 9U
  98. #define GPIOC_OTG_FS_OVCURR 10U
  99. #define GPIOC_OTG_FS_VBUS 11U
  100. #define GPIOC_OTG_FS_ID 12U
  101. #define GPIOC_MFX_IRQ_OUT 13U
  102. #define GPIOC_OSC32_IN 14U
  103. #define GPIOC_OSC32_OUT 15U
  104. #define GPIOD_EXT_RST 0U
  105. #define GPIOD_MEMS_SCK 1U
  106. #define GPIOD_GYRO_INT1 2U
  107. #define GPIOD_MEMS_MISO 3U
  108. #define GPIOD_MEMS_MOSI 4U
  109. #define GPIOD_USART_TX 5U
  110. #define GPIOD_USART_RX 6U
  111. #define GPIOD_GYRO_CS 7U
  112. #define GPIOD_LCD_SEG18 8U
  113. #define GPIOD_LCD_SEG5 9U
  114. #define GPIOD_LCD_SEG17 10U
  115. #define GPIOD_LCD_SEG6 11U
  116. #define GPIOD_LCD_SEG16 12U
  117. #define GPIOD_LCD_SEG7 13U
  118. #define GPIOD_LCD_SEG15 14U
  119. #define GPIOD_LCD_SEG8 15U
  120. #define GPIOE_XL_CS 0U
  121. #define GPIOE_XL_INT 1U
  122. #define GPIOE_SAI1_MCK 2U
  123. #define GPIOE_AUDIO_RST 3U
  124. #define GPIOE_SAI1_FS 4U
  125. #define GPIOE_SAI1_SCK 5U
  126. #define GPIOE_SAI1_SD 6U
  127. #define GPIOE_AUDIO_DIN 7U
  128. #define GPIOE_LED_GREEN 8U
  129. #define GPIOE_AUDIO_CLK 9U
  130. #define GPIOE_QSPI_CLK 10U
  131. #define GPIOE_QSPI_CS 11U
  132. #define GPIOE_QSPI_D0 12U
  133. #define GPIOE_QSPI_D1 13U
  134. #define GPIOE_QSPI_D2 14U
  135. #define GPIOE_QSPI_D3 15U
  136. #define GPIOF_PIN0 0U
  137. #define GPIOF_PIN1 1U
  138. #define GPIOF_PIN2 2U
  139. #define GPIOF_PIN3 3U
  140. #define GPIOF_PIN4 4U
  141. #define GPIOF_PIN5 5U
  142. #define GPIOF_PIN6 6U
  143. #define GPIOF_PIN7 7U
  144. #define GPIOF_PIN8 8U
  145. #define GPIOF_PIN9 9U
  146. #define GPIOF_PIN10 10U
  147. #define GPIOF_PIN11 11U
  148. #define GPIOF_PIN12 12U
  149. #define GPIOF_PIN13 13U
  150. #define GPIOF_PIN14 14U
  151. #define GPIOF_PIN15 15U
  152. #define GPIOG_PIN0 0U
  153. #define GPIOG_PIN1 1U
  154. #define GPIOG_PIN2 2U
  155. #define GPIOG_PIN3 3U
  156. #define GPIOG_PIN4 4U
  157. #define GPIOG_PIN5 5U
  158. #define GPIOG_PIN6 6U
  159. #define GPIOG_PIN7 7U
  160. #define GPIOG_PIN8 8U
  161. #define GPIOG_PIN9 9U
  162. #define GPIOG_PIN10 10U
  163. #define GPIOG_PIN11 11U
  164. #define GPIOG_PIN12 12U
  165. #define GPIOG_PIN13 13U
  166. #define GPIOG_PIN14 14U
  167. #define GPIOG_PIN15 15U
  168. #define GPIOH_OSC_IN 0U
  169. #define GPIOH_OSC_OUT 1U
  170. #define GPIOH_PIN2 2U
  171. #define GPIOH_PIN3 3U
  172. #define GPIOH_PIN4 4U
  173. #define GPIOH_PIN5 5U
  174. #define GPIOH_PIN6 6U
  175. #define GPIOH_PIN7 7U
  176. #define GPIOH_PIN8 8U
  177. #define GPIOH_PIN9 9U
  178. #define GPIOH_PIN10 10U
  179. #define GPIOH_PIN11 11U
  180. #define GPIOH_PIN12 12U
  181. #define GPIOH_PIN13 13U
  182. #define GPIOH_PIN14 14U
  183. #define GPIOH_PIN15 15U
  184. /*
  185. * IO lines assignments.
  186. */
  187. #define LINE_JOY_CENTER PAL_LINE(GPIOA, 0U)
  188. #define LINE_JOY_LEFT PAL_LINE(GPIOA, 1U)
  189. #define LINE_JOY_RIGHT PAL_LINE(GPIOA, 2U)
  190. #define LINE_JOY_UP PAL_LINE(GPIOA, 3U)
  191. #define LINE_MFX_WAKEUP PAL_LINE(GPIOA, 4U)
  192. #define LINE_JOY_DOWN PAL_LINE(GPIOA, 5U)
  193. #define LINE_LCD_SEG23 PAL_LINE(GPIOA, 6U)
  194. #define LINE_LCD_SEG0 PAL_LINE(GPIOA, 7U)
  195. #define LINE_LCD_COM0 PAL_LINE(GPIOA, 8U)
  196. #define LINE_LCD_COM1 PAL_LINE(GPIOA, 9U)
  197. #define LINE_LCD_COM2 PAL_LINE(GPIOA, 10U)
  198. #define LINE_OTG_FS_DM PAL_LINE(GPIOA, 11U)
  199. #define LINE_OTG_FS_DP PAL_LINE(GPIOA, 12U)
  200. #define LINE_SWDIO PAL_LINE(GPIOA, 13U)
  201. #define LINE_SWCLK PAL_LINE(GPIOA, 14U)
  202. #define LINE_LCD_SEG21 PAL_LINE(GPIOB, 0U)
  203. #define LINE_LCD_SEG2 PAL_LINE(GPIOB, 1U)
  204. #define LINE_LED_RED PAL_LINE(GPIOB, 2U)
  205. #define LINE_SWO PAL_LINE(GPIOB, 3U)
  206. #define LINE_REG_ON_3V3 PAL_LINE(GPIOB, 3U)
  207. #define LINE_LCD_SEG11 PAL_LINE(GPIOB, 4U)
  208. #define LINE_LCD_SEG12 PAL_LINE(GPIOB, 5U)
  209. #define LINE_I2C1_SCL PAL_LINE(GPIOB, 6U)
  210. #define LINE_I2C1_SDA PAL_LINE(GPIOB, 7U)
  211. #define LINE_GYRO_INT2 PAL_LINE(GPIOB, 8U)
  212. #define LINE_LCD_COM3 PAL_LINE(GPIOB, 9U)
  213. #define LINE_MFX_I2C_SCL PAL_LINE(GPIOB, 10U)
  214. #define LINE_I2C2_SCL PAL_LINE(GPIOB, 10U)
  215. #define LINE_MFX_I2C_SDA PAL_LINE(GPIOB, 11U)
  216. #define LINE_I2C2_SDA PAL_LINE(GPIOB, 11U)
  217. #define LINE_LCD_SEG20 PAL_LINE(GPIOB, 12U)
  218. #define LINE_LCD_SEG3 PAL_LINE(GPIOB, 13U)
  219. #define LINE_LCD_SEG19 PAL_LINE(GPIOB, 14U)
  220. #define LINE_LCD_SEG4 PAL_LINE(GPIOB, 15U)
  221. #define LINE_MAG_CS PAL_LINE(GPIOC, 0U)
  222. #define LINE_MAG_INT PAL_LINE(GPIOC, 1U)
  223. #define LINE_MAG_DRDY PAL_LINE(GPIOC, 2U)
  224. #define LINE_LCD_VLCD PAL_LINE(GPIOC, 3U)
  225. #define LINE_LCD_SEG22 PAL_LINE(GPIOC, 4U)
  226. #define LINE_LCD_SEG1 PAL_LINE(GPIOC, 5U)
  227. #define LINE_LCD_SEG14 PAL_LINE(GPIOC, 6U)
  228. #define LINE_LCD_SEG9 PAL_LINE(GPIOC, 7U)
  229. #define LINE_LCD_SEG13 PAL_LINE(GPIOC, 8U)
  230. #define LINE_OTG_FS_PSON PAL_LINE(GPIOC, 9U)
  231. #define LINE_OTG_FS_OVCURR PAL_LINE(GPIOC, 10U)
  232. #define LINE_OTG_FS_VBUS PAL_LINE(GPIOC, 11U)
  233. #define LINE_OTG_FS_ID PAL_LINE(GPIOC, 12U)
  234. #define LINE_MFX_IRQ_OUT PAL_LINE(GPIOC, 13U)
  235. #define LINE_OSC32_IN PAL_LINE(GPIOC, 14U)
  236. #define LINE_OSC32_OUT PAL_LINE(GPIOC, 15U)
  237. #define LINE_EXT_RST PAL_LINE(GPIOD, 0U)
  238. #define LINE_MEMS_SCK PAL_LINE(GPIOD, 1U)
  239. #define LINE_GYRO_INT1 PAL_LINE(GPIOD, 2U)
  240. #define LINE_MEMS_MISO PAL_LINE(GPIOD, 3U)
  241. #define LINE_MEMS_MOSI PAL_LINE(GPIOD, 4U)
  242. #define LINE_USART_TX PAL_LINE(GPIOD, 5U)
  243. #define LINE_USART_RX PAL_LINE(GPIOD, 6U)
  244. #define LINE_GYRO_CS PAL_LINE(GPIOD, 7U)
  245. #define LINE_LCD_SEG18 PAL_LINE(GPIOD, 8U)
  246. #define LINE_LCD_SEG5 PAL_LINE(GPIOD, 9U)
  247. #define LINE_LCD_SEG17 PAL_LINE(GPIOD, 10U)
  248. #define LINE_LCD_SEG6 PAL_LINE(GPIOD, 11U)
  249. #define LINE_LCD_SEG16 PAL_LINE(GPIOD, 12U)
  250. #define LINE_LCD_SEG7 PAL_LINE(GPIOD, 13U)
  251. #define LINE_LCD_SEG15 PAL_LINE(GPIOD, 14U)
  252. #define LINE_LCD_SEG8 PAL_LINE(GPIOD, 15U)
  253. #define LINE_XL_CS PAL_LINE(GPIOE, 0U)
  254. #define LINE_XL_INT PAL_LINE(GPIOE, 1U)
  255. #define LINE_SAI1_MCK PAL_LINE(GPIOE, 2U)
  256. #define LINE_AUDIO_RST PAL_LINE(GPIOE, 3U)
  257. #define LINE_SAI1_FS PAL_LINE(GPIOE, 4U)
  258. #define LINE_SAI1_SCK PAL_LINE(GPIOE, 5U)
  259. #define LINE_SAI1_SD PAL_LINE(GPIOE, 6U)
  260. #define LINE_AUDIO_DIN PAL_LINE(GPIOE, 7U)
  261. #define LINE_LED_GREEN PAL_LINE(GPIOE, 8U)
  262. #define LINE_AUDIO_CLK PAL_LINE(GPIOE, 9U)
  263. #define LINE_QSPI_CLK PAL_LINE(GPIOE, 10U)
  264. #define LINE_QSPI_CS PAL_LINE(GPIOE, 11U)
  265. #define LINE_QSPI_D0 PAL_LINE(GPIOE, 12U)
  266. #define LINE_QSPI_D1 PAL_LINE(GPIOE, 13U)
  267. #define LINE_QSPI_D2 PAL_LINE(GPIOE, 14U)
  268. #define LINE_QSPI_D3 PAL_LINE(GPIOE, 15U)
  269. #define LINE_OSC_IN PAL_LINE(GPIOH, 0U)
  270. #define LINE_OSC_OUT PAL_LINE(GPIOH, 1U)
  271. /*===========================================================================*/
  272. /* Driver pre-compile time settings. */
  273. /*===========================================================================*/
  274. /*===========================================================================*/
  275. /* Derived constants and error checks. */
  276. /*===========================================================================*/
  277. /*===========================================================================*/
  278. /* Driver data structures and types. */
  279. /*===========================================================================*/
  280. /*===========================================================================*/
  281. /* Driver macros. */
  282. /*===========================================================================*/
  283. /*
  284. * I/O ports initial setup, this configuration is established soon after reset
  285. * in the initialization code.
  286. * Please refer to the STM32 Reference Manual for details.
  287. */
  288. #define PIN_MODE_INPUT(n) (0U << ((n) * 2U))
  289. #define PIN_MODE_OUTPUT(n) (1U << ((n) * 2U))
  290. #define PIN_MODE_ALTERNATE(n) (2U << ((n) * 2U))
  291. #define PIN_MODE_ANALOG(n) (3U << ((n) * 2U))
  292. #define PIN_ODR_LOW(n) (0U << (n))
  293. #define PIN_ODR_HIGH(n) (1U << (n))
  294. #define PIN_OTYPE_PUSHPULL(n) (0U << (n))
  295. #define PIN_OTYPE_OPENDRAIN(n) (1U << (n))
  296. #define PIN_OSPEED_VERYLOW(n) (0U << ((n) * 2U))
  297. #define PIN_OSPEED_LOW(n) (1U << ((n) * 2U))
  298. #define PIN_OSPEED_MEDIUM(n) (2U << ((n) * 2U))
  299. #define PIN_OSPEED_HIGH(n) (3U << ((n) * 2U))
  300. #define PIN_PUPDR_FLOATING(n) (0U << ((n) * 2U))
  301. #define PIN_PUPDR_PULLUP(n) (1U << ((n) * 2U))
  302. #define PIN_PUPDR_PULLDOWN(n) (2U << ((n) * 2U))
  303. #define PIN_AFIO_AF(n, v) ((v) << (((n) % 8U) * 4U))
  304. #define PIN_ASCR_DISABLED(n) (0U << (n))
  305. #define PIN_ASCR_ENABLED(n) (1U << (n))
  306. #define PIN_LOCKR_DISABLED(n) (0U << (n))
  307. #define PIN_LOCKR_ENABLED(n) (1U << (n))
  308. /*
  309. * GPIOA setup:
  310. *
  311. * PA0 - JOY_CENTER (input pulldown).
  312. * PA1 - JOY_LEFT (input pulldown).
  313. * PA2 - JOY_RIGHT (input pulldown).
  314. * PA3 - JOY_UP (input pulldown).
  315. * PA4 - MFX_WAKEUP (output pushpull maximum).
  316. * PA5 - JOY_DOWN (input pulldown).
  317. * PA6 - LCD_SEG23 (alternate 11).
  318. * PA7 - LCD_SEG0 (alternate 11).
  319. * PA8 - LCD_COM0 (alternate 11).
  320. * PA9 - LCD_COM1 (alternate 11).
  321. * PA10 - LCD_COM2 (alternate 11).
  322. * PA11 - OTG_FS_DM (alternate 10).
  323. * PA12 - OTG_FS_DP (alternate 10).
  324. * PA13 - SWDIO (alternate 0).
  325. * PA14 - SWCLK (alternate 0).
  326. * PA15 - PIN15 (analog).
  327. */
  328. #define VAL_GPIOA_MODER (PIN_MODE_INPUT(GPIOA_JOY_CENTER) | \
  329. PIN_MODE_INPUT(GPIOA_JOY_LEFT) | \
  330. PIN_MODE_INPUT(GPIOA_JOY_RIGHT) | \
  331. PIN_MODE_INPUT(GPIOA_JOY_UP) | \
  332. PIN_MODE_OUTPUT(GPIOA_MFX_WAKEUP) | \
  333. PIN_MODE_INPUT(GPIOA_JOY_DOWN) | \
  334. PIN_MODE_ALTERNATE(GPIOA_LCD_SEG23) | \
  335. PIN_MODE_ALTERNATE(GPIOA_LCD_SEG0) | \
  336. PIN_MODE_ALTERNATE(GPIOA_LCD_COM0) | \
  337. PIN_MODE_ALTERNATE(GPIOA_LCD_COM1) | \
  338. PIN_MODE_ALTERNATE(GPIOA_LCD_COM2) | \
  339. PIN_MODE_ALTERNATE(GPIOA_OTG_FS_DM) | \
  340. PIN_MODE_ALTERNATE(GPIOA_OTG_FS_DP) | \
  341. PIN_MODE_ALTERNATE(GPIOA_SWDIO) | \
  342. PIN_MODE_ALTERNATE(GPIOA_SWCLK) | \
  343. PIN_MODE_ANALOG(GPIOA_PIN15))
  344. #define VAL_GPIOA_OTYPER (PIN_OTYPE_PUSHPULL(GPIOA_JOY_CENTER) | \
  345. PIN_OTYPE_PUSHPULL(GPIOA_JOY_LEFT) | \
  346. PIN_OTYPE_PUSHPULL(GPIOA_JOY_RIGHT) | \
  347. PIN_OTYPE_PUSHPULL(GPIOA_JOY_UP) | \
  348. PIN_OTYPE_PUSHPULL(GPIOA_MFX_WAKEUP) | \
  349. PIN_OTYPE_PUSHPULL(GPIOA_JOY_DOWN) | \
  350. PIN_OTYPE_PUSHPULL(GPIOA_LCD_SEG23) | \
  351. PIN_OTYPE_PUSHPULL(GPIOA_LCD_SEG0) | \
  352. PIN_OTYPE_PUSHPULL(GPIOA_LCD_COM0) | \
  353. PIN_OTYPE_PUSHPULL(GPIOA_LCD_COM1) | \
  354. PIN_OTYPE_PUSHPULL(GPIOA_LCD_COM2) | \
  355. PIN_OTYPE_PUSHPULL(GPIOA_OTG_FS_DM) | \
  356. PIN_OTYPE_PUSHPULL(GPIOA_OTG_FS_DP) | \
  357. PIN_OTYPE_PUSHPULL(GPIOA_SWDIO) | \
  358. PIN_OTYPE_PUSHPULL(GPIOA_SWCLK) | \
  359. PIN_OTYPE_PUSHPULL(GPIOA_PIN15))
  360. #define VAL_GPIOA_OSPEEDR (PIN_OSPEED_HIGH(GPIOA_JOY_CENTER) | \
  361. PIN_OSPEED_HIGH(GPIOA_JOY_LEFT) | \
  362. PIN_OSPEED_HIGH(GPIOA_JOY_RIGHT) | \
  363. PIN_OSPEED_HIGH(GPIOA_JOY_UP) | \
  364. PIN_OSPEED_HIGH(GPIOA_MFX_WAKEUP) | \
  365. PIN_OSPEED_HIGH(GPIOA_JOY_DOWN) | \
  366. PIN_OSPEED_HIGH(GPIOA_LCD_SEG23) | \
  367. PIN_OSPEED_HIGH(GPIOA_LCD_SEG0) | \
  368. PIN_OSPEED_HIGH(GPIOA_LCD_COM0) | \
  369. PIN_OSPEED_HIGH(GPIOA_LCD_COM1) | \
  370. PIN_OSPEED_HIGH(GPIOA_LCD_COM2) | \
  371. PIN_OSPEED_HIGH(GPIOA_OTG_FS_DM) | \
  372. PIN_OSPEED_HIGH(GPIOA_OTG_FS_DP) | \
  373. PIN_OSPEED_HIGH(GPIOA_SWDIO) | \
  374. PIN_OSPEED_HIGH(GPIOA_SWCLK) | \
  375. PIN_OSPEED_HIGH(GPIOA_PIN15))
  376. #define VAL_GPIOA_PUPDR (PIN_PUPDR_PULLDOWN(GPIOA_JOY_CENTER) | \
  377. PIN_PUPDR_PULLDOWN(GPIOA_JOY_LEFT) | \
  378. PIN_PUPDR_PULLDOWN(GPIOA_JOY_RIGHT) | \
  379. PIN_PUPDR_PULLDOWN(GPIOA_JOY_UP) | \
  380. PIN_PUPDR_FLOATING(GPIOA_MFX_WAKEUP) | \
  381. PIN_PUPDR_PULLDOWN(GPIOA_JOY_DOWN) | \
  382. PIN_PUPDR_FLOATING(GPIOA_LCD_SEG23) | \
  383. PIN_PUPDR_FLOATING(GPIOA_LCD_SEG0) | \
  384. PIN_PUPDR_FLOATING(GPIOA_LCD_COM0) | \
  385. PIN_PUPDR_FLOATING(GPIOA_LCD_COM1) | \
  386. PIN_PUPDR_FLOATING(GPIOA_LCD_COM2) | \
  387. PIN_PUPDR_FLOATING(GPIOA_OTG_FS_DM) | \
  388. PIN_PUPDR_FLOATING(GPIOA_OTG_FS_DP) | \
  389. PIN_PUPDR_PULLUP(GPIOA_SWDIO) | \
  390. PIN_PUPDR_PULLDOWN(GPIOA_SWCLK) | \
  391. PIN_PUPDR_FLOATING(GPIOA_PIN15))
  392. #define VAL_GPIOA_ODR (PIN_ODR_HIGH(GPIOA_JOY_CENTER) | \
  393. PIN_ODR_HIGH(GPIOA_JOY_LEFT) | \
  394. PIN_ODR_HIGH(GPIOA_JOY_RIGHT) | \
  395. PIN_ODR_HIGH(GPIOA_JOY_UP) | \
  396. PIN_ODR_HIGH(GPIOA_MFX_WAKEUP) | \
  397. PIN_ODR_HIGH(GPIOA_JOY_DOWN) | \
  398. PIN_ODR_HIGH(GPIOA_LCD_SEG23) | \
  399. PIN_ODR_HIGH(GPIOA_LCD_SEG0) | \
  400. PIN_ODR_HIGH(GPIOA_LCD_COM0) | \
  401. PIN_ODR_HIGH(GPIOA_LCD_COM1) | \
  402. PIN_ODR_HIGH(GPIOA_LCD_COM2) | \
  403. PIN_ODR_HIGH(GPIOA_OTG_FS_DM) | \
  404. PIN_ODR_HIGH(GPIOA_OTG_FS_DP) | \
  405. PIN_ODR_HIGH(GPIOA_SWDIO) | \
  406. PIN_ODR_HIGH(GPIOA_SWCLK) | \
  407. PIN_ODR_HIGH(GPIOA_PIN15))
  408. #define VAL_GPIOA_AFRL (PIN_AFIO_AF(GPIOA_JOY_CENTER, 0U) | \
  409. PIN_AFIO_AF(GPIOA_JOY_LEFT, 0U) | \
  410. PIN_AFIO_AF(GPIOA_JOY_RIGHT, 0U) | \
  411. PIN_AFIO_AF(GPIOA_JOY_UP, 0U) | \
  412. PIN_AFIO_AF(GPIOA_MFX_WAKEUP, 0U) | \
  413. PIN_AFIO_AF(GPIOA_JOY_DOWN, 0U) | \
  414. PIN_AFIO_AF(GPIOA_LCD_SEG23, 11U) | \
  415. PIN_AFIO_AF(GPIOA_LCD_SEG0, 11U))
  416. #define VAL_GPIOA_AFRH (PIN_AFIO_AF(GPIOA_LCD_COM0, 11U) | \
  417. PIN_AFIO_AF(GPIOA_LCD_COM1, 11U) | \
  418. PIN_AFIO_AF(GPIOA_LCD_COM2, 11U) | \
  419. PIN_AFIO_AF(GPIOA_OTG_FS_DM, 10U) | \
  420. PIN_AFIO_AF(GPIOA_OTG_FS_DP, 10U) | \
  421. PIN_AFIO_AF(GPIOA_SWDIO, 0U) | \
  422. PIN_AFIO_AF(GPIOA_SWCLK, 0U) | \
  423. PIN_AFIO_AF(GPIOA_PIN15, 0U))
  424. #define VAL_GPIOA_ASCR (PIN_ASCR_DISABLED(GPIOA_JOY_CENTER) | \
  425. PIN_ASCR_DISABLED(GPIOA_JOY_LEFT) | \
  426. PIN_ASCR_DISABLED(GPIOA_JOY_RIGHT) | \
  427. PIN_ASCR_DISABLED(GPIOA_JOY_UP) | \
  428. PIN_ASCR_DISABLED(GPIOA_MFX_WAKEUP) | \
  429. PIN_ASCR_DISABLED(GPIOA_JOY_DOWN) | \
  430. PIN_ASCR_DISABLED(GPIOA_LCD_SEG23) | \
  431. PIN_ASCR_DISABLED(GPIOA_LCD_SEG0) | \
  432. PIN_ASCR_DISABLED(GPIOA_LCD_COM0) | \
  433. PIN_ASCR_DISABLED(GPIOA_LCD_COM1) | \
  434. PIN_ASCR_DISABLED(GPIOA_LCD_COM2) | \
  435. PIN_ASCR_DISABLED(GPIOA_OTG_FS_DM) | \
  436. PIN_ASCR_DISABLED(GPIOA_OTG_FS_DP) | \
  437. PIN_ASCR_DISABLED(GPIOA_SWDIO) | \
  438. PIN_ASCR_DISABLED(GPIOA_SWCLK) | \
  439. PIN_ASCR_DISABLED(GPIOA_PIN15))
  440. #define VAL_GPIOA_LOCKR (PIN_LOCKR_DISABLED(GPIOA_JOY_CENTER) | \
  441. PIN_LOCKR_DISABLED(GPIOA_JOY_LEFT) | \
  442. PIN_LOCKR_DISABLED(GPIOA_JOY_RIGHT) | \
  443. PIN_LOCKR_DISABLED(GPIOA_JOY_UP) | \
  444. PIN_LOCKR_DISABLED(GPIOA_MFX_WAKEUP) | \
  445. PIN_LOCKR_DISABLED(GPIOA_JOY_DOWN) | \
  446. PIN_LOCKR_DISABLED(GPIOA_LCD_SEG23) | \
  447. PIN_LOCKR_DISABLED(GPIOA_LCD_SEG0) | \
  448. PIN_LOCKR_DISABLED(GPIOA_LCD_COM0) | \
  449. PIN_LOCKR_DISABLED(GPIOA_LCD_COM1) | \
  450. PIN_LOCKR_DISABLED(GPIOA_LCD_COM2) | \
  451. PIN_LOCKR_DISABLED(GPIOA_OTG_FS_DM) | \
  452. PIN_LOCKR_DISABLED(GPIOA_OTG_FS_DP) | \
  453. PIN_LOCKR_DISABLED(GPIOA_SWDIO) | \
  454. PIN_LOCKR_DISABLED(GPIOA_SWCLK) | \
  455. PIN_LOCKR_DISABLED(GPIOA_PIN15))
  456. /*
  457. * GPIOB setup:
  458. *
  459. * PB0 - LCD_SEG21 (alternate 11).
  460. * PB1 - LCD_SEG2 (alternate 11).
  461. * PB2 - LED_RED (output pushpull maximum).
  462. * PB3 - SWO REG_ON_3V3 (analog).
  463. * PB4 - LCD_SEG11 (alternate 11).
  464. * PB5 - LCD_SEG12 (alternate 11).
  465. * PB6 - I2C1_SCL (alternate 4).
  466. * PB7 - I2C1_SDA (alternate 4).
  467. * PB8 - GYRO_INT2 (input pulldown).
  468. * PB9 - LCD_COM3 (alternate 11).
  469. * PB10 - MFX_I2C_SCL I2C2_SCL (alternate 4).
  470. * PB11 - MFX_I2C_SDA I2C2_SDA (alternate 4).
  471. * PB12 - LCD_SEG20 (alternate 11).
  472. * PB13 - LCD_SEG3 (alternate 11).
  473. * PB14 - LCD_SEG19 (alternate 11).
  474. * PB15 - LCD_SEG4 (alternate 11).
  475. */
  476. #define VAL_GPIOB_MODER (PIN_MODE_ALTERNATE(GPIOB_LCD_SEG21) | \
  477. PIN_MODE_ALTERNATE(GPIOB_LCD_SEG2) | \
  478. PIN_MODE_OUTPUT(GPIOB_LED_RED) | \
  479. PIN_MODE_ANALOG(GPIOB_SWO) | \
  480. PIN_MODE_ALTERNATE(GPIOB_LCD_SEG11) | \
  481. PIN_MODE_ALTERNATE(GPIOB_LCD_SEG12) | \
  482. PIN_MODE_ALTERNATE(GPIOB_I2C1_SCL) | \
  483. PIN_MODE_ALTERNATE(GPIOB_I2C1_SDA) | \
  484. PIN_MODE_INPUT(GPIOB_GYRO_INT2) | \
  485. PIN_MODE_ALTERNATE(GPIOB_LCD_COM3) | \
  486. PIN_MODE_ALTERNATE(GPIOB_MFX_I2C_SCL) |\
  487. PIN_MODE_ALTERNATE(GPIOB_MFX_I2C_SDA) |\
  488. PIN_MODE_ALTERNATE(GPIOB_LCD_SEG20) | \
  489. PIN_MODE_ALTERNATE(GPIOB_LCD_SEG3) | \
  490. PIN_MODE_ALTERNATE(GPIOB_LCD_SEG19) | \
  491. PIN_MODE_ALTERNATE(GPIOB_LCD_SEG4))
  492. #define VAL_GPIOB_OTYPER (PIN_OTYPE_PUSHPULL(GPIOB_LCD_SEG21) | \
  493. PIN_OTYPE_PUSHPULL(GPIOB_LCD_SEG2) | \
  494. PIN_OTYPE_PUSHPULL(GPIOB_LED_RED) | \
  495. PIN_OTYPE_PUSHPULL(GPIOB_SWO) | \
  496. PIN_OTYPE_PUSHPULL(GPIOB_LCD_SEG11) | \
  497. PIN_OTYPE_PUSHPULL(GPIOB_LCD_SEG12) | \
  498. PIN_OTYPE_PUSHPULL(GPIOB_I2C1_SCL) | \
  499. PIN_OTYPE_PUSHPULL(GPIOB_I2C1_SDA) | \
  500. PIN_OTYPE_PUSHPULL(GPIOB_GYRO_INT2) | \
  501. PIN_OTYPE_PUSHPULL(GPIOB_LCD_COM3) | \
  502. PIN_OTYPE_PUSHPULL(GPIOB_MFX_I2C_SCL) |\
  503. PIN_OTYPE_PUSHPULL(GPIOB_MFX_I2C_SDA) |\
  504. PIN_OTYPE_PUSHPULL(GPIOB_LCD_SEG20) | \
  505. PIN_OTYPE_PUSHPULL(GPIOB_LCD_SEG3) | \
  506. PIN_OTYPE_PUSHPULL(GPIOB_LCD_SEG19) | \
  507. PIN_OTYPE_PUSHPULL(GPIOB_LCD_SEG4))
  508. #define VAL_GPIOB_OSPEEDR (PIN_OSPEED_HIGH(GPIOB_LCD_SEG21) | \
  509. PIN_OSPEED_HIGH(GPIOB_LCD_SEG2) | \
  510. PIN_OSPEED_HIGH(GPIOB_LED_RED) | \
  511. PIN_OSPEED_HIGH(GPIOB_SWO) | \
  512. PIN_OSPEED_HIGH(GPIOB_LCD_SEG11) | \
  513. PIN_OSPEED_HIGH(GPIOB_LCD_SEG12) | \
  514. PIN_OSPEED_HIGH(GPIOB_I2C1_SCL) | \
  515. PIN_OSPEED_HIGH(GPIOB_I2C1_SDA) | \
  516. PIN_OSPEED_HIGH(GPIOB_GYRO_INT2) | \
  517. PIN_OSPEED_HIGH(GPIOB_LCD_COM3) | \
  518. PIN_OSPEED_HIGH(GPIOB_MFX_I2C_SCL) | \
  519. PIN_OSPEED_HIGH(GPIOB_MFX_I2C_SDA) | \
  520. PIN_OSPEED_HIGH(GPIOB_LCD_SEG20) | \
  521. PIN_OSPEED_HIGH(GPIOB_LCD_SEG3) | \
  522. PIN_OSPEED_HIGH(GPIOB_LCD_SEG19) | \
  523. PIN_OSPEED_HIGH(GPIOB_LCD_SEG4))
  524. #define VAL_GPIOB_PUPDR (PIN_PUPDR_FLOATING(GPIOB_LCD_SEG21) | \
  525. PIN_PUPDR_FLOATING(GPIOB_LCD_SEG2) | \
  526. PIN_PUPDR_FLOATING(GPIOB_LED_RED) | \
  527. PIN_PUPDR_FLOATING(GPIOB_SWO) | \
  528. PIN_PUPDR_FLOATING(GPIOB_LCD_SEG11) | \
  529. PIN_PUPDR_FLOATING(GPIOB_LCD_SEG12) | \
  530. PIN_PUPDR_FLOATING(GPIOB_I2C1_SCL) | \
  531. PIN_PUPDR_FLOATING(GPIOB_I2C1_SDA) | \
  532. PIN_PUPDR_PULLDOWN(GPIOB_GYRO_INT2) | \
  533. PIN_PUPDR_FLOATING(GPIOB_LCD_COM3) | \
  534. PIN_PUPDR_FLOATING(GPIOB_MFX_I2C_SCL) |\
  535. PIN_PUPDR_FLOATING(GPIOB_MFX_I2C_SDA) |\
  536. PIN_PUPDR_FLOATING(GPIOB_LCD_SEG20) | \
  537. PIN_PUPDR_FLOATING(GPIOB_LCD_SEG3) | \
  538. PIN_PUPDR_FLOATING(GPIOB_LCD_SEG19) | \
  539. PIN_PUPDR_FLOATING(GPIOB_LCD_SEG4))
  540. #define VAL_GPIOB_ODR (PIN_ODR_HIGH(GPIOB_LCD_SEG21) | \
  541. PIN_ODR_HIGH(GPIOB_LCD_SEG2) | \
  542. PIN_ODR_LOW(GPIOB_LED_RED) | \
  543. PIN_ODR_HIGH(GPIOB_SWO) | \
  544. PIN_ODR_HIGH(GPIOB_LCD_SEG11) | \
  545. PIN_ODR_HIGH(GPIOB_LCD_SEG12) | \
  546. PIN_ODR_HIGH(GPIOB_I2C1_SCL) | \
  547. PIN_ODR_HIGH(GPIOB_I2C1_SDA) | \
  548. PIN_ODR_HIGH(GPIOB_GYRO_INT2) | \
  549. PIN_ODR_HIGH(GPIOB_LCD_COM3) | \
  550. PIN_ODR_HIGH(GPIOB_MFX_I2C_SCL) | \
  551. PIN_ODR_HIGH(GPIOB_MFX_I2C_SDA) | \
  552. PIN_ODR_HIGH(GPIOB_LCD_SEG20) | \
  553. PIN_ODR_HIGH(GPIOB_LCD_SEG3) | \
  554. PIN_ODR_HIGH(GPIOB_LCD_SEG19) | \
  555. PIN_ODR_HIGH(GPIOB_LCD_SEG4))
  556. #define VAL_GPIOB_AFRL (PIN_AFIO_AF(GPIOB_LCD_SEG21, 11U) | \
  557. PIN_AFIO_AF(GPIOB_LCD_SEG2, 11U) | \
  558. PIN_AFIO_AF(GPIOB_LED_RED, 0U) | \
  559. PIN_AFIO_AF(GPIOB_SWO, 0U) | \
  560. PIN_AFIO_AF(GPIOB_LCD_SEG11, 11U) | \
  561. PIN_AFIO_AF(GPIOB_LCD_SEG12, 11U) | \
  562. PIN_AFIO_AF(GPIOB_I2C1_SCL, 4U) | \
  563. PIN_AFIO_AF(GPIOB_I2C1_SDA, 4U))
  564. #define VAL_GPIOB_AFRH (PIN_AFIO_AF(GPIOB_GYRO_INT2, 0U) | \
  565. PIN_AFIO_AF(GPIOB_LCD_COM3, 11U) | \
  566. PIN_AFIO_AF(GPIOB_MFX_I2C_SCL, 4U) | \
  567. PIN_AFIO_AF(GPIOB_MFX_I2C_SDA, 4U) | \
  568. PIN_AFIO_AF(GPIOB_LCD_SEG20, 11U) | \
  569. PIN_AFIO_AF(GPIOB_LCD_SEG3, 11U) | \
  570. PIN_AFIO_AF(GPIOB_LCD_SEG19, 11U) | \
  571. PIN_AFIO_AF(GPIOB_LCD_SEG4, 11U))
  572. #define VAL_GPIOB_ASCR (PIN_ASCR_DISABLED(GPIOB_LCD_SEG21) | \
  573. PIN_ASCR_DISABLED(GPIOB_LCD_SEG2) | \
  574. PIN_ASCR_DISABLED(GPIOB_LED_RED) | \
  575. PIN_ASCR_ENABLED(GPIOB_SWO) | \
  576. PIN_ASCR_DISABLED(GPIOB_LCD_SEG11) | \
  577. PIN_ASCR_DISABLED(GPIOB_LCD_SEG12) | \
  578. PIN_ASCR_DISABLED(GPIOB_I2C1_SCL) | \
  579. PIN_ASCR_DISABLED(GPIOB_I2C1_SDA) | \
  580. PIN_ASCR_DISABLED(GPIOB_GYRO_INT2) | \
  581. PIN_ASCR_DISABLED(GPIOB_LCD_COM3) | \
  582. PIN_ASCR_DISABLED(GPIOB_MFX_I2C_SCL) | \
  583. PIN_ASCR_DISABLED(GPIOB_MFX_I2C_SDA) | \
  584. PIN_ASCR_DISABLED(GPIOB_LCD_SEG20) | \
  585. PIN_ASCR_DISABLED(GPIOB_LCD_SEG3) | \
  586. PIN_ASCR_DISABLED(GPIOB_LCD_SEG19) | \
  587. PIN_ASCR_DISABLED(GPIOB_LCD_SEG4))
  588. #define VAL_GPIOB_LOCKR (PIN_LOCKR_DISABLED(GPIOB_LCD_SEG21) | \
  589. PIN_LOCKR_DISABLED(GPIOB_LCD_SEG2) | \
  590. PIN_LOCKR_DISABLED(GPIOB_LED_RED) | \
  591. PIN_LOCKR_DISABLED(GPIOB_SWO) | \
  592. PIN_LOCKR_DISABLED(GPIOB_LCD_SEG11) | \
  593. PIN_LOCKR_DISABLED(GPIOB_LCD_SEG12) | \
  594. PIN_LOCKR_DISABLED(GPIOB_I2C1_SCL) | \
  595. PIN_LOCKR_DISABLED(GPIOB_I2C1_SDA) | \
  596. PIN_LOCKR_DISABLED(GPIOB_GYRO_INT2) | \
  597. PIN_LOCKR_DISABLED(GPIOB_LCD_COM3) | \
  598. PIN_LOCKR_DISABLED(GPIOB_MFX_I2C_SCL) |\
  599. PIN_LOCKR_DISABLED(GPIOB_MFX_I2C_SDA) |\
  600. PIN_LOCKR_DISABLED(GPIOB_LCD_SEG20) | \
  601. PIN_LOCKR_DISABLED(GPIOB_LCD_SEG3) | \
  602. PIN_LOCKR_DISABLED(GPIOB_LCD_SEG19) | \
  603. PIN_LOCKR_DISABLED(GPIOB_LCD_SEG4))
  604. /*
  605. * GPIOC setup:
  606. *
  607. * PC0 - MAG_CS (output pushpull maximum).
  608. * PC1 - MAG_INT (input pulldown).
  609. * PC2 - MAG_DRDY (input pulldown).
  610. * PC3 - LCD_VLCD (alternate 11).
  611. * PC4 - LCD_SEG22 (alternate 11).
  612. * PC5 - LCD_SEG1 (alternate 11).
  613. * PC6 - LCD_SEG14 (alternate 11).
  614. * PC7 - LCD_SEG9 (alternate 11).
  615. * PC8 - LCD_SEG13 (alternate 11).
  616. * PC9 - OTG_FS_PSON (output pushpull maximum).
  617. * PC10 - OTG_FS_OVCURR (input floating).
  618. * PC11 - OTG_FS_VBUS (input floating).
  619. * PC12 - OTG_FS_ID (alternate 10).
  620. * PC13 - MFX_IRQ_OUT (input pulldown).
  621. * PC14 - OSC32_IN (input floating).
  622. * PC15 - OSC32_OUT (input floating).
  623. */
  624. #define VAL_GPIOC_MODER (PIN_MODE_OUTPUT(GPIOC_MAG_CS) | \
  625. PIN_MODE_INPUT(GPIOC_MAG_INT) | \
  626. PIN_MODE_INPUT(GPIOC_MAG_DRDY) | \
  627. PIN_MODE_ALTERNATE(GPIOC_LCD_VLCD) | \
  628. PIN_MODE_ALTERNATE(GPIOC_LCD_SEG22) | \
  629. PIN_MODE_ALTERNATE(GPIOC_LCD_SEG1) | \
  630. PIN_MODE_ALTERNATE(GPIOC_LCD_SEG14) | \
  631. PIN_MODE_ALTERNATE(GPIOC_LCD_SEG9) | \
  632. PIN_MODE_ALTERNATE(GPIOC_LCD_SEG13) | \
  633. PIN_MODE_OUTPUT(GPIOC_OTG_FS_PSON) | \
  634. PIN_MODE_INPUT(GPIOC_OTG_FS_OVCURR) | \
  635. PIN_MODE_INPUT(GPIOC_OTG_FS_VBUS) | \
  636. PIN_MODE_ALTERNATE(GPIOC_OTG_FS_ID) | \
  637. PIN_MODE_INPUT(GPIOC_MFX_IRQ_OUT) | \
  638. PIN_MODE_INPUT(GPIOC_OSC32_IN) | \
  639. PIN_MODE_INPUT(GPIOC_OSC32_OUT))
  640. #define VAL_GPIOC_OTYPER (PIN_OTYPE_PUSHPULL(GPIOC_MAG_CS) | \
  641. PIN_OTYPE_PUSHPULL(GPIOC_MAG_INT) | \
  642. PIN_OTYPE_PUSHPULL(GPIOC_MAG_DRDY) | \
  643. PIN_OTYPE_PUSHPULL(GPIOC_LCD_VLCD) | \
  644. PIN_OTYPE_PUSHPULL(GPIOC_LCD_SEG22) | \
  645. PIN_OTYPE_PUSHPULL(GPIOC_LCD_SEG1) | \
  646. PIN_OTYPE_PUSHPULL(GPIOC_LCD_SEG14) | \
  647. PIN_OTYPE_PUSHPULL(GPIOC_LCD_SEG9) | \
  648. PIN_OTYPE_PUSHPULL(GPIOC_LCD_SEG13) | \
  649. PIN_OTYPE_PUSHPULL(GPIOC_OTG_FS_PSON) |\
  650. PIN_OTYPE_PUSHPULL(GPIOC_OTG_FS_OVCURR) |\
  651. PIN_OTYPE_PUSHPULL(GPIOC_OTG_FS_VBUS) |\
  652. PIN_OTYPE_PUSHPULL(GPIOC_OTG_FS_ID) | \
  653. PIN_OTYPE_PUSHPULL(GPIOC_MFX_IRQ_OUT) |\
  654. PIN_OTYPE_PUSHPULL(GPIOC_OSC32_IN) | \
  655. PIN_OTYPE_PUSHPULL(GPIOC_OSC32_OUT))
  656. #define VAL_GPIOC_OSPEEDR (PIN_OSPEED_HIGH(GPIOC_MAG_CS) | \
  657. PIN_OSPEED_HIGH(GPIOC_MAG_INT) | \
  658. PIN_OSPEED_HIGH(GPIOC_MAG_DRDY) | \
  659. PIN_OSPEED_HIGH(GPIOC_LCD_VLCD) | \
  660. PIN_OSPEED_HIGH(GPIOC_LCD_SEG22) | \
  661. PIN_OSPEED_HIGH(GPIOC_LCD_SEG1) | \
  662. PIN_OSPEED_HIGH(GPIOC_LCD_SEG14) | \
  663. PIN_OSPEED_HIGH(GPIOC_LCD_SEG9) | \
  664. PIN_OSPEED_HIGH(GPIOC_LCD_SEG13) | \
  665. PIN_OSPEED_HIGH(GPIOC_OTG_FS_PSON) | \
  666. PIN_OSPEED_HIGH(GPIOC_OTG_FS_OVCURR) | \
  667. PIN_OSPEED_HIGH(GPIOC_OTG_FS_VBUS) | \
  668. PIN_OSPEED_HIGH(GPIOC_OTG_FS_ID) | \
  669. PIN_OSPEED_HIGH(GPIOC_MFX_IRQ_OUT) | \
  670. PIN_OSPEED_VERYLOW(GPIOC_OSC32_IN) | \
  671. PIN_OSPEED_VERYLOW(GPIOC_OSC32_OUT))
  672. #define VAL_GPIOC_PUPDR (PIN_PUPDR_PULLUP(GPIOC_MAG_CS) | \
  673. PIN_PUPDR_PULLDOWN(GPIOC_MAG_INT) | \
  674. PIN_PUPDR_PULLDOWN(GPIOC_MAG_DRDY) | \
  675. PIN_PUPDR_FLOATING(GPIOC_LCD_VLCD) | \
  676. PIN_PUPDR_FLOATING(GPIOC_LCD_SEG22) | \
  677. PIN_PUPDR_FLOATING(GPIOC_LCD_SEG1) | \
  678. PIN_PUPDR_FLOATING(GPIOC_LCD_SEG14) | \
  679. PIN_PUPDR_FLOATING(GPIOC_LCD_SEG9) | \
  680. PIN_PUPDR_FLOATING(GPIOC_LCD_SEG13) | \
  681. PIN_PUPDR_FLOATING(GPIOC_OTG_FS_PSON) |\
  682. PIN_PUPDR_FLOATING(GPIOC_OTG_FS_OVCURR) |\
  683. PIN_PUPDR_FLOATING(GPIOC_OTG_FS_VBUS) |\
  684. PIN_PUPDR_FLOATING(GPIOC_OTG_FS_ID) | \
  685. PIN_PUPDR_PULLDOWN(GPIOC_MFX_IRQ_OUT) |\
  686. PIN_PUPDR_FLOATING(GPIOC_OSC32_IN) | \
  687. PIN_PUPDR_FLOATING(GPIOC_OSC32_OUT))
  688. #define VAL_GPIOC_ODR (PIN_ODR_HIGH(GPIOC_MAG_CS) | \
  689. PIN_ODR_HIGH(GPIOC_MAG_INT) | \
  690. PIN_ODR_HIGH(GPIOC_MAG_DRDY) | \
  691. PIN_ODR_HIGH(GPIOC_LCD_VLCD) | \
  692. PIN_ODR_HIGH(GPIOC_LCD_SEG22) | \
  693. PIN_ODR_HIGH(GPIOC_LCD_SEG1) | \
  694. PIN_ODR_HIGH(GPIOC_LCD_SEG14) | \
  695. PIN_ODR_HIGH(GPIOC_LCD_SEG9) | \
  696. PIN_ODR_HIGH(GPIOC_LCD_SEG13) | \
  697. PIN_ODR_HIGH(GPIOC_OTG_FS_PSON) | \
  698. PIN_ODR_HIGH(GPIOC_OTG_FS_OVCURR) | \
  699. PIN_ODR_HIGH(GPIOC_OTG_FS_VBUS) | \
  700. PIN_ODR_HIGH(GPIOC_OTG_FS_ID) | \
  701. PIN_ODR_HIGH(GPIOC_MFX_IRQ_OUT) | \
  702. PIN_ODR_HIGH(GPIOC_OSC32_IN) | \
  703. PIN_ODR_HIGH(GPIOC_OSC32_OUT))
  704. #define VAL_GPIOC_AFRL (PIN_AFIO_AF(GPIOC_MAG_CS, 0U) | \
  705. PIN_AFIO_AF(GPIOC_MAG_INT, 0U) | \
  706. PIN_AFIO_AF(GPIOC_MAG_DRDY, 0U) | \
  707. PIN_AFIO_AF(GPIOC_LCD_VLCD, 11U) | \
  708. PIN_AFIO_AF(GPIOC_LCD_SEG22, 11U) | \
  709. PIN_AFIO_AF(GPIOC_LCD_SEG1, 11U) | \
  710. PIN_AFIO_AF(GPIOC_LCD_SEG14, 11U) | \
  711. PIN_AFIO_AF(GPIOC_LCD_SEG9, 11U))
  712. #define VAL_GPIOC_AFRH (PIN_AFIO_AF(GPIOC_LCD_SEG13, 11U) | \
  713. PIN_AFIO_AF(GPIOC_OTG_FS_PSON, 0U) | \
  714. PIN_AFIO_AF(GPIOC_OTG_FS_OVCURR, 0U) | \
  715. PIN_AFIO_AF(GPIOC_OTG_FS_VBUS, 0U) | \
  716. PIN_AFIO_AF(GPIOC_OTG_FS_ID, 10U) | \
  717. PIN_AFIO_AF(GPIOC_MFX_IRQ_OUT, 0U) | \
  718. PIN_AFIO_AF(GPIOC_OSC32_IN, 0U) | \
  719. PIN_AFIO_AF(GPIOC_OSC32_OUT, 0U))
  720. #define VAL_GPIOC_ASCR (PIN_ASCR_DISABLED(GPIOC_MAG_CS) | \
  721. PIN_ASCR_DISABLED(GPIOC_MAG_INT) | \
  722. PIN_ASCR_DISABLED(GPIOC_MAG_DRDY) | \
  723. PIN_ASCR_DISABLED(GPIOC_LCD_VLCD) | \
  724. PIN_ASCR_DISABLED(GPIOC_LCD_SEG22) | \
  725. PIN_ASCR_DISABLED(GPIOC_LCD_SEG1) | \
  726. PIN_ASCR_DISABLED(GPIOC_LCD_SEG14) | \
  727. PIN_ASCR_DISABLED(GPIOC_LCD_SEG9) | \
  728. PIN_ASCR_DISABLED(GPIOC_LCD_SEG13) | \
  729. PIN_ASCR_DISABLED(GPIOC_OTG_FS_PSON) | \
  730. PIN_ASCR_DISABLED(GPIOC_OTG_FS_OVCURR) |\
  731. PIN_ASCR_DISABLED(GPIOC_OTG_FS_VBUS) | \
  732. PIN_ASCR_DISABLED(GPIOC_OTG_FS_ID) | \
  733. PIN_ASCR_DISABLED(GPIOC_MFX_IRQ_OUT) | \
  734. PIN_ASCR_DISABLED(GPIOC_OSC32_IN) | \
  735. PIN_ASCR_DISABLED(GPIOC_OSC32_OUT))
  736. #define VAL_GPIOC_LOCKR (PIN_LOCKR_DISABLED(GPIOC_MAG_CS) | \
  737. PIN_LOCKR_DISABLED(GPIOC_MAG_INT) | \
  738. PIN_LOCKR_DISABLED(GPIOC_MAG_DRDY) | \
  739. PIN_LOCKR_DISABLED(GPIOC_LCD_VLCD) | \
  740. PIN_LOCKR_DISABLED(GPIOC_LCD_SEG22) | \
  741. PIN_LOCKR_DISABLED(GPIOC_LCD_SEG1) | \
  742. PIN_LOCKR_DISABLED(GPIOC_LCD_SEG14) | \
  743. PIN_LOCKR_DISABLED(GPIOC_LCD_SEG9) | \
  744. PIN_LOCKR_DISABLED(GPIOC_LCD_SEG13) | \
  745. PIN_LOCKR_DISABLED(GPIOC_OTG_FS_PSON) |\
  746. PIN_LOCKR_DISABLED(GPIOC_OTG_FS_OVCURR) |\
  747. PIN_LOCKR_DISABLED(GPIOC_OTG_FS_VBUS) |\
  748. PIN_LOCKR_DISABLED(GPIOC_OTG_FS_ID) | \
  749. PIN_LOCKR_DISABLED(GPIOC_MFX_IRQ_OUT) |\
  750. PIN_LOCKR_DISABLED(GPIOC_OSC32_IN) | \
  751. PIN_LOCKR_DISABLED(GPIOC_OSC32_OUT))
  752. /*
  753. * GPIOD setup:
  754. *
  755. * PD0 - EXT_RST (output pushpull maximum).
  756. * PD1 - MEMS_SCK (alternate 5).
  757. * PD2 - GYRO_INT1 (input pulldown).
  758. * PD3 - MEMS_MISO (alternate 5).
  759. * PD4 - MEMS_MOSI (alternate 5).
  760. * PD5 - USART_TX (alternate 7).
  761. * PD6 - USART_RX (alternate 7).
  762. * PD7 - GYRO_CS (output pushpull maximum).
  763. * PD8 - LCD_SEG18 (alternate 11).
  764. * PD9 - LCD_SEG5 (alternate 11).
  765. * PD10 - LCD_SEG17 (alternate 11).
  766. * PD11 - LCD_SEG6 (alternate 11).
  767. * PD12 - LCD_SEG16 (alternate 11).
  768. * PD13 - LCD_SEG7 (alternate 11).
  769. * PD14 - LCD_SEG15 (alternate 11).
  770. * PD15 - LCD_SEG8 (alternate 11).
  771. */
  772. #define VAL_GPIOD_MODER (PIN_MODE_OUTPUT(GPIOD_EXT_RST) | \
  773. PIN_MODE_ALTERNATE(GPIOD_MEMS_SCK) | \
  774. PIN_MODE_INPUT(GPIOD_GYRO_INT1) | \
  775. PIN_MODE_ALTERNATE(GPIOD_MEMS_MISO) | \
  776. PIN_MODE_ALTERNATE(GPIOD_MEMS_MOSI) | \
  777. PIN_MODE_ALTERNATE(GPIOD_USART_TX) | \
  778. PIN_MODE_ALTERNATE(GPIOD_USART_RX) | \
  779. PIN_MODE_OUTPUT(GPIOD_GYRO_CS) | \
  780. PIN_MODE_ALTERNATE(GPIOD_LCD_SEG18) | \
  781. PIN_MODE_ALTERNATE(GPIOD_LCD_SEG5) | \
  782. PIN_MODE_ALTERNATE(GPIOD_LCD_SEG17) | \
  783. PIN_MODE_ALTERNATE(GPIOD_LCD_SEG6) | \
  784. PIN_MODE_ALTERNATE(GPIOD_LCD_SEG16) | \
  785. PIN_MODE_ALTERNATE(GPIOD_LCD_SEG7) | \
  786. PIN_MODE_ALTERNATE(GPIOD_LCD_SEG15) | \
  787. PIN_MODE_ALTERNATE(GPIOD_LCD_SEG8))
  788. #define VAL_GPIOD_OTYPER (PIN_OTYPE_PUSHPULL(GPIOD_EXT_RST) | \
  789. PIN_OTYPE_PUSHPULL(GPIOD_MEMS_SCK) | \
  790. PIN_OTYPE_PUSHPULL(GPIOD_GYRO_INT1) | \
  791. PIN_OTYPE_PUSHPULL(GPIOD_MEMS_MISO) | \
  792. PIN_OTYPE_PUSHPULL(GPIOD_MEMS_MOSI) | \
  793. PIN_OTYPE_PUSHPULL(GPIOD_USART_TX) | \
  794. PIN_OTYPE_PUSHPULL(GPIOD_USART_RX) | \
  795. PIN_OTYPE_PUSHPULL(GPIOD_GYRO_CS) | \
  796. PIN_OTYPE_PUSHPULL(GPIOD_LCD_SEG18) | \
  797. PIN_OTYPE_PUSHPULL(GPIOD_LCD_SEG5) | \
  798. PIN_OTYPE_PUSHPULL(GPIOD_LCD_SEG17) | \
  799. PIN_OTYPE_PUSHPULL(GPIOD_LCD_SEG6) | \
  800. PIN_OTYPE_PUSHPULL(GPIOD_LCD_SEG16) | \
  801. PIN_OTYPE_PUSHPULL(GPIOD_LCD_SEG7) | \
  802. PIN_OTYPE_PUSHPULL(GPIOD_LCD_SEG15) | \
  803. PIN_OTYPE_PUSHPULL(GPIOD_LCD_SEG8))
  804. #define VAL_GPIOD_OSPEEDR (PIN_OSPEED_HIGH(GPIOD_EXT_RST) | \
  805. PIN_OSPEED_HIGH(GPIOD_MEMS_SCK) | \
  806. PIN_OSPEED_HIGH(GPIOD_GYRO_INT1) | \
  807. PIN_OSPEED_HIGH(GPIOD_MEMS_MISO) | \
  808. PIN_OSPEED_HIGH(GPIOD_MEMS_MOSI) | \
  809. PIN_OSPEED_HIGH(GPIOD_USART_TX) | \
  810. PIN_OSPEED_HIGH(GPIOD_USART_RX) | \
  811. PIN_OSPEED_HIGH(GPIOD_GYRO_CS) | \
  812. PIN_OSPEED_HIGH(GPIOD_LCD_SEG18) | \
  813. PIN_OSPEED_HIGH(GPIOD_LCD_SEG5) | \
  814. PIN_OSPEED_HIGH(GPIOD_LCD_SEG17) | \
  815. PIN_OSPEED_HIGH(GPIOD_LCD_SEG6) | \
  816. PIN_OSPEED_HIGH(GPIOD_LCD_SEG16) | \
  817. PIN_OSPEED_HIGH(GPIOD_LCD_SEG7) | \
  818. PIN_OSPEED_HIGH(GPIOD_LCD_SEG15) | \
  819. PIN_OSPEED_HIGH(GPIOD_LCD_SEG8))
  820. #define VAL_GPIOD_PUPDR (PIN_PUPDR_PULLDOWN(GPIOD_EXT_RST) | \
  821. PIN_PUPDR_PULLUP(GPIOD_MEMS_SCK) | \
  822. PIN_PUPDR_PULLDOWN(GPIOD_GYRO_INT1) | \
  823. PIN_PUPDR_PULLUP(GPIOD_MEMS_MISO) | \
  824. PIN_PUPDR_PULLUP(GPIOD_MEMS_MOSI) | \
  825. PIN_PUPDR_FLOATING(GPIOD_USART_TX) | \
  826. PIN_PUPDR_FLOATING(GPIOD_USART_RX) | \
  827. PIN_PUPDR_PULLUP(GPIOD_GYRO_CS) | \
  828. PIN_PUPDR_FLOATING(GPIOD_LCD_SEG18) | \
  829. PIN_PUPDR_FLOATING(GPIOD_LCD_SEG5) | \
  830. PIN_PUPDR_FLOATING(GPIOD_LCD_SEG17) | \
  831. PIN_PUPDR_FLOATING(GPIOD_LCD_SEG6) | \
  832. PIN_PUPDR_FLOATING(GPIOD_LCD_SEG16) | \
  833. PIN_PUPDR_FLOATING(GPIOD_LCD_SEG7) | \
  834. PIN_PUPDR_FLOATING(GPIOD_LCD_SEG15) | \
  835. PIN_PUPDR_FLOATING(GPIOD_LCD_SEG8))
  836. #define VAL_GPIOD_ODR (PIN_ODR_LOW(GPIOD_EXT_RST) | \
  837. PIN_ODR_HIGH(GPIOD_MEMS_SCK) | \
  838. PIN_ODR_HIGH(GPIOD_GYRO_INT1) | \
  839. PIN_ODR_HIGH(GPIOD_MEMS_MISO) | \
  840. PIN_ODR_HIGH(GPIOD_MEMS_MOSI) | \
  841. PIN_ODR_HIGH(GPIOD_USART_TX) | \
  842. PIN_ODR_HIGH(GPIOD_USART_RX) | \
  843. PIN_ODR_HIGH(GPIOD_GYRO_CS) | \
  844. PIN_ODR_HIGH(GPIOD_LCD_SEG18) | \
  845. PIN_ODR_HIGH(GPIOD_LCD_SEG5) | \
  846. PIN_ODR_HIGH(GPIOD_LCD_SEG17) | \
  847. PIN_ODR_HIGH(GPIOD_LCD_SEG6) | \
  848. PIN_ODR_HIGH(GPIOD_LCD_SEG16) | \
  849. PIN_ODR_HIGH(GPIOD_LCD_SEG7) | \
  850. PIN_ODR_HIGH(GPIOD_LCD_SEG15) | \
  851. PIN_ODR_HIGH(GPIOD_LCD_SEG8))
  852. #define VAL_GPIOD_AFRL (PIN_AFIO_AF(GPIOD_EXT_RST, 0U) | \
  853. PIN_AFIO_AF(GPIOD_MEMS_SCK, 5U) | \
  854. PIN_AFIO_AF(GPIOD_GYRO_INT1, 0U) | \
  855. PIN_AFIO_AF(GPIOD_MEMS_MISO, 5U) | \
  856. PIN_AFIO_AF(GPIOD_MEMS_MOSI, 5U) | \
  857. PIN_AFIO_AF(GPIOD_USART_TX, 7U) | \
  858. PIN_AFIO_AF(GPIOD_USART_RX, 7U) | \
  859. PIN_AFIO_AF(GPIOD_GYRO_CS, 0U))
  860. #define VAL_GPIOD_AFRH (PIN_AFIO_AF(GPIOD_LCD_SEG18, 11U) | \
  861. PIN_AFIO_AF(GPIOD_LCD_SEG5, 11U) | \
  862. PIN_AFIO_AF(GPIOD_LCD_SEG17, 11U) | \
  863. PIN_AFIO_AF(GPIOD_LCD_SEG6, 11U) | \
  864. PIN_AFIO_AF(GPIOD_LCD_SEG16, 11U) | \
  865. PIN_AFIO_AF(GPIOD_LCD_SEG7, 11U) | \
  866. PIN_AFIO_AF(GPIOD_LCD_SEG15, 11U) | \
  867. PIN_AFIO_AF(GPIOD_LCD_SEG8, 11U))
  868. #define VAL_GPIOD_ASCR (PIN_ASCR_DISABLED(GPIOD_EXT_RST) | \
  869. PIN_ASCR_DISABLED(GPIOD_MEMS_SCK) | \
  870. PIN_ASCR_DISABLED(GPIOD_GYRO_INT1) | \
  871. PIN_ASCR_DISABLED(GPIOD_MEMS_MISO) | \
  872. PIN_ASCR_DISABLED(GPIOD_MEMS_MOSI) | \
  873. PIN_ASCR_DISABLED(GPIOD_USART_TX) | \
  874. PIN_ASCR_DISABLED(GPIOD_USART_RX) | \
  875. PIN_ASCR_DISABLED(GPIOD_GYRO_CS) | \
  876. PIN_ASCR_DISABLED(GPIOD_LCD_SEG18) | \
  877. PIN_ASCR_DISABLED(GPIOD_LCD_SEG5) | \
  878. PIN_ASCR_DISABLED(GPIOD_LCD_SEG17) | \
  879. PIN_ASCR_DISABLED(GPIOD_LCD_SEG6) | \
  880. PIN_ASCR_DISABLED(GPIOD_LCD_SEG16) | \
  881. PIN_ASCR_DISABLED(GPIOD_LCD_SEG7) | \
  882. PIN_ASCR_DISABLED(GPIOD_LCD_SEG15) | \
  883. PIN_ASCR_DISABLED(GPIOD_LCD_SEG8))
  884. #define VAL_GPIOD_LOCKR (PIN_LOCKR_DISABLED(GPIOD_EXT_RST) | \
  885. PIN_LOCKR_DISABLED(GPIOD_MEMS_SCK) | \
  886. PIN_LOCKR_DISABLED(GPIOD_GYRO_INT1) | \
  887. PIN_LOCKR_DISABLED(GPIOD_MEMS_MISO) | \
  888. PIN_LOCKR_DISABLED(GPIOD_MEMS_MOSI) | \
  889. PIN_LOCKR_DISABLED(GPIOD_USART_TX) | \
  890. PIN_LOCKR_DISABLED(GPIOD_USART_RX) | \
  891. PIN_LOCKR_DISABLED(GPIOD_GYRO_CS) | \
  892. PIN_LOCKR_DISABLED(GPIOD_LCD_SEG18) | \
  893. PIN_LOCKR_DISABLED(GPIOD_LCD_SEG5) | \
  894. PIN_LOCKR_DISABLED(GPIOD_LCD_SEG17) | \
  895. PIN_LOCKR_DISABLED(GPIOD_LCD_SEG6) | \
  896. PIN_LOCKR_DISABLED(GPIOD_LCD_SEG16) | \
  897. PIN_LOCKR_DISABLED(GPIOD_LCD_SEG7) | \
  898. PIN_LOCKR_DISABLED(GPIOD_LCD_SEG15) | \
  899. PIN_LOCKR_DISABLED(GPIOD_LCD_SEG8))
  900. /*
  901. * GPIOE setup:
  902. *
  903. * PE0 - XL_CS (output pushpull maximum).
  904. * PE1 - XL_INT (input pulldown).
  905. * PE2 - SAI1_MCK (alternate 13).
  906. * PE3 - AUDIO_RST (output pushpull maximum).
  907. * PE4 - SAI1_FS (alternate 13).
  908. * PE5 - SAI1_SCK (alternate 13).
  909. * PE6 - SAI1_SD (alternate 13).
  910. * PE7 - AUDIO_DIN (alternate 6).
  911. * PE8 - LED_GREEN (output pushpull maximum).
  912. * PE9 - AUDIO_CLK (alternate 6).
  913. * PE10 - QSPI_CLK (alternate 10).
  914. * PE11 - QSPI_CS (alternate 10).
  915. * PE12 - QSPI_D0 (alternate 10).
  916. * PE13 - QSPI_D1 (alternate 10).
  917. * PE14 - QSPI_D2 (alternate 10).
  918. * PE15 - QSPI_D3 (alternate 10).
  919. */
  920. #define VAL_GPIOE_MODER (PIN_MODE_OUTPUT(GPIOE_XL_CS) | \
  921. PIN_MODE_INPUT(GPIOE_XL_INT) | \
  922. PIN_MODE_ALTERNATE(GPIOE_SAI1_MCK) | \
  923. PIN_MODE_OUTPUT(GPIOE_AUDIO_RST) | \
  924. PIN_MODE_ALTERNATE(GPIOE_SAI1_FS) | \
  925. PIN_MODE_ALTERNATE(GPIOE_SAI1_SCK) | \
  926. PIN_MODE_ALTERNATE(GPIOE_SAI1_SD) | \
  927. PIN_MODE_ALTERNATE(GPIOE_AUDIO_DIN) | \
  928. PIN_MODE_OUTPUT(GPIOE_LED_GREEN) | \
  929. PIN_MODE_ALTERNATE(GPIOE_AUDIO_CLK) | \
  930. PIN_MODE_ALTERNATE(GPIOE_QSPI_CLK) | \
  931. PIN_MODE_ALTERNATE(GPIOE_QSPI_CS) | \
  932. PIN_MODE_ALTERNATE(GPIOE_QSPI_D0) | \
  933. PIN_MODE_ALTERNATE(GPIOE_QSPI_D1) | \
  934. PIN_MODE_ALTERNATE(GPIOE_QSPI_D2) | \
  935. PIN_MODE_ALTERNATE(GPIOE_QSPI_D3))
  936. #define VAL_GPIOE_OTYPER (PIN_OTYPE_PUSHPULL(GPIOE_XL_CS) | \
  937. PIN_OTYPE_PUSHPULL(GPIOE_XL_INT) | \
  938. PIN_OTYPE_PUSHPULL(GPIOE_SAI1_MCK) | \
  939. PIN_OTYPE_PUSHPULL(GPIOE_AUDIO_RST) | \
  940. PIN_OTYPE_PUSHPULL(GPIOE_SAI1_FS) | \
  941. PIN_OTYPE_PUSHPULL(GPIOE_SAI1_SCK) | \
  942. PIN_OTYPE_PUSHPULL(GPIOE_SAI1_SD) | \
  943. PIN_OTYPE_PUSHPULL(GPIOE_AUDIO_DIN) | \
  944. PIN_OTYPE_PUSHPULL(GPIOE_LED_GREEN) | \
  945. PIN_OTYPE_PUSHPULL(GPIOE_AUDIO_CLK) | \
  946. PIN_OTYPE_PUSHPULL(GPIOE_QSPI_CLK) | \
  947. PIN_OTYPE_PUSHPULL(GPIOE_QSPI_CS) | \
  948. PIN_OTYPE_PUSHPULL(GPIOE_QSPI_D0) | \
  949. PIN_OTYPE_PUSHPULL(GPIOE_QSPI_D1) | \
  950. PIN_OTYPE_PUSHPULL(GPIOE_QSPI_D2) | \
  951. PIN_OTYPE_PUSHPULL(GPIOE_QSPI_D3))
  952. #define VAL_GPIOE_OSPEEDR (PIN_OSPEED_HIGH(GPIOE_XL_CS) | \
  953. PIN_OSPEED_HIGH(GPIOE_XL_INT) | \
  954. PIN_OSPEED_HIGH(GPIOE_SAI1_MCK) | \
  955. PIN_OSPEED_HIGH(GPIOE_AUDIO_RST) | \
  956. PIN_OSPEED_HIGH(GPIOE_SAI1_FS) | \
  957. PIN_OSPEED_HIGH(GPIOE_SAI1_SCK) | \
  958. PIN_OSPEED_HIGH(GPIOE_SAI1_SD) | \
  959. PIN_OSPEED_HIGH(GPIOE_AUDIO_DIN) | \
  960. PIN_OSPEED_HIGH(GPIOE_LED_GREEN) | \
  961. PIN_OSPEED_HIGH(GPIOE_AUDIO_CLK) | \
  962. PIN_OSPEED_HIGH(GPIOE_QSPI_CLK) | \
  963. PIN_OSPEED_HIGH(GPIOE_QSPI_CS) | \
  964. PIN_OSPEED_HIGH(GPIOE_QSPI_D0) | \
  965. PIN_OSPEED_HIGH(GPIOE_QSPI_D1) | \
  966. PIN_OSPEED_HIGH(GPIOE_QSPI_D2) | \
  967. PIN_OSPEED_HIGH(GPIOE_QSPI_D3))
  968. #define VAL_GPIOE_PUPDR (PIN_PUPDR_PULLUP(GPIOE_XL_CS) | \
  969. PIN_PUPDR_PULLDOWN(GPIOE_XL_INT) | \
  970. PIN_PUPDR_FLOATING(GPIOE_SAI1_MCK) | \
  971. PIN_PUPDR_FLOATING(GPIOE_AUDIO_RST) | \
  972. PIN_PUPDR_FLOATING(GPIOE_SAI1_FS) | \
  973. PIN_PUPDR_FLOATING(GPIOE_SAI1_SCK) | \
  974. PIN_PUPDR_FLOATING(GPIOE_SAI1_SD) | \
  975. PIN_PUPDR_FLOATING(GPIOE_AUDIO_DIN) | \
  976. PIN_PUPDR_FLOATING(GPIOE_LED_GREEN) | \
  977. PIN_PUPDR_FLOATING(GPIOE_AUDIO_CLK) | \
  978. PIN_PUPDR_PULLUP(GPIOE_QSPI_CLK) | \
  979. PIN_PUPDR_PULLUP(GPIOE_QSPI_CS) | \
  980. PIN_PUPDR_PULLUP(GPIOE_QSPI_D0) | \
  981. PIN_PUPDR_PULLUP(GPIOE_QSPI_D1) | \
  982. PIN_PUPDR_PULLUP(GPIOE_QSPI_D2) | \
  983. PIN_PUPDR_PULLUP(GPIOE_QSPI_D3))
  984. #define VAL_GPIOE_ODR (PIN_ODR_HIGH(GPIOE_XL_CS) | \
  985. PIN_ODR_HIGH(GPIOE_XL_INT) | \
  986. PIN_ODR_HIGH(GPIOE_SAI1_MCK) | \
  987. PIN_ODR_HIGH(GPIOE_AUDIO_RST) | \
  988. PIN_ODR_HIGH(GPIOE_SAI1_FS) | \
  989. PIN_ODR_HIGH(GPIOE_SAI1_SCK) | \
  990. PIN_ODR_HIGH(GPIOE_SAI1_SD) | \
  991. PIN_ODR_HIGH(GPIOE_AUDIO_DIN) | \
  992. PIN_ODR_LOW(GPIOE_LED_GREEN) | \
  993. PIN_ODR_HIGH(GPIOE_AUDIO_CLK) | \
  994. PIN_ODR_HIGH(GPIOE_QSPI_CLK) | \
  995. PIN_ODR_HIGH(GPIOE_QSPI_CS) | \
  996. PIN_ODR_HIGH(GPIOE_QSPI_D0) | \
  997. PIN_ODR_HIGH(GPIOE_QSPI_D1) | \
  998. PIN_ODR_HIGH(GPIOE_QSPI_D2) | \
  999. PIN_ODR_HIGH(GPIOE_QSPI_D3))
  1000. #define VAL_GPIOE_AFRL (PIN_AFIO_AF(GPIOE_XL_CS, 0U) | \
  1001. PIN_AFIO_AF(GPIOE_XL_INT, 0U) | \
  1002. PIN_AFIO_AF(GPIOE_SAI1_MCK, 13U) | \
  1003. PIN_AFIO_AF(GPIOE_AUDIO_RST, 0U) | \
  1004. PIN_AFIO_AF(GPIOE_SAI1_FS, 13U) | \
  1005. PIN_AFIO_AF(GPIOE_SAI1_SCK, 13U) | \
  1006. PIN_AFIO_AF(GPIOE_SAI1_SD, 13U) | \
  1007. PIN_AFIO_AF(GPIOE_AUDIO_DIN, 6U))
  1008. #define VAL_GPIOE_AFRH (PIN_AFIO_AF(GPIOE_LED_GREEN, 0U) | \
  1009. PIN_AFIO_AF(GPIOE_AUDIO_CLK, 6U) | \
  1010. PIN_AFIO_AF(GPIOE_QSPI_CLK, 10U) | \
  1011. PIN_AFIO_AF(GPIOE_QSPI_CS, 10U) | \
  1012. PIN_AFIO_AF(GPIOE_QSPI_D0, 10U) | \
  1013. PIN_AFIO_AF(GPIOE_QSPI_D1, 10U) | \
  1014. PIN_AFIO_AF(GPIOE_QSPI_D2, 10U) | \
  1015. PIN_AFIO_AF(GPIOE_QSPI_D3, 10U))
  1016. #define VAL_GPIOE_ASCR (PIN_ASCR_DISABLED(GPIOE_XL_CS) | \
  1017. PIN_ASCR_DISABLED(GPIOE_XL_INT) | \
  1018. PIN_ASCR_DISABLED(GPIOE_SAI1_MCK) | \
  1019. PIN_ASCR_DISABLED(GPIOE_AUDIO_RST) | \
  1020. PIN_ASCR_DISABLED(GPIOE_SAI1_FS) | \
  1021. PIN_ASCR_DISABLED(GPIOE_SAI1_SCK) | \
  1022. PIN_ASCR_DISABLED(GPIOE_SAI1_SD) | \
  1023. PIN_ASCR_DISABLED(GPIOE_AUDIO_DIN) | \
  1024. PIN_ASCR_DISABLED(GPIOE_LED_GREEN) | \
  1025. PIN_ASCR_DISABLED(GPIOE_AUDIO_CLK) | \
  1026. PIN_ASCR_DISABLED(GPIOE_QSPI_CLK) | \
  1027. PIN_ASCR_DISABLED(GPIOE_QSPI_CS) | \
  1028. PIN_ASCR_DISABLED(GPIOE_QSPI_D0) | \
  1029. PIN_ASCR_DISABLED(GPIOE_QSPI_D1) | \
  1030. PIN_ASCR_DISABLED(GPIOE_QSPI_D2) | \
  1031. PIN_ASCR_DISABLED(GPIOE_QSPI_D3))
  1032. #define VAL_GPIOE_LOCKR (PIN_LOCKR_DISABLED(GPIOE_XL_CS) | \
  1033. PIN_LOCKR_DISABLED(GPIOE_XL_INT) | \
  1034. PIN_LOCKR_DISABLED(GPIOE_SAI1_MCK) | \
  1035. PIN_LOCKR_DISABLED(GPIOE_AUDIO_RST) | \
  1036. PIN_LOCKR_DISABLED(GPIOE_SAI1_FS) | \
  1037. PIN_LOCKR_DISABLED(GPIOE_SAI1_SCK) | \
  1038. PIN_LOCKR_DISABLED(GPIOE_SAI1_SD) | \
  1039. PIN_LOCKR_DISABLED(GPIOE_AUDIO_DIN) | \
  1040. PIN_LOCKR_DISABLED(GPIOE_LED_GREEN) | \
  1041. PIN_LOCKR_DISABLED(GPIOE_AUDIO_CLK) | \
  1042. PIN_LOCKR_DISABLED(GPIOE_QSPI_CLK) | \
  1043. PIN_LOCKR_DISABLED(GPIOE_QSPI_CS) | \
  1044. PIN_LOCKR_DISABLED(GPIOE_QSPI_D0) | \
  1045. PIN_LOCKR_DISABLED(GPIOE_QSPI_D1) | \
  1046. PIN_LOCKR_DISABLED(GPIOE_QSPI_D2) | \
  1047. PIN_LOCKR_DISABLED(GPIOE_QSPI_D3))
  1048. /*
  1049. * GPIOF setup:
  1050. *
  1051. * PF0 - PIN0 (analog).
  1052. * PF1 - PIN1 (analog).
  1053. * PF2 - PIN2 (analog).
  1054. * PF3 - PIN3 (analog).
  1055. * PF4 - PIN4 (analog).
  1056. * PF5 - PIN5 (analog).
  1057. * PF6 - PIN6 (analog).
  1058. * PF7 - PIN7 (analog).
  1059. * PF8 - PIN8 (analog).
  1060. * PF9 - PIN9 (analog).
  1061. * PF10 - PIN10 (analog).
  1062. * PF11 - PIN11 (analog).
  1063. * PF12 - PIN12 (analog).
  1064. * PF13 - PIN13 (analog).
  1065. * PF14 - PIN14 (analog).
  1066. * PF15 - PIN15 (analog).
  1067. */
  1068. #define VAL_GPIOF_MODER (PIN_MODE_ANALOG(GPIOF_PIN0) | \
  1069. PIN_MODE_ANALOG(GPIOF_PIN1) | \
  1070. PIN_MODE_ANALOG(GPIOF_PIN2) | \
  1071. PIN_MODE_ANALOG(GPIOF_PIN3) | \
  1072. PIN_MODE_ANALOG(GPIOF_PIN4) | \
  1073. PIN_MODE_ANALOG(GPIOF_PIN5) | \
  1074. PIN_MODE_ANALOG(GPIOF_PIN6) | \
  1075. PIN_MODE_ANALOG(GPIOF_PIN7) | \
  1076. PIN_MODE_ANALOG(GPIOF_PIN8) | \
  1077. PIN_MODE_ANALOG(GPIOF_PIN9) | \
  1078. PIN_MODE_ANALOG(GPIOF_PIN10) | \
  1079. PIN_MODE_ANALOG(GPIOF_PIN11) | \
  1080. PIN_MODE_ANALOG(GPIOF_PIN12) | \
  1081. PIN_MODE_ANALOG(GPIOF_PIN13) | \
  1082. PIN_MODE_ANALOG(GPIOF_PIN14) | \
  1083. PIN_MODE_ANALOG(GPIOF_PIN15))
  1084. #define VAL_GPIOF_OTYPER (PIN_OTYPE_PUSHPULL(GPIOF_PIN0) | \
  1085. PIN_OTYPE_PUSHPULL(GPIOF_PIN1) | \
  1086. PIN_OTYPE_PUSHPULL(GPIOF_PIN2) | \
  1087. PIN_OTYPE_PUSHPULL(GPIOF_PIN3) | \
  1088. PIN_OTYPE_PUSHPULL(GPIOF_PIN4) | \
  1089. PIN_OTYPE_PUSHPULL(GPIOF_PIN5) | \
  1090. PIN_OTYPE_PUSHPULL(GPIOF_PIN6) | \
  1091. PIN_OTYPE_PUSHPULL(GPIOF_PIN7) | \
  1092. PIN_OTYPE_PUSHPULL(GPIOF_PIN8) | \
  1093. PIN_OTYPE_PUSHPULL(GPIOF_PIN9) | \
  1094. PIN_OTYPE_PUSHPULL(GPIOF_PIN10) | \
  1095. PIN_OTYPE_PUSHPULL(GPIOF_PIN11) | \
  1096. PIN_OTYPE_PUSHPULL(GPIOF_PIN12) | \
  1097. PIN_OTYPE_PUSHPULL(GPIOF_PIN13) | \
  1098. PIN_OTYPE_PUSHPULL(GPIOF_PIN14) | \
  1099. PIN_OTYPE_PUSHPULL(GPIOF_PIN15))
  1100. #define VAL_GPIOF_OSPEEDR (PIN_OSPEED_HIGH(GPIOF_PIN0) | \
  1101. PIN_OSPEED_HIGH(GPIOF_PIN1) | \
  1102. PIN_OSPEED_HIGH(GPIOF_PIN2) | \
  1103. PIN_OSPEED_HIGH(GPIOF_PIN3) | \
  1104. PIN_OSPEED_HIGH(GPIOF_PIN4) | \
  1105. PIN_OSPEED_HIGH(GPIOF_PIN5) | \
  1106. PIN_OSPEED_HIGH(GPIOF_PIN6) | \
  1107. PIN_OSPEED_HIGH(GPIOF_PIN7) | \
  1108. PIN_OSPEED_HIGH(GPIOF_PIN8) | \
  1109. PIN_OSPEED_HIGH(GPIOF_PIN9) | \
  1110. PIN_OSPEED_HIGH(GPIOF_PIN10) | \
  1111. PIN_OSPEED_HIGH(GPIOF_PIN11) | \
  1112. PIN_OSPEED_HIGH(GPIOF_PIN12) | \
  1113. PIN_OSPEED_HIGH(GPIOF_PIN13) | \
  1114. PIN_OSPEED_HIGH(GPIOF_PIN14) | \
  1115. PIN_OSPEED_HIGH(GPIOF_PIN15))
  1116. #define VAL_GPIOF_PUPDR (PIN_PUPDR_FLOATING(GPIOF_PIN0) | \
  1117. PIN_PUPDR_FLOATING(GPIOF_PIN1) | \
  1118. PIN_PUPDR_FLOATING(GPIOF_PIN2) | \
  1119. PIN_PUPDR_FLOATING(GPIOF_PIN3) | \
  1120. PIN_PUPDR_FLOATING(GPIOF_PIN4) | \
  1121. PIN_PUPDR_FLOATING(GPIOF_PIN5) | \
  1122. PIN_PUPDR_FLOATING(GPIOF_PIN6) | \
  1123. PIN_PUPDR_FLOATING(GPIOF_PIN7) | \
  1124. PIN_PUPDR_FLOATING(GPIOF_PIN8) | \
  1125. PIN_PUPDR_FLOATING(GPIOF_PIN9) | \
  1126. PIN_PUPDR_FLOATING(GPIOF_PIN10) | \
  1127. PIN_PUPDR_FLOATING(GPIOF_PIN11) | \
  1128. PIN_PUPDR_FLOATING(GPIOF_PIN12) | \
  1129. PIN_PUPDR_FLOATING(GPIOF_PIN13) | \
  1130. PIN_PUPDR_FLOATING(GPIOF_PIN14) | \
  1131. PIN_PUPDR_FLOATING(GPIOF_PIN15))
  1132. #define VAL_GPIOF_ODR (PIN_ODR_HIGH(GPIOF_PIN0) | \
  1133. PIN_ODR_HIGH(GPIOF_PIN1) | \
  1134. PIN_ODR_HIGH(GPIOF_PIN2) | \
  1135. PIN_ODR_HIGH(GPIOF_PIN3) | \
  1136. PIN_ODR_HIGH(GPIOF_PIN4) | \
  1137. PIN_ODR_HIGH(GPIOF_PIN5) | \
  1138. PIN_ODR_HIGH(GPIOF_PIN6) | \
  1139. PIN_ODR_HIGH(GPIOF_PIN7) | \
  1140. PIN_ODR_HIGH(GPIOF_PIN8) | \
  1141. PIN_ODR_HIGH(GPIOF_PIN9) | \
  1142. PIN_ODR_HIGH(GPIOF_PIN10) | \
  1143. PIN_ODR_HIGH(GPIOF_PIN11) | \
  1144. PIN_ODR_HIGH(GPIOF_PIN12) | \
  1145. PIN_ODR_HIGH(GPIOF_PIN13) | \
  1146. PIN_ODR_HIGH(GPIOF_PIN14) | \
  1147. PIN_ODR_HIGH(GPIOF_PIN15))
  1148. #define VAL_GPIOF_AFRL (PIN_AFIO_AF(GPIOF_PIN0, 0U) | \
  1149. PIN_AFIO_AF(GPIOF_PIN1, 0U) | \
  1150. PIN_AFIO_AF(GPIOF_PIN2, 0U) | \
  1151. PIN_AFIO_AF(GPIOF_PIN3, 0U) | \
  1152. PIN_AFIO_AF(GPIOF_PIN4, 0U) | \
  1153. PIN_AFIO_AF(GPIOF_PIN5, 0U) | \
  1154. PIN_AFIO_AF(GPIOF_PIN6, 0U) | \
  1155. PIN_AFIO_AF(GPIOF_PIN7, 0U))
  1156. #define VAL_GPIOF_AFRH (PIN_AFIO_AF(GPIOF_PIN8, 0U) | \
  1157. PIN_AFIO_AF(GPIOF_PIN9, 0U) | \
  1158. PIN_AFIO_AF(GPIOF_PIN10, 0U) | \
  1159. PIN_AFIO_AF(GPIOF_PIN11, 0U) | \
  1160. PIN_AFIO_AF(GPIOF_PIN12, 0U) | \
  1161. PIN_AFIO_AF(GPIOF_PIN13, 0U) | \
  1162. PIN_AFIO_AF(GPIOF_PIN14, 0U) | \
  1163. PIN_AFIO_AF(GPIOF_PIN15, 0U))
  1164. #define VAL_GPIOF_ASCR (PIN_ASCR_DISABLED(GPIOF_PIN0) | \
  1165. PIN_ASCR_DISABLED(GPIOF_PIN1) | \
  1166. PIN_ASCR_DISABLED(GPIOF_PIN2) | \
  1167. PIN_ASCR_DISABLED(GPIOF_PIN3) | \
  1168. PIN_ASCR_DISABLED(GPIOF_PIN4) | \
  1169. PIN_ASCR_DISABLED(GPIOF_PIN5) | \
  1170. PIN_ASCR_DISABLED(GPIOF_PIN6) | \
  1171. PIN_ASCR_DISABLED(GPIOF_PIN7) | \
  1172. PIN_ASCR_DISABLED(GPIOF_PIN8) | \
  1173. PIN_ASCR_DISABLED(GPIOF_PIN9) | \
  1174. PIN_ASCR_DISABLED(GPIOF_PIN10) | \
  1175. PIN_ASCR_DISABLED(GPIOF_PIN11) | \
  1176. PIN_ASCR_DISABLED(GPIOF_PIN12) | \
  1177. PIN_ASCR_DISABLED(GPIOF_PIN13) | \
  1178. PIN_ASCR_DISABLED(GPIOF_PIN14) | \
  1179. PIN_ASCR_DISABLED(GPIOF_PIN15))
  1180. #define VAL_GPIOF_LOCKR (PIN_LOCKR_DISABLED(GPIOF_PIN0) | \
  1181. PIN_LOCKR_DISABLED(GPIOF_PIN1) | \
  1182. PIN_LOCKR_DISABLED(GPIOF_PIN2) | \
  1183. PIN_LOCKR_DISABLED(GPIOF_PIN3) | \
  1184. PIN_LOCKR_DISABLED(GPIOF_PIN4) | \
  1185. PIN_LOCKR_DISABLED(GPIOF_PIN5) | \
  1186. PIN_LOCKR_DISABLED(GPIOF_PIN6) | \
  1187. PIN_LOCKR_DISABLED(GPIOF_PIN7) | \
  1188. PIN_LOCKR_DISABLED(GPIOF_PIN8) | \
  1189. PIN_LOCKR_DISABLED(GPIOF_PIN9) | \
  1190. PIN_LOCKR_DISABLED(GPIOF_PIN10) | \
  1191. PIN_LOCKR_DISABLED(GPIOF_PIN11) | \
  1192. PIN_LOCKR_DISABLED(GPIOF_PIN12) | \
  1193. PIN_LOCKR_DISABLED(GPIOF_PIN13) | \
  1194. PIN_LOCKR_DISABLED(GPIOF_PIN14) | \
  1195. PIN_LOCKR_DISABLED(GPIOF_PIN15))
  1196. /*
  1197. * GPIOG setup:
  1198. *
  1199. * PG0 - PIN0 (analog).
  1200. * PG1 - PIN1 (analog).
  1201. * PG2 - PIN2 (analog).
  1202. * PG3 - PIN3 (analog).
  1203. * PG4 - PIN4 (analog).
  1204. * PG5 - PIN5 (analog).
  1205. * PG6 - PIN6 (analog).
  1206. * PG7 - PIN7 (analog).
  1207. * PG8 - PIN8 (analog).
  1208. * PG9 - PIN9 (analog).
  1209. * PG10 - PIN10 (analog).
  1210. * PG11 - PIN11 (analog).
  1211. * PG12 - PIN12 (analog).
  1212. * PG13 - PIN13 (analog).
  1213. * PG14 - PIN14 (analog).
  1214. * PG15 - PIN15 (analog).
  1215. */
  1216. #define VAL_GPIOG_MODER (PIN_MODE_ANALOG(GPIOG_PIN0) | \
  1217. PIN_MODE_ANALOG(GPIOG_PIN1) | \
  1218. PIN_MODE_ANALOG(GPIOG_PIN2) | \
  1219. PIN_MODE_ANALOG(GPIOG_PIN3) | \
  1220. PIN_MODE_ANALOG(GPIOG_PIN4) | \
  1221. PIN_MODE_ANALOG(GPIOG_PIN5) | \
  1222. PIN_MODE_ANALOG(GPIOG_PIN6) | \
  1223. PIN_MODE_ANALOG(GPIOG_PIN7) | \
  1224. PIN_MODE_ANALOG(GPIOG_PIN8) | \
  1225. PIN_MODE_ANALOG(GPIOG_PIN9) | \
  1226. PIN_MODE_ANALOG(GPIOG_PIN10) | \
  1227. PIN_MODE_ANALOG(GPIOG_PIN11) | \
  1228. PIN_MODE_ANALOG(GPIOG_PIN12) | \
  1229. PIN_MODE_ANALOG(GPIOG_PIN13) | \
  1230. PIN_MODE_ANALOG(GPIOG_PIN14) | \
  1231. PIN_MODE_ANALOG(GPIOG_PIN15))
  1232. #define VAL_GPIOG_OTYPER (PIN_OTYPE_PUSHPULL(GPIOG_PIN0) | \
  1233. PIN_OTYPE_PUSHPULL(GPIOG_PIN1) | \
  1234. PIN_OTYPE_PUSHPULL(GPIOG_PIN2) | \
  1235. PIN_OTYPE_PUSHPULL(GPIOG_PIN3) | \
  1236. PIN_OTYPE_PUSHPULL(GPIOG_PIN4) | \
  1237. PIN_OTYPE_PUSHPULL(GPIOG_PIN5) | \
  1238. PIN_OTYPE_PUSHPULL(GPIOG_PIN6) | \
  1239. PIN_OTYPE_PUSHPULL(GPIOG_PIN7) | \
  1240. PIN_OTYPE_PUSHPULL(GPIOG_PIN8) | \
  1241. PIN_OTYPE_PUSHPULL(GPIOG_PIN9) | \
  1242. PIN_OTYPE_PUSHPULL(GPIOG_PIN10) | \
  1243. PIN_OTYPE_PUSHPULL(GPIOG_PIN11) | \
  1244. PIN_OTYPE_PUSHPULL(GPIOG_PIN12) | \
  1245. PIN_OTYPE_PUSHPULL(GPIOG_PIN13) | \
  1246. PIN_OTYPE_PUSHPULL(GPIOG_PIN14) | \
  1247. PIN_OTYPE_PUSHPULL(GPIOG_PIN15))
  1248. #define VAL_GPIOG_OSPEEDR (PIN_OSPEED_VERYLOW(GPIOG_PIN0) | \
  1249. PIN_OSPEED_VERYLOW(GPIOG_PIN1) | \
  1250. PIN_OSPEED_VERYLOW(GPIOG_PIN2) | \
  1251. PIN_OSPEED_VERYLOW(GPIOG_PIN3) | \
  1252. PIN_OSPEED_VERYLOW(GPIOG_PIN4) | \
  1253. PIN_OSPEED_VERYLOW(GPIOG_PIN5) | \
  1254. PIN_OSPEED_VERYLOW(GPIOG_PIN6) | \
  1255. PIN_OSPEED_VERYLOW(GPIOG_PIN7) | \
  1256. PIN_OSPEED_VERYLOW(GPIOG_PIN8) | \
  1257. PIN_OSPEED_VERYLOW(GPIOG_PIN9) | \
  1258. PIN_OSPEED_VERYLOW(GPIOG_PIN10) | \
  1259. PIN_OSPEED_VERYLOW(GPIOG_PIN11) | \
  1260. PIN_OSPEED_VERYLOW(GPIOG_PIN12) | \
  1261. PIN_OSPEED_VERYLOW(GPIOG_PIN13) | \
  1262. PIN_OSPEED_VERYLOW(GPIOG_PIN14) | \
  1263. PIN_OSPEED_VERYLOW(GPIOG_PIN15))
  1264. #define VAL_GPIOG_PUPDR (PIN_PUPDR_FLOATING(GPIOG_PIN0) | \
  1265. PIN_PUPDR_FLOATING(GPIOG_PIN1) | \
  1266. PIN_PUPDR_FLOATING(GPIOG_PIN2) | \
  1267. PIN_PUPDR_FLOATING(GPIOG_PIN3) | \
  1268. PIN_PUPDR_FLOATING(GPIOG_PIN4) | \
  1269. PIN_PUPDR_FLOATING(GPIOG_PIN5) | \
  1270. PIN_PUPDR_FLOATING(GPIOG_PIN6) | \
  1271. PIN_PUPDR_FLOATING(GPIOG_PIN7) | \
  1272. PIN_PUPDR_FLOATING(GPIOG_PIN8) | \
  1273. PIN_PUPDR_FLOATING(GPIOG_PIN9) | \
  1274. PIN_PUPDR_FLOATING(GPIOG_PIN10) | \
  1275. PIN_PUPDR_FLOATING(GPIOG_PIN11) | \
  1276. PIN_PUPDR_FLOATING(GPIOG_PIN12) | \
  1277. PIN_PUPDR_FLOATING(GPIOG_PIN13) | \
  1278. PIN_PUPDR_FLOATING(GPIOG_PIN14) | \
  1279. PIN_PUPDR_FLOATING(GPIOG_PIN15))
  1280. #define VAL_GPIOG_ODR (PIN_ODR_HIGH(GPIOG_PIN0) | \
  1281. PIN_ODR_HIGH(GPIOG_PIN1) | \
  1282. PIN_ODR_HIGH(GPIOG_PIN2) | \
  1283. PIN_ODR_HIGH(GPIOG_PIN3) | \
  1284. PIN_ODR_HIGH(GPIOG_PIN4) | \
  1285. PIN_ODR_HIGH(GPIOG_PIN5) | \
  1286. PIN_ODR_HIGH(GPIOG_PIN6) | \
  1287. PIN_ODR_HIGH(GPIOG_PIN7) | \
  1288. PIN_ODR_HIGH(GPIOG_PIN8) | \
  1289. PIN_ODR_HIGH(GPIOG_PIN9) | \
  1290. PIN_ODR_HIGH(GPIOG_PIN10) | \
  1291. PIN_ODR_HIGH(GPIOG_PIN11) | \
  1292. PIN_ODR_HIGH(GPIOG_PIN12) | \
  1293. PIN_ODR_HIGH(GPIOG_PIN13) | \
  1294. PIN_ODR_HIGH(GPIOG_PIN14) | \
  1295. PIN_ODR_HIGH(GPIOG_PIN15))
  1296. #define VAL_GPIOG_AFRL (PIN_AFIO_AF(GPIOG_PIN0, 0U) | \
  1297. PIN_AFIO_AF(GPIOG_PIN1, 0U) | \
  1298. PIN_AFIO_AF(GPIOG_PIN2, 0U) | \
  1299. PIN_AFIO_AF(GPIOG_PIN3, 0U) | \
  1300. PIN_AFIO_AF(GPIOG_PIN4, 0U) | \
  1301. PIN_AFIO_AF(GPIOG_PIN5, 0U) | \
  1302. PIN_AFIO_AF(GPIOG_PIN6, 0U) | \
  1303. PIN_AFIO_AF(GPIOG_PIN7, 0U))
  1304. #define VAL_GPIOG_AFRH (PIN_AFIO_AF(GPIOG_PIN8, 0U) | \
  1305. PIN_AFIO_AF(GPIOG_PIN9, 0U) | \
  1306. PIN_AFIO_AF(GPIOG_PIN10, 0U) | \
  1307. PIN_AFIO_AF(GPIOG_PIN11, 0U) | \
  1308. PIN_AFIO_AF(GPIOG_PIN12, 0U) | \
  1309. PIN_AFIO_AF(GPIOG_PIN13, 0U) | \
  1310. PIN_AFIO_AF(GPIOG_PIN14, 0U) | \
  1311. PIN_AFIO_AF(GPIOG_PIN15, 0U))
  1312. #define VAL_GPIOG_ASCR (PIN_ASCR_DISABLED(GPIOG_PIN0) | \
  1313. PIN_ASCR_DISABLED(GPIOG_PIN1) | \
  1314. PIN_ASCR_DISABLED(GPIOG_PIN2) | \
  1315. PIN_ASCR_DISABLED(GPIOG_PIN3) | \
  1316. PIN_ASCR_DISABLED(GPIOG_PIN4) | \
  1317. PIN_ASCR_DISABLED(GPIOG_PIN5) | \
  1318. PIN_ASCR_DISABLED(GPIOG_PIN6) | \
  1319. PIN_ASCR_DISABLED(GPIOG_PIN7) | \
  1320. PIN_ASCR_DISABLED(GPIOG_PIN8) | \
  1321. PIN_ASCR_DISABLED(GPIOG_PIN9) | \
  1322. PIN_ASCR_DISABLED(GPIOG_PIN10) | \
  1323. PIN_ASCR_DISABLED(GPIOG_PIN11) | \
  1324. PIN_ASCR_DISABLED(GPIOG_PIN12) | \
  1325. PIN_ASCR_DISABLED(GPIOG_PIN13) | \
  1326. PIN_ASCR_DISABLED(GPIOG_PIN14) | \
  1327. PIN_ASCR_DISABLED(GPIOG_PIN15))
  1328. #define VAL_GPIOG_LOCKR (PIN_LOCKR_DISABLED(GPIOG_PIN0) | \
  1329. PIN_LOCKR_DISABLED(GPIOG_PIN1) | \
  1330. PIN_LOCKR_DISABLED(GPIOG_PIN2) | \
  1331. PIN_LOCKR_DISABLED(GPIOG_PIN3) | \
  1332. PIN_LOCKR_DISABLED(GPIOG_PIN4) | \
  1333. PIN_LOCKR_DISABLED(GPIOG_PIN5) | \
  1334. PIN_LOCKR_DISABLED(GPIOG_PIN6) | \
  1335. PIN_LOCKR_DISABLED(GPIOG_PIN7) | \
  1336. PIN_LOCKR_DISABLED(GPIOG_PIN8) | \
  1337. PIN_LOCKR_DISABLED(GPIOG_PIN9) | \
  1338. PIN_LOCKR_DISABLED(GPIOG_PIN10) | \
  1339. PIN_LOCKR_DISABLED(GPIOG_PIN11) | \
  1340. PIN_LOCKR_DISABLED(GPIOG_PIN12) | \
  1341. PIN_LOCKR_DISABLED(GPIOG_PIN13) | \
  1342. PIN_LOCKR_DISABLED(GPIOG_PIN14) | \
  1343. PIN_LOCKR_DISABLED(GPIOG_PIN15))
  1344. /*
  1345. * GPIOH setup:
  1346. *
  1347. * PH0 - OSC_IN (input floating).
  1348. * PH1 - OSC_OUT (input floating).
  1349. * PH2 - PIN2 (analog).
  1350. * PH3 - PIN3 (analog).
  1351. * PH4 - PIN4 (analog).
  1352. * PH5 - PIN5 (analog).
  1353. * PH6 - PIN6 (analog).
  1354. * PH7 - PIN7 (analog).
  1355. * PH8 - PIN8 (analog).
  1356. * PH9 - PIN9 (analog).
  1357. * PH10 - PIN10 (analog).
  1358. * PH11 - PIN11 (analog).
  1359. * PH12 - PIN12 (analog).
  1360. * PH13 - PIN13 (analog).
  1361. * PH14 - PIN14 (analog).
  1362. * PH15 - PIN15 (analog).
  1363. */
  1364. #define VAL_GPIOH_MODER (PIN_MODE_INPUT(GPIOH_OSC_IN) | \
  1365. PIN_MODE_INPUT(GPIOH_OSC_OUT) | \
  1366. PIN_MODE_ANALOG(GPIOH_PIN2) | \
  1367. PIN_MODE_ANALOG(GPIOH_PIN3) | \
  1368. PIN_MODE_ANALOG(GPIOH_PIN4) | \
  1369. PIN_MODE_ANALOG(GPIOH_PIN5) | \
  1370. PIN_MODE_ANALOG(GPIOH_PIN6) | \
  1371. PIN_MODE_ANALOG(GPIOH_PIN7) | \
  1372. PIN_MODE_ANALOG(GPIOH_PIN8) | \
  1373. PIN_MODE_ANALOG(GPIOH_PIN9) | \
  1374. PIN_MODE_ANALOG(GPIOH_PIN10) | \
  1375. PIN_MODE_ANALOG(GPIOH_PIN11) | \
  1376. PIN_MODE_ANALOG(GPIOH_PIN12) | \
  1377. PIN_MODE_ANALOG(GPIOH_PIN13) | \
  1378. PIN_MODE_ANALOG(GPIOH_PIN14) | \
  1379. PIN_MODE_ANALOG(GPIOH_PIN15))
  1380. #define VAL_GPIOH_OTYPER (PIN_OTYPE_PUSHPULL(GPIOH_OSC_IN) | \
  1381. PIN_OTYPE_PUSHPULL(GPIOH_OSC_OUT) | \
  1382. PIN_OTYPE_PUSHPULL(GPIOH_PIN2) | \
  1383. PIN_OTYPE_PUSHPULL(GPIOH_PIN3) | \
  1384. PIN_OTYPE_PUSHPULL(GPIOH_PIN4) | \
  1385. PIN_OTYPE_PUSHPULL(GPIOH_PIN5) | \
  1386. PIN_OTYPE_PUSHPULL(GPIOH_PIN6) | \
  1387. PIN_OTYPE_PUSHPULL(GPIOH_PIN7) | \
  1388. PIN_OTYPE_PUSHPULL(GPIOH_PIN8) | \
  1389. PIN_OTYPE_PUSHPULL(GPIOH_PIN9) | \
  1390. PIN_OTYPE_PUSHPULL(GPIOH_PIN10) | \
  1391. PIN_OTYPE_PUSHPULL(GPIOH_PIN11) | \
  1392. PIN_OTYPE_PUSHPULL(GPIOH_PIN12) | \
  1393. PIN_OTYPE_PUSHPULL(GPIOH_PIN13) | \
  1394. PIN_OTYPE_PUSHPULL(GPIOH_PIN14) | \
  1395. PIN_OTYPE_PUSHPULL(GPIOH_PIN15))
  1396. #define VAL_GPIOH_OSPEEDR (PIN_OSPEED_HIGH(GPIOH_OSC_IN) | \
  1397. PIN_OSPEED_HIGH(GPIOH_OSC_OUT) | \
  1398. PIN_OSPEED_VERYLOW(GPIOH_PIN2) | \
  1399. PIN_OSPEED_VERYLOW(GPIOH_PIN3) | \
  1400. PIN_OSPEED_VERYLOW(GPIOH_PIN4) | \
  1401. PIN_OSPEED_VERYLOW(GPIOH_PIN5) | \
  1402. PIN_OSPEED_VERYLOW(GPIOH_PIN6) | \
  1403. PIN_OSPEED_VERYLOW(GPIOH_PIN7) | \
  1404. PIN_OSPEED_VERYLOW(GPIOH_PIN8) | \
  1405. PIN_OSPEED_VERYLOW(GPIOH_PIN9) | \
  1406. PIN_OSPEED_VERYLOW(GPIOH_PIN10) | \
  1407. PIN_OSPEED_VERYLOW(GPIOH_PIN11) | \
  1408. PIN_OSPEED_VERYLOW(GPIOH_PIN12) | \
  1409. PIN_OSPEED_VERYLOW(GPIOH_PIN13) | \
  1410. PIN_OSPEED_VERYLOW(GPIOH_PIN14) | \
  1411. PIN_OSPEED_VERYLOW(GPIOH_PIN15))
  1412. #define VAL_GPIOH_PUPDR (PIN_PUPDR_FLOATING(GPIOH_OSC_IN) | \
  1413. PIN_PUPDR_FLOATING(GPIOH_OSC_OUT) | \
  1414. PIN_PUPDR_FLOATING(GPIOH_PIN2) | \
  1415. PIN_PUPDR_FLOATING(GPIOH_PIN3) | \
  1416. PIN_PUPDR_FLOATING(GPIOH_PIN4) | \
  1417. PIN_PUPDR_FLOATING(GPIOH_PIN5) | \
  1418. PIN_PUPDR_FLOATING(GPIOH_PIN6) | \
  1419. PIN_PUPDR_FLOATING(GPIOH_PIN7) | \
  1420. PIN_PUPDR_FLOATING(GPIOH_PIN8) | \
  1421. PIN_PUPDR_FLOATING(GPIOH_PIN9) | \
  1422. PIN_PUPDR_FLOATING(GPIOH_PIN10) | \
  1423. PIN_PUPDR_FLOATING(GPIOH_PIN11) | \
  1424. PIN_PUPDR_FLOATING(GPIOH_PIN12) | \
  1425. PIN_PUPDR_FLOATING(GPIOH_PIN13) | \
  1426. PIN_PUPDR_FLOATING(GPIOH_PIN14) | \
  1427. PIN_PUPDR_FLOATING(GPIOH_PIN15))
  1428. #define VAL_GPIOH_ODR (PIN_ODR_HIGH(GPIOH_OSC_IN) | \
  1429. PIN_ODR_HIGH(GPIOH_OSC_OUT) | \
  1430. PIN_ODR_HIGH(GPIOH_PIN2) | \
  1431. PIN_ODR_HIGH(GPIOH_PIN3) | \
  1432. PIN_ODR_HIGH(GPIOH_PIN4) | \
  1433. PIN_ODR_HIGH(GPIOH_PIN5) | \
  1434. PIN_ODR_HIGH(GPIOH_PIN6) | \
  1435. PIN_ODR_HIGH(GPIOH_PIN7) | \
  1436. PIN_ODR_HIGH(GPIOH_PIN8) | \
  1437. PIN_ODR_HIGH(GPIOH_PIN9) | \
  1438. PIN_ODR_HIGH(GPIOH_PIN10) | \
  1439. PIN_ODR_HIGH(GPIOH_PIN11) | \
  1440. PIN_ODR_HIGH(GPIOH_PIN12) | \
  1441. PIN_ODR_HIGH(GPIOH_PIN13) | \
  1442. PIN_ODR_HIGH(GPIOH_PIN14) | \
  1443. PIN_ODR_HIGH(GPIOH_PIN15))
  1444. #define VAL_GPIOH_AFRL (PIN_AFIO_AF(GPIOH_OSC_IN, 0U) | \
  1445. PIN_AFIO_AF(GPIOH_OSC_OUT, 0U) | \
  1446. PIN_AFIO_AF(GPIOH_PIN2, 0U) | \
  1447. PIN_AFIO_AF(GPIOH_PIN3, 0U) | \
  1448. PIN_AFIO_AF(GPIOH_PIN4, 0U) | \
  1449. PIN_AFIO_AF(GPIOH_PIN5, 0U) | \
  1450. PIN_AFIO_AF(GPIOH_PIN6, 0U) | \
  1451. PIN_AFIO_AF(GPIOH_PIN7, 0U))
  1452. #define VAL_GPIOH_AFRH (PIN_AFIO_AF(GPIOH_PIN8, 0U) | \
  1453. PIN_AFIO_AF(GPIOH_PIN9, 0U) | \
  1454. PIN_AFIO_AF(GPIOH_PIN10, 0U) | \
  1455. PIN_AFIO_AF(GPIOH_PIN11, 0U) | \
  1456. PIN_AFIO_AF(GPIOH_PIN12, 0U) | \
  1457. PIN_AFIO_AF(GPIOH_PIN13, 0U) | \
  1458. PIN_AFIO_AF(GPIOH_PIN14, 0U) | \
  1459. PIN_AFIO_AF(GPIOH_PIN15, 0U))
  1460. #define VAL_GPIOH_ASCR (PIN_ASCR_DISABLED(GPIOH_OSC_IN) | \
  1461. PIN_ASCR_DISABLED(GPIOH_OSC_OUT) | \
  1462. PIN_ASCR_DISABLED(GPIOH_PIN2) | \
  1463. PIN_ASCR_DISABLED(GPIOH_PIN3) | \
  1464. PIN_ASCR_DISABLED(GPIOH_PIN4) | \
  1465. PIN_ASCR_DISABLED(GPIOH_PIN5) | \
  1466. PIN_ASCR_DISABLED(GPIOH_PIN6) | \
  1467. PIN_ASCR_DISABLED(GPIOH_PIN7) | \
  1468. PIN_ASCR_DISABLED(GPIOH_PIN8) | \
  1469. PIN_ASCR_DISABLED(GPIOH_PIN9) | \
  1470. PIN_ASCR_DISABLED(GPIOH_PIN10) | \
  1471. PIN_ASCR_DISABLED(GPIOH_PIN11) | \
  1472. PIN_ASCR_DISABLED(GPIOH_PIN12) | \
  1473. PIN_ASCR_DISABLED(GPIOH_PIN13) | \
  1474. PIN_ASCR_DISABLED(GPIOH_PIN14) | \
  1475. PIN_ASCR_DISABLED(GPIOH_PIN15))
  1476. #define VAL_GPIOH_LOCKR (PIN_LOCKR_DISABLED(GPIOH_OSC_IN) | \
  1477. PIN_LOCKR_DISABLED(GPIOH_OSC_OUT) | \
  1478. PIN_LOCKR_DISABLED(GPIOH_PIN2) | \
  1479. PIN_LOCKR_DISABLED(GPIOH_PIN3) | \
  1480. PIN_LOCKR_DISABLED(GPIOH_PIN4) | \
  1481. PIN_LOCKR_DISABLED(GPIOH_PIN5) | \
  1482. PIN_LOCKR_DISABLED(GPIOH_PIN6) | \
  1483. PIN_LOCKR_DISABLED(GPIOH_PIN7) | \
  1484. PIN_LOCKR_DISABLED(GPIOH_PIN8) | \
  1485. PIN_LOCKR_DISABLED(GPIOH_PIN9) | \
  1486. PIN_LOCKR_DISABLED(GPIOH_PIN10) | \
  1487. PIN_LOCKR_DISABLED(GPIOH_PIN11) | \
  1488. PIN_LOCKR_DISABLED(GPIOH_PIN12) | \
  1489. PIN_LOCKR_DISABLED(GPIOH_PIN13) | \
  1490. PIN_LOCKR_DISABLED(GPIOH_PIN14) | \
  1491. PIN_LOCKR_DISABLED(GPIOH_PIN15))
  1492. /*===========================================================================*/
  1493. /* External declarations. */
  1494. /*===========================================================================*/
  1495. #if !defined(_FROM_ASM_)
  1496. #ifdef __cplusplus
  1497. extern "C" {
  1498. #endif
  1499. void boardInit(void);
  1500. #ifdef __cplusplus
  1501. }
  1502. #endif
  1503. #endif /* _FROM_ASM_ */
  1504. #endif /* BOARD_H */