hwdef.h 86 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844
  1. /*
  2. generated hardware definitions from hwdef.dat - DO NOT EDIT
  3. */
  4. #pragma once
  5. #ifndef TRUE
  6. #define TRUE 1
  7. #endif
  8. #ifndef FALSE
  9. #define FALSE 0
  10. #endif
  11. // MCU type (ChibiOS define)
  12. #define STM32H7xx_MCUCONF
  13. #define STM32H743_MCUCONF
  14. #define STM32H743xx
  15. // crystal frequency
  16. #define STM32_HSECLK 16000000U
  17. // UART used for stdout (printf)
  18. #define HAL_USE_SDC FALSE
  19. #define STM32_USB_USE_OTG1 TRUE
  20. #define HAL_USE_USB TRUE
  21. #define HAL_USE_SERIAL_USB TRUE
  22. #define STM32_VDD 330U
  23. #define HAL_STORAGE_SIZE 16384
  24. #define CONFIG_HAL_BOARD_SUBTYPE HAL_BOARD_SUBTYPE_CHIBIOS_FMUV5
  25. #define HAL_CHIBIOS_ARCH_FMUV5 1
  26. #define BOARD_TYPE_DEFAULT 24
  27. #define STM32_VDD 330U
  28. #define HAL_I2C_INTERNAL_MASK 1
  29. #define AP_FEATURE_RTSCTS 1
  30. #define AP_FEATURE_SBUS_OUT 1
  31. #define BOARD_PWM_COUNT_DEFAULT 8
  32. #define HAL_HEATER_GPIO_PIN 80
  33. #define HAL_GPIO_A_LED_PIN 90
  34. #define HAL_GPIO_B_LED_PIN 92
  35. #define HAL_GPIO_LED_ON 0
  36. #define HAL_STORAGE_SIZE 16384
  37. #define HAL_WITH_RAMTRON 1
  38. #define HAL_HAVE_SAFETY_SWITCH 1
  39. #define HAL_BARO_DEFAULT HAL_BARO_MS5611_SPI
  40. #define HAL_COMPASS_DEFAULT HAL_COMPASS_NONE
  41. #define HAL_COMPASS_AUTO_ROT_DEFAULT 2
  42. #define HAL_BOARD_LOG_DIRECTORY "/APM/LOGS"
  43. #define HAL_BOARD_TERRAIN_DIRECTORY "/APM/TERRAIN"
  44. #define HAL_BATT_MONITOR_DEFAULT 4
  45. #define HAL_BATT_VOLT_PIN 16
  46. #define HAL_BATT_CURR_PIN 17
  47. #define HAL_BATT2_VOLT_PIN 14
  48. #define HAL_BATT2_CURR_PIN 15
  49. #define HAL_BATT_VOLT_SCALE 18.182
  50. #define HAL_BATT_CURR_SCALE 36.364
  51. #define BOARD_FLASH_SIZE 2048
  52. #define CRT1_AREAS_NUMBER 1
  53. // location of loaded firmware
  54. #define FLASH_LOAD_ADDRESS 0x08020000
  55. // memory regions
  56. #define HAL_MEMORY_REGIONS {(void*)0x24000000, 0x00080000, 0x01 }, {(void*)0x30000000, 0x00048000, 0x01 }, {(void*)0x38000000, 0x00010000, 0x01 }, {(void*)0x00004000, 0x0000fc00, 0x02 }, {(void*)0x20000000, 0x00020000, 0x02 }
  57. // CPU serial number (12 bytes)
  58. #define UDID_START 0x1ff1e800
  59. // APJ board ID (for bootloaders)
  60. #define APJ_BOARD_ID 139
  61. // USB configuration
  62. #define HAL_USB_VENDOR_ID 0x3162
  63. #define HAL_USB_PRODUCT_ID 0x004B
  64. #define HAL_USB_STRING_MANUFACTURER "Holybro"
  65. #define HAL_USB_STRING_PRODUCT "Pixhawk4Pro"
  66. #define HAL_USB_STRING_SERIAL "%SERIAL%"
  67. #define HAL_SPI1_CONFIG { &SPID1, 1, STM32_SPI_SPI1_DMA_STREAMS }
  68. #define HAL_SPI2_CONFIG { &SPID2, 2, STM32_SPI_SPI2_DMA_STREAMS }
  69. #define HAL_SPI4_CONFIG { &SPID4, 4, STM32_SPI_SPI4_DMA_STREAMS }
  70. #define HAL_SPI5_CONFIG { &SPID5, 5, STM32_SPI_SPI5_DMA_STREAMS }
  71. #define HAL_SPI6_CONFIG { &SPID6, 6, STM32_SPI_SPI6_DMA_STREAMS }
  72. #define HAL_SPI_BUS_LIST HAL_SPI1_CONFIG,HAL_SPI2_CONFIG,HAL_SPI4_CONFIG,HAL_SPI5_CONFIG,HAL_SPI6_CONFIG
  73. // SPI device table
  74. #define HAL_SPI_DEVICE0 SPIDesc("ms5611" , 2, 1, PAL_LINE(GPIOF,10U), SPIDEV_MODE3, 20*MHZ, 20*MHZ)
  75. #define HAL_SPI_DEVICE1 SPIDesc("icm20689" , 0, 1, PAL_LINE(GPIOF,2U) , SPIDEV_MODE3, 2*MHZ, 8*MHZ)
  76. #define HAL_SPI_DEVICE2 SPIDesc("icm20602" , 0, 2, PAL_LINE(GPIOF,3U) , SPIDEV_MODE3, 2*MHZ, 8*MHZ)
  77. #define HAL_SPI_DEVICE3 SPIDesc("bmi055_g" , 0, 3, PAL_LINE(GPIOF,4U) , SPIDEV_MODE3, 10*MHZ, 10*MHZ)
  78. #define HAL_SPI_DEVICE4 SPIDesc("bmi055_a" , 0, 4, PAL_LINE(GPIOG,10U), SPIDEV_MODE3, 10*MHZ, 10*MHZ)
  79. #define HAL_SPI_DEVICE5 SPIDesc("ramtron" , 1, 1, PAL_LINE(GPIOF,5U) , SPIDEV_MODE3, 8*MHZ, 8*MHZ)
  80. #define HAL_SPI_DEVICE6 SPIDesc("external1m0" , 3, 1, PAL_LINE(GPIOI,4U) , SPIDEV_MODE0, 2*MHZ, 2*MHZ)
  81. #define HAL_SPI_DEVICE7 SPIDesc("external1m1" , 3, 1, PAL_LINE(GPIOI,4U) , SPIDEV_MODE1, 2*MHZ, 2*MHZ)
  82. #define HAL_SPI_DEVICE8 SPIDesc("external1m2" , 3, 1, PAL_LINE(GPIOI,4U) , SPIDEV_MODE2, 2*MHZ, 2*MHZ)
  83. #define HAL_SPI_DEVICE9 SPIDesc("external1m3" , 3, 1, PAL_LINE(GPIOI,4U) , SPIDEV_MODE3, 2*MHZ, 2*MHZ)
  84. #define HAL_SPI_DEVICE10 SPIDesc("external2m0" , 3, 2, PAL_LINE(GPIOI,10U), SPIDEV_MODE0, 2*MHZ, 2*MHZ)
  85. #define HAL_SPI_DEVICE11 SPIDesc("external2m1" , 3, 2, PAL_LINE(GPIOI,10U), SPIDEV_MODE1, 2*MHZ, 2*MHZ)
  86. #define HAL_SPI_DEVICE12 SPIDesc("external2m2" , 3, 2, PAL_LINE(GPIOI,10U), SPIDEV_MODE2, 2*MHZ, 2*MHZ)
  87. #define HAL_SPI_DEVICE13 SPIDesc("external2m3" , 3, 2, PAL_LINE(GPIOI,10U), SPIDEV_MODE3, 2*MHZ, 2*MHZ)
  88. #define HAL_SPI_DEVICE14 SPIDesc("external3m0" , 4, 1, PAL_LINE(GPIOI,6U) , SPIDEV_MODE0, 2*MHZ, 2*MHZ)
  89. #define HAL_SPI_DEVICE15 SPIDesc("external3m1" , 4, 1, PAL_LINE(GPIOI,6U) , SPIDEV_MODE1, 2*MHZ, 2*MHZ)
  90. #define HAL_SPI_DEVICE16 SPIDesc("external3m2" , 4, 1, PAL_LINE(GPIOI,6U) , SPIDEV_MODE2, 2*MHZ, 2*MHZ)
  91. #define HAL_SPI_DEVICE17 SPIDesc("external3m3" , 4, 1, PAL_LINE(GPIOI,6U) , SPIDEV_MODE3, 2*MHZ, 2*MHZ)
  92. #define HAL_SPI_DEVICE18 SPIDesc("external4m0" , 4, 2, PAL_LINE(GPIOI,7U) , SPIDEV_MODE0, 2*MHZ, 2*MHZ)
  93. #define HAL_SPI_DEVICE19 SPIDesc("external4m1" , 4, 2, PAL_LINE(GPIOI,7U) , SPIDEV_MODE1, 2*MHZ, 2*MHZ)
  94. #define HAL_SPI_DEVICE20 SPIDesc("external4m2" , 4, 2, PAL_LINE(GPIOI,7U) , SPIDEV_MODE2, 2*MHZ, 2*MHZ)
  95. #define HAL_SPI_DEVICE21 SPIDesc("external4m3" , 4, 2, PAL_LINE(GPIOI,7U) , SPIDEV_MODE3, 2*MHZ, 2*MHZ)
  96. #define HAL_SPI_DEVICE22 SPIDesc("external5m0" , 4, 2, PAL_LINE(GPIOI,8U) , SPIDEV_MODE0, 2*MHZ, 2*MHZ)
  97. #define HAL_SPI_DEVICE23 SPIDesc("external5m1" , 4, 2, PAL_LINE(GPIOI,8U) , SPIDEV_MODE1, 2*MHZ, 2*MHZ)
  98. #define HAL_SPI_DEVICE24 SPIDesc("external5m2" , 4, 2, PAL_LINE(GPIOI,8U) , SPIDEV_MODE2, 2*MHZ, 2*MHZ)
  99. #define HAL_SPI_DEVICE25 SPIDesc("external5m3" , 4, 2, PAL_LINE(GPIOI,8U) , SPIDEV_MODE3, 2*MHZ, 2*MHZ)
  100. #define HAL_SPI_DEVICE_LIST HAL_SPI_DEVICE0,HAL_SPI_DEVICE1,HAL_SPI_DEVICE2,HAL_SPI_DEVICE3,HAL_SPI_DEVICE4,HAL_SPI_DEVICE5,HAL_SPI_DEVICE6,HAL_SPI_DEVICE7,HAL_SPI_DEVICE8,HAL_SPI_DEVICE9,HAL_SPI_DEVICE10,HAL_SPI_DEVICE11,HAL_SPI_DEVICE12,HAL_SPI_DEVICE13,HAL_SPI_DEVICE14,HAL_SPI_DEVICE15,HAL_SPI_DEVICE16,HAL_SPI_DEVICE17,HAL_SPI_DEVICE18,HAL_SPI_DEVICE19,HAL_SPI_DEVICE20,HAL_SPI_DEVICE21,HAL_SPI_DEVICE22,HAL_SPI_DEVICE23,HAL_SPI_DEVICE24,HAL_SPI_DEVICE25
  101. // ADC config
  102. #define ANALOG_VCC_5V_PIN 10
  103. #define HAL_HAVE_BOARD_VOLTAGE 1
  104. #define HAL_ANALOG_PINS { \
  105. { 4, 3.30/4096 }, /* PC4 SPARE1_ADC1 */ \
  106. { 9, 3.30/4096 }, /* PB0 RSSI_IN */ \
  107. { 10, 2*3.30/4096 }, /* PC0 VDD_5V_SENS */ \
  108. { 11, 2*3.30/4096 }, /* PC1 SCALED_V3V3 */ \
  109. { 14, 3.30/4096 }, /* PA2 BATT2_VOLTAGE_SENS */ \
  110. { 15, 3.30/4096 }, /* PA3 BATT2_CURRENT_SENS */ \
  111. { 16, 3.30/4096 }, /* PA0 BATT_VOLTAGE_SENS */ \
  112. { 17, 3.30/4096 }, /* PA1 BATT_CURRENT_SENS */ \
  113. { 18, 3.30/4096 }, /* PA4 SPARE2_ADC1 */ \
  114. }
  115. // GPIO config
  116. #define HAL_GPIO_LINE_GPIO50 PAL_LINE(GPIOE, 14U)
  117. #define HAL_GPIO_LINE_GPIO51 PAL_LINE(GPIOA, 10U)
  118. #define HAL_GPIO_LINE_GPIO52 PAL_LINE(GPIOE, 11U)
  119. #define HAL_GPIO_LINE_GPIO53 PAL_LINE(GPIOE, 9U)
  120. #define HAL_GPIO_LINE_GPIO54 PAL_LINE(GPIOD, 13U)
  121. #define HAL_GPIO_LINE_GPIO55 PAL_LINE(GPIOD, 14U)
  122. #define HAL_GPIO_LINE_GPIO56 PAL_LINE(GPIOH, 6U)
  123. #define HAL_GPIO_LINE_GPIO57 PAL_LINE(GPIOH, 9U)
  124. #define HAL_GPIO_LINE_GPIO58 PAL_LINE(GPIOA, 5U)
  125. #define HAL_GPIO_LINE_GPIO59 PAL_LINE(GPIOB, 3U)
  126. #define HAL_GPIO_LINE_GPIO60 PAL_LINE(GPIOB, 11U)
  127. #define HAL_GPIO_LINE_GPIO61 PAL_LINE(GPIOI, 0U)
  128. #define HAL_GPIO_LINE_GPIO70 PAL_LINE(GPIOH, 2U)
  129. #define HAL_GPIO_LINE_GPIO71 PAL_LINE(GPIOH, 3U)
  130. #define HAL_GPIO_LINE_GPIO72 PAL_LINE(GPIOH, 4U)
  131. #define HAL_GPIO_LINE_GPIO77 PAL_LINE(GPIOE, 5U)
  132. #define HAL_GPIO_LINE_GPIO80 PAL_LINE(GPIOA, 7U)
  133. #define HAL_GPIO_LINE_GPIO90 PAL_LINE(GPIOB, 1U)
  134. #define HAL_GPIO_LINE_GPIO91 PAL_LINE(GPIOC, 6U)
  135. #define HAL_GPIO_LINE_GPIO92 PAL_LINE(GPIOC, 7U)
  136. #define HAL_GPIO_PINS { \
  137. { 50, true, 1, PAL_LINE(GPIOE, 14U)}, /* PE14 TIM1_CH4 TIM1 AF1 PWM1 */ \
  138. { 51, true, 2, PAL_LINE(GPIOA, 10U)}, /* PA10 TIM1_CH3 TIM1 AF1 PWM2 */ \
  139. { 52, true, 3, PAL_LINE(GPIOE, 11U)}, /* PE11 TIM1_CH2 TIM1 AF1 PWM3 */ \
  140. { 53, true, 4, PAL_LINE(GPIOE, 9U)}, /* PE9 TIM1_CH1 TIM1 AF1 PWM4 */ \
  141. { 54, true, 5, PAL_LINE(GPIOD, 13U)}, /* PD13 TIM4_CH2 TIM4 AF2 PWM5 */ \
  142. { 55, true, 6, PAL_LINE(GPIOD, 14U)}, /* PD14 TIM4_CH3 TIM4 AF2 PWM6 */ \
  143. { 56, true, 7, PAL_LINE(GPIOH, 6U)}, /* PH6 TIM12_CH1 TIM12 AF2 PWM7 */ \
  144. { 57, true, 8, PAL_LINE(GPIOH, 9U)}, /* PH9 TIM12_CH2 TIM12 AF2 PWM8 */ \
  145. { 58, true, 0, PAL_LINE(GPIOA, 5U)}, /* PA5 FMU_CAP1 INPUT */ \
  146. { 59, true, 0, PAL_LINE(GPIOB, 3U)}, /* PB3 FMU_CAP2 INPUT */ \
  147. { 60, true, 0, PAL_LINE(GPIOB, 11U)}, /* PB11 FMU_CAP3 INPUT */ \
  148. { 61, true, 0, PAL_LINE(GPIOI, 0U)}, /* PI0 FMU_SPARE_4 INPUT */ \
  149. { 70, true, 0, PAL_LINE(GPIOH, 2U)}, /* PH2 GPIO_CAN1_SILENT OUTPUT */ \
  150. { 71, true, 0, PAL_LINE(GPIOH, 3U)}, /* PH3 GPIO_CAN2_SILENT OUTPUT */ \
  151. { 72, true, 0, PAL_LINE(GPIOH, 4U)}, /* PH4 GPIO_CAN3_SILENT OUTPUT */ \
  152. { 77, true, 0, PAL_LINE(GPIOE, 5U)}, /* PE5 TIM15_CH1 TIM9 AF4 */ \
  153. { 80, true, 0, PAL_LINE(GPIOA, 7U)}, /* PA7 HEATER_EN OUTPUT */ \
  154. { 90, true, 0, PAL_LINE(GPIOB, 1U)}, /* PB1 LED_RED OUTPUT */ \
  155. { 91, true, 0, PAL_LINE(GPIOC, 6U)}, /* PC6 LED_GREEN OUTPUT */ \
  156. { 92, true, 0, PAL_LINE(GPIOC, 7U)}, /* PC7 LED_BLUE OUTPUT */ \
  157. }
  158. // full pin define list
  159. #define HAL_GPIO_PIN_BATT2_CURRENT_SENS PAL_LINE(GPIOA,3U)
  160. #define HAL_GPIO_PIN_BATT2_VOLTAGE_SENS PAL_LINE(GPIOA,2U)
  161. #define HAL_GPIO_PIN_BATT_CURRENT_SENS PAL_LINE(GPIOA,1U)
  162. #define HAL_GPIO_PIN_BATT_VOLTAGE_SENS PAL_LINE(GPIOA,0U)
  163. #define HAL_GPIO_PIN_BMI055_A_CS PAL_LINE(GPIOG,10U)
  164. #define HAL_GPIO_PIN_BMI055_G_CS PAL_LINE(GPIOF,4U)
  165. #define HAL_GPIO_PIN_DRDY1_ICM20689 PAL_LINE(GPIOB,4U)
  166. #define HAL_GPIO_PIN_DRDY2_BMI055_GYRO PAL_LINE(GPIOB,14U)
  167. #define HAL_GPIO_PIN_DRDY3_BMI055_ACC PAL_LINE(GPIOB,15U)
  168. #define HAL_GPIO_PIN_DRDY4_ICM20602 PAL_LINE(GPIOC,5U)
  169. #define HAL_GPIO_PIN_DRDY5_BMI055_GYRO PAL_LINE(GPIOC,13U)
  170. #define HAL_GPIO_PIN_DRDY6_BMI055_ACC PAL_LINE(GPIOD,10U)
  171. #define HAL_GPIO_PIN_DRDY7_EXTERNAL1 PAL_LINE(GPIOD,15U)
  172. #define HAL_GPIO_PIN_DRDY8_NC PAL_LINE(GPIOE,7U)
  173. #define HAL_GPIO_PIN_EXT1_CS1 PAL_LINE(GPIOI,4U)
  174. #define HAL_GPIO_PIN_EXT1_CS2 PAL_LINE(GPIOI,10U)
  175. #define HAL_GPIO_PIN_EXT2_CS1 PAL_LINE(GPIOI,6U)
  176. #define HAL_GPIO_PIN_EXT2_CS2 PAL_LINE(GPIOI,7U)
  177. #define HAL_GPIO_PIN_EXT2_CS3 PAL_LINE(GPIOI,8U)
  178. #define HAL_GPIO_PIN_FMU_CAP1 PAL_LINE(GPIOA,5U)
  179. #define HAL_GPIO_PIN_FMU_CAP2 PAL_LINE(GPIOB,3U)
  180. #define HAL_GPIO_PIN_FMU_CAP3 PAL_LINE(GPIOB,11U)
  181. #define HAL_GPIO_PIN_FMU_SPARE_4 PAL_LINE(GPIOI,0U)
  182. #define HAL_GPIO_PIN_FRAM_CS PAL_LINE(GPIOF,5U)
  183. #define HAL_GPIO_PIN_GPIO_CAN1_SILENT PAL_LINE(GPIOH,2U)
  184. #define HAL_GPIO_PIN_GPIO_CAN2_SILENT PAL_LINE(GPIOH,3U)
  185. #define HAL_GPIO_PIN_GPIO_CAN3_SILENT PAL_LINE(GPIOH,4U)
  186. #define HAL_GPIO_PIN_HEATER_EN PAL_LINE(GPIOA,7U)
  187. #define HAL_GPIO_PIN_I2C1_SCL PAL_LINE(GPIOB,8U)
  188. #define HAL_GPIO_PIN_I2C1_SDA PAL_LINE(GPIOB,9U)
  189. #define HAL_GPIO_PIN_I2C1_SCL PAL_LINE(GPIOB,8U)
  190. #define HAL_GPIO_PIN_I2C2_SCL PAL_LINE(GPIOF,1U)
  191. #define HAL_GPIO_PIN_I2C2_SDA PAL_LINE(GPIOF,0U)
  192. #define HAL_GPIO_PIN_I2C2_SCL PAL_LINE(GPIOF,1U)
  193. #define HAL_GPIO_PIN_I2C3_SCL PAL_LINE(GPIOH,7U)
  194. #define HAL_GPIO_PIN_I2C3_SDA PAL_LINE(GPIOH,8U)
  195. #define HAL_GPIO_PIN_I2C3_SCL PAL_LINE(GPIOH,7U)
  196. #define HAL_GPIO_PIN_I2C4_SCL PAL_LINE(GPIOF,14U)
  197. #define HAL_GPIO_PIN_I2C4_SDA PAL_LINE(GPIOF,15U)
  198. #define HAL_GPIO_PIN_I2C4_SCL PAL_LINE(GPIOF,14U)
  199. #define HAL_GPIO_PIN_ICM20602_CS PAL_LINE(GPIOF,3U)
  200. #define HAL_GPIO_PIN_ICM20689_CS PAL_LINE(GPIOF,2U)
  201. #define HAL_GPIO_PIN_JTCK_SWCLK PAL_LINE(GPIOA,14U)
  202. #define HAL_GPIO_PIN_JTMS_SWDIO PAL_LINE(GPIOA,13U)
  203. #define HAL_GPIO_PIN_LED_BLUE PAL_LINE(GPIOC,7U)
  204. #define HAL_GPIO_PIN_LED_GREEN PAL_LINE(GPIOC,6U)
  205. #define HAL_GPIO_PIN_LED_RED PAL_LINE(GPIOB,1U)
  206. #define HAL_GPIO_PIN_MS5611_CS PAL_LINE(GPIOF,10U)
  207. #define HAL_GPIO_PIN_OTG_FS_DM PAL_LINE(GPIOA,11U)
  208. #define HAL_GPIO_PIN_OTG_FS_DP PAL_LINE(GPIOA,12U)
  209. #define HAL_GPIO_PIN_RSSI_IN PAL_LINE(GPIOB,0U)
  210. #define HAL_GPIO_PIN_SCALED_V3V3 PAL_LINE(GPIOC,1U)
  211. #define HAL_GPIO_PIN_SPARE1_ADC1 PAL_LINE(GPIOC,4U)
  212. #define HAL_GPIO_PIN_SPARE2_ADC1 PAL_LINE(GPIOA,4U)
  213. #define HAL_GPIO_PIN_SPI1_MISO PAL_LINE(GPIOA,6U)
  214. #define HAL_GPIO_PIN_SPI1_MOSI PAL_LINE(GPIOD,7U)
  215. #define HAL_GPIO_PIN_SPI1_SCK PAL_LINE(GPIOG,11U)
  216. #define HAL_GPIO_PIN_SPI2_MISO PAL_LINE(GPIOI,2U)
  217. #define HAL_GPIO_PIN_SPI2_MOSI PAL_LINE(GPIOI,3U)
  218. #define HAL_GPIO_PIN_SPI2_SCK PAL_LINE(GPIOI,1U)
  219. #define HAL_GPIO_PIN_SPI4_MISO PAL_LINE(GPIOE,13U)
  220. #define HAL_GPIO_PIN_SPI4_MOSI PAL_LINE(GPIOE,6U)
  221. #define HAL_GPIO_PIN_SPI4_SCK PAL_LINE(GPIOE,2U)
  222. #define HAL_GPIO_PIN_SPI5_MISO PAL_LINE(GPIOF,8U)
  223. #define HAL_GPIO_PIN_SPI5_MOSI PAL_LINE(GPIOF,9U)
  224. #define HAL_GPIO_PIN_SPI5_SCK PAL_LINE(GPIOF,7U)
  225. #define HAL_GPIO_PIN_SPI6_MISO PAL_LINE(GPIOG,12U)
  226. #define HAL_GPIO_PIN_SPI6_MOSI PAL_LINE(GPIOB,5U)
  227. #define HAL_GPIO_PIN_SPI6_SCK PAL_LINE(GPIOG,13U)
  228. #define HAL_GPIO_PIN_TIM12_CH1 PAL_LINE(GPIOH,6U)
  229. #define HAL_GPIO_PIN_TIM12_CH2 PAL_LINE(GPIOH,9U)
  230. #define HAL_GPIO_PIN_TIM15_CH1 PAL_LINE(GPIOE,5U)
  231. #define HAL_GPIO_PIN_TIM1_CH1 PAL_LINE(GPIOE,9U)
  232. #define HAL_GPIO_PIN_TIM1_CH2 PAL_LINE(GPIOE,11U)
  233. #define HAL_GPIO_PIN_TIM1_CH3 PAL_LINE(GPIOA,10U)
  234. #define HAL_GPIO_PIN_TIM1_CH4 PAL_LINE(GPIOE,14U)
  235. #define HAL_GPIO_PIN_TIM4_CH2 PAL_LINE(GPIOD,13U)
  236. #define HAL_GPIO_PIN_TIM4_CH3 PAL_LINE(GPIOD,14U)
  237. #define HAL_GPIO_PIN_UART4_RX PAL_LINE(GPIOD,0U)
  238. #define HAL_GPIO_PIN_UART4_TX PAL_LINE(GPIOD,1U)
  239. #define HAL_GPIO_PIN_UART7_RX PAL_LINE(GPIOF,6U)
  240. #define HAL_GPIO_PIN_UART7_TX PAL_LINE(GPIOE,8U)
  241. #define HAL_GPIO_PIN_UART8_RX PAL_LINE(GPIOE,0U)
  242. #define HAL_GPIO_PIN_UART8_TX PAL_LINE(GPIOE,1U)
  243. #define HAL_GPIO_PIN_USART1_RX PAL_LINE(GPIOB,7U)
  244. #define HAL_GPIO_PIN_USART1_TX PAL_LINE(GPIOB,6U)
  245. #define HAL_GPIO_PIN_USART2_CTS PAL_LINE(GPIOD,3U)
  246. #define HAL_GPIO_PIN_USART2_RTS PAL_LINE(GPIOD,4U)
  247. #define HAL_GPIO_PIN_USART2_RX PAL_LINE(GPIOD,6U)
  248. #define HAL_GPIO_PIN_USART2_TX PAL_LINE(GPIOD,5U)
  249. #define HAL_GPIO_PIN_USART3_CTS PAL_LINE(GPIOD,11U)
  250. #define HAL_GPIO_PIN_USART3_RTS PAL_LINE(GPIOD,12U)
  251. #define HAL_GPIO_PIN_USART3_RX PAL_LINE(GPIOD,9U)
  252. #define HAL_GPIO_PIN_USART3_TX PAL_LINE(GPIOD,8U)
  253. #define HAL_GPIO_PIN_USART6_CTS PAL_LINE(GPIOG,15U)
  254. #define HAL_GPIO_PIN_USART6_RTS PAL_LINE(GPIOG,8U)
  255. #define HAL_GPIO_PIN_USART6_RX PAL_LINE(GPIOG,9U)
  256. #define HAL_GPIO_PIN_VBUS PAL_LINE(GPIOG,3U)
  257. #define HAL_GPIO_PIN_VDD_3V3_SD_CARD_EN PAL_LINE(GPIOG,7U)
  258. #define HAL_GPIO_PIN_VDD_3V3_SENSORS_EN PAL_LINE(GPIOE,3U)
  259. #define HAL_GPIO_PIN_VDD_5V_HIPOWER_OC PAL_LINE(GPIOF,13U)
  260. #define HAL_GPIO_PIN_VDD_5V_PERIPH_OC PAL_LINE(GPIOE,15U)
  261. #define HAL_GPIO_PIN_VDD_5V_RC_EN PAL_LINE(GPIOG,5U)
  262. #define HAL_GPIO_PIN_VDD_5V_SENS PAL_LINE(GPIOC,0U)
  263. #define HAL_GPIO_PIN_VDD_5V_WIFI_EN PAL_LINE(GPIOG,6U)
  264. #define HAL_GPIO_PIN_VDD_BRICK2_VALID PAL_LINE(GPIOG,2U)
  265. #define HAL_GPIO_PIN_VDD_BRICK_VALID PAL_LINE(GPIOG,1U)
  266. #define HAL_GPIO_PIN_nSPI5_RESET_EXTERNAL1 PAL_LINE(GPIOB,10U)
  267. #define HAL_GPIO_PIN_nVDD_5V_HIPOWER_EN PAL_LINE(GPIOF,12U)
  268. #define HAL_GPIO_PIN_nVDD_5V_PERIPH_EN PAL_LINE(GPIOG,4U)
  269. // peripherals enabled
  270. #define STM32_I2C_USE_I2C1 TRUE
  271. #define STM32_I2C_USE_I2C2 TRUE
  272. #define STM32_I2C_USE_I2C3 TRUE
  273. #define STM32_I2C_USE_I2C4 TRUE
  274. #define STM32_USB_USE_OTG1 TRUE
  275. #define STM32_SPI_USE_SPI1 TRUE
  276. #define STM32_SPI_USE_SPI2 TRUE
  277. #define STM32_SPI_USE_SPI4 TRUE
  278. #define STM32_SPI_USE_SPI5 TRUE
  279. #define STM32_SPI_USE_SPI6 TRUE
  280. #ifndef STM32_SERIAL_USE_UART4
  281. #define STM32_SERIAL_USE_UART4 TRUE
  282. #endif
  283. #ifndef STM32_SERIAL_USE_UART7
  284. #define STM32_SERIAL_USE_UART7 TRUE
  285. #endif
  286. #ifndef STM32_SERIAL_USE_UART8
  287. #define STM32_SERIAL_USE_UART8 TRUE
  288. #endif
  289. #ifndef STM32_SERIAL_USE_USART1
  290. #define STM32_SERIAL_USE_USART1 TRUE
  291. #endif
  292. #ifndef STM32_SERIAL_USE_USART2
  293. #define STM32_SERIAL_USE_USART2 TRUE
  294. #endif
  295. #ifndef STM32_SERIAL_USE_USART3
  296. #define STM32_SERIAL_USE_USART3 TRUE
  297. #endif
  298. #ifndef STM32_SERIAL_USE_USART6
  299. #define STM32_SERIAL_USE_USART6 TRUE
  300. #endif
  301. // auto-generated DMA mapping from dma_resolver.py
  302. // Note: The following peripherals can't be resolved for DMA: ['USART2_RX', 'USART3_RX', 'UART8_TX', 'UART8_RX']
  303. #define STM32_ADC_ADC1_DMA_STREAM STM32_DMA_STREAM_ID(2, 0)
  304. #define STM32_ADC_ADC1_DMA_CHAN STM32_DMAMUX1_ADC1
  305. #define STM32_I2C_I2C1_RX_DMA_STREAM STM32_DMA_STREAM_ID(2, 1) // shared I2C1_RX,SPI4_RX,I2C2_RX,SPI2_RX
  306. #define STM32_I2C_I2C1_RX_DMA_CHAN STM32_DMAMUX1_I2C1_RX
  307. #define STM32_I2C_I2C1_TX_DMA_STREAM STM32_DMA_STREAM_ID(2, 6)
  308. #define STM32_I2C_I2C1_TX_DMA_CHAN STM32_DMAMUX1_I2C1_TX
  309. #define STM32_I2C_I2C2_RX_DMA_STREAM STM32_DMA_STREAM_ID(2, 1) // shared I2C1_RX,SPI4_RX,I2C2_RX,SPI2_RX
  310. #define STM32_I2C_I2C2_RX_DMA_CHAN STM32_DMAMUX1_I2C2_RX
  311. #define STM32_I2C_I2C2_TX_DMA_STREAM STM32_DMA_STREAM_ID(2, 5) // shared SPI4_TX,I2C2_TX,SPI2_TX,USART3_TX,SPI5_TX
  312. #define STM32_I2C_I2C2_TX_DMA_CHAN STM32_DMAMUX1_I2C2_TX
  313. #define STM32_I2C_I2C3_RX_DMA_STREAM STM32_DMA_STREAM_ID(2, 3)
  314. #define STM32_I2C_I2C3_RX_DMA_CHAN STM32_DMAMUX1_I2C3_RX
  315. #define STM32_I2C_I2C3_TX_DMA_STREAM STM32_DMA_STREAM_ID(2, 2) // shared I2C3_TX,SPI5_RX
  316. #define STM32_I2C_I2C3_TX_DMA_CHAN STM32_DMAMUX1_I2C3_TX
  317. #define STM32_I2C_I2C4_RX_BDMA_STREAM STM32_DMA_STREAM_ID(1, 5)
  318. #define STM32_I2C_I2C4_RX_BDMA_CHAN STM32_DMAMUX2_I2C4_RX
  319. #define STM32_I2C_I2C4_TX_BDMA_STREAM STM32_DMA_STREAM_ID(1, 7)
  320. #define STM32_I2C_I2C4_TX_BDMA_CHAN STM32_DMAMUX2_I2C4_TX
  321. #define STM32_SPI_SPI1_RX_DMA_STREAM STM32_DMA_STREAM_ID(1, 3)
  322. #define STM32_SPI_SPI1_RX_DMA_CHAN STM32_DMAMUX1_SPI1_RX
  323. #define STM32_SPI_SPI1_TX_DMA_STREAM STM32_DMA_STREAM_ID(1, 2)
  324. #define STM32_SPI_SPI1_TX_DMA_CHAN STM32_DMAMUX1_SPI1_TX
  325. #define STM32_SPI_SPI2_RX_DMA_STREAM STM32_DMA_STREAM_ID(2, 1) // shared I2C1_RX,SPI4_RX,I2C2_RX,SPI2_RX
  326. #define STM32_SPI_SPI2_RX_DMA_CHAN STM32_DMAMUX1_SPI2_RX
  327. #define STM32_SPI_SPI2_TX_DMA_STREAM STM32_DMA_STREAM_ID(2, 5) // shared SPI4_TX,I2C2_TX,SPI2_TX,USART3_TX,SPI5_TX
  328. #define STM32_SPI_SPI2_TX_DMA_CHAN STM32_DMAMUX1_SPI2_TX
  329. #define STM32_SPI_SPI4_RX_DMA_STREAM STM32_DMA_STREAM_ID(2, 1) // shared I2C1_RX,SPI4_RX,I2C2_RX,SPI2_RX
  330. #define STM32_SPI_SPI4_RX_DMA_CHAN STM32_DMAMUX1_SPI4_RX
  331. #define STM32_SPI_SPI4_TX_DMA_STREAM STM32_DMA_STREAM_ID(2, 5) // shared SPI4_TX,I2C2_TX,SPI2_TX,USART3_TX,SPI5_TX
  332. #define STM32_SPI_SPI4_TX_DMA_CHAN STM32_DMAMUX1_SPI4_TX
  333. #define STM32_SPI_SPI5_RX_DMA_STREAM STM32_DMA_STREAM_ID(2, 2) // shared I2C3_TX,SPI5_RX
  334. #define STM32_SPI_SPI5_RX_DMA_CHAN STM32_DMAMUX1_SPI5_RX
  335. #define STM32_SPI_SPI5_TX_DMA_STREAM STM32_DMA_STREAM_ID(2, 5) // shared SPI4_TX,I2C2_TX,SPI2_TX,USART3_TX,SPI5_TX
  336. #define STM32_SPI_SPI5_TX_DMA_CHAN STM32_DMAMUX1_SPI5_TX
  337. #define STM32_SPI_SPI6_RX_BDMA_STREAM STM32_DMA_STREAM_ID(1, 4)
  338. #define STM32_SPI_SPI6_RX_BDMA_CHAN STM32_DMAMUX2_SPI6_RX
  339. #define STM32_SPI_SPI6_TX_BDMA_STREAM STM32_DMA_STREAM_ID(1, 6)
  340. #define STM32_SPI_SPI6_TX_BDMA_CHAN STM32_DMAMUX2_SPI6_TX
  341. #define STM32_TIM_TIM1_UP_DMA_STREAM STM32_DMA_STREAM_ID(1, 0)
  342. #define STM32_TIM_TIM1_UP_DMA_CHAN STM32_DMAMUX1_TIM1_UP
  343. #define STM32_TIM_TIM4_UP_DMA_STREAM STM32_DMA_STREAM_ID(1, 1)
  344. #define STM32_TIM_TIM4_UP_DMA_CHAN STM32_DMAMUX1_TIM4_UP
  345. #define STM32_UART_USART2_TX_DMA_STREAM STM32_DMA_STREAM_ID(2, 4)
  346. #define STM32_UART_USART2_TX_DMA_CHAN STM32_DMAMUX1_USART2_TX
  347. #define STM32_UART_USART3_TX_DMA_STREAM STM32_DMA_STREAM_ID(2, 5) // shared SPI4_TX,I2C2_TX,SPI2_TX,USART3_TX,SPI5_TX
  348. #define STM32_UART_USART3_TX_DMA_CHAN STM32_DMAMUX1_USART3_TX
  349. // generated UART DMA configuration lines
  350. #define STM32_USART1_RX_DMA_CONFIG false, 0, 0
  351. #define STM32_USART1_TX_DMA_CONFIG false, 0, 0
  352. #define STM32_USART2_RX_DMA_CONFIG false, 0, 0
  353. #define STM32_USART2_TX_DMA_CONFIG true, STM32_UART_USART2_TX_DMA_STREAM, STM32_DMAMUX1_USART2_TX
  354. #define STM32_USART3_RX_DMA_CONFIG false, 0, 0
  355. #define STM32_USART3_TX_DMA_CONFIG true, STM32_UART_USART3_TX_DMA_STREAM, STM32_DMAMUX1_USART3_TX
  356. #define STM32_UART4_RX_DMA_CONFIG false, 0, 0
  357. #define STM32_UART4_TX_DMA_CONFIG false, 0, 0
  358. #define STM32_USART6_RX_DMA_CONFIG false, 0, 0
  359. #define STM32_USART6_TX_DMA_CONFIG false, 0, 0
  360. #define STM32_UART7_RX_DMA_CONFIG false, 0, 0
  361. #define STM32_UART7_TX_DMA_CONFIG false, 0, 0
  362. #define STM32_UART8_RX_DMA_CONFIG false, 0, 0
  363. #define STM32_UART8_TX_DMA_CONFIG false, 0, 0
  364. // generated SPI DMA configuration lines
  365. #define STM32_SPI_SPI1_DMA_STREAMS STM32_SPI_SPI1_TX_DMA_STREAM, STM32_SPI_SPI1_RX_DMA_STREAM
  366. #define STM32_SPI_SPI2_DMA_STREAMS STM32_SPI_SPI2_TX_DMA_STREAM, STM32_SPI_SPI2_RX_DMA_STREAM
  367. #define STM32_SPI_SPI4_DMA_STREAMS STM32_SPI_SPI4_TX_DMA_STREAM, STM32_SPI_SPI4_RX_DMA_STREAM
  368. #define STM32_SPI_SPI5_DMA_STREAMS STM32_SPI_SPI5_TX_DMA_STREAM, STM32_SPI_SPI5_RX_DMA_STREAM
  369. #define STM32_SPI_SPI6_DMA_STREAMS STM32_SPI_SPI6_TX_BDMA_STREAM, STM32_SPI_SPI6_RX_BDMA_STREAM
  370. // Alarm PWM output config
  371. #define STM32_PWM_USE_TIM15 TRUE
  372. #define STM32_TIM15_SUPPRESS_ISR
  373. #define HAL_PWM_ALARM \
  374. { /* pwmGroup */ \
  375. 0, /* Timer channel */ \
  376. { /* PWMConfig */ \
  377. 1000000, /* PWM clock frequency. */ \
  378. 1000, /* Initial PWM period 20ms. */ \
  379. NULL, /* no callback */ \
  380. { /* Channel Config */ \
  381. {PWM_OUTPUT_ACTIVE_HIGH, NULL}, \
  382. {PWM_OUTPUT_DISABLED, NULL}, \
  383. {PWM_OUTPUT_DISABLED, NULL}, \
  384. {PWM_OUTPUT_DISABLED, NULL} \
  385. }, \
  386. 0, 0 \
  387. }, \
  388. &PWMD15 /* PWMDriver* */ \
  389. }
  390. // PWM timer config
  391. #define STM32_PWM_USE_TIM1 TRUE
  392. #define STM32_TIM1_SUPPRESS_ISR
  393. #define STM32_PWM_USE_TIM12 TRUE
  394. #define STM32_TIM12_SUPPRESS_ISR
  395. #define STM32_PWM_USE_TIM4 TRUE
  396. #define STM32_TIM4_SUPPRESS_ISR
  397. // PWM output config
  398. #if defined(STM32_TIM_TIM1_UP_DMA_STREAM) && defined(STM32_TIM_TIM1_UP_DMA_CHAN)
  399. # define HAL_PWM1_DMA_CONFIG true, STM32_TIM_TIM1_UP_DMA_STREAM, STM32_TIM_TIM1_UP_DMA_CHAN
  400. #else
  401. # define HAL_PWM1_DMA_CONFIG false, 0, 0
  402. #endif
  403. #define HAL_PWM_GROUP1 { true, \
  404. {3, 2, 1, 0}, \
  405. /* Group Initial Config */ \
  406. { \
  407. 1000000, /* PWM clock frequency. */ \
  408. 20000, /* Initial PWM period 20ms. */ \
  409. NULL, /* no callback */ \
  410. { \
  411. /* Channel Config */ \
  412. {PWM_OUTPUT_ACTIVE_HIGH, NULL}, \
  413. {PWM_OUTPUT_ACTIVE_HIGH, NULL}, \
  414. {PWM_OUTPUT_ACTIVE_HIGH, NULL}, \
  415. {PWM_OUTPUT_ACTIVE_HIGH, NULL} \
  416. }, 0, 0}, &PWMD1, \
  417. HAL_PWM1_DMA_CONFIG, \
  418. { 1, 1, 1, 1 }, \
  419. { PAL_LINE(GPIOE, 9U), PAL_LINE(GPIOE, 11U), PAL_LINE(GPIOA, 10U), PAL_LINE(GPIOE, 14U) }}
  420. #if defined(STM32_TIM_TIM12_UP_DMA_STREAM) && defined(STM32_TIM_TIM12_UP_DMA_CHAN)
  421. # define HAL_PWM12_DMA_CONFIG true, STM32_TIM_TIM12_UP_DMA_STREAM, STM32_TIM_TIM12_UP_DMA_CHAN
  422. #else
  423. # define HAL_PWM12_DMA_CONFIG false, 0, 0
  424. #endif
  425. #define HAL_PWM_GROUP2 { false, \
  426. {6, 7, 255, 255}, \
  427. /* Group Initial Config */ \
  428. { \
  429. 1000000, /* PWM clock frequency. */ \
  430. 20000, /* Initial PWM period 20ms. */ \
  431. NULL, /* no callback */ \
  432. { \
  433. /* Channel Config */ \
  434. {PWM_OUTPUT_ACTIVE_HIGH, NULL}, \
  435. {PWM_OUTPUT_ACTIVE_HIGH, NULL}, \
  436. {PWM_OUTPUT_DISABLED, NULL}, \
  437. {PWM_OUTPUT_DISABLED, NULL} \
  438. }, 0, 0}, &PWMD12, \
  439. HAL_PWM12_DMA_CONFIG, \
  440. { 2, 2, 0, 0 }, \
  441. { PAL_LINE(GPIOH, 6U), PAL_LINE(GPIOH, 9U), 0, 0 }}
  442. #if defined(STM32_TIM_TIM4_UP_DMA_STREAM) && defined(STM32_TIM_TIM4_UP_DMA_CHAN)
  443. # define HAL_PWM4_DMA_CONFIG true, STM32_TIM_TIM4_UP_DMA_STREAM, STM32_TIM_TIM4_UP_DMA_CHAN
  444. #else
  445. # define HAL_PWM4_DMA_CONFIG false, 0, 0
  446. #endif
  447. #define HAL_PWM_GROUP3 { false, \
  448. {255, 4, 5, 255}, \
  449. /* Group Initial Config */ \
  450. { \
  451. 1000000, /* PWM clock frequency. */ \
  452. 20000, /* Initial PWM period 20ms. */ \
  453. NULL, /* no callback */ \
  454. { \
  455. /* Channel Config */ \
  456. {PWM_OUTPUT_DISABLED, NULL}, \
  457. {PWM_OUTPUT_ACTIVE_HIGH, NULL}, \
  458. {PWM_OUTPUT_ACTIVE_HIGH, NULL}, \
  459. {PWM_OUTPUT_DISABLED, NULL} \
  460. }, 0, 0}, &PWMD4, \
  461. HAL_PWM4_DMA_CONFIG, \
  462. { 0, 2, 2, 0 }, \
  463. { 0, PAL_LINE(GPIOD, 13U), PAL_LINE(GPIOD, 14U), 0 }}
  464. #define HAL_PWM_GROUPS HAL_PWM_GROUP1,HAL_PWM_GROUP2,HAL_PWM_GROUP3
  465. // I2C configuration
  466. #if defined(STM32_I2C_I2C3_RX_DMA_STREAM) && defined(STM32_I2C_I2C3_TX_DMA_STREAM)
  467. #define HAL_I2C3_CONFIG { &I2CD3, STM32_I2C_I2C3_RX_DMA_STREAM, STM32_I2C_I2C3_TX_DMA_STREAM, HAL_GPIO_PIN_I2C3_SCL, HAL_GPIO_PIN_I2C3_SDA }
  468. #else
  469. #define HAL_I2C3_CONFIG { &I2CD3, SHARED_DMA_NONE, SHARED_DMA_NONE, HAL_GPIO_PIN_I2C3_SCL, HAL_GPIO_PIN_I2C3_SDA }
  470. #endif
  471. #if defined(STM32_I2C_I2C1_RX_DMA_STREAM) && defined(STM32_I2C_I2C1_TX_DMA_STREAM)
  472. #define HAL_I2C1_CONFIG { &I2CD1, STM32_I2C_I2C1_RX_DMA_STREAM, STM32_I2C_I2C1_TX_DMA_STREAM, HAL_GPIO_PIN_I2C1_SCL, HAL_GPIO_PIN_I2C1_SDA }
  473. #else
  474. #define HAL_I2C1_CONFIG { &I2CD1, SHARED_DMA_NONE, SHARED_DMA_NONE, HAL_GPIO_PIN_I2C1_SCL, HAL_GPIO_PIN_I2C1_SDA }
  475. #endif
  476. #if defined(STM32_I2C_I2C2_RX_DMA_STREAM) && defined(STM32_I2C_I2C2_TX_DMA_STREAM)
  477. #define HAL_I2C2_CONFIG { &I2CD2, STM32_I2C_I2C2_RX_DMA_STREAM, STM32_I2C_I2C2_TX_DMA_STREAM, HAL_GPIO_PIN_I2C2_SCL, HAL_GPIO_PIN_I2C2_SDA }
  478. #else
  479. #define HAL_I2C2_CONFIG { &I2CD2, SHARED_DMA_NONE, SHARED_DMA_NONE, HAL_GPIO_PIN_I2C2_SCL, HAL_GPIO_PIN_I2C2_SDA }
  480. #endif
  481. #if defined(STM32_I2C_I2C4_RX_DMA_STREAM) && defined(STM32_I2C_I2C4_TX_DMA_STREAM)
  482. #define HAL_I2C4_CONFIG { &I2CD4, STM32_I2C_I2C4_RX_DMA_STREAM, STM32_I2C_I2C4_TX_DMA_STREAM, HAL_GPIO_PIN_I2C4_SCL, HAL_GPIO_PIN_I2C4_SDA }
  483. #else
  484. #define HAL_I2C4_CONFIG { &I2CD4, SHARED_DMA_NONE, SHARED_DMA_NONE, HAL_GPIO_PIN_I2C4_SCL, HAL_GPIO_PIN_I2C4_SDA }
  485. #endif
  486. #define HAL_I2C_DEVICE_LIST HAL_I2C3_CONFIG,HAL_I2C1_CONFIG,HAL_I2C2_CONFIG,HAL_I2C4_CONFIG
  487. // UART configuration
  488. #define HAL_UARTA_DRIVER ChibiOS::UARTDriver uartADriver(0)
  489. #define HAL_UARTB_DRIVER ChibiOS::UARTDriver uartBDriver(1)
  490. #define HAL_UARTC_DRIVER ChibiOS::UARTDriver uartCDriver(2)
  491. #define HAL_UARTD_DRIVER ChibiOS::UARTDriver uartDDriver(3)
  492. #define HAL_UARTE_DRIVER ChibiOS::UARTDriver uartEDriver(4)
  493. #define HAL_UARTF_DRIVER ChibiOS::UARTDriver uartFDriver(5)
  494. #define HAL_UARTG_DRIVER ChibiOS::UARTDriver uartGDriver(6)
  495. #define HAL_WITH_IO_MCU 1
  496. #define HAL_UART_IOMCU_IDX 7
  497. #define HAL_UART_IO_DRIVER ChibiOS::UARTDriver uart_io(HAL_UART_IOMCU_IDX)
  498. #define HAL_HAVE_SERVO_VOLTAGE 1
  499. #define HAL_OTG1_CONFIG {(BaseSequentialStream*) &SDU1, true, false, 0, 0, false, 0, 0}
  500. #define HAL_USART1_CONFIG { (BaseSequentialStream*) &SD1, false, STM32_USART1_RX_DMA_CONFIG, STM32_USART1_TX_DMA_CONFIG, 0, -1, 0, -1, 0}
  501. #define HAL_USART2_CONFIG { (BaseSequentialStream*) &SD2, false, STM32_USART2_RX_DMA_CONFIG, STM32_USART2_TX_DMA_CONFIG, PAL_LINE(GPIOD,4U), -1, 0, -1, 0}
  502. #define HAL_USART3_CONFIG { (BaseSequentialStream*) &SD3, false, STM32_USART3_RX_DMA_CONFIG, STM32_USART3_TX_DMA_CONFIG, PAL_LINE(GPIOD,12U), -1, 0, -1, 0}
  503. #define HAL_UART4_CONFIG { (BaseSequentialStream*) &SD4, false, STM32_UART4_RX_DMA_CONFIG, STM32_UART4_TX_DMA_CONFIG, 0, -1, 0, -1, 0}
  504. #define HAL_USART6_CONFIG { (BaseSequentialStream*) &SD6, false, STM32_USART6_RX_DMA_CONFIG, STM32_USART6_TX_DMA_CONFIG, PAL_LINE(GPIOG,8U), -1, 0, -1, 0}
  505. #define HAL_UART7_CONFIG { (BaseSequentialStream*) &SD7, false, STM32_UART7_RX_DMA_CONFIG, STM32_UART7_TX_DMA_CONFIG, 0, -1, 0, -1, 0}
  506. #define HAL_UART8_CONFIG { (BaseSequentialStream*) &SD8, false, STM32_UART8_RX_DMA_CONFIG, STM32_UART8_TX_DMA_CONFIG, 0, -1, 0, -1, 0}
  507. #define HAL_UART_DEVICE_LIST HAL_OTG1_CONFIG,HAL_USART1_CONFIG,HAL_USART2_CONFIG,HAL_USART3_CONFIG,HAL_UART4_CONFIG,HAL_USART6_CONFIG,HAL_UART7_CONFIG,HAL_UART8_CONFIG
  508. #define HAL_HAVE_AP_ROMFS_EMBEDDED_H 1
  509. /*
  510. * I/O ports initial setup, this configuration is established soon after reset
  511. * in the initialization code.
  512. * Please refer to the STM32 Reference Manual for details.
  513. */
  514. #define PIN_MODE_INPUT(n) (0U << ((n) * 2U))
  515. #define PIN_MODE_OUTPUT(n) (1U << ((n) * 2U))
  516. #define PIN_MODE_ALTERNATE(n) (2U << ((n) * 2U))
  517. #define PIN_MODE_ANALOG(n) (3U << ((n) * 2U))
  518. #define PIN_ODR_LOW(n) (0U << (n))
  519. #define PIN_ODR_HIGH(n) (1U << (n))
  520. #define PIN_OTYPE_PUSHPULL(n) (0U << (n))
  521. #define PIN_OTYPE_OPENDRAIN(n) (1U << (n))
  522. #define PIN_OSPEED_VERYLOW(n) (0U << ((n) * 2U))
  523. #define PIN_OSPEED_LOW(n) (1U << ((n) * 2U))
  524. #define PIN_OSPEED_MEDIUM(n) (2U << ((n) * 2U))
  525. #define PIN_OSPEED_HIGH(n) (3U << ((n) * 2U))
  526. #define PIN_PUPDR_FLOATING(n) (0U << ((n) * 2U))
  527. #define PIN_PUPDR_PULLUP(n) (1U << ((n) * 2U))
  528. #define PIN_PUPDR_PULLDOWN(n) (2U << ((n) * 2U))
  529. #define PIN_AFIO_AF(n, v) ((v) << (((n) % 8U) * 4U))
  530. /* PORTA:
  531. PA0 BATT_VOLTAGE_SENS ADC1 ADC1_IN16
  532. PA1 BATT_CURRENT_SENS ADC1 ADC1_IN17
  533. PA2 BATT2_VOLTAGE_SENS ADC1 ADC1_IN14
  534. PA3 BATT2_CURRENT_SENS ADC1 ADC1_IN15
  535. PA4 SPARE2_ADC1 ADC1 ADC1_IN18
  536. PA5 FMU_CAP1 INPUT
  537. PA6 SPI1_MISO SPI1 AF5
  538. PA7 HEATER_EN OUTPUT
  539. PA10 TIM1_CH3 TIM1 AF1 PWM2
  540. PA11 OTG_FS_DM OTG1 AF10
  541. PA12 OTG_FS_DP OTG1 AF10
  542. PA13 JTMS-SWDIO SWD AF0
  543. PA14 JTCK-SWCLK SWD AF0
  544. */
  545. #define VAL_GPIOA_MODER (PIN_MODE_ANALOG(0U) | \
  546. PIN_MODE_ANALOG(1U) | \
  547. PIN_MODE_ANALOG(2U) | \
  548. PIN_MODE_ANALOG(3U) | \
  549. PIN_MODE_ANALOG(4U) | \
  550. PIN_MODE_INPUT(5U) | \
  551. PIN_MODE_ALTERNATE(6U) | \
  552. PIN_MODE_OUTPUT(7U) | \
  553. PIN_MODE_INPUT(8U) | \
  554. PIN_MODE_INPUT(9U) | \
  555. PIN_MODE_ALTERNATE(10U) | \
  556. PIN_MODE_ALTERNATE(11U) | \
  557. PIN_MODE_ALTERNATE(12U) | \
  558. PIN_MODE_ALTERNATE(13U) | \
  559. PIN_MODE_ALTERNATE(14U) | \
  560. PIN_MODE_INPUT(15U))
  561. #define VAL_GPIOA_OTYPER (PIN_OTYPE_PUSHPULL(0U) | \
  562. PIN_OTYPE_PUSHPULL(1U) | \
  563. PIN_OTYPE_PUSHPULL(2U) | \
  564. PIN_OTYPE_PUSHPULL(3U) | \
  565. PIN_OTYPE_PUSHPULL(4U) | \
  566. PIN_OTYPE_PUSHPULL(5U) | \
  567. PIN_OTYPE_PUSHPULL(6U) | \
  568. PIN_OTYPE_PUSHPULL(7U) | \
  569. PIN_OTYPE_PUSHPULL(8U) | \
  570. PIN_OTYPE_PUSHPULL(9U) | \
  571. PIN_OTYPE_PUSHPULL(10U) | \
  572. PIN_OTYPE_PUSHPULL(11U) | \
  573. PIN_OTYPE_PUSHPULL(12U) | \
  574. PIN_OTYPE_PUSHPULL(13U) | \
  575. PIN_OTYPE_PUSHPULL(14U) | \
  576. PIN_OTYPE_PUSHPULL(15U))
  577. #define VAL_GPIOA_OSPEEDR (PIN_OSPEED_MEDIUM(0U) | \
  578. PIN_OSPEED_MEDIUM(1U) | \
  579. PIN_OSPEED_MEDIUM(2U) | \
  580. PIN_OSPEED_MEDIUM(3U) | \
  581. PIN_OSPEED_MEDIUM(4U) | \
  582. PIN_OSPEED_MEDIUM(5U) | \
  583. PIN_OSPEED_MEDIUM(6U) | \
  584. PIN_OSPEED_MEDIUM(7U) | \
  585. PIN_OSPEED_MEDIUM(8U) | \
  586. PIN_OSPEED_MEDIUM(9U) | \
  587. PIN_OSPEED_MEDIUM(10U) | \
  588. PIN_OSPEED_MEDIUM(11U) | \
  589. PIN_OSPEED_MEDIUM(12U) | \
  590. PIN_OSPEED_MEDIUM(13U) | \
  591. PIN_OSPEED_MEDIUM(14U) | \
  592. PIN_OSPEED_MEDIUM(15U))
  593. #define VAL_GPIOA_PUPDR (PIN_PUPDR_FLOATING(0U) | \
  594. PIN_PUPDR_FLOATING(1U) | \
  595. PIN_PUPDR_FLOATING(2U) | \
  596. PIN_PUPDR_FLOATING(3U) | \
  597. PIN_PUPDR_FLOATING(4U) | \
  598. PIN_PUPDR_FLOATING(5U) | \
  599. PIN_PUPDR_FLOATING(6U) | \
  600. PIN_PUPDR_FLOATING(7U) | \
  601. PIN_PUPDR_FLOATING(8U) | \
  602. PIN_PUPDR_FLOATING(9U) | \
  603. PIN_PUPDR_FLOATING(10U) | \
  604. PIN_PUPDR_FLOATING(11U) | \
  605. PIN_PUPDR_FLOATING(12U) | \
  606. PIN_PUPDR_FLOATING(13U) | \
  607. PIN_PUPDR_FLOATING(14U) | \
  608. PIN_PUPDR_FLOATING(15U))
  609. #define VAL_GPIOA_ODR (PIN_ODR_HIGH(0U) | \
  610. PIN_ODR_HIGH(1U) | \
  611. PIN_ODR_HIGH(2U) | \
  612. PIN_ODR_HIGH(3U) | \
  613. PIN_ODR_HIGH(4U) | \
  614. PIN_ODR_HIGH(5U) | \
  615. PIN_ODR_HIGH(6U) | \
  616. PIN_ODR_LOW(7U) | \
  617. PIN_ODR_HIGH(8U) | \
  618. PIN_ODR_HIGH(9U) | \
  619. PIN_ODR_HIGH(10U) | \
  620. PIN_ODR_HIGH(11U) | \
  621. PIN_ODR_HIGH(12U) | \
  622. PIN_ODR_HIGH(13U) | \
  623. PIN_ODR_HIGH(14U) | \
  624. PIN_ODR_HIGH(15U))
  625. #define VAL_GPIOA_AFRL (PIN_AFIO_AF(0U, 0U) | \
  626. PIN_AFIO_AF(1U, 0U) | \
  627. PIN_AFIO_AF(2U, 0U) | \
  628. PIN_AFIO_AF(3U, 0U) | \
  629. PIN_AFIO_AF(4U, 0U) | \
  630. PIN_AFIO_AF(5U, 0U) | \
  631. PIN_AFIO_AF(6U, 5U) | \
  632. PIN_AFIO_AF(7U, 0U))
  633. #define VAL_GPIOA_AFRH (PIN_AFIO_AF(8U, 0U) | \
  634. PIN_AFIO_AF(9U, 0U) | \
  635. PIN_AFIO_AF(10U, 1U) | \
  636. PIN_AFIO_AF(11U, 10U) | \
  637. PIN_AFIO_AF(12U, 10U) | \
  638. PIN_AFIO_AF(13U, 0U) | \
  639. PIN_AFIO_AF(14U, 0U) | \
  640. PIN_AFIO_AF(15U, 0U))
  641. /* PORTB:
  642. PB0 RSSI_IN ADC1 ADC1_IN9
  643. PB1 LED_RED OUTPUT
  644. PB3 FMU_CAP2 INPUT
  645. PB4 DRDY1_ICM20689 INPUT
  646. PB5 SPI6_MOSI SPI6 AF8
  647. PB6 USART1_TX USART1 AF7
  648. PB7 USART1_RX USART1 AF7
  649. PB8 I2C1_SCL I2C1 AF4
  650. PB9 I2C1_SDA I2C1 AF4
  651. PB10 nSPI5_RESET_EXTERNAL1 OUTPUT
  652. PB11 FMU_CAP3 INPUT
  653. PB14 DRDY2_BMI055_GYRO INPUT
  654. PB15 DRDY3_BMI055_ACC INPUT
  655. */
  656. #define VAL_GPIOB_MODER (PIN_MODE_ANALOG(0U) | \
  657. PIN_MODE_OUTPUT(1U) | \
  658. PIN_MODE_INPUT(2U) | \
  659. PIN_MODE_INPUT(3U) | \
  660. PIN_MODE_INPUT(4U) | \
  661. PIN_MODE_ALTERNATE(5U) | \
  662. PIN_MODE_ALTERNATE(6U) | \
  663. PIN_MODE_ALTERNATE(7U) | \
  664. PIN_MODE_ALTERNATE(8U) | \
  665. PIN_MODE_ALTERNATE(9U) | \
  666. PIN_MODE_OUTPUT(10U) | \
  667. PIN_MODE_INPUT(11U) | \
  668. PIN_MODE_INPUT(12U) | \
  669. PIN_MODE_INPUT(13U) | \
  670. PIN_MODE_INPUT(14U) | \
  671. PIN_MODE_INPUT(15U))
  672. #define VAL_GPIOB_OTYPER (PIN_OTYPE_PUSHPULL(0U) | \
  673. PIN_OTYPE_PUSHPULL(1U) | \
  674. PIN_OTYPE_PUSHPULL(2U) | \
  675. PIN_OTYPE_PUSHPULL(3U) | \
  676. PIN_OTYPE_PUSHPULL(4U) | \
  677. PIN_OTYPE_PUSHPULL(5U) | \
  678. PIN_OTYPE_PUSHPULL(6U) | \
  679. PIN_OTYPE_PUSHPULL(7U) | \
  680. PIN_OTYPE_OPENDRAIN(8U) | \
  681. PIN_OTYPE_OPENDRAIN(9U) | \
  682. PIN_OTYPE_PUSHPULL(10U) | \
  683. PIN_OTYPE_PUSHPULL(11U) | \
  684. PIN_OTYPE_PUSHPULL(12U) | \
  685. PIN_OTYPE_PUSHPULL(13U) | \
  686. PIN_OTYPE_PUSHPULL(14U) | \
  687. PIN_OTYPE_PUSHPULL(15U))
  688. #define VAL_GPIOB_OSPEEDR (PIN_OSPEED_MEDIUM(0U) | \
  689. PIN_OSPEED_MEDIUM(1U) | \
  690. PIN_OSPEED_MEDIUM(2U) | \
  691. PIN_OSPEED_MEDIUM(3U) | \
  692. PIN_OSPEED_MEDIUM(4U) | \
  693. PIN_OSPEED_MEDIUM(5U) | \
  694. PIN_OSPEED_MEDIUM(6U) | \
  695. PIN_OSPEED_MEDIUM(7U) | \
  696. PIN_OSPEED_MEDIUM(8U) | \
  697. PIN_OSPEED_MEDIUM(9U) | \
  698. PIN_OSPEED_MEDIUM(10U) | \
  699. PIN_OSPEED_MEDIUM(11U) | \
  700. PIN_OSPEED_MEDIUM(12U) | \
  701. PIN_OSPEED_MEDIUM(13U) | \
  702. PIN_OSPEED_MEDIUM(14U) | \
  703. PIN_OSPEED_MEDIUM(15U))
  704. #define VAL_GPIOB_PUPDR (PIN_PUPDR_FLOATING(0U) | \
  705. PIN_PUPDR_FLOATING(1U) | \
  706. PIN_PUPDR_FLOATING(2U) | \
  707. PIN_PUPDR_FLOATING(3U) | \
  708. PIN_PUPDR_FLOATING(4U) | \
  709. PIN_PUPDR_FLOATING(5U) | \
  710. PIN_PUPDR_PULLUP(6U) | \
  711. PIN_PUPDR_PULLUP(7U) | \
  712. PIN_PUPDR_FLOATING(8U) | \
  713. PIN_PUPDR_FLOATING(9U) | \
  714. PIN_PUPDR_FLOATING(10U) | \
  715. PIN_PUPDR_FLOATING(11U) | \
  716. PIN_PUPDR_FLOATING(12U) | \
  717. PIN_PUPDR_FLOATING(13U) | \
  718. PIN_PUPDR_FLOATING(14U) | \
  719. PIN_PUPDR_FLOATING(15U))
  720. #define VAL_GPIOB_ODR (PIN_ODR_HIGH(0U) | \
  721. PIN_ODR_HIGH(1U) | \
  722. PIN_ODR_HIGH(2U) | \
  723. PIN_ODR_HIGH(3U) | \
  724. PIN_ODR_HIGH(4U) | \
  725. PIN_ODR_HIGH(5U) | \
  726. PIN_ODR_HIGH(6U) | \
  727. PIN_ODR_HIGH(7U) | \
  728. PIN_ODR_HIGH(8U) | \
  729. PIN_ODR_HIGH(9U) | \
  730. PIN_ODR_HIGH(10U) | \
  731. PIN_ODR_HIGH(11U) | \
  732. PIN_ODR_HIGH(12U) | \
  733. PIN_ODR_HIGH(13U) | \
  734. PIN_ODR_HIGH(14U) | \
  735. PIN_ODR_HIGH(15U))
  736. #define VAL_GPIOB_AFRL (PIN_AFIO_AF(0U, 0U) | \
  737. PIN_AFIO_AF(1U, 0U) | \
  738. PIN_AFIO_AF(2U, 0U) | \
  739. PIN_AFIO_AF(3U, 0U) | \
  740. PIN_AFIO_AF(4U, 0U) | \
  741. PIN_AFIO_AF(5U, 8U) | \
  742. PIN_AFIO_AF(6U, 7U) | \
  743. PIN_AFIO_AF(7U, 7U))
  744. #define VAL_GPIOB_AFRH (PIN_AFIO_AF(8U, 4U) | \
  745. PIN_AFIO_AF(9U, 4U) | \
  746. PIN_AFIO_AF(10U, 0U) | \
  747. PIN_AFIO_AF(11U, 0U) | \
  748. PIN_AFIO_AF(12U, 0U) | \
  749. PIN_AFIO_AF(13U, 0U) | \
  750. PIN_AFIO_AF(14U, 0U) | \
  751. PIN_AFIO_AF(15U, 0U))
  752. /* PORTC:
  753. PC0 VDD_5V_SENS ADC1 ADC1_IN10
  754. PC1 SCALED_V3V3 ADC1 ADC1_IN11
  755. PC4 SPARE1_ADC1 ADC1 ADC1_IN4
  756. PC5 DRDY4_ICM20602 INPUT
  757. PC6 LED_GREEN OUTPUT
  758. PC7 LED_BLUE OUTPUT
  759. PC13 DRDY5_BMI055_GYRO INPUT
  760. */
  761. #define VAL_GPIOC_MODER (PIN_MODE_ANALOG(0U) | \
  762. PIN_MODE_ANALOG(1U) | \
  763. PIN_MODE_INPUT(2U) | \
  764. PIN_MODE_INPUT(3U) | \
  765. PIN_MODE_ANALOG(4U) | \
  766. PIN_MODE_INPUT(5U) | \
  767. PIN_MODE_OUTPUT(6U) | \
  768. PIN_MODE_OUTPUT(7U) | \
  769. PIN_MODE_INPUT(8U) | \
  770. PIN_MODE_INPUT(9U) | \
  771. PIN_MODE_INPUT(10U) | \
  772. PIN_MODE_INPUT(11U) | \
  773. PIN_MODE_INPUT(12U) | \
  774. PIN_MODE_INPUT(13U) | \
  775. PIN_MODE_INPUT(14U) | \
  776. PIN_MODE_INPUT(15U))
  777. #define VAL_GPIOC_OTYPER (PIN_OTYPE_PUSHPULL(0U) | \
  778. PIN_OTYPE_PUSHPULL(1U) | \
  779. PIN_OTYPE_PUSHPULL(2U) | \
  780. PIN_OTYPE_PUSHPULL(3U) | \
  781. PIN_OTYPE_PUSHPULL(4U) | \
  782. PIN_OTYPE_PUSHPULL(5U) | \
  783. PIN_OTYPE_PUSHPULL(6U) | \
  784. PIN_OTYPE_PUSHPULL(7U) | \
  785. PIN_OTYPE_PUSHPULL(8U) | \
  786. PIN_OTYPE_PUSHPULL(9U) | \
  787. PIN_OTYPE_PUSHPULL(10U) | \
  788. PIN_OTYPE_PUSHPULL(11U) | \
  789. PIN_OTYPE_PUSHPULL(12U) | \
  790. PIN_OTYPE_PUSHPULL(13U) | \
  791. PIN_OTYPE_PUSHPULL(14U) | \
  792. PIN_OTYPE_PUSHPULL(15U))
  793. #define VAL_GPIOC_OSPEEDR (PIN_OSPEED_MEDIUM(0U) | \
  794. PIN_OSPEED_MEDIUM(1U) | \
  795. PIN_OSPEED_MEDIUM(2U) | \
  796. PIN_OSPEED_MEDIUM(3U) | \
  797. PIN_OSPEED_MEDIUM(4U) | \
  798. PIN_OSPEED_MEDIUM(5U) | \
  799. PIN_OSPEED_MEDIUM(6U) | \
  800. PIN_OSPEED_MEDIUM(7U) | \
  801. PIN_OSPEED_MEDIUM(8U) | \
  802. PIN_OSPEED_MEDIUM(9U) | \
  803. PIN_OSPEED_MEDIUM(10U) | \
  804. PIN_OSPEED_MEDIUM(11U) | \
  805. PIN_OSPEED_MEDIUM(12U) | \
  806. PIN_OSPEED_MEDIUM(13U) | \
  807. PIN_OSPEED_MEDIUM(14U) | \
  808. PIN_OSPEED_MEDIUM(15U))
  809. #define VAL_GPIOC_PUPDR (PIN_PUPDR_FLOATING(0U) | \
  810. PIN_PUPDR_FLOATING(1U) | \
  811. PIN_PUPDR_FLOATING(2U) | \
  812. PIN_PUPDR_FLOATING(3U) | \
  813. PIN_PUPDR_FLOATING(4U) | \
  814. PIN_PUPDR_FLOATING(5U) | \
  815. PIN_PUPDR_FLOATING(6U) | \
  816. PIN_PUPDR_FLOATING(7U) | \
  817. PIN_PUPDR_FLOATING(8U) | \
  818. PIN_PUPDR_FLOATING(9U) | \
  819. PIN_PUPDR_FLOATING(10U) | \
  820. PIN_PUPDR_FLOATING(11U) | \
  821. PIN_PUPDR_FLOATING(12U) | \
  822. PIN_PUPDR_FLOATING(13U) | \
  823. PIN_PUPDR_FLOATING(14U) | \
  824. PIN_PUPDR_FLOATING(15U))
  825. #define VAL_GPIOC_ODR (PIN_ODR_HIGH(0U) | \
  826. PIN_ODR_HIGH(1U) | \
  827. PIN_ODR_HIGH(2U) | \
  828. PIN_ODR_HIGH(3U) | \
  829. PIN_ODR_HIGH(4U) | \
  830. PIN_ODR_HIGH(5U) | \
  831. PIN_ODR_LOW(6U) | \
  832. PIN_ODR_HIGH(7U) | \
  833. PIN_ODR_HIGH(8U) | \
  834. PIN_ODR_HIGH(9U) | \
  835. PIN_ODR_HIGH(10U) | \
  836. PIN_ODR_HIGH(11U) | \
  837. PIN_ODR_HIGH(12U) | \
  838. PIN_ODR_HIGH(13U) | \
  839. PIN_ODR_HIGH(14U) | \
  840. PIN_ODR_HIGH(15U))
  841. #define VAL_GPIOC_AFRL (PIN_AFIO_AF(0U, 0U) | \
  842. PIN_AFIO_AF(1U, 0U) | \
  843. PIN_AFIO_AF(2U, 0U) | \
  844. PIN_AFIO_AF(3U, 0U) | \
  845. PIN_AFIO_AF(4U, 0U) | \
  846. PIN_AFIO_AF(5U, 0U) | \
  847. PIN_AFIO_AF(6U, 0U) | \
  848. PIN_AFIO_AF(7U, 0U))
  849. #define VAL_GPIOC_AFRH (PIN_AFIO_AF(8U, 0U) | \
  850. PIN_AFIO_AF(9U, 0U) | \
  851. PIN_AFIO_AF(10U, 0U) | \
  852. PIN_AFIO_AF(11U, 0U) | \
  853. PIN_AFIO_AF(12U, 0U) | \
  854. PIN_AFIO_AF(13U, 0U) | \
  855. PIN_AFIO_AF(14U, 0U) | \
  856. PIN_AFIO_AF(15U, 0U))
  857. /* PORTD:
  858. PD0 UART4_RX UART4 AF8
  859. PD1 UART4_TX UART4 AF8
  860. PD3 USART2_CTS USART2 AF7
  861. PD4 USART2_RTS USART2
  862. PD5 USART2_TX USART2 AF7
  863. PD6 USART2_RX USART2 AF7
  864. PD7 SPI1_MOSI SPI1 AF5
  865. PD8 USART3_TX USART3 AF7
  866. PD9 USART3_RX USART3 AF7
  867. PD10 DRDY6_BMI055_ACC INPUT
  868. PD11 USART3_CTS USART3 AF7
  869. PD12 USART3_RTS USART3
  870. PD13 TIM4_CH2 TIM4 AF2 PWM5
  871. PD14 TIM4_CH3 TIM4 AF2 PWM6
  872. PD15 DRDY7_EXTERNAL1 INPUT
  873. */
  874. #define VAL_GPIOD_MODER (PIN_MODE_ALTERNATE(0U) | \
  875. PIN_MODE_ALTERNATE(1U) | \
  876. PIN_MODE_INPUT(2U) | \
  877. PIN_MODE_ALTERNATE(3U) | \
  878. PIN_MODE_OUTPUT(4U) | \
  879. PIN_MODE_ALTERNATE(5U) | \
  880. PIN_MODE_ALTERNATE(6U) | \
  881. PIN_MODE_ALTERNATE(7U) | \
  882. PIN_MODE_ALTERNATE(8U) | \
  883. PIN_MODE_ALTERNATE(9U) | \
  884. PIN_MODE_INPUT(10U) | \
  885. PIN_MODE_ALTERNATE(11U) | \
  886. PIN_MODE_OUTPUT(12U) | \
  887. PIN_MODE_ALTERNATE(13U) | \
  888. PIN_MODE_ALTERNATE(14U) | \
  889. PIN_MODE_INPUT(15U))
  890. #define VAL_GPIOD_OTYPER (PIN_OTYPE_PUSHPULL(0U) | \
  891. PIN_OTYPE_PUSHPULL(1U) | \
  892. PIN_OTYPE_PUSHPULL(2U) | \
  893. PIN_OTYPE_PUSHPULL(3U) | \
  894. PIN_OTYPE_PUSHPULL(4U) | \
  895. PIN_OTYPE_PUSHPULL(5U) | \
  896. PIN_OTYPE_PUSHPULL(6U) | \
  897. PIN_OTYPE_PUSHPULL(7U) | \
  898. PIN_OTYPE_PUSHPULL(8U) | \
  899. PIN_OTYPE_PUSHPULL(9U) | \
  900. PIN_OTYPE_PUSHPULL(10U) | \
  901. PIN_OTYPE_PUSHPULL(11U) | \
  902. PIN_OTYPE_PUSHPULL(12U) | \
  903. PIN_OTYPE_PUSHPULL(13U) | \
  904. PIN_OTYPE_PUSHPULL(14U) | \
  905. PIN_OTYPE_PUSHPULL(15U))
  906. #define VAL_GPIOD_OSPEEDR (PIN_OSPEED_MEDIUM(0U) | \
  907. PIN_OSPEED_MEDIUM(1U) | \
  908. PIN_OSPEED_MEDIUM(2U) | \
  909. PIN_OSPEED_MEDIUM(3U) | \
  910. PIN_OSPEED_MEDIUM(4U) | \
  911. PIN_OSPEED_MEDIUM(5U) | \
  912. PIN_OSPEED_MEDIUM(6U) | \
  913. PIN_OSPEED_MEDIUM(7U) | \
  914. PIN_OSPEED_MEDIUM(8U) | \
  915. PIN_OSPEED_MEDIUM(9U) | \
  916. PIN_OSPEED_MEDIUM(10U) | \
  917. PIN_OSPEED_MEDIUM(11U) | \
  918. PIN_OSPEED_MEDIUM(12U) | \
  919. PIN_OSPEED_MEDIUM(13U) | \
  920. PIN_OSPEED_MEDIUM(14U) | \
  921. PIN_OSPEED_MEDIUM(15U))
  922. #define VAL_GPIOD_PUPDR (PIN_PUPDR_PULLUP(0U) | \
  923. PIN_PUPDR_PULLUP(1U) | \
  924. PIN_PUPDR_FLOATING(2U) | \
  925. PIN_PUPDR_PULLUP(3U) | \
  926. PIN_PUPDR_PULLUP(4U) | \
  927. PIN_PUPDR_PULLUP(5U) | \
  928. PIN_PUPDR_PULLUP(6U) | \
  929. PIN_PUPDR_FLOATING(7U) | \
  930. PIN_PUPDR_PULLUP(8U) | \
  931. PIN_PUPDR_PULLUP(9U) | \
  932. PIN_PUPDR_FLOATING(10U) | \
  933. PIN_PUPDR_PULLUP(11U) | \
  934. PIN_PUPDR_PULLUP(12U) | \
  935. PIN_PUPDR_FLOATING(13U) | \
  936. PIN_PUPDR_FLOATING(14U) | \
  937. PIN_PUPDR_FLOATING(15U))
  938. #define VAL_GPIOD_ODR (PIN_ODR_HIGH(0U) | \
  939. PIN_ODR_HIGH(1U) | \
  940. PIN_ODR_HIGH(2U) | \
  941. PIN_ODR_HIGH(3U) | \
  942. PIN_ODR_HIGH(4U) | \
  943. PIN_ODR_HIGH(5U) | \
  944. PIN_ODR_HIGH(6U) | \
  945. PIN_ODR_HIGH(7U) | \
  946. PIN_ODR_HIGH(8U) | \
  947. PIN_ODR_HIGH(9U) | \
  948. PIN_ODR_HIGH(10U) | \
  949. PIN_ODR_HIGH(11U) | \
  950. PIN_ODR_HIGH(12U) | \
  951. PIN_ODR_HIGH(13U) | \
  952. PIN_ODR_HIGH(14U) | \
  953. PIN_ODR_HIGH(15U))
  954. #define VAL_GPIOD_AFRL (PIN_AFIO_AF(0U, 8U) | \
  955. PIN_AFIO_AF(1U, 8U) | \
  956. PIN_AFIO_AF(2U, 0U) | \
  957. PIN_AFIO_AF(3U, 7U) | \
  958. PIN_AFIO_AF(4U, 0U) | \
  959. PIN_AFIO_AF(5U, 7U) | \
  960. PIN_AFIO_AF(6U, 7U) | \
  961. PIN_AFIO_AF(7U, 5U))
  962. #define VAL_GPIOD_AFRH (PIN_AFIO_AF(8U, 7U) | \
  963. PIN_AFIO_AF(9U, 7U) | \
  964. PIN_AFIO_AF(10U, 0U) | \
  965. PIN_AFIO_AF(11U, 7U) | \
  966. PIN_AFIO_AF(12U, 0U) | \
  967. PIN_AFIO_AF(13U, 2U) | \
  968. PIN_AFIO_AF(14U, 2U) | \
  969. PIN_AFIO_AF(15U, 0U))
  970. /* PORTE:
  971. PE0 UART8_RX UART8 AF8
  972. PE1 UART8_TX UART8 AF8
  973. PE2 SPI4_SCK SPI4 AF5
  974. PE3 VDD_3V3_SENSORS_EN OUTPUT
  975. PE5 TIM15_CH1 TIM9 AF4
  976. PE6 SPI4_MOSI SPI4 AF5
  977. PE7 DRDY8_NC INPUT
  978. PE8 UART7_TX UART7 AF7
  979. PE9 TIM1_CH1 TIM1 AF1 PWM4
  980. PE11 TIM1_CH2 TIM1 AF1 PWM3
  981. PE13 SPI4_MISO SPI4 AF5
  982. PE14 TIM1_CH4 TIM1 AF1 PWM1
  983. PE15 VDD_5V_PERIPH_OC INPUT
  984. */
  985. #define VAL_GPIOE_MODER (PIN_MODE_ALTERNATE(0U) | \
  986. PIN_MODE_ALTERNATE(1U) | \
  987. PIN_MODE_ALTERNATE(2U) | \
  988. PIN_MODE_OUTPUT(3U) | \
  989. PIN_MODE_INPUT(4U) | \
  990. PIN_MODE_ALTERNATE(5U) | \
  991. PIN_MODE_ALTERNATE(6U) | \
  992. PIN_MODE_INPUT(7U) | \
  993. PIN_MODE_ALTERNATE(8U) | \
  994. PIN_MODE_ALTERNATE(9U) | \
  995. PIN_MODE_INPUT(10U) | \
  996. PIN_MODE_ALTERNATE(11U) | \
  997. PIN_MODE_INPUT(12U) | \
  998. PIN_MODE_ALTERNATE(13U) | \
  999. PIN_MODE_ALTERNATE(14U) | \
  1000. PIN_MODE_INPUT(15U))
  1001. #define VAL_GPIOE_OTYPER (PIN_OTYPE_PUSHPULL(0U) | \
  1002. PIN_OTYPE_PUSHPULL(1U) | \
  1003. PIN_OTYPE_PUSHPULL(2U) | \
  1004. PIN_OTYPE_PUSHPULL(3U) | \
  1005. PIN_OTYPE_PUSHPULL(4U) | \
  1006. PIN_OTYPE_PUSHPULL(5U) | \
  1007. PIN_OTYPE_PUSHPULL(6U) | \
  1008. PIN_OTYPE_PUSHPULL(7U) | \
  1009. PIN_OTYPE_PUSHPULL(8U) | \
  1010. PIN_OTYPE_PUSHPULL(9U) | \
  1011. PIN_OTYPE_PUSHPULL(10U) | \
  1012. PIN_OTYPE_PUSHPULL(11U) | \
  1013. PIN_OTYPE_PUSHPULL(12U) | \
  1014. PIN_OTYPE_PUSHPULL(13U) | \
  1015. PIN_OTYPE_PUSHPULL(14U) | \
  1016. PIN_OTYPE_PUSHPULL(15U))
  1017. #define VAL_GPIOE_OSPEEDR (PIN_OSPEED_MEDIUM(0U) | \
  1018. PIN_OSPEED_MEDIUM(1U) | \
  1019. PIN_OSPEED_MEDIUM(2U) | \
  1020. PIN_OSPEED_MEDIUM(3U) | \
  1021. PIN_OSPEED_MEDIUM(4U) | \
  1022. PIN_OSPEED_MEDIUM(5U) | \
  1023. PIN_OSPEED_MEDIUM(6U) | \
  1024. PIN_OSPEED_MEDIUM(7U) | \
  1025. PIN_OSPEED_MEDIUM(8U) | \
  1026. PIN_OSPEED_MEDIUM(9U) | \
  1027. PIN_OSPEED_MEDIUM(10U) | \
  1028. PIN_OSPEED_MEDIUM(11U) | \
  1029. PIN_OSPEED_MEDIUM(12U) | \
  1030. PIN_OSPEED_MEDIUM(13U) | \
  1031. PIN_OSPEED_MEDIUM(14U) | \
  1032. PIN_OSPEED_MEDIUM(15U))
  1033. #define VAL_GPIOE_PUPDR (PIN_PUPDR_PULLUP(0U) | \
  1034. PIN_PUPDR_PULLUP(1U) | \
  1035. PIN_PUPDR_FLOATING(2U) | \
  1036. PIN_PUPDR_FLOATING(3U) | \
  1037. PIN_PUPDR_FLOATING(4U) | \
  1038. PIN_PUPDR_FLOATING(5U) | \
  1039. PIN_PUPDR_FLOATING(6U) | \
  1040. PIN_PUPDR_FLOATING(7U) | \
  1041. PIN_PUPDR_PULLUP(8U) | \
  1042. PIN_PUPDR_FLOATING(9U) | \
  1043. PIN_PUPDR_FLOATING(10U) | \
  1044. PIN_PUPDR_FLOATING(11U) | \
  1045. PIN_PUPDR_FLOATING(12U) | \
  1046. PIN_PUPDR_FLOATING(13U) | \
  1047. PIN_PUPDR_FLOATING(14U) | \
  1048. PIN_PUPDR_PULLUP(15U))
  1049. #define VAL_GPIOE_ODR (PIN_ODR_HIGH(0U) | \
  1050. PIN_ODR_HIGH(1U) | \
  1051. PIN_ODR_HIGH(2U) | \
  1052. PIN_ODR_LOW(3U) | \
  1053. PIN_ODR_HIGH(4U) | \
  1054. PIN_ODR_HIGH(5U) | \
  1055. PIN_ODR_HIGH(6U) | \
  1056. PIN_ODR_HIGH(7U) | \
  1057. PIN_ODR_HIGH(8U) | \
  1058. PIN_ODR_HIGH(9U) | \
  1059. PIN_ODR_HIGH(10U) | \
  1060. PIN_ODR_HIGH(11U) | \
  1061. PIN_ODR_HIGH(12U) | \
  1062. PIN_ODR_HIGH(13U) | \
  1063. PIN_ODR_HIGH(14U) | \
  1064. PIN_ODR_HIGH(15U))
  1065. #define VAL_GPIOE_AFRL (PIN_AFIO_AF(0U, 8U) | \
  1066. PIN_AFIO_AF(1U, 8U) | \
  1067. PIN_AFIO_AF(2U, 5U) | \
  1068. PIN_AFIO_AF(3U, 0U) | \
  1069. PIN_AFIO_AF(4U, 0U) | \
  1070. PIN_AFIO_AF(5U, 4U) | \
  1071. PIN_AFIO_AF(6U, 5U) | \
  1072. PIN_AFIO_AF(7U, 0U))
  1073. #define VAL_GPIOE_AFRH (PIN_AFIO_AF(8U, 7U) | \
  1074. PIN_AFIO_AF(9U, 1U) | \
  1075. PIN_AFIO_AF(10U, 0U) | \
  1076. PIN_AFIO_AF(11U, 1U) | \
  1077. PIN_AFIO_AF(12U, 0U) | \
  1078. PIN_AFIO_AF(13U, 5U) | \
  1079. PIN_AFIO_AF(14U, 1U) | \
  1080. PIN_AFIO_AF(15U, 0U))
  1081. /* PORTF:
  1082. PF0 I2C2_SDA I2C2 AF4
  1083. PF1 I2C2_SCL I2C2 AF4
  1084. PF2 ICM20689_CS CS
  1085. PF3 ICM20602_CS CS
  1086. PF4 BMI055_G_CS CS
  1087. PF5 FRAM_CS CS
  1088. PF6 UART7_RX UART7 AF7
  1089. PF7 SPI5_SCK SPI5 AF5
  1090. PF8 SPI5_MISO SPI5 AF5
  1091. PF9 SPI5_MOSI SPI5 AF5
  1092. PF10 MS5611_CS CS
  1093. PF12 nVDD_5V_HIPOWER_EN OUTPUT
  1094. PF13 VDD_5V_HIPOWER_OC INPUT
  1095. PF14 I2C4_SCL I2C4 AF4
  1096. PF15 I2C4_SDA I2C4 AF4
  1097. */
  1098. #define VAL_GPIOF_MODER (PIN_MODE_ALTERNATE(0U) | \
  1099. PIN_MODE_ALTERNATE(1U) | \
  1100. PIN_MODE_OUTPUT(2U) | \
  1101. PIN_MODE_OUTPUT(3U) | \
  1102. PIN_MODE_OUTPUT(4U) | \
  1103. PIN_MODE_OUTPUT(5U) | \
  1104. PIN_MODE_ALTERNATE(6U) | \
  1105. PIN_MODE_ALTERNATE(7U) | \
  1106. PIN_MODE_ALTERNATE(8U) | \
  1107. PIN_MODE_ALTERNATE(9U) | \
  1108. PIN_MODE_OUTPUT(10U) | \
  1109. PIN_MODE_INPUT(11U) | \
  1110. PIN_MODE_OUTPUT(12U) | \
  1111. PIN_MODE_INPUT(13U) | \
  1112. PIN_MODE_ALTERNATE(14U) | \
  1113. PIN_MODE_ALTERNATE(15U))
  1114. #define VAL_GPIOF_OTYPER (PIN_OTYPE_OPENDRAIN(0U) | \
  1115. PIN_OTYPE_OPENDRAIN(1U) | \
  1116. PIN_OTYPE_PUSHPULL(2U) | \
  1117. PIN_OTYPE_PUSHPULL(3U) | \
  1118. PIN_OTYPE_PUSHPULL(4U) | \
  1119. PIN_OTYPE_PUSHPULL(5U) | \
  1120. PIN_OTYPE_PUSHPULL(6U) | \
  1121. PIN_OTYPE_PUSHPULL(7U) | \
  1122. PIN_OTYPE_PUSHPULL(8U) | \
  1123. PIN_OTYPE_PUSHPULL(9U) | \
  1124. PIN_OTYPE_PUSHPULL(10U) | \
  1125. PIN_OTYPE_PUSHPULL(11U) | \
  1126. PIN_OTYPE_PUSHPULL(12U) | \
  1127. PIN_OTYPE_PUSHPULL(13U) | \
  1128. PIN_OTYPE_OPENDRAIN(14U) | \
  1129. PIN_OTYPE_OPENDRAIN(15U))
  1130. #define VAL_GPIOF_OSPEEDR (PIN_OSPEED_MEDIUM(0U) | \
  1131. PIN_OSPEED_MEDIUM(1U) | \
  1132. PIN_OSPEED_VERYLOW(2U) | \
  1133. PIN_OSPEED_VERYLOW(3U) | \
  1134. PIN_OSPEED_MEDIUM(4U) | \
  1135. PIN_OSPEED_VERYLOW(5U) | \
  1136. PIN_OSPEED_MEDIUM(6U) | \
  1137. PIN_OSPEED_MEDIUM(7U) | \
  1138. PIN_OSPEED_MEDIUM(8U) | \
  1139. PIN_OSPEED_MEDIUM(9U) | \
  1140. PIN_OSPEED_MEDIUM(10U) | \
  1141. PIN_OSPEED_MEDIUM(11U) | \
  1142. PIN_OSPEED_MEDIUM(12U) | \
  1143. PIN_OSPEED_MEDIUM(13U) | \
  1144. PIN_OSPEED_MEDIUM(14U) | \
  1145. PIN_OSPEED_MEDIUM(15U))
  1146. #define VAL_GPIOF_PUPDR (PIN_PUPDR_FLOATING(0U) | \
  1147. PIN_PUPDR_FLOATING(1U) | \
  1148. PIN_PUPDR_PULLUP(2U) | \
  1149. PIN_PUPDR_PULLUP(3U) | \
  1150. PIN_PUPDR_PULLUP(4U) | \
  1151. PIN_PUPDR_PULLUP(5U) | \
  1152. PIN_PUPDR_PULLUP(6U) | \
  1153. PIN_PUPDR_FLOATING(7U) | \
  1154. PIN_PUPDR_FLOATING(8U) | \
  1155. PIN_PUPDR_FLOATING(9U) | \
  1156. PIN_PUPDR_PULLUP(10U) | \
  1157. PIN_PUPDR_FLOATING(11U) | \
  1158. PIN_PUPDR_FLOATING(12U) | \
  1159. PIN_PUPDR_PULLUP(13U) | \
  1160. PIN_PUPDR_FLOATING(14U) | \
  1161. PIN_PUPDR_FLOATING(15U))
  1162. #define VAL_GPIOF_ODR (PIN_ODR_HIGH(0U) | \
  1163. PIN_ODR_HIGH(1U) | \
  1164. PIN_ODR_HIGH(2U) | \
  1165. PIN_ODR_HIGH(3U) | \
  1166. PIN_ODR_HIGH(4U) | \
  1167. PIN_ODR_HIGH(5U) | \
  1168. PIN_ODR_HIGH(6U) | \
  1169. PIN_ODR_HIGH(7U) | \
  1170. PIN_ODR_HIGH(8U) | \
  1171. PIN_ODR_HIGH(9U) | \
  1172. PIN_ODR_HIGH(10U) | \
  1173. PIN_ODR_HIGH(11U) | \
  1174. PIN_ODR_HIGH(12U) | \
  1175. PIN_ODR_HIGH(13U) | \
  1176. PIN_ODR_HIGH(14U) | \
  1177. PIN_ODR_HIGH(15U))
  1178. #define VAL_GPIOF_AFRL (PIN_AFIO_AF(0U, 4U) | \
  1179. PIN_AFIO_AF(1U, 4U) | \
  1180. PIN_AFIO_AF(2U, 0U) | \
  1181. PIN_AFIO_AF(3U, 0U) | \
  1182. PIN_AFIO_AF(4U, 0U) | \
  1183. PIN_AFIO_AF(5U, 0U) | \
  1184. PIN_AFIO_AF(6U, 7U) | \
  1185. PIN_AFIO_AF(7U, 5U))
  1186. #define VAL_GPIOF_AFRH (PIN_AFIO_AF(8U, 5U) | \
  1187. PIN_AFIO_AF(9U, 5U) | \
  1188. PIN_AFIO_AF(10U, 0U) | \
  1189. PIN_AFIO_AF(11U, 0U) | \
  1190. PIN_AFIO_AF(12U, 0U) | \
  1191. PIN_AFIO_AF(13U, 0U) | \
  1192. PIN_AFIO_AF(14U, 4U) | \
  1193. PIN_AFIO_AF(15U, 4U))
  1194. /* PORTG:
  1195. PG1 VDD_BRICK_VALID INPUT
  1196. PG2 VDD_BRICK2_VALID INPUT
  1197. PG3 VBUS INPUT
  1198. PG4 nVDD_5V_PERIPH_EN OUTPUT
  1199. PG5 VDD_5V_RC_EN OUTPUT
  1200. PG6 VDD_5V_WIFI_EN OUTPUT
  1201. PG7 VDD_3V3_SD_CARD_EN OUTPUT
  1202. PG8 USART6_RTS USART6
  1203. PG9 USART6_RX USART6 AF7
  1204. PG10 BMI055_A_CS CS
  1205. PG11 SPI1_SCK SPI1 AF5
  1206. PG12 SPI6_MISO SPI6 AF5
  1207. PG13 SPI6_SCK SPI6 AF5
  1208. PG15 USART6_CTS USART6 AF7
  1209. */
  1210. #define VAL_GPIOG_MODER (PIN_MODE_INPUT(0U) | \
  1211. PIN_MODE_INPUT(1U) | \
  1212. PIN_MODE_INPUT(2U) | \
  1213. PIN_MODE_INPUT(3U) | \
  1214. PIN_MODE_OUTPUT(4U) | \
  1215. PIN_MODE_OUTPUT(5U) | \
  1216. PIN_MODE_OUTPUT(6U) | \
  1217. PIN_MODE_OUTPUT(7U) | \
  1218. PIN_MODE_OUTPUT(8U) | \
  1219. PIN_MODE_ALTERNATE(9U) | \
  1220. PIN_MODE_OUTPUT(10U) | \
  1221. PIN_MODE_ALTERNATE(11U) | \
  1222. PIN_MODE_ALTERNATE(12U) | \
  1223. PIN_MODE_ALTERNATE(13U) | \
  1224. PIN_MODE_INPUT(14U) | \
  1225. PIN_MODE_ALTERNATE(15U))
  1226. #define VAL_GPIOG_OTYPER (PIN_OTYPE_PUSHPULL(0U) | \
  1227. PIN_OTYPE_PUSHPULL(1U) | \
  1228. PIN_OTYPE_PUSHPULL(2U) | \
  1229. PIN_OTYPE_PUSHPULL(3U) | \
  1230. PIN_OTYPE_PUSHPULL(4U) | \
  1231. PIN_OTYPE_PUSHPULL(5U) | \
  1232. PIN_OTYPE_PUSHPULL(6U) | \
  1233. PIN_OTYPE_PUSHPULL(7U) | \
  1234. PIN_OTYPE_PUSHPULL(8U) | \
  1235. PIN_OTYPE_PUSHPULL(9U) | \
  1236. PIN_OTYPE_PUSHPULL(10U) | \
  1237. PIN_OTYPE_PUSHPULL(11U) | \
  1238. PIN_OTYPE_PUSHPULL(12U) | \
  1239. PIN_OTYPE_PUSHPULL(13U) | \
  1240. PIN_OTYPE_PUSHPULL(14U) | \
  1241. PIN_OTYPE_PUSHPULL(15U))
  1242. #define VAL_GPIOG_OSPEEDR (PIN_OSPEED_MEDIUM(0U) | \
  1243. PIN_OSPEED_MEDIUM(1U) | \
  1244. PIN_OSPEED_MEDIUM(2U) | \
  1245. PIN_OSPEED_MEDIUM(3U) | \
  1246. PIN_OSPEED_MEDIUM(4U) | \
  1247. PIN_OSPEED_MEDIUM(5U) | \
  1248. PIN_OSPEED_MEDIUM(6U) | \
  1249. PIN_OSPEED_MEDIUM(7U) | \
  1250. PIN_OSPEED_MEDIUM(8U) | \
  1251. PIN_OSPEED_MEDIUM(9U) | \
  1252. PIN_OSPEED_MEDIUM(10U) | \
  1253. PIN_OSPEED_MEDIUM(11U) | \
  1254. PIN_OSPEED_MEDIUM(12U) | \
  1255. PIN_OSPEED_MEDIUM(13U) | \
  1256. PIN_OSPEED_MEDIUM(14U) | \
  1257. PIN_OSPEED_MEDIUM(15U))
  1258. #define VAL_GPIOG_PUPDR (PIN_PUPDR_FLOATING(0U) | \
  1259. PIN_PUPDR_PULLUP(1U) | \
  1260. PIN_PUPDR_PULLUP(2U) | \
  1261. PIN_PUPDR_FLOATING(3U) | \
  1262. PIN_PUPDR_FLOATING(4U) | \
  1263. PIN_PUPDR_FLOATING(5U) | \
  1264. PIN_PUPDR_FLOATING(6U) | \
  1265. PIN_PUPDR_FLOATING(7U) | \
  1266. PIN_PUPDR_PULLUP(8U) | \
  1267. PIN_PUPDR_PULLUP(9U) | \
  1268. PIN_PUPDR_PULLUP(10U) | \
  1269. PIN_PUPDR_FLOATING(11U) | \
  1270. PIN_PUPDR_FLOATING(12U) | \
  1271. PIN_PUPDR_FLOATING(13U) | \
  1272. PIN_PUPDR_FLOATING(14U) | \
  1273. PIN_PUPDR_PULLUP(15U))
  1274. #define VAL_GPIOG_ODR (PIN_ODR_HIGH(0U) | \
  1275. PIN_ODR_HIGH(1U) | \
  1276. PIN_ODR_HIGH(2U) | \
  1277. PIN_ODR_HIGH(3U) | \
  1278. PIN_ODR_HIGH(4U) | \
  1279. PIN_ODR_HIGH(5U) | \
  1280. PIN_ODR_HIGH(6U) | \
  1281. PIN_ODR_HIGH(7U) | \
  1282. PIN_ODR_HIGH(8U) | \
  1283. PIN_ODR_HIGH(9U) | \
  1284. PIN_ODR_HIGH(10U) | \
  1285. PIN_ODR_HIGH(11U) | \
  1286. PIN_ODR_HIGH(12U) | \
  1287. PIN_ODR_HIGH(13U) | \
  1288. PIN_ODR_HIGH(14U) | \
  1289. PIN_ODR_HIGH(15U))
  1290. #define VAL_GPIOG_AFRL (PIN_AFIO_AF(0U, 0U) | \
  1291. PIN_AFIO_AF(1U, 0U) | \
  1292. PIN_AFIO_AF(2U, 0U) | \
  1293. PIN_AFIO_AF(3U, 0U) | \
  1294. PIN_AFIO_AF(4U, 0U) | \
  1295. PIN_AFIO_AF(5U, 0U) | \
  1296. PIN_AFIO_AF(6U, 0U) | \
  1297. PIN_AFIO_AF(7U, 0U))
  1298. #define VAL_GPIOG_AFRH (PIN_AFIO_AF(8U, 0U) | \
  1299. PIN_AFIO_AF(9U, 7U) | \
  1300. PIN_AFIO_AF(10U, 0U) | \
  1301. PIN_AFIO_AF(11U, 5U) | \
  1302. PIN_AFIO_AF(12U, 5U) | \
  1303. PIN_AFIO_AF(13U, 5U) | \
  1304. PIN_AFIO_AF(14U, 0U) | \
  1305. PIN_AFIO_AF(15U, 7U))
  1306. /* PORTH:
  1307. PH2 GPIO_CAN1_SILENT OUTPUT
  1308. PH3 GPIO_CAN2_SILENT OUTPUT
  1309. PH4 GPIO_CAN3_SILENT OUTPUT
  1310. PH6 TIM12_CH1 TIM12 AF2 PWM7
  1311. PH7 I2C3_SCL I2C3 AF4
  1312. PH8 I2C3_SDA I2C3 AF4
  1313. PH9 TIM12_CH2 TIM12 AF2 PWM8
  1314. */
  1315. #define VAL_GPIOH_MODER (PIN_MODE_INPUT(0U) | \
  1316. PIN_MODE_INPUT(1U) | \
  1317. PIN_MODE_OUTPUT(2U) | \
  1318. PIN_MODE_OUTPUT(3U) | \
  1319. PIN_MODE_OUTPUT(4U) | \
  1320. PIN_MODE_INPUT(5U) | \
  1321. PIN_MODE_ALTERNATE(6U) | \
  1322. PIN_MODE_ALTERNATE(7U) | \
  1323. PIN_MODE_ALTERNATE(8U) | \
  1324. PIN_MODE_ALTERNATE(9U) | \
  1325. PIN_MODE_INPUT(10U) | \
  1326. PIN_MODE_INPUT(11U) | \
  1327. PIN_MODE_INPUT(12U) | \
  1328. PIN_MODE_INPUT(13U) | \
  1329. PIN_MODE_INPUT(14U) | \
  1330. PIN_MODE_INPUT(15U))
  1331. #define VAL_GPIOH_OTYPER (PIN_OTYPE_PUSHPULL(0U) | \
  1332. PIN_OTYPE_PUSHPULL(1U) | \
  1333. PIN_OTYPE_PUSHPULL(2U) | \
  1334. PIN_OTYPE_PUSHPULL(3U) | \
  1335. PIN_OTYPE_PUSHPULL(4U) | \
  1336. PIN_OTYPE_PUSHPULL(5U) | \
  1337. PIN_OTYPE_PUSHPULL(6U) | \
  1338. PIN_OTYPE_OPENDRAIN(7U) | \
  1339. PIN_OTYPE_OPENDRAIN(8U) | \
  1340. PIN_OTYPE_PUSHPULL(9U) | \
  1341. PIN_OTYPE_PUSHPULL(10U) | \
  1342. PIN_OTYPE_PUSHPULL(11U) | \
  1343. PIN_OTYPE_PUSHPULL(12U) | \
  1344. PIN_OTYPE_PUSHPULL(13U) | \
  1345. PIN_OTYPE_PUSHPULL(14U) | \
  1346. PIN_OTYPE_PUSHPULL(15U))
  1347. #define VAL_GPIOH_OSPEEDR (PIN_OSPEED_MEDIUM(0U) | \
  1348. PIN_OSPEED_MEDIUM(1U) | \
  1349. PIN_OSPEED_LOW(2U) | \
  1350. PIN_OSPEED_LOW(3U) | \
  1351. PIN_OSPEED_LOW(4U) | \
  1352. PIN_OSPEED_MEDIUM(5U) | \
  1353. PIN_OSPEED_MEDIUM(6U) | \
  1354. PIN_OSPEED_MEDIUM(7U) | \
  1355. PIN_OSPEED_MEDIUM(8U) | \
  1356. PIN_OSPEED_MEDIUM(9U) | \
  1357. PIN_OSPEED_MEDIUM(10U) | \
  1358. PIN_OSPEED_MEDIUM(11U) | \
  1359. PIN_OSPEED_MEDIUM(12U) | \
  1360. PIN_OSPEED_MEDIUM(13U) | \
  1361. PIN_OSPEED_MEDIUM(14U) | \
  1362. PIN_OSPEED_MEDIUM(15U))
  1363. #define VAL_GPIOH_PUPDR (PIN_PUPDR_FLOATING(0U) | \
  1364. PIN_PUPDR_FLOATING(1U) | \
  1365. PIN_PUPDR_FLOATING(2U) | \
  1366. PIN_PUPDR_FLOATING(3U) | \
  1367. PIN_PUPDR_FLOATING(4U) | \
  1368. PIN_PUPDR_FLOATING(5U) | \
  1369. PIN_PUPDR_FLOATING(6U) | \
  1370. PIN_PUPDR_FLOATING(7U) | \
  1371. PIN_PUPDR_FLOATING(8U) | \
  1372. PIN_PUPDR_FLOATING(9U) | \
  1373. PIN_PUPDR_FLOATING(10U) | \
  1374. PIN_PUPDR_FLOATING(11U) | \
  1375. PIN_PUPDR_FLOATING(12U) | \
  1376. PIN_PUPDR_FLOATING(13U) | \
  1377. PIN_PUPDR_FLOATING(14U) | \
  1378. PIN_PUPDR_FLOATING(15U))
  1379. #define VAL_GPIOH_ODR (PIN_ODR_HIGH(0U) | \
  1380. PIN_ODR_HIGH(1U) | \
  1381. PIN_ODR_LOW(2U) | \
  1382. PIN_ODR_LOW(3U) | \
  1383. PIN_ODR_LOW(4U) | \
  1384. PIN_ODR_HIGH(5U) | \
  1385. PIN_ODR_HIGH(6U) | \
  1386. PIN_ODR_HIGH(7U) | \
  1387. PIN_ODR_HIGH(8U) | \
  1388. PIN_ODR_HIGH(9U) | \
  1389. PIN_ODR_HIGH(10U) | \
  1390. PIN_ODR_HIGH(11U) | \
  1391. PIN_ODR_HIGH(12U) | \
  1392. PIN_ODR_HIGH(13U) | \
  1393. PIN_ODR_HIGH(14U) | \
  1394. PIN_ODR_HIGH(15U))
  1395. #define VAL_GPIOH_AFRL (PIN_AFIO_AF(0U, 0U) | \
  1396. PIN_AFIO_AF(1U, 0U) | \
  1397. PIN_AFIO_AF(2U, 0U) | \
  1398. PIN_AFIO_AF(3U, 0U) | \
  1399. PIN_AFIO_AF(4U, 0U) | \
  1400. PIN_AFIO_AF(5U, 0U) | \
  1401. PIN_AFIO_AF(6U, 2U) | \
  1402. PIN_AFIO_AF(7U, 4U))
  1403. #define VAL_GPIOH_AFRH (PIN_AFIO_AF(8U, 4U) | \
  1404. PIN_AFIO_AF(9U, 2U) | \
  1405. PIN_AFIO_AF(10U, 0U) | \
  1406. PIN_AFIO_AF(11U, 0U) | \
  1407. PIN_AFIO_AF(12U, 0U) | \
  1408. PIN_AFIO_AF(13U, 0U) | \
  1409. PIN_AFIO_AF(14U, 0U) | \
  1410. PIN_AFIO_AF(15U, 0U))
  1411. /* PORTI:
  1412. PI0 FMU_SPARE_4 INPUT
  1413. PI1 SPI2_SCK SPI2 AF5
  1414. PI2 SPI2_MISO SPI2 AF5
  1415. PI3 SPI2_MOSI SPI2 AF5
  1416. PI4 EXT1_CS1 CS
  1417. PI6 EXT2_CS1 CS
  1418. PI7 EXT2_CS2 CS
  1419. PI8 EXT2_CS3 CS
  1420. PI10 EXT1_CS2 CS
  1421. */
  1422. #define VAL_GPIOI_MODER (PIN_MODE_INPUT(0U) | \
  1423. PIN_MODE_ALTERNATE(1U) | \
  1424. PIN_MODE_ALTERNATE(2U) | \
  1425. PIN_MODE_ALTERNATE(3U) | \
  1426. PIN_MODE_OUTPUT(4U) | \
  1427. PIN_MODE_INPUT(5U) | \
  1428. PIN_MODE_OUTPUT(6U) | \
  1429. PIN_MODE_OUTPUT(7U) | \
  1430. PIN_MODE_OUTPUT(8U) | \
  1431. PIN_MODE_INPUT(9U) | \
  1432. PIN_MODE_OUTPUT(10U) | \
  1433. PIN_MODE_INPUT(11U) | \
  1434. PIN_MODE_INPUT(12U) | \
  1435. PIN_MODE_INPUT(13U) | \
  1436. PIN_MODE_INPUT(14U) | \
  1437. PIN_MODE_INPUT(15U))
  1438. #define VAL_GPIOI_OTYPER (PIN_OTYPE_PUSHPULL(0U) | \
  1439. PIN_OTYPE_PUSHPULL(1U) | \
  1440. PIN_OTYPE_PUSHPULL(2U) | \
  1441. PIN_OTYPE_PUSHPULL(3U) | \
  1442. PIN_OTYPE_PUSHPULL(4U) | \
  1443. PIN_OTYPE_PUSHPULL(5U) | \
  1444. PIN_OTYPE_PUSHPULL(6U) | \
  1445. PIN_OTYPE_PUSHPULL(7U) | \
  1446. PIN_OTYPE_PUSHPULL(8U) | \
  1447. PIN_OTYPE_PUSHPULL(9U) | \
  1448. PIN_OTYPE_PUSHPULL(10U) | \
  1449. PIN_OTYPE_PUSHPULL(11U) | \
  1450. PIN_OTYPE_PUSHPULL(12U) | \
  1451. PIN_OTYPE_PUSHPULL(13U) | \
  1452. PIN_OTYPE_PUSHPULL(14U) | \
  1453. PIN_OTYPE_PUSHPULL(15U))
  1454. #define VAL_GPIOI_OSPEEDR (PIN_OSPEED_MEDIUM(0U) | \
  1455. PIN_OSPEED_MEDIUM(1U) | \
  1456. PIN_OSPEED_MEDIUM(2U) | \
  1457. PIN_OSPEED_MEDIUM(3U) | \
  1458. PIN_OSPEED_MEDIUM(4U) | \
  1459. PIN_OSPEED_MEDIUM(5U) | \
  1460. PIN_OSPEED_MEDIUM(6U) | \
  1461. PIN_OSPEED_MEDIUM(7U) | \
  1462. PIN_OSPEED_MEDIUM(8U) | \
  1463. PIN_OSPEED_MEDIUM(9U) | \
  1464. PIN_OSPEED_MEDIUM(10U) | \
  1465. PIN_OSPEED_MEDIUM(11U) | \
  1466. PIN_OSPEED_MEDIUM(12U) | \
  1467. PIN_OSPEED_MEDIUM(13U) | \
  1468. PIN_OSPEED_MEDIUM(14U) | \
  1469. PIN_OSPEED_MEDIUM(15U))
  1470. #define VAL_GPIOI_PUPDR (PIN_PUPDR_FLOATING(0U) | \
  1471. PIN_PUPDR_FLOATING(1U) | \
  1472. PIN_PUPDR_FLOATING(2U) | \
  1473. PIN_PUPDR_FLOATING(3U) | \
  1474. PIN_PUPDR_PULLUP(4U) | \
  1475. PIN_PUPDR_FLOATING(5U) | \
  1476. PIN_PUPDR_PULLUP(6U) | \
  1477. PIN_PUPDR_PULLUP(7U) | \
  1478. PIN_PUPDR_PULLUP(8U) | \
  1479. PIN_PUPDR_FLOATING(9U) | \
  1480. PIN_PUPDR_PULLUP(10U) | \
  1481. PIN_PUPDR_FLOATING(11U) | \
  1482. PIN_PUPDR_FLOATING(12U) | \
  1483. PIN_PUPDR_FLOATING(13U) | \
  1484. PIN_PUPDR_FLOATING(14U) | \
  1485. PIN_PUPDR_FLOATING(15U))
  1486. #define VAL_GPIOI_ODR (PIN_ODR_HIGH(0U) | \
  1487. PIN_ODR_HIGH(1U) | \
  1488. PIN_ODR_HIGH(2U) | \
  1489. PIN_ODR_HIGH(3U) | \
  1490. PIN_ODR_HIGH(4U) | \
  1491. PIN_ODR_HIGH(5U) | \
  1492. PIN_ODR_HIGH(6U) | \
  1493. PIN_ODR_HIGH(7U) | \
  1494. PIN_ODR_HIGH(8U) | \
  1495. PIN_ODR_HIGH(9U) | \
  1496. PIN_ODR_HIGH(10U) | \
  1497. PIN_ODR_HIGH(11U) | \
  1498. PIN_ODR_HIGH(12U) | \
  1499. PIN_ODR_HIGH(13U) | \
  1500. PIN_ODR_HIGH(14U) | \
  1501. PIN_ODR_HIGH(15U))
  1502. #define VAL_GPIOI_AFRL (PIN_AFIO_AF(0U, 0U) | \
  1503. PIN_AFIO_AF(1U, 5U) | \
  1504. PIN_AFIO_AF(2U, 5U) | \
  1505. PIN_AFIO_AF(3U, 5U) | \
  1506. PIN_AFIO_AF(4U, 0U) | \
  1507. PIN_AFIO_AF(5U, 0U) | \
  1508. PIN_AFIO_AF(6U, 0U) | \
  1509. PIN_AFIO_AF(7U, 0U))
  1510. #define VAL_GPIOI_AFRH (PIN_AFIO_AF(8U, 0U) | \
  1511. PIN_AFIO_AF(9U, 0U) | \
  1512. PIN_AFIO_AF(10U, 0U) | \
  1513. PIN_AFIO_AF(11U, 0U) | \
  1514. PIN_AFIO_AF(12U, 0U) | \
  1515. PIN_AFIO_AF(13U, 0U) | \
  1516. PIN_AFIO_AF(14U, 0U) | \
  1517. PIN_AFIO_AF(15U, 0U))
  1518. /* PORTJ:
  1519. */
  1520. #define VAL_GPIOJ_MODER (PIN_MODE_INPUT(0U) | \
  1521. PIN_MODE_INPUT(1U) | \
  1522. PIN_MODE_INPUT(2U) | \
  1523. PIN_MODE_INPUT(3U) | \
  1524. PIN_MODE_INPUT(4U) | \
  1525. PIN_MODE_INPUT(5U) | \
  1526. PIN_MODE_INPUT(6U) | \
  1527. PIN_MODE_INPUT(7U) | \
  1528. PIN_MODE_INPUT(8U) | \
  1529. PIN_MODE_INPUT(9U) | \
  1530. PIN_MODE_INPUT(10U) | \
  1531. PIN_MODE_INPUT(11U) | \
  1532. PIN_MODE_INPUT(12U) | \
  1533. PIN_MODE_INPUT(13U) | \
  1534. PIN_MODE_INPUT(14U) | \
  1535. PIN_MODE_INPUT(15U))
  1536. #define VAL_GPIOJ_OTYPER (PIN_OTYPE_PUSHPULL(0U) | \
  1537. PIN_OTYPE_PUSHPULL(1U) | \
  1538. PIN_OTYPE_PUSHPULL(2U) | \
  1539. PIN_OTYPE_PUSHPULL(3U) | \
  1540. PIN_OTYPE_PUSHPULL(4U) | \
  1541. PIN_OTYPE_PUSHPULL(5U) | \
  1542. PIN_OTYPE_PUSHPULL(6U) | \
  1543. PIN_OTYPE_PUSHPULL(7U) | \
  1544. PIN_OTYPE_PUSHPULL(8U) | \
  1545. PIN_OTYPE_PUSHPULL(9U) | \
  1546. PIN_OTYPE_PUSHPULL(10U) | \
  1547. PIN_OTYPE_PUSHPULL(11U) | \
  1548. PIN_OTYPE_PUSHPULL(12U) | \
  1549. PIN_OTYPE_PUSHPULL(13U) | \
  1550. PIN_OTYPE_PUSHPULL(14U) | \
  1551. PIN_OTYPE_PUSHPULL(15U))
  1552. #define VAL_GPIOJ_OSPEEDR (PIN_OSPEED_MEDIUM(0U) | \
  1553. PIN_OSPEED_MEDIUM(1U) | \
  1554. PIN_OSPEED_MEDIUM(2U) | \
  1555. PIN_OSPEED_MEDIUM(3U) | \
  1556. PIN_OSPEED_MEDIUM(4U) | \
  1557. PIN_OSPEED_MEDIUM(5U) | \
  1558. PIN_OSPEED_MEDIUM(6U) | \
  1559. PIN_OSPEED_MEDIUM(7U) | \
  1560. PIN_OSPEED_MEDIUM(8U) | \
  1561. PIN_OSPEED_MEDIUM(9U) | \
  1562. PIN_OSPEED_MEDIUM(10U) | \
  1563. PIN_OSPEED_MEDIUM(11U) | \
  1564. PIN_OSPEED_MEDIUM(12U) | \
  1565. PIN_OSPEED_MEDIUM(13U) | \
  1566. PIN_OSPEED_MEDIUM(14U) | \
  1567. PIN_OSPEED_MEDIUM(15U))
  1568. #define VAL_GPIOJ_PUPDR (PIN_PUPDR_FLOATING(0U) | \
  1569. PIN_PUPDR_FLOATING(1U) | \
  1570. PIN_PUPDR_FLOATING(2U) | \
  1571. PIN_PUPDR_FLOATING(3U) | \
  1572. PIN_PUPDR_FLOATING(4U) | \
  1573. PIN_PUPDR_FLOATING(5U) | \
  1574. PIN_PUPDR_FLOATING(6U) | \
  1575. PIN_PUPDR_FLOATING(7U) | \
  1576. PIN_PUPDR_FLOATING(8U) | \
  1577. PIN_PUPDR_FLOATING(9U) | \
  1578. PIN_PUPDR_FLOATING(10U) | \
  1579. PIN_PUPDR_FLOATING(11U) | \
  1580. PIN_PUPDR_FLOATING(12U) | \
  1581. PIN_PUPDR_FLOATING(13U) | \
  1582. PIN_PUPDR_FLOATING(14U) | \
  1583. PIN_PUPDR_FLOATING(15U))
  1584. #define VAL_GPIOJ_ODR (PIN_ODR_HIGH(0U) | \
  1585. PIN_ODR_HIGH(1U) | \
  1586. PIN_ODR_HIGH(2U) | \
  1587. PIN_ODR_HIGH(3U) | \
  1588. PIN_ODR_HIGH(4U) | \
  1589. PIN_ODR_HIGH(5U) | \
  1590. PIN_ODR_HIGH(6U) | \
  1591. PIN_ODR_HIGH(7U) | \
  1592. PIN_ODR_HIGH(8U) | \
  1593. PIN_ODR_HIGH(9U) | \
  1594. PIN_ODR_HIGH(10U) | \
  1595. PIN_ODR_HIGH(11U) | \
  1596. PIN_ODR_HIGH(12U) | \
  1597. PIN_ODR_HIGH(13U) | \
  1598. PIN_ODR_HIGH(14U) | \
  1599. PIN_ODR_HIGH(15U))
  1600. #define VAL_GPIOJ_AFRL (PIN_AFIO_AF(0U, 0U) | \
  1601. PIN_AFIO_AF(1U, 0U) | \
  1602. PIN_AFIO_AF(2U, 0U) | \
  1603. PIN_AFIO_AF(3U, 0U) | \
  1604. PIN_AFIO_AF(4U, 0U) | \
  1605. PIN_AFIO_AF(5U, 0U) | \
  1606. PIN_AFIO_AF(6U, 0U) | \
  1607. PIN_AFIO_AF(7U, 0U))
  1608. #define VAL_GPIOJ_AFRH (PIN_AFIO_AF(8U, 0U) | \
  1609. PIN_AFIO_AF(9U, 0U) | \
  1610. PIN_AFIO_AF(10U, 0U) | \
  1611. PIN_AFIO_AF(11U, 0U) | \
  1612. PIN_AFIO_AF(12U, 0U) | \
  1613. PIN_AFIO_AF(13U, 0U) | \
  1614. PIN_AFIO_AF(14U, 0U) | \
  1615. PIN_AFIO_AF(15U, 0U))
  1616. /* PORTK:
  1617. */
  1618. #define VAL_GPIOK_MODER (PIN_MODE_INPUT(0U) | \
  1619. PIN_MODE_INPUT(1U) | \
  1620. PIN_MODE_INPUT(2U) | \
  1621. PIN_MODE_INPUT(3U) | \
  1622. PIN_MODE_INPUT(4U) | \
  1623. PIN_MODE_INPUT(5U) | \
  1624. PIN_MODE_INPUT(6U) | \
  1625. PIN_MODE_INPUT(7U) | \
  1626. PIN_MODE_INPUT(8U) | \
  1627. PIN_MODE_INPUT(9U) | \
  1628. PIN_MODE_INPUT(10U) | \
  1629. PIN_MODE_INPUT(11U) | \
  1630. PIN_MODE_INPUT(12U) | \
  1631. PIN_MODE_INPUT(13U) | \
  1632. PIN_MODE_INPUT(14U) | \
  1633. PIN_MODE_INPUT(15U))
  1634. #define VAL_GPIOK_OTYPER (PIN_OTYPE_PUSHPULL(0U) | \
  1635. PIN_OTYPE_PUSHPULL(1U) | \
  1636. PIN_OTYPE_PUSHPULL(2U) | \
  1637. PIN_OTYPE_PUSHPULL(3U) | \
  1638. PIN_OTYPE_PUSHPULL(4U) | \
  1639. PIN_OTYPE_PUSHPULL(5U) | \
  1640. PIN_OTYPE_PUSHPULL(6U) | \
  1641. PIN_OTYPE_PUSHPULL(7U) | \
  1642. PIN_OTYPE_PUSHPULL(8U) | \
  1643. PIN_OTYPE_PUSHPULL(9U) | \
  1644. PIN_OTYPE_PUSHPULL(10U) | \
  1645. PIN_OTYPE_PUSHPULL(11U) | \
  1646. PIN_OTYPE_PUSHPULL(12U) | \
  1647. PIN_OTYPE_PUSHPULL(13U) | \
  1648. PIN_OTYPE_PUSHPULL(14U) | \
  1649. PIN_OTYPE_PUSHPULL(15U))
  1650. #define VAL_GPIOK_OSPEEDR (PIN_OSPEED_MEDIUM(0U) | \
  1651. PIN_OSPEED_MEDIUM(1U) | \
  1652. PIN_OSPEED_MEDIUM(2U) | \
  1653. PIN_OSPEED_MEDIUM(3U) | \
  1654. PIN_OSPEED_MEDIUM(4U) | \
  1655. PIN_OSPEED_MEDIUM(5U) | \
  1656. PIN_OSPEED_MEDIUM(6U) | \
  1657. PIN_OSPEED_MEDIUM(7U) | \
  1658. PIN_OSPEED_MEDIUM(8U) | \
  1659. PIN_OSPEED_MEDIUM(9U) | \
  1660. PIN_OSPEED_MEDIUM(10U) | \
  1661. PIN_OSPEED_MEDIUM(11U) | \
  1662. PIN_OSPEED_MEDIUM(12U) | \
  1663. PIN_OSPEED_MEDIUM(13U) | \
  1664. PIN_OSPEED_MEDIUM(14U) | \
  1665. PIN_OSPEED_MEDIUM(15U))
  1666. #define VAL_GPIOK_PUPDR (PIN_PUPDR_FLOATING(0U) | \
  1667. PIN_PUPDR_FLOATING(1U) | \
  1668. PIN_PUPDR_FLOATING(2U) | \
  1669. PIN_PUPDR_FLOATING(3U) | \
  1670. PIN_PUPDR_FLOATING(4U) | \
  1671. PIN_PUPDR_FLOATING(5U) | \
  1672. PIN_PUPDR_FLOATING(6U) | \
  1673. PIN_PUPDR_FLOATING(7U) | \
  1674. PIN_PUPDR_FLOATING(8U) | \
  1675. PIN_PUPDR_FLOATING(9U) | \
  1676. PIN_PUPDR_FLOATING(10U) | \
  1677. PIN_PUPDR_FLOATING(11U) | \
  1678. PIN_PUPDR_FLOATING(12U) | \
  1679. PIN_PUPDR_FLOATING(13U) | \
  1680. PIN_PUPDR_FLOATING(14U) | \
  1681. PIN_PUPDR_FLOATING(15U))
  1682. #define VAL_GPIOK_ODR (PIN_ODR_HIGH(0U) | \
  1683. PIN_ODR_HIGH(1U) | \
  1684. PIN_ODR_HIGH(2U) | \
  1685. PIN_ODR_HIGH(3U) | \
  1686. PIN_ODR_HIGH(4U) | \
  1687. PIN_ODR_HIGH(5U) | \
  1688. PIN_ODR_HIGH(6U) | \
  1689. PIN_ODR_HIGH(7U) | \
  1690. PIN_ODR_HIGH(8U) | \
  1691. PIN_ODR_HIGH(9U) | \
  1692. PIN_ODR_HIGH(10U) | \
  1693. PIN_ODR_HIGH(11U) | \
  1694. PIN_ODR_HIGH(12U) | \
  1695. PIN_ODR_HIGH(13U) | \
  1696. PIN_ODR_HIGH(14U) | \
  1697. PIN_ODR_HIGH(15U))
  1698. #define VAL_GPIOK_AFRL (PIN_AFIO_AF(0U, 0U) | \
  1699. PIN_AFIO_AF(1U, 0U) | \
  1700. PIN_AFIO_AF(2U, 0U) | \
  1701. PIN_AFIO_AF(3U, 0U) | \
  1702. PIN_AFIO_AF(4U, 0U) | \
  1703. PIN_AFIO_AF(5U, 0U) | \
  1704. PIN_AFIO_AF(6U, 0U) | \
  1705. PIN_AFIO_AF(7U, 0U))
  1706. #define VAL_GPIOK_AFRH (PIN_AFIO_AF(8U, 0U) | \
  1707. PIN_AFIO_AF(9U, 0U) | \
  1708. PIN_AFIO_AF(10U, 0U) | \
  1709. PIN_AFIO_AF(11U, 0U) | \
  1710. PIN_AFIO_AF(12U, 0U) | \
  1711. PIN_AFIO_AF(13U, 0U) | \
  1712. PIN_AFIO_AF(14U, 0U) | \
  1713. PIN_AFIO_AF(15U, 0U))