From ee40be8df6f76d1840000d4608895b844a526252 Mon Sep 17 00:00:00 2001 From: tianjialong Date: Mon, 6 Mar 2023 10:03:12 +0800 Subject: [PATCH] =?UTF-8?q?cubemx=E5=BC=80=E5=90=AF=E5=A4=96=E9=83=A8?= =?UTF-8?q?=E4=B8=AD=E6=96=AD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Inc/stm32f4xx_it.h | 1 + LWIP.ioc | 1 + Src/gpio.c | 4 ++++ Src/stm32f4xx_it.c | 14 ++++++++++++++ 4 files changed, 20 insertions(+) diff --git a/Inc/stm32f4xx_it.h b/Inc/stm32f4xx_it.h index a0eef34..b541375 100644 --- a/Inc/stm32f4xx_it.h +++ b/Inc/stm32f4xx_it.h @@ -52,6 +52,7 @@ void MemManage_Handler(void); void BusFault_Handler(void); void UsageFault_Handler(void); void DebugMon_Handler(void); +void EXTI2_IRQHandler(void); void TIM1_UP_TIM10_IRQHandler(void); void USART1_IRQHandler(void); void TIM6_DAC_IRQHandler(void); diff --git a/LWIP.ioc b/LWIP.ioc index 1b0e4f8..a19ae5f 100644 --- a/LWIP.ioc +++ b/LWIP.ioc @@ -87,6 +87,7 @@ MxDb.Version=DB.6.0.70 NVIC.BusFault_IRQn=true\:0\:0\:false\:false\:true\:false\:false\:false\:false NVIC.DebugMonitor_IRQn=true\:0\:0\:false\:false\:true\:false\:false\:false\:false NVIC.ETH_IRQn=true\:5\:0\:false\:false\:true\:true\:false\:true\:true +NVIC.EXTI2_IRQn=true\:5\:0\:false\:false\:true\:true\:true\:true\:true NVIC.ForceEnableDMAVector=true NVIC.HardFault_IRQn=true\:0\:0\:false\:false\:true\:false\:false\:false\:false NVIC.MemoryManagement_IRQn=true\:0\:0\:false\:false\:true\:false\:false\:false\:false diff --git a/Src/gpio.c b/Src/gpio.c index 0f77f97..7f871a3 100644 --- a/Src/gpio.c +++ b/Src/gpio.c @@ -85,6 +85,10 @@ void MX_GPIO_Init(void) GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_LOW; HAL_GPIO_Init(ETH_RST_GPIO_Port, &GPIO_InitStruct); + /* EXTI interrupt init*/ + HAL_NVIC_SetPriority(EXTI2_IRQn, 5, 0); + HAL_NVIC_EnableIRQ(EXTI2_IRQn); + } /* USER CODE BEGIN 2 */ diff --git a/Src/stm32f4xx_it.c b/Src/stm32f4xx_it.c index 5957f96..06fe9aa 100644 --- a/Src/stm32f4xx_it.c +++ b/Src/stm32f4xx_it.c @@ -161,6 +161,20 @@ void DebugMon_Handler(void) /******************************************************************************/ /** + * @brief This function handles EXTI line2 interrupt. + */ +void EXTI2_IRQHandler(void) +{ + /* USER CODE BEGIN EXTI2_IRQn 0 */ + + /* USER CODE END EXTI2_IRQn 0 */ + HAL_GPIO_EXTI_IRQHandler(GPIO_PIN_2); + /* USER CODE BEGIN EXTI2_IRQn 1 */ + + /* USER CODE END EXTI2_IRQn 1 */ +} + +/** * @brief This function handles TIM1 update interrupt and TIM10 global interrupt. */ void TIM1_UP_TIM10_IRQHandler(void)