fork download
  1. /**
  2.  ******************************************************************************
  3.  * File Name : main.c
  4.  * Description : Main program body
  5.  ******************************************************************************
  6.  *
  7.  * COPYRIGHT(c) 2016 STMicroelectronics
  8.  *
  9.  * Redistribution and use in source and binary forms, with or without modification,
  10.  * are permitted provided that the following conditions are met:
  11.  * 1. Redistributions of source code must retain the above copyright notice,
  12.  * this list of conditions and the following disclaimer.
  13.  * 2. Redistributions in binary form must reproduce the above copyright notice,
  14.  * this list of conditions and the following disclaimer in the documentation
  15.  * and/or other materials provided with the distribution.
  16.  * 3. Neither the name of STMicroelectronics nor the names of its contributors
  17.  * may be used to endorse or promote products derived from this software
  18.  * without specific prior written permission.
  19.  *
  20.  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
  21.  * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
  22.  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
  23.  * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
  24.  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
  25.  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
  26.  * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
  27.  * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
  28.  * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
  29.  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  30.  *
  31.  ******************************************************************************
  32.  */
  33. /* Includes ------------------------------------------------------------------*/
  34. #include "stm32f7xx_hal.h"
  35. #include "math.h"
  36. //#include "stdint.h"
  37. #define GPIO_Pin_All ((uint16_t)0xFFFF) /* All pins selected */
  38. //#define GPIO_Pin_All ((u16)0xFFFF) /* All pins selected */
  39. /* USER CODE BEGIN Includes */
  40.  
  41. /* USER CODE END Includes */
  42.  
  43. /* Private variables ---------------------------------------------------------*/
  44.  
  45. /* USER CODE BEGIN PV */
  46. /* Private variables ---------------------------------------------------------*/
  47.  
  48. /* USER CODE END PV */
  49.  
  50. /* Private function prototypes -----------------------------------------------*/
  51. void SystemClock_Config(void);
  52. void Error_Handler(void);
  53. static void MX_GPIO_Init(void);
  54.  
  55. /* USER CODE BEGIN PFP */
  56. /* Private function prototypes -----------------------------------------------*/
  57.  
  58. /* USER CODE END PFP */
  59.  
  60. /* USER CODE BEGIN 0 */
  61.  
  62. /* USER CODE END 0 */
  63. uint8_t plasma[64][32];
  64. uint32_t information[128];
  65. const uint8_t off[3] = { 0, 0, 0 };
  66.  
  67. void Delay(__IO uint32_t nCount) {
  68. while(nCount--) {
  69. }
  70. }
  71.  
  72. // PWM timer declarations
  73. #define PWM_TIMER TIM3
  74. #define PWM_TIMER_CHANNEL TIM_CHANNEL_1
  75. #define PWM_TIMER_DMAID TIM_DMA_ID_CC1
  76.  
  77. // Timer period
  78. #define TIM_PERIOD 29
  79. // PWM width for a high bit
  80. #define TIM_COMPARE_HIGH 18
  81. // PWM width for a low bit
  82. #define TIM_COMPARE_LOW 9
  83.  
  84. TIM_HandleTypeDef timHandle;
  85. DMA_HandleTypeDef dmaHandle;
  86.  
  87. /* Buffer that holds one complete DMA transmission
  88.  *
  89.  * Ensure that this buffer is big enough to hold
  90.  * all data bytes that need to be sent
  91.  *
  92.  * The buffer size can be calculated as follows:
  93.  * number of LEDs * 24 bytes + 42 bytes
  94.  *
  95.  * This leaves us with a maximum string length of
  96.  * (2^16 bytes per DMA stream - 42 bytes)/24 bytes per LED = 2728 LEDs
  97.  */
  98.  
  99. // FIXME: This does more than initialise TIMER 3
  100. void neopixel_Init(void) {
  101. /* GPIOB Configuration: PWM as alternate function push-pull */
  102. // "D5" output on Nucleo, PB4, TIM3 channel 1
  103. __GPIOB_CLK_ENABLE();
  104. GPIO_InitTypeDef gpioInit;
  105. gpioInit.Pin = GPIO_Pin_All;
  106. gpioInit.Mode = GPIO_MODE_AF_PP;
  107. gpioInit.Speed = GPIO_SPEED_HIGH;
  108. gpioInit.Alternate = GPIO_AF2_TIM3;
  109. gpioInit.Pull = GPIO_NOPULL;
  110. HAL_GPIO_Init(GPIOB, &gpioInit);
  111.  
  112. // Set up the timer
  113. __TIM3_CLK_ENABLE();
  114. timHandle.Instance = PWM_TIMER;
  115. timHandle.Init.ClockDivision = 0;
  116. timHandle.Init.Prescaler = (((HAL_RCC_GetPCLK1Freq() * 2) / TIM_PERIOD)
  117. / 800000) - 1; // 800kHz tick
  118. timHandle.Init.Period = TIM_PERIOD;
  119. timHandle.Init.CounterMode = TIM_COUNTERMODE_UP;
  120.  
  121. /* PWM1 Mode configuration: Channel 1 */
  122. TIM_OC_InitTypeDef sConfig;
  123. sConfig.OCMode = TIM_OCMODE_PWM1;
  124. sConfig.OCPolarity = TIM_OCPOLARITY_HIGH;
  125. sConfig.OCNPolarity = TIM_OCNPOLARITY_HIGH;
  126. sConfig.OCIdleState = TIM_OCIDLESTATE_RESET;
  127. sConfig.OCNIdleState = TIM_OCNIDLESTATE_RESET;
  128. sConfig.OCFastMode = TIM_OCFAST_ENABLE;
  129. sConfig.Pulse = 0;
  130.  
  131. sConfig.Pulse = TIM_PERIOD / 2;
  132. HAL_TIM_PWM_Start(&timHandle, PWM_TIMER_CHANNEL);
  133. __HAL_TIM_ENABLE(&timHandle);
  134. for (;;)
  135. ;
  136.  
  137. __DMA1_CLK_ENABLE();
  138. dmaHandle.Instance = DMA1_Stream4;
  139. dmaHandle.Init.Channel = DMA_CHANNEL_5;
  140. dmaHandle.Init.Direction = DMA_MEMORY_TO_PERIPH;
  141. dmaHandle.Init.FIFOMode = DMA_FIFOMODE_DISABLE;
  142. dmaHandle.Init.FIFOThreshold = DMA_FIFO_THRESHOLD_HALFFULL;
  143.  
  144. dmaHandle.Init.MemDataAlignment = DMA_MDATAALIGN_HALFWORD;
  145. dmaHandle.Init.MemInc = DMA_MINC_ENABLE;
  146. dmaHandle.Init.MemBurst = DMA_MBURST_SINGLE;
  147.  
  148. dmaHandle.Init.Mode = DMA_NORMAL;
  149.  
  150. dmaHandle.Init.PeriphDataAlignment = DMA_PDATAALIGN_HALFWORD;
  151. dmaHandle.Init.PeriphInc = DMA_PINC_DISABLE;
  152. dmaHandle.Init.PeriphBurst = DMA_PBURST_SINGLE;
  153.  
  154. dmaHandle.Init.Priority = DMA_PRIORITY_HIGH;
  155. __HAL_LINKDMA(&timHandle, hdma[PWM_TIMER_DMAID], dmaHandle);
  156.  
  157. }
  158.  
  159. /* This function sends data bytes out to a string of WS2812s
  160.  * The first argument is a pointer to the first RGB triplet to be sent
  161.  * The seconds argument is the number of LEDs in the chain
  162.  *
  163.  * This will result in the RGB triplet passed by argument 1 being sent to
  164.  * the LED that is the furthest away from the controller (the point where
  165.  * data is injected into the chain)
  166.  */
  167. void neopixel_Send(void) {
  168. int i, j;
  169. uint8_t led;
  170. uint16_t memaddr;
  171. size_t buffersize;
  172.  
  173. // Byte order mapping. 0 is red, 1 is green, 2 is blue
  174. const uint8_t pix_map[3] = { 0, 2, 1 };
  175.  
  176. // PAP: Clear the timer's counter and set the compare value to 0. This
  177. // sets the output low on start and gives us a full cycle to set up DMA.
  178. __HAL_TIM_SET_COUNTER(&timHandle, 0);
  179. __HAL_TIM_SET_COMPARE(&timHandle, PWM_TIMER_CHANNEL, 0);
  180.  
  181. // Start the timer and DMA transfer
  182. HAL_DMA_Init(&dmaHandle);
  183. HAL_TIM_PWM_Start_DMA(&timHandle, PWM_TIMER_CHANNEL, information,
  184. sizeof(uint32_t) * 128);
  185. //trace_printf("DMA kick... ");
  186. HAL_DMA_PollForTransfer(&dmaHandle, HAL_DMA_FULL_TRANSFER, HAL_MAX_DELAY);
  187. //trace_printf("done\n");
  188. }
  189.  
  190. int main(void) {
  191. uint8_t n = 0;
  192. uint8_t theInt;
  193. uint8_t varOne;
  194. uint8_t varTwo;
  195. uint8_t varThree;
  196. uint8_t varFour;
  197. neopixel_Init();
  198.  
  199. //generate the plasma once
  200. for (int y = 0; y < 64; y++) {
  201. for (int x = 0; x < 32; x++) {
  202. //the plasma buffer is a sum of sines
  203. uint8_t color = (int) (128.0 + (128.0 * sin(x / 16.0)) + 128.0
  204. + (128.0 * sin(y / 16.0))) / 80;
  205. plasma[y][x] = color;
  206. }
  207.  
  208. }
  209.  
  210. /* USER CODE BEGIN 1 */
  211.  
  212. /* USER CODE END 1 */
  213.  
  214. /* MCU Configuration----------------------------------------------------------*/
  215.  
  216. /* Reset of all peripherals, Initializes the Flash interface and the Systick. */
  217. HAL_Init();
  218.  
  219. /* Configure the system clock */
  220. SystemClock_Config();
  221.  
  222. /* Initialize all configured peripherals */
  223. MX_GPIO_Init();
  224.  
  225. /* USER CODE BEGIN 2 */
  226.  
  227. /* USER CODE END 2 */
  228.  
  229. /* Infinite loop */
  230. /* USER CODE BEGIN WHILE */
  231. int count = 0;
  232.  
  233. //OUTPUT ENABLE
  234. HAL_GPIO_WritePin(GPIOC, GPIO_PIN_7, GPIO_PIN_RESET);
  235.  
  236. while (1) {
  237.  
  238. count = (count + 1) % 65;
  239.  
  240. uint32_t redOne = (1 << 0) & plasma[count][n];
  241. uint32_t redTwo = (1 << 0) & plasma[count][n + 16];
  242. uint32_t greenOne = (1 << 10) & plasma[count][n];
  243. uint32_t greenTwo = (1 << 9) & plasma[count][n + 16];
  244. uint32_t blueOne = (1 << 8) & plasma[count][n];
  245. uint32_t blueTwo = (1 << 7) & plasma[count][n + 16];
  246. uint32_t CLOCK = (1 << 6);
  247.  
  248. information[count + 2] = redOne | redTwo | greenOne | greenTwo | blueOne
  249. | blueTwo | CLOCK;
  250. information[count + 1] = 0;
  251.  
  252. if (count == 64) {
  253.  
  254. //DMA SEND STUFF
  255.  
  256. neopixel_Send();
  257.  
  258. varOne = (1 << 0) & n;
  259. varTwo = (1 << 1) & n;
  260. varThree = (1 << 2) & n;
  261. varFour = (1 << 3) & n;
  262. n = (n + 1) % 16;
  263.  
  264. //ROWS
  265.  
  266. HAL_GPIO_WritePin(GPIOG, GPIO_PIN_6, varOne);
  267. HAL_GPIO_WritePin(GPIOB, GPIO_PIN_4, varTwo);
  268. HAL_GPIO_WritePin(GPIOF, GPIO_PIN_7, varThree);
  269. HAL_GPIO_WritePin(GPIOB, GPIO_PIN_15, varFour);
  270.  
  271. //LATCH
  272. HAL_GPIO_WritePin(GPIOA, GPIO_PIN_15, GPIO_PIN_SET);
  273. HAL_GPIO_WritePin(GPIOA, GPIO_PIN_15, GPIO_PIN_RESET);
  274.  
  275. }
  276.  
  277. }
  278.  
  279. }
  280.  
  281. /** System Clock Configuration
  282.  */
  283. void SystemClock_Config(void) {
  284.  
  285. RCC_OscInitTypeDef RCC_OscInitStruct;
  286. RCC_ClkInitTypeDef RCC_ClkInitStruct;
  287.  
  288. __HAL_RCC_PWR_CLK_ENABLE();
  289.  
  290. __HAL_PWR_VOLTAGESCALING_CONFIG(PWR_REGULATOR_VOLTAGE_SCALE2);
  291.  
  292. RCC_OscInitStruct.OscillatorType = RCC_OSCILLATORTYPE_HSI;
  293. RCC_OscInitStruct.HSIState = RCC_HSI_ON;
  294. RCC_OscInitStruct.HSICalibrationValue = 16;
  295. RCC_OscInitStruct.PLL.PLLState = RCC_PLL_ON;
  296. RCC_OscInitStruct.PLL.PLLSource = RCC_PLLSOURCE_HSI;
  297. RCC_OscInitStruct.PLL.PLLM = 10;
  298. RCC_OscInitStruct.PLL.PLLN = 210;
  299. RCC_OscInitStruct.PLL.PLLP = RCC_PLLP_DIV2;
  300. RCC_OscInitStruct.PLL.PLLQ = 2;
  301. if (HAL_RCC_OscConfig(&RCC_OscInitStruct) != HAL_OK) {
  302. Error_Handler();
  303. }
  304.  
  305. RCC_ClkInitStruct.ClockType = RCC_CLOCKTYPE_HCLK | RCC_CLOCKTYPE_SYSCLK
  306. | RCC_CLOCKTYPE_PCLK1 | RCC_CLOCKTYPE_PCLK2;
  307. RCC_ClkInitStruct.SYSCLKSource = RCC_SYSCLKSOURCE_PLLCLK;
  308. RCC_ClkInitStruct.AHBCLKDivider = RCC_SYSCLK_DIV1;
  309. RCC_ClkInitStruct.APB1CLKDivider = RCC_HCLK_DIV4;
  310. RCC_ClkInitStruct.APB2CLKDivider = RCC_HCLK_DIV2;
  311. if (HAL_RCC_ClockConfig(&RCC_ClkInitStruct, FLASH_LATENCY_5) != HAL_OK) {
  312. Error_Handler();
  313. }
  314.  
  315. HAL_SYSTICK_Config(HAL_RCC_GetHCLKFreq() / 1000);
  316.  
  317. HAL_SYSTICK_CLKSourceConfig(SYSTICK_CLKSOURCE_HCLK);
  318.  
  319. /* SysTick_IRQn interrupt configuration */
  320. HAL_NVIC_SetPriority(SysTick_IRQn, 0, 0);
  321. }
  322.  
  323. /** Configure pins
  324.  PE4 ------> LTDC_B0
  325.  PE2 ------> QUADSPI_BK1_IO2
  326.  PG14 ------> ETH_TXD1
  327.  PE1 ------> FMC_NBL1
  328.  PE0 ------> FMC_NBL0
  329.  PB5 ------> USB_OTG_HS_ULPI_D7
  330.  PD7 ------> SPDIFRX_IN0
  331.  PC12 ------> SDMMC1_CK
  332.  PE5 ------> DCMI_D6
  333.  PE6 ------> DCMI_D7
  334.  PG13 ------> ETH_TXD0
  335.  PB7 ------> USART1_RX
  336.  PB6 ------> QUADSPI_BK1_NCS
  337.  PG15 ------> FMC_SDNCAS
  338.  PG11 ------> ETH_TX_EN
  339.  PJ13 ------> LTDC_B1
  340.  PD0 ------> FMC_D2_DA2
  341.  PC11 ------> SDMMC1_D3
  342.  PC10 ------> SDMMC1_D2
  343.  PA12 ------> USB_OTG_FS_DP
  344.  PI4 ------> SAI2_MCLK_A
  345.  PK7 ------> LTDC_DE
  346.  PK6 ------> LTDC_B7
  347.  PK5 ------> LTDC_B6
  348.  PG12 ------> LTDC_B4
  349.  PG10 ------> SAI2_SD_B
  350.  PJ14 ------> LTDC_B2
  351.  PD3 ------> DCMI_D5
  352.  PD1 ------> FMC_D3_DA3
  353.  PA11 ------> USB_OTG_FS_DM
  354.  PF0 ------> FMC_A0
  355.  PI5 ------> SAI2_SCK_A
  356.  PI7 ------> SAI2_FS_A
  357.  PI10 ------> LTDC_HSYNC
  358.  PI6 ------> SAI2_SD_A
  359.  PK4 ------> LTDC_B5
  360.  PG9 ------> DCMI_VSYNC
  361.  PJ15 ------> LTDC_B3
  362.  PD2 ------> SDMMC1_CMD
  363.  PA10 ------> USB_OTG_FS_ID
  364.  PF1 ------> FMC_A1
  365.  PI9 ------> LTDC_VSYNC
  366.  PH14 ------> DCMI_D4
  367.  PA9 ------> USART1_TX
  368.  PK1 ------> LTDC_G6
  369.  PK2 ------> LTDC_G7
  370.  PC9 ------> SDMMC1_D1
  371.  PF2 ------> FMC_A2
  372.  PI15 ------> LTDC_R0
  373.  PJ11 ------> LTDC_G4
  374.  PK0 ------> LTDC_G5
  375.  PC8 ------> SDMMC1_D0
  376.  PF3 ------> FMC_A3
  377.  PI14 ------> LTDC_CLK
  378.  PH4 ------> USB_OTG_HS_ULPI_NXT
  379.  PJ8 ------> LTDC_G1
  380.  PJ10 ------> LTDC_G3
  381.  PG8 ------> FMC_SDCLK
  382.  PF4 ------> FMC_A4
  383.  PH5 ------> FMC_SDNWE
  384.  PH3 ------> FMC_SDNE0
  385.  PJ7 ------> LTDC_G0
  386.  PJ9 ------> LTDC_G2
  387.  PF5 ------> FMC_A5
  388.  PJ6 ------> LTDC_R7
  389.  PD15 ------> FMC_D1_DA1
  390.  PB13 ------> USB_OTG_HS_ULPI_D6
  391.  PD10 ------> FMC_D15_DA15
  392.  PC3 ------> FMC_SDCKE0
  393.  PD14 ------> FMC_D0_DA0
  394.  PB12 ------> USB_OTG_HS_ULPI_D5
  395.  PD9 ------> FMC_D14_DA14
  396.  PD8 ------> FMC_D13_DA13
  397.  PC0 ------> USB_OTG_HS_ULPI_STP
  398.  PC1 ------> ETH_MDC
  399.  PC2 ------> USB_OTG_HS_ULPI_DIR
  400.  PB2 ------> QUADSPI_CLK
  401.  PF12 ------> FMC_A6
  402.  PG1 ------> FMC_A11
  403.  PF15 ------> FMC_A9
  404.  PJ4 ------> LTDC_R5
  405.  PD12 ------> QUADSPI_BK1_IO1
  406.  PD13 ------> QUADSPI_BK1_IO3
  407.  PJ5 ------> LTDC_R6
  408.  PH12 ------> DCMI_D3
  409.  PA1 ------> ETH_REF_CLK
  410.  PA4 ------> DCMI_HSYNC
  411.  PC4 ------> ETH_RXD0
  412.  PF13 ------> FMC_A7
  413.  PG0 ------> FMC_A10
  414.  PJ3 ------> LTDC_R4
  415.  PE8 ------> FMC_D5_DA5
  416.  PD11 ------> QUADSPI_BK1_IO0
  417.  PG5 ------> FMC_A15_BA1
  418.  PG4 ------> FMC_A14_BA0
  419.  PH7 ------> I2C3_SCL
  420.  PH9 ------> DCMI_D0
  421.  PH11 ------> DCMI_D2
  422.  PA2 ------> ETH_MDIO
  423.  PA6 ------> DCMI_PIXCLK
  424.  PA5 ------> USB_OTG_HS_ULPI_CK
  425.  PC5 ------> ETH_RXD1
  426.  PF14 ------> FMC_A8
  427.  PJ2 ------> LTDC_R3
  428.  PF11 ------> FMC_SDNRAS
  429.  PE9 ------> FMC_D6_DA6
  430.  PE11 ------> FMC_D8_DA8
  431.  PE14 ------> FMC_D11_DA11
  432.  PB10 ------> USB_OTG_HS_ULPI_D3
  433.  PH8 ------> I2C3_SDA
  434.  PH10 ------> DCMI_D1
  435.  PA3 ------> USB_OTG_HS_ULPI_D0
  436.  PA7 ------> ETH_CRS_DV
  437.  PB1 ------> USB_OTG_HS_ULPI_D2
  438.  PB0 ------> USB_OTG_HS_ULPI_D1
  439.  PJ0 ------> LTDC_R1
  440.  PJ1 ------> LTDC_R2
  441.  PE7 ------> FMC_D4_DA4
  442.  PE10 ------> FMC_D7_DA7
  443.  PE12 ------> FMC_D9_DA9
  444.  PE15 ------> FMC_D12_DA12
  445.  PE13 ------> FMC_D10_DA10
  446.  PB11 ------> USB_OTG_HS_ULPI_D4
  447.  */
  448. static void MX_GPIO_Init(void) {
  449.  
  450. GPIO_InitTypeDef GPIO_InitStruct;
  451.  
  452. /* GPIO Ports Clock Enable */
  453. __HAL_RCC_GPIOE_CLK_ENABLE();
  454. __HAL_RCC_GPIOG_CLK_ENABLE();
  455. __HAL_RCC_GPIOB_CLK_ENABLE();
  456. __HAL_RCC_GPIOD_CLK_ENABLE();
  457. __HAL_RCC_GPIOC_CLK_ENABLE();
  458. __HAL_RCC_GPIOA_CLK_ENABLE();
  459. __HAL_RCC_GPIOJ_CLK_ENABLE();
  460. __HAL_RCC_GPIOI_CLK_ENABLE();
  461. __HAL_RCC_GPIOK_CLK_ENABLE();
  462. __HAL_RCC_GPIOF_CLK_ENABLE();
  463. __HAL_RCC_GPIOH_CLK_ENABLE();
  464.  
  465. /*Configure GPIO pin : LCD_B0_Pin */
  466. GPIO_InitStruct.Pin = LCD_B0_Pin;
  467. GPIO_InitStruct.Mode = GPIO_MODE_AF_PP;
  468. GPIO_InitStruct.Pull = GPIO_NOPULL;
  469. GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_LOW;
  470. GPIO_InitStruct.Alternate = GPIO_AF14_LTDC;
  471. HAL_GPIO_Init(LCD_B0_GPIO_Port, &GPIO_InitStruct);
  472.  
  473. /*Configure GPIO pin : OTG_HS_OverCurrent_Pin */
  474. GPIO_InitStruct.Pin = OTG_HS_OverCurrent_Pin;
  475. GPIO_InitStruct.Mode = GPIO_MODE_INPUT;
  476. GPIO_InitStruct.Pull = GPIO_NOPULL;
  477. HAL_GPIO_Init(OTG_HS_OverCurrent_GPIO_Port, &GPIO_InitStruct);
  478.  
  479. /*Configure GPIO pin : QSPI_D2_Pin */
  480. GPIO_InitStruct.Pin = QSPI_D2_Pin;
  481. GPIO_InitStruct.Mode = GPIO_MODE_AF_PP;
  482. GPIO_InitStruct.Pull = GPIO_NOPULL;
  483. GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_VERY_HIGH;
  484. GPIO_InitStruct.Alternate = GPIO_AF9_QUADSPI;
  485. HAL_GPIO_Init(QSPI_D2_GPIO_Port, &GPIO_InitStruct);
  486.  
  487. /*Configure GPIO pins : RMII_TXD1_Pin RMII_TXD0_Pin RMII_TX_EN_Pin */
  488. GPIO_InitStruct.Pin = RMII_TXD1_Pin | RMII_TXD0_Pin | RMII_TX_EN_Pin;
  489. GPIO_InitStruct.Mode = GPIO_MODE_AF_PP;
  490. GPIO_InitStruct.Pull = GPIO_NOPULL;
  491. GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_VERY_HIGH;
  492. GPIO_InitStruct.Alternate = GPIO_AF11_ETH;
  493. HAL_GPIO_Init(GPIOG, &GPIO_InitStruct);
  494.  
  495. /*Configure GPIO pins : PE1 PE0 FMC_D5_Pin FMC_D6_Pin
  496. FMC_D8_Pin FMC_D11_Pin FMC_D4_Pin FMC_D7_Pin
  497. FMC_D9_Pin FMC_D12_Pin FMC_D10_Pin */
  498. GPIO_InitStruct.Pin = GPIO_PIN_1 | GPIO_PIN_0 | FMC_D5_Pin | FMC_D6_Pin
  499. | FMC_D8_Pin | FMC_D11_Pin | FMC_D4_Pin | FMC_D7_Pin | FMC_D9_Pin
  500. | FMC_D12_Pin | FMC_D10_Pin;
  501. GPIO_InitStruct.Mode = GPIO_MODE_AF_PP;
  502. GPIO_InitStruct.Pull = GPIO_NOPULL;
  503. GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_VERY_HIGH;
  504. GPIO_InitStruct.Alternate = GPIO_AF12_FMC;
  505. HAL_GPIO_Init(GPIOE, &GPIO_InitStruct);
  506.  
  507. /*Configure GPIO pins : PB8 PB4 PB9 PB14
  508. PB15 */
  509. GPIO_InitStruct.Pin = GPIO_PIN_8 | GPIO_PIN_4 | GPIO_PIN_9 | GPIO_PIN_14
  510. | GPIO_PIN_15;
  511. GPIO_InitStruct.Mode = GPIO_MODE_OUTPUT_PP;
  512. GPIO_InitStruct.Pull = GPIO_PULLDOWN;
  513. GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_VERY_HIGH;
  514. HAL_GPIO_Init(GPIOB, &GPIO_InitStruct);
  515.  
  516. /*Configure GPIO pins : ULPI_D7_Pin ULPI_D6_Pin ULPI_D5_Pin ULPI_D3_Pin
  517. ULPI_D2_Pin ULPI_D1_Pin ULPI_D4_Pin */
  518. GPIO_InitStruct.Pin = ULPI_D7_Pin | ULPI_D6_Pin | ULPI_D5_Pin | ULPI_D3_Pin
  519. | ULPI_D2_Pin | ULPI_D1_Pin | ULPI_D4_Pin;
  520. GPIO_InitStruct.Mode = GPIO_MODE_AF_PP;
  521. GPIO_InitStruct.Pull = GPIO_NOPULL;
  522. GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_VERY_HIGH;
  523. GPIO_InitStruct.Alternate = GPIO_AF10_OTG_HS;
  524. HAL_GPIO_Init(GPIOB, &GPIO_InitStruct);
  525.  
  526. /*Configure GPIO pin : SPDIF_RX0_Pin */
  527. GPIO_InitStruct.Pin = SPDIF_RX0_Pin;
  528. GPIO_InitStruct.Mode = GPIO_MODE_AF_PP;
  529. GPIO_InitStruct.Pull = GPIO_NOPULL;
  530. GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_LOW;
  531. GPIO_InitStruct.Alternate = GPIO_AF8_SPDIFRX;
  532. HAL_GPIO_Init(SPDIF_RX0_GPIO_Port, &GPIO_InitStruct);
  533.  
  534. /*Configure GPIO pins : SDMMC_CK_Pin SDMMC_D3_Pin SDMMC_D2_Pin PC9
  535. PC8 */
  536. GPIO_InitStruct.Pin = SDMMC_CK_Pin | SDMMC_D3_Pin | SDMMC_D2_Pin
  537. | GPIO_PIN_9 | GPIO_PIN_8;
  538. GPIO_InitStruct.Mode = GPIO_MODE_AF_PP;
  539. GPIO_InitStruct.Pull = GPIO_NOPULL;
  540. GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_VERY_HIGH;
  541. GPIO_InitStruct.Alternate = GPIO_AF12_SDMMC1;
  542. HAL_GPIO_Init(GPIOC, &GPIO_InitStruct);
  543.  
  544. /*Configure GPIO pins : PA15 PA8 */
  545. GPIO_InitStruct.Pin = GPIO_PIN_15 | GPIO_PIN_8;
  546. GPIO_InitStruct.Mode = GPIO_MODE_OUTPUT_PP;
  547. GPIO_InitStruct.Pull = GPIO_PULLDOWN;
  548. GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_VERY_HIGH;
  549. HAL_GPIO_Init(GPIOA, &GPIO_InitStruct);
  550.  
  551. /*Configure GPIO pins : PE5 PE6 */
  552. GPIO_InitStruct.Pin = GPIO_PIN_5 | GPIO_PIN_6;
  553. GPIO_InitStruct.Mode = GPIO_MODE_AF_PP;
  554. GPIO_InitStruct.Pull = GPIO_NOPULL;
  555. GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_LOW;
  556. GPIO_InitStruct.Alternate = GPIO_AF13_DCMI;
  557. HAL_GPIO_Init(GPIOE, &GPIO_InitStruct);
  558.  
  559. /*Configure GPIO pin : VCP_RX_Pin */
  560. GPIO_InitStruct.Pin = VCP_RX_Pin;
  561. GPIO_InitStruct.Mode = GPIO_MODE_AF_PP;
  562. GPIO_InitStruct.Pull = GPIO_NOPULL;
  563. GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_LOW;
  564. GPIO_InitStruct.Alternate = GPIO_AF7_USART1;
  565. HAL_GPIO_Init(VCP_RX_GPIO_Port, &GPIO_InitStruct);
  566.  
  567. /*Configure GPIO pin : QSPI_NCS_Pin */
  568. GPIO_InitStruct.Pin = QSPI_NCS_Pin;
  569. GPIO_InitStruct.Mode = GPIO_MODE_AF_PP;
  570. GPIO_InitStruct.Pull = GPIO_NOPULL;
  571. GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_VERY_HIGH;
  572. GPIO_InitStruct.Alternate = GPIO_AF10_QUADSPI;
  573. HAL_GPIO_Init(QSPI_NCS_GPIO_Port, &GPIO_InitStruct);
  574.  
  575. /*Configure GPIO pins : PG15 PG8 PG1 PG0
  576. FMC_BA1_Pin FMC_BA0_Pin */
  577. GPIO_InitStruct.Pin = GPIO_PIN_15 | GPIO_PIN_8 | GPIO_PIN_1 | GPIO_PIN_0
  578. | FMC_BA1_Pin | FMC_BA0_Pin;
  579. GPIO_InitStruct.Mode = GPIO_MODE_AF_PP;
  580. GPIO_InitStruct.Pull = GPIO_NOPULL;
  581. GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_VERY_HIGH;
  582. GPIO_InitStruct.Alternate = GPIO_AF12_FMC;
  583. HAL_GPIO_Init(GPIOG, &GPIO_InitStruct);
  584.  
  585. /*Configure GPIO pins : LCD_B1_Pin LCD_B2_Pin LCD_B3_Pin LCD_G4_Pin
  586. LCD_G1_Pin LCD_G3_Pin LCD_G0_Pin LCD_G2_Pin
  587. LCD_R7_Pin LCD_R5_Pin LCD_R6_Pin LCD_R4_Pin
  588. LCD_R3_Pin LCD_R1_Pin LCD_R2_Pin */
  589. GPIO_InitStruct.Pin = LCD_B1_Pin | LCD_B2_Pin | LCD_B3_Pin | LCD_G4_Pin
  590. | LCD_G1_Pin | LCD_G3_Pin | LCD_G0_Pin | LCD_G2_Pin | LCD_R7_Pin
  591. | LCD_R5_Pin | LCD_R6_Pin | LCD_R4_Pin | LCD_R3_Pin | LCD_R1_Pin
  592. | LCD_R2_Pin;
  593. GPIO_InitStruct.Mode = GPIO_MODE_AF_PP;
  594. GPIO_InitStruct.Pull = GPIO_NOPULL;
  595. GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_LOW;
  596. GPIO_InitStruct.Alternate = GPIO_AF14_LTDC;
  597. HAL_GPIO_Init(GPIOJ, &GPIO_InitStruct);
  598.  
  599. /*Configure GPIO pin : OTG_FS_VBUS_Pin */
  600. GPIO_InitStruct.Pin = OTG_FS_VBUS_Pin;
  601. GPIO_InitStruct.Mode = GPIO_MODE_INPUT;
  602. GPIO_InitStruct.Pull = GPIO_NOPULL;
  603. HAL_GPIO_Init(OTG_FS_VBUS_GPIO_Port, &GPIO_InitStruct);
  604.  
  605. /*Configure GPIO pin : Audio_INT_Pin */
  606. GPIO_InitStruct.Pin = Audio_INT_Pin;
  607. GPIO_InitStruct.Mode = GPIO_MODE_EVT_RISING;
  608. GPIO_InitStruct.Pull = GPIO_NOPULL;
  609. HAL_GPIO_Init(Audio_INT_GPIO_Port, &GPIO_InitStruct);
  610.  
  611. /*Configure GPIO pins : FMC_D2_Pin FMC_D3_Pin FMC_D1_Pin FMC_D15_Pin
  612. FMC_D0_Pin FMC_D14_Pin FMC_D13_Pin */
  613. GPIO_InitStruct.Pin = FMC_D2_Pin | FMC_D3_Pin | FMC_D1_Pin | FMC_D15_Pin
  614. | FMC_D0_Pin | FMC_D14_Pin | FMC_D13_Pin;
  615. GPIO_InitStruct.Mode = GPIO_MODE_AF_PP;
  616. GPIO_InitStruct.Pull = GPIO_NOPULL;
  617. GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_VERY_HIGH;
  618. GPIO_InitStruct.Alternate = GPIO_AF12_FMC;
  619. HAL_GPIO_Init(GPIOD, &GPIO_InitStruct);
  620.  
  621. /*Configure GPIO pins : OTG_FS_P_Pin OTG_FS_N_Pin OTG_FS_ID_Pin */
  622. GPIO_InitStruct.Pin = OTG_FS_P_Pin | OTG_FS_N_Pin | OTG_FS_ID_Pin;
  623. GPIO_InitStruct.Mode = GPIO_MODE_AF_PP;
  624. GPIO_InitStruct.Pull = GPIO_NOPULL;
  625. GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_VERY_HIGH;
  626. GPIO_InitStruct.Alternate = GPIO_AF10_OTG_FS;
  627. HAL_GPIO_Init(GPIOA, &GPIO_InitStruct);
  628.  
  629. /*Configure GPIO pins : SAI2_MCLKA_Pin SAI2_SCKA_Pin SAI2_FSA_Pin SAI2_SDA_Pin */
  630. GPIO_InitStruct.Pin = SAI2_MCLKA_Pin | SAI2_SCKA_Pin | SAI2_FSA_Pin
  631. | SAI2_SDA_Pin;
  632. GPIO_InitStruct.Mode = GPIO_MODE_AF_PP;
  633. GPIO_InitStruct.Pull = GPIO_NOPULL;
  634. GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_LOW;
  635. GPIO_InitStruct.Alternate = GPIO_AF10_SAI2;
  636. HAL_GPIO_Init(GPIOI, &GPIO_InitStruct);
  637.  
  638. /*Configure GPIO pins : LCD_DE_Pin LCD_B7_Pin LCD_B6_Pin LCD_B5_Pin
  639. LCD_G6_Pin LCD_G7_Pin LCD_G5_Pin */
  640. GPIO_InitStruct.Pin = LCD_DE_Pin | LCD_B7_Pin | LCD_B6_Pin | LCD_B5_Pin
  641. | LCD_G6_Pin | LCD_G7_Pin | LCD_G5_Pin;
  642. GPIO_InitStruct.Mode = GPIO_MODE_AF_PP;
  643. GPIO_InitStruct.Pull = GPIO_NOPULL;
  644. GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_LOW;
  645. GPIO_InitStruct.Alternate = GPIO_AF14_LTDC;
  646. HAL_GPIO_Init(GPIOK, &GPIO_InitStruct);
  647.  
  648. /*Configure GPIO pin : LCD_B4_Pin */
  649. GPIO_InitStruct.Pin = LCD_B4_Pin;
  650. GPIO_InitStruct.Mode = GPIO_MODE_AF_PP;
  651. GPIO_InitStruct.Pull = GPIO_NOPULL;
  652. GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_LOW;
  653. GPIO_InitStruct.Alternate = GPIO_AF9_LTDC;
  654. HAL_GPIO_Init(LCD_B4_GPIO_Port, &GPIO_InitStruct);
  655.  
  656. /*Configure GPIO pin : SAI2_SDB_Pin */
  657. GPIO_InitStruct.Pin = SAI2_SDB_Pin;
  658. GPIO_InitStruct.Mode = GPIO_MODE_AF_PP;
  659. GPIO_InitStruct.Pull = GPIO_NOPULL;
  660. GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_LOW;
  661. GPIO_InitStruct.Alternate = GPIO_AF10_SAI2;
  662. HAL_GPIO_Init(SAI2_SDB_GPIO_Port, &GPIO_InitStruct);
  663.  
  664. /*Configure GPIO pin : OTG_FS_PowerSwitchOn_Pin */
  665. GPIO_InitStruct.Pin = OTG_FS_PowerSwitchOn_Pin;
  666. GPIO_InitStruct.Mode = GPIO_MODE_OUTPUT_PP;
  667. GPIO_InitStruct.Pull = GPIO_NOPULL;
  668. GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_LOW;
  669. HAL_GPIO_Init(OTG_FS_PowerSwitchOn_GPIO_Port, &GPIO_InitStruct);
  670.  
  671. /*Configure GPIO pin : PD3 */
  672. GPIO_InitStruct.Pin = GPIO_PIN_3;
  673. GPIO_InitStruct.Mode = GPIO_MODE_AF_PP;
  674. GPIO_InitStruct.Pull = GPIO_NOPULL;
  675. GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_LOW;
  676. GPIO_InitStruct.Alternate = GPIO_AF13_DCMI;
  677. HAL_GPIO_Init(GPIOD, &GPIO_InitStruct);
  678.  
  679. /*Configure GPIO pins : ARDUINO_D7_Pin ARDUINO_D8_Pin PI1 PI0 */
  680. GPIO_InitStruct.Pin = ARDUINO_D7_Pin | ARDUINO_D8_Pin | GPIO_PIN_1
  681. | GPIO_PIN_0;
  682. GPIO_InitStruct.Mode = GPIO_MODE_OUTPUT_PP;
  683. GPIO_InitStruct.Pull = GPIO_PULLDOWN;
  684. GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_VERY_HIGH;
  685. HAL_GPIO_Init(GPIOI, &GPIO_InitStruct);
  686.  
  687. /*Configure GPIO pin : uSD_Detect_Pin */
  688. GPIO_InitStruct.Pin = uSD_Detect_Pin;
  689. GPIO_InitStruct.Mode = GPIO_MODE_INPUT;
  690. GPIO_InitStruct.Pull = GPIO_NOPULL;
  691. HAL_GPIO_Init(uSD_Detect_GPIO_Port, &GPIO_InitStruct);
  692.  
  693. /*Configure GPIO pins : PF0 PF1 PF2 PF3
  694. PF4 PF5 PF12 PF15
  695. PF13 PF14 PF11 */
  696. GPIO_InitStruct.Pin = GPIO_PIN_0 | GPIO_PIN_1 | GPIO_PIN_2 | GPIO_PIN_3
  697. | GPIO_PIN_4 | GPIO_PIN_5 | GPIO_PIN_12 | GPIO_PIN_15 | GPIO_PIN_13
  698. | GPIO_PIN_14 | GPIO_PIN_11;
  699. GPIO_InitStruct.Mode = GPIO_MODE_AF_PP;
  700. GPIO_InitStruct.Pull = GPIO_NOPULL;
  701. GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_VERY_HIGH;
  702. GPIO_InitStruct.Alternate = GPIO_AF12_FMC;
  703. HAL_GPIO_Init(GPIOF, &GPIO_InitStruct);
  704.  
  705. /*Configure GPIO pins : LCD_HSYNC_Pin LCD_VSYNC_Pin LCD_R0_Pin LCD_CLK_Pin */
  706. GPIO_InitStruct.Pin = LCD_HSYNC_Pin | LCD_VSYNC_Pin | LCD_R0_Pin
  707. | LCD_CLK_Pin;
  708. GPIO_InitStruct.Mode = GPIO_MODE_AF_PP;
  709. GPIO_InitStruct.Pull = GPIO_NOPULL;
  710. GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_LOW;
  711. GPIO_InitStruct.Alternate = GPIO_AF14_LTDC;
  712. HAL_GPIO_Init(GPIOI, &GPIO_InitStruct);
  713.  
  714. /*Configure GPIO pin : LCD_BL_CTRL_Pin */
  715. GPIO_InitStruct.Pin = LCD_BL_CTRL_Pin;
  716. GPIO_InitStruct.Mode = GPIO_MODE_OUTPUT_PP;
  717. GPIO_InitStruct.Pull = GPIO_NOPULL;
  718. GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_LOW;
  719. HAL_GPIO_Init(LCD_BL_CTRL_GPIO_Port, &GPIO_InitStruct);
  720.  
  721. /*Configure GPIO pin : PG9 */
  722. GPIO_InitStruct.Pin = GPIO_PIN_9;
  723. GPIO_InitStruct.Mode = GPIO_MODE_AF_PP;
  724. GPIO_InitStruct.Pull = GPIO_NOPULL;
  725. GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_LOW;
  726. GPIO_InitStruct.Alternate = GPIO_AF13_DCMI;
  727. HAL_GPIO_Init(GPIOG, &GPIO_InitStruct);
  728.  
  729. /*Configure GPIO pin : OTG_FS_OverCurrent_Pin */
  730. GPIO_InitStruct.Pin = OTG_FS_OverCurrent_Pin;
  731. GPIO_InitStruct.Mode = GPIO_MODE_INPUT;
  732. GPIO_InitStruct.Pull = GPIO_NOPULL;
  733. HAL_GPIO_Init(OTG_FS_OverCurrent_GPIO_Port, &GPIO_InitStruct);
  734.  
  735. /*Configure GPIO pin : SDMMC_D0_Pin */
  736. GPIO_InitStruct.Pin = SDMMC_D0_Pin;
  737. GPIO_InitStruct.Mode = GPIO_MODE_AF_PP;
  738. GPIO_InitStruct.Pull = GPIO_NOPULL;
  739. GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_VERY_HIGH;
  740. GPIO_InitStruct.Alternate = GPIO_AF12_SDMMC1;
  741. HAL_GPIO_Init(SDMMC_D0_GPIO_Port, &GPIO_InitStruct);
  742.  
  743. /*Configure GPIO pins : TP3_Pin NC2_Pin */
  744. GPIO_InitStruct.Pin = TP3_Pin | NC2_Pin;
  745. GPIO_InitStruct.Mode = GPIO_MODE_INPUT;
  746. GPIO_InitStruct.Pull = GPIO_NOPULL;
  747. HAL_GPIO_Init(GPIOH, &GPIO_InitStruct);
  748.  
  749. /*Configure GPIO pin : LCD_DISP_Pin */
  750. GPIO_InitStruct.Pin = LCD_DISP_Pin;
  751. GPIO_InitStruct.Mode = GPIO_MODE_OUTPUT_PP;
  752. GPIO_InitStruct.Pull = GPIO_NOPULL;
  753. GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_LOW;
  754. HAL_GPIO_Init(LCD_DISP_GPIO_Port, &GPIO_InitStruct);
  755.  
  756. /*Configure GPIO pin : DCMI_PWR_EN_Pin */
  757. GPIO_InitStruct.Pin = DCMI_PWR_EN_Pin;
  758. GPIO_InitStruct.Mode = GPIO_MODE_OUTPUT_PP;
  759. GPIO_InitStruct.Pull = GPIO_NOPULL;
  760. GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_LOW;
  761. HAL_GPIO_Init(DCMI_PWR_EN_GPIO_Port, &GPIO_InitStruct);
  762.  
  763. /*Configure GPIO pins : PH14 PH12 PH9 PH11
  764. PH10 */
  765. GPIO_InitStruct.Pin = GPIO_PIN_14 | GPIO_PIN_12 | GPIO_PIN_9 | GPIO_PIN_11
  766. | GPIO_PIN_10;
  767. GPIO_InitStruct.Mode = GPIO_MODE_AF_PP;
  768. GPIO_InitStruct.Pull = GPIO_NOPULL;
  769. GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_LOW;
  770. GPIO_InitStruct.Alternate = GPIO_AF13_DCMI;
  771. HAL_GPIO_Init(GPIOH, &GPIO_InitStruct);
  772.  
  773. /*Configure GPIO pin : VCP_TX_Pin */
  774. GPIO_InitStruct.Pin = VCP_TX_Pin;
  775. GPIO_InitStruct.Mode = GPIO_MODE_AF_PP;
  776. GPIO_InitStruct.Pull = GPIO_NOPULL;
  777. GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_LOW;
  778. GPIO_InitStruct.Alternate = GPIO_AF7_USART1;
  779. HAL_GPIO_Init(VCP_TX_GPIO_Port, &GPIO_InitStruct);
  780.  
  781. /*Configure GPIO pin : LCD_INT_Pin */
  782. GPIO_InitStruct.Pin = LCD_INT_Pin;
  783. GPIO_InitStruct.Mode = GPIO_MODE_EVT_RISING;
  784. GPIO_InitStruct.Pull = GPIO_NOPULL;
  785. HAL_GPIO_Init(LCD_INT_GPIO_Port, &GPIO_InitStruct);
  786.  
  787. /*Configure GPIO pins : PC7 PC6 */
  788. GPIO_InitStruct.Pin = GPIO_PIN_7 | GPIO_PIN_6;
  789. GPIO_InitStruct.Mode = GPIO_MODE_OUTPUT_PP;
  790. GPIO_InitStruct.Pull = GPIO_PULLDOWN;
  791. GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_VERY_HIGH;
  792. HAL_GPIO_Init(GPIOC, &GPIO_InitStruct);
  793.  
  794. /*Configure GPIO pin : ULPI_NXT_Pin */
  795. GPIO_InitStruct.Pin = ULPI_NXT_Pin;
  796. GPIO_InitStruct.Mode = GPIO_MODE_AF_PP;
  797. GPIO_InitStruct.Pull = GPIO_NOPULL;
  798. GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_VERY_HIGH;
  799. GPIO_InitStruct.Alternate = GPIO_AF10_OTG_HS;
  800. HAL_GPIO_Init(ULPI_NXT_GPIO_Port, &GPIO_InitStruct);
  801.  
  802. /*Configure GPIO pins : FMC_SDNME_Pin PH3 */
  803. GPIO_InitStruct.Pin = FMC_SDNME_Pin | GPIO_PIN_3;
  804. GPIO_InitStruct.Mode = GPIO_MODE_AF_PP;
  805. GPIO_InitStruct.Pull = GPIO_NOPULL;
  806. GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_VERY_HIGH;
  807. GPIO_InitStruct.Alternate = GPIO_AF12_FMC;
  808. HAL_GPIO_Init(GPIOH, &GPIO_InitStruct);
  809.  
  810. /*Configure GPIO pins : ARDUINO_D4_Pin ARDUINO_D2_Pin */
  811. GPIO_InitStruct.Pin = ARDUINO_D4_Pin | ARDUINO_D2_Pin;
  812. GPIO_InitStruct.Mode = GPIO_MODE_OUTPUT_PP;
  813. GPIO_InitStruct.Pull = GPIO_PULLDOWN;
  814. GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_VERY_HIGH;
  815. HAL_GPIO_Init(GPIOG, &GPIO_InitStruct);
  816.  
  817. /*Configure GPIO pins : PF7 PF6 PF10 PF9
  818. PF8 */
  819. GPIO_InitStruct.Pin = GPIO_PIN_7 | GPIO_PIN_6 | GPIO_PIN_10 | GPIO_PIN_9
  820. | GPIO_PIN_8;
  821. GPIO_InitStruct.Mode = GPIO_MODE_OUTPUT_PP;
  822. GPIO_InitStruct.Pull = GPIO_PULLDOWN;
  823. GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_LOW;
  824. HAL_GPIO_Init(GPIOF, &GPIO_InitStruct);
  825.  
  826. /*Configure GPIO pin : PC3 */
  827. GPIO_InitStruct.Pin = GPIO_PIN_3;
  828. GPIO_InitStruct.Mode = GPIO_MODE_AF_PP;
  829. GPIO_InitStruct.Pull = GPIO_NOPULL;
  830. GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_VERY_HIGH;
  831. GPIO_InitStruct.Alternate = GPIO_AF12_FMC;
  832. HAL_GPIO_Init(GPIOC, &GPIO_InitStruct);
  833.  
  834. /*Configure GPIO pins : ULPI_STP_Pin ULPI_DIR_Pin */
  835. GPIO_InitStruct.Pin = ULPI_STP_Pin | ULPI_DIR_Pin;
  836. GPIO_InitStruct.Mode = GPIO_MODE_AF_PP;
  837. GPIO_InitStruct.Pull = GPIO_NOPULL;
  838. GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_VERY_HIGH;
  839. GPIO_InitStruct.Alternate = GPIO_AF10_OTG_HS;
  840. HAL_GPIO_Init(GPIOC, &GPIO_InitStruct);
  841.  
  842. /*Configure GPIO pins : RMII_MDC_Pin RMII_RXD0_Pin RMII_RXD1_Pin */
  843. GPIO_InitStruct.Pin = RMII_MDC_Pin | RMII_RXD0_Pin | RMII_RXD1_Pin;
  844. GPIO_InitStruct.Mode = GPIO_MODE_AF_PP;
  845. GPIO_InitStruct.Pull = GPIO_NOPULL;
  846. GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_VERY_HIGH;
  847. GPIO_InitStruct.Alternate = GPIO_AF11_ETH;
  848. HAL_GPIO_Init(GPIOC, &GPIO_InitStruct);
  849.  
  850. /*Configure GPIO pin : PB2 */
  851. GPIO_InitStruct.Pin = GPIO_PIN_2;
  852. GPIO_InitStruct.Mode = GPIO_MODE_AF_PP;
  853. GPIO_InitStruct.Pull = GPIO_NOPULL;
  854. GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_VERY_HIGH;
  855. GPIO_InitStruct.Alternate = GPIO_AF9_QUADSPI;
  856. HAL_GPIO_Init(GPIOB, &GPIO_InitStruct);
  857.  
  858. /*Configure GPIO pins : QSPI_D1_Pin QSPI_D3_Pin QSPI_D0_Pin */
  859. GPIO_InitStruct.Pin = QSPI_D1_Pin | QSPI_D3_Pin | QSPI_D0_Pin;
  860. GPIO_InitStruct.Mode = GPIO_MODE_AF_PP;
  861. GPIO_InitStruct.Pull = GPIO_NOPULL;
  862. GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_VERY_HIGH;
  863. GPIO_InitStruct.Alternate = GPIO_AF9_QUADSPI;
  864. HAL_GPIO_Init(GPIOD, &GPIO_InitStruct);
  865.  
  866. /*Configure GPIO pin : EXT_RST_Pin */
  867. GPIO_InitStruct.Pin = EXT_RST_Pin;
  868. GPIO_InitStruct.Mode = GPIO_MODE_OUTPUT_PP;
  869. GPIO_InitStruct.Pull = GPIO_NOPULL;
  870. GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_LOW;
  871. HAL_GPIO_Init(EXT_RST_GPIO_Port, &GPIO_InitStruct);
  872.  
  873. /*Configure GPIO pin : RMII_RXER_Pin */
  874. GPIO_InitStruct.Pin = RMII_RXER_Pin;
  875. GPIO_InitStruct.Mode = GPIO_MODE_INPUT;
  876. GPIO_InitStruct.Pull = GPIO_NOPULL;
  877. HAL_GPIO_Init(RMII_RXER_GPIO_Port, &GPIO_InitStruct);
  878.  
  879. /*Configure GPIO pins : RMII_REF_CLK_Pin RMII_MDIO_Pin RMII_CRS_DV_Pin */
  880. GPIO_InitStruct.Pin = RMII_REF_CLK_Pin | RMII_MDIO_Pin | RMII_CRS_DV_Pin;
  881. GPIO_InitStruct.Mode = GPIO_MODE_AF_PP;
  882. GPIO_InitStruct.Pull = GPIO_NOPULL;
  883. GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_VERY_HIGH;
  884. GPIO_InitStruct.Alternate = GPIO_AF11_ETH;
  885. HAL_GPIO_Init(GPIOA, &GPIO_InitStruct);
  886.  
  887. /*Configure GPIO pin : PA0 */
  888. GPIO_InitStruct.Pin = GPIO_PIN_0;
  889. GPIO_InitStruct.Mode = GPIO_MODE_OUTPUT_PP;
  890. GPIO_InitStruct.Pull = GPIO_PULLDOWN;
  891. GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_LOW;
  892. HAL_GPIO_Init(GPIOA, &GPIO_InitStruct);
  893.  
  894. /*Configure GPIO pins : PA4 PA6 */
  895. GPIO_InitStruct.Pin = GPIO_PIN_4 | GPIO_PIN_6;
  896. GPIO_InitStruct.Mode = GPIO_MODE_AF_PP;
  897. GPIO_InitStruct.Pull = GPIO_NOPULL;
  898. GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_LOW;
  899. GPIO_InitStruct.Alternate = GPIO_AF13_DCMI;
  900. HAL_GPIO_Init(GPIOA, &GPIO_InitStruct);
  901.  
  902. /*Configure GPIO pins : LCD_SCL_Pin LCD_SDA_Pin */
  903. GPIO_InitStruct.Pin = LCD_SCL_Pin | LCD_SDA_Pin;
  904. GPIO_InitStruct.Mode = GPIO_MODE_AF_OD;
  905. GPIO_InitStruct.Pull = GPIO_PULLUP;
  906. GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_VERY_HIGH;
  907. GPIO_InitStruct.Alternate = GPIO_AF4_I2C3;
  908. HAL_GPIO_Init(GPIOH, &GPIO_InitStruct);
  909.  
  910. /*Configure GPIO pins : ULPI_CLK_Pin ULPI_D0_Pin */
  911. GPIO_InitStruct.Pin = ULPI_CLK_Pin | ULPI_D0_Pin;
  912. GPIO_InitStruct.Mode = GPIO_MODE_AF_PP;
  913. GPIO_InitStruct.Pull = GPIO_NOPULL;
  914. GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_VERY_HIGH;
  915. GPIO_InitStruct.Alternate = GPIO_AF10_OTG_HS;
  916. HAL_GPIO_Init(GPIOA, &GPIO_InitStruct);
  917.  
  918. /*Configure GPIO pin : PH6 */
  919. GPIO_InitStruct.Pin = GPIO_PIN_6;
  920. GPIO_InitStruct.Mode = GPIO_MODE_OUTPUT_PP;
  921. GPIO_InitStruct.Pull = GPIO_PULLDOWN;
  922. GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_VERY_HIGH;
  923. HAL_GPIO_Init(GPIOH, &GPIO_InitStruct);
  924.  
  925. /*Configure GPIO pin Output Level */
  926. HAL_GPIO_WritePin(GPIOB,
  927. GPIO_PIN_8 | GPIO_PIN_4 | GPIO_PIN_9 | GPIO_PIN_14 | GPIO_PIN_15,
  928. GPIO_PIN_SET);
  929.  
  930. /*Configure GPIO pin Output Level */
  931. HAL_GPIO_WritePin(GPIOA, GPIO_PIN_15 | GPIO_PIN_8, GPIO_PIN_SET);
  932.  
  933. /*Configure GPIO pin Output Level */
  934. HAL_GPIO_WritePin(OTG_FS_PowerSwitchOn_GPIO_Port, OTG_FS_PowerSwitchOn_Pin,
  935. GPIO_PIN_RESET);
  936.  
  937. /*Configure GPIO pin Output Level */
  938. HAL_GPIO_WritePin(GPIOI,
  939. ARDUINO_D7_Pin | ARDUINO_D8_Pin | GPIO_PIN_1 | GPIO_PIN_0,
  940. GPIO_PIN_SET);
  941.  
  942. /*Configure GPIO pin Output Level */
  943. HAL_GPIO_WritePin(LCD_BL_CTRL_GPIO_Port, LCD_BL_CTRL_Pin, GPIO_PIN_RESET);
  944.  
  945. /*Configure GPIO pin Output Level */
  946. HAL_GPIO_WritePin(LCD_DISP_GPIO_Port, LCD_DISP_Pin, GPIO_PIN_RESET);
  947.  
  948. /*Configure GPIO pin Output Level */
  949. HAL_GPIO_WritePin(DCMI_PWR_EN_GPIO_Port, DCMI_PWR_EN_Pin, GPIO_PIN_RESET);
  950.  
  951. /*Configure GPIO pin Output Level */
  952. HAL_GPIO_WritePin(GPIOC, GPIO_PIN_7 | GPIO_PIN_6, GPIO_PIN_SET);
  953.  
  954. /*Configure GPIO pin Output Level */
  955. HAL_GPIO_WritePin(GPIOG, ARDUINO_D4_Pin | ARDUINO_D2_Pin, GPIO_PIN_SET);
  956.  
  957. /*Configure GPIO pin Output Level */
  958. HAL_GPIO_WritePin(GPIOF,
  959. GPIO_PIN_7 | GPIO_PIN_6 | GPIO_PIN_10 | GPIO_PIN_9 | GPIO_PIN_8,
  960. GPIO_PIN_RESET);
  961.  
  962. /*Configure GPIO pin Output Level */
  963. HAL_GPIO_WritePin(EXT_RST_GPIO_Port, EXT_RST_Pin, GPIO_PIN_RESET);
  964.  
  965. /*Configure GPIO pin Output Level */
  966. HAL_GPIO_WritePin(GPIOA, GPIO_PIN_0, GPIO_PIN_RESET);
  967.  
  968. /*Configure GPIO pin Output Level */
  969. HAL_GPIO_WritePin(GPIOH, GPIO_PIN_6, GPIO_PIN_SET);
  970.  
  971. }
  972.  
  973. /* USER CODE BEGIN 4 */
  974.  
  975. /* USER CODE END 4 */
  976.  
  977. /**
  978.  * @brief This function is executed in case of error occurrence.
  979.  * @param None
  980.  * @retval None
  981.  */
  982. void Error_Handler(void) {
  983. /* USER CODE BEGIN Error_Handler */
  984. /* User can add his own implementation to report the HAL error return state */
  985. while (1) {
  986. }
  987. /* USER CODE END Error_Handler */
  988. }
  989.  
  990. #ifdef USE_FULL_ASSERT
  991.  
  992. /**
  993.  * @brief Reports the name of the source file and the source line number
  994.  * where the assert_param error has occurred.
  995.  * @param file: pointer to the source file name
  996.  * @param line: assert_param error line source number
  997.  * @retval None
  998.  */
  999. void assert_failed(uint8_t* file, uint32_t line)
  1000. {
  1001. /* USER CODE BEGIN 6 */
  1002. /* User can add his own implementation to report the file name and line number,
  1003. ex: printf("Wrong parameters value: file %s on line %d\r\n", file, line) */
  1004. /* USER CODE END 6 */
  1005.  
  1006. }
  1007.  
  1008. #endif
  1009.  
  1010. /**
  1011.  * @}
  1012.  */
  1013.  
  1014. /**
  1015.  * @}
  1016.  */
  1017.  
  1018. /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
prog.c:34:27: fatal error: stm32f7xx_hal.h: No such file or directory
compilation terminated.
stdout
Standard output is empty