外部中断原有操作使用回调执行

This commit is contained in:
王绪洁 2025-03-17 11:57:13 +08:00
parent 27686f4f1f
commit cd1850ef7e
3 changed files with 5785 additions and 5768 deletions

View File

@ -298,6 +298,33 @@ void HAL_UART_TxCpltCallback(UART_HandleTypeDef *huart)
HART2_RTS_RECEIVE; HART2_RTS_RECEIVE;
} }
} }
void HAL_GPIO_EXTI_Callback(uint16_t GPIO_Pin)
{
if (GPIO_Pin == EC11_KEY_Pin)
{
if (ec11_data.confirm_key_flag == 0)
{
ec11_data.confirm_key_flag = 1;
}
else if (ec11_data.confirm_key_flag == 1)
{
ec11_data.confirm_key_flag = 2;
}
else if (ec11_data.confirm_key_flag == 2)
{
ec11_data.confirm_key_flag = 3;
}
}
if (GPIO_Pin == HART2_OCD_Pin)
{
HAL_GPIO_TogglePin(LED2_R_GPIO_Port, LED2_R_Pin);
}
if (GPIO_Pin == HART1_OCD_Pin)
{
HAL_GPIO_TogglePin(LED2_Y_GPIO_Port, LED2_Y_Pin);
}
}
/* USER CODE END 4 */ /* USER CODE END 4 */
/** /**

View File

@ -89,8 +89,8 @@ extern TIM_HandleTypeDef htim4;
/* Cortex-M4 Processor Interruption and Exception Handlers */ /* Cortex-M4 Processor Interruption and Exception Handlers */
/******************************************************************************/ /******************************************************************************/
/** /**
* @brief This function handles Non maskable interrupt. * @brief This function handles Non maskable interrupt.
*/ */
void NMI_Handler(void) void NMI_Handler(void)
{ {
/* USER CODE BEGIN NonMaskableInt_IRQn 0 */ /* USER CODE BEGIN NonMaskableInt_IRQn 0 */
@ -104,8 +104,8 @@ void NMI_Handler(void)
} }
/** /**
* @brief This function handles Hard fault interrupt. * @brief This function handles Hard fault interrupt.
*/ */
void HardFault_Handler(void) void HardFault_Handler(void)
{ {
/* USER CODE BEGIN HardFault_IRQn 0 */ /* USER CODE BEGIN HardFault_IRQn 0 */
@ -119,8 +119,8 @@ void HardFault_Handler(void)
} }
/** /**
* @brief This function handles Memory management fault. * @brief This function handles Memory management fault.
*/ */
void MemManage_Handler(void) void MemManage_Handler(void)
{ {
/* USER CODE BEGIN MemoryManagement_IRQn 0 */ /* USER CODE BEGIN MemoryManagement_IRQn 0 */
@ -134,8 +134,8 @@ void MemManage_Handler(void)
} }
/** /**
* @brief This function handles Pre-fetch fault, memory access fault. * @brief This function handles Pre-fetch fault, memory access fault.
*/ */
void BusFault_Handler(void) void BusFault_Handler(void)
{ {
/* USER CODE BEGIN BusFault_IRQn 0 */ /* USER CODE BEGIN BusFault_IRQn 0 */
@ -149,8 +149,8 @@ void BusFault_Handler(void)
} }
/** /**
* @brief This function handles Undefined instruction or illegal state. * @brief This function handles Undefined instruction or illegal state.
*/ */
void UsageFault_Handler(void) void UsageFault_Handler(void)
{ {
/* USER CODE BEGIN UsageFault_IRQn 0 */ /* USER CODE BEGIN UsageFault_IRQn 0 */
@ -164,8 +164,8 @@ void UsageFault_Handler(void)
} }
/** /**
* @brief This function handles Debug monitor. * @brief This function handles Debug monitor.
*/ */
void DebugMon_Handler(void) void DebugMon_Handler(void)
{ {
/* USER CODE BEGIN DebugMonitor_IRQn 0 */ /* USER CODE BEGIN DebugMonitor_IRQn 0 */
@ -184,8 +184,8 @@ void DebugMon_Handler(void)
/******************************************************************************/ /******************************************************************************/
/** /**
* @brief This function handles EXTI line1 interrupt. * @brief This function handles EXTI line1 interrupt.
*/ */
void EXTI1_IRQHandler(void) void EXTI1_IRQHandler(void)
{ {
/* USER CODE BEGIN EXTI1_IRQn 0 */ /* USER CODE BEGIN EXTI1_IRQn 0 */
@ -193,13 +193,13 @@ void EXTI1_IRQHandler(void)
/* USER CODE END EXTI1_IRQn 0 */ /* USER CODE END EXTI1_IRQn 0 */
HAL_GPIO_EXTI_IRQHandler(HART1_OCD_Pin); HAL_GPIO_EXTI_IRQHandler(HART1_OCD_Pin);
/* USER CODE BEGIN EXTI1_IRQn 1 */ /* USER CODE BEGIN EXTI1_IRQn 1 */
HAL_GPIO_TogglePin(LED3_G_GPIO_Port, LED3_G_Pin);
/* USER CODE END EXTI1_IRQn 1 */ /* USER CODE END EXTI1_IRQn 1 */
} }
/** /**
* @brief This function handles EXTI line3 interrupt. * @brief This function handles EXTI line3 interrupt.
*/ */
void EXTI3_IRQHandler(void) void EXTI3_IRQHandler(void)
{ {
/* USER CODE BEGIN EXTI3_IRQn 0 */ /* USER CODE BEGIN EXTI3_IRQn 0 */
@ -207,13 +207,13 @@ void EXTI3_IRQHandler(void)
/* USER CODE END EXTI3_IRQn 0 */ /* USER CODE END EXTI3_IRQn 0 */
HAL_GPIO_EXTI_IRQHandler(HART2_OCD_Pin); HAL_GPIO_EXTI_IRQHandler(HART2_OCD_Pin);
/* USER CODE BEGIN EXTI3_IRQn 1 */ /* USER CODE BEGIN EXTI3_IRQn 1 */
HAL_GPIO_TogglePin(LED3_R_GPIO_Port, LED3_R_Pin);
/* USER CODE END EXTI3_IRQn 1 */ /* USER CODE END EXTI3_IRQn 1 */
} }
/** /**
* @brief This function handles DMA1 stream0 global interrupt. * @brief This function handles DMA1 stream0 global interrupt.
*/ */
void DMA1_Stream0_IRQHandler(void) void DMA1_Stream0_IRQHandler(void)
{ {
/* USER CODE BEGIN DMA1_Stream0_IRQn 0 */ /* USER CODE BEGIN DMA1_Stream0_IRQn 0 */
@ -226,8 +226,8 @@ void DMA1_Stream0_IRQHandler(void)
} }
/** /**
* @brief This function handles DMA1 stream1 global interrupt. * @brief This function handles DMA1 stream1 global interrupt.
*/ */
void DMA1_Stream1_IRQHandler(void) void DMA1_Stream1_IRQHandler(void)
{ {
/* USER CODE BEGIN DMA1_Stream1_IRQn 0 */ /* USER CODE BEGIN DMA1_Stream1_IRQn 0 */
@ -240,8 +240,8 @@ void DMA1_Stream1_IRQHandler(void)
} }
/** /**
* @brief This function handles DMA1 stream2 global interrupt. * @brief This function handles DMA1 stream2 global interrupt.
*/ */
void DMA1_Stream2_IRQHandler(void) void DMA1_Stream2_IRQHandler(void)
{ {
/* USER CODE BEGIN DMA1_Stream2_IRQn 0 */ /* USER CODE BEGIN DMA1_Stream2_IRQn 0 */
@ -254,8 +254,8 @@ void DMA1_Stream2_IRQHandler(void)
} }
/** /**
* @brief This function handles DMA1 stream3 global interrupt. * @brief This function handles DMA1 stream3 global interrupt.
*/ */
void DMA1_Stream3_IRQHandler(void) void DMA1_Stream3_IRQHandler(void)
{ {
/* USER CODE BEGIN DMA1_Stream3_IRQn 0 */ /* USER CODE BEGIN DMA1_Stream3_IRQn 0 */
@ -268,8 +268,8 @@ void DMA1_Stream3_IRQHandler(void)
} }
/** /**
* @brief This function handles DMA1 stream4 global interrupt. * @brief This function handles DMA1 stream4 global interrupt.
*/ */
void DMA1_Stream4_IRQHandler(void) void DMA1_Stream4_IRQHandler(void)
{ {
/* USER CODE BEGIN DMA1_Stream4_IRQn 0 */ /* USER CODE BEGIN DMA1_Stream4_IRQn 0 */
@ -282,8 +282,8 @@ void DMA1_Stream4_IRQHandler(void)
} }
/** /**
* @brief This function handles DMA1 stream5 global interrupt. * @brief This function handles DMA1 stream5 global interrupt.
*/ */
void DMA1_Stream5_IRQHandler(void) void DMA1_Stream5_IRQHandler(void)
{ {
/* USER CODE BEGIN DMA1_Stream5_IRQn 0 */ /* USER CODE BEGIN DMA1_Stream5_IRQn 0 */
@ -296,8 +296,8 @@ void DMA1_Stream5_IRQHandler(void)
} }
/** /**
* @brief This function handles DMA1 stream6 global interrupt. * @brief This function handles DMA1 stream6 global interrupt.
*/ */
void DMA1_Stream6_IRQHandler(void) void DMA1_Stream6_IRQHandler(void)
{ {
/* USER CODE BEGIN DMA1_Stream6_IRQn 0 */ /* USER CODE BEGIN DMA1_Stream6_IRQn 0 */
@ -310,8 +310,8 @@ void DMA1_Stream6_IRQHandler(void)
} }
/** /**
* @brief This function handles EXTI line[9:5] interrupts. * @brief This function handles EXTI line[9:5] interrupts.
*/ */
void EXTI9_5_IRQHandler(void) void EXTI9_5_IRQHandler(void)
{ {
/* USER CODE BEGIN EXTI9_5_IRQn 0 */ /* USER CODE BEGIN EXTI9_5_IRQn 0 */
@ -319,18 +319,7 @@ void EXTI9_5_IRQHandler(void)
/* USER CODE END EXTI9_5_IRQn 0 */ /* USER CODE END EXTI9_5_IRQn 0 */
HAL_GPIO_EXTI_IRQHandler(EC11_KEY_Pin); HAL_GPIO_EXTI_IRQHandler(EC11_KEY_Pin);
/* USER CODE BEGIN EXTI9_5_IRQn 1 */ /* USER CODE BEGIN EXTI9_5_IRQn 1 */
if (ec11_data.confirm_key_flag == 0)
{
ec11_data.confirm_key_flag = 1;
}
else if (ec11_data.confirm_key_flag == 1)
{
ec11_data.confirm_key_flag = 2;
}
else if (ec11_data.confirm_key_flag == 2)
{
ec11_data.confirm_key_flag = 3;
}
// if (buzzer_flag == 1) // if (buzzer_flag == 1)
// { // {
// HAL_TIM_PWM_Start(&htim3, TIM_CHANNEL_3); // 蜂鸣器PWM输出用于蜂鸣器发声 // HAL_TIM_PWM_Start(&htim3, TIM_CHANNEL_3); // 蜂鸣器PWM输出用于蜂鸣器发声
@ -345,8 +334,8 @@ void EXTI9_5_IRQHandler(void)
} }
/** /**
* @brief This function handles TIM4 global interrupt. * @brief This function handles TIM4 global interrupt.
*/ */
void TIM4_IRQHandler(void) void TIM4_IRQHandler(void)
{ {
/* USER CODE BEGIN TIM4_IRQn 0 */ /* USER CODE BEGIN TIM4_IRQn 0 */
@ -359,8 +348,8 @@ void TIM4_IRQHandler(void)
} }
/** /**
* @brief This function handles USART1 global interrupt. * @brief This function handles USART1 global interrupt.
*/ */
void USART1_IRQHandler(void) void USART1_IRQHandler(void)
{ {
/* USER CODE BEGIN USART1_IRQn 0 */ /* USER CODE BEGIN USART1_IRQn 0 */
@ -373,8 +362,8 @@ void USART1_IRQHandler(void)
} }
/** /**
* @brief This function handles USART2 global interrupt. * @brief This function handles USART2 global interrupt.
*/ */
void USART2_IRQHandler(void) void USART2_IRQHandler(void)
{ {
/* USER CODE BEGIN USART2_IRQn 0 */ /* USER CODE BEGIN USART2_IRQn 0 */
@ -386,8 +375,8 @@ void USART2_IRQHandler(void)
} }
/** /**
* @brief This function handles USART3 global interrupt. * @brief This function handles USART3 global interrupt.
*/ */
void USART3_IRQHandler(void) void USART3_IRQHandler(void)
{ {
/* USER CODE BEGIN USART3_IRQn 0 */ /* USER CODE BEGIN USART3_IRQn 0 */
@ -400,8 +389,8 @@ void USART3_IRQHandler(void)
} }
/** /**
* @brief This function handles DMA1 stream7 global interrupt. * @brief This function handles DMA1 stream7 global interrupt.
*/ */
void DMA1_Stream7_IRQHandler(void) void DMA1_Stream7_IRQHandler(void)
{ {
/* USER CODE BEGIN DMA1_Stream7_IRQn 0 */ /* USER CODE BEGIN DMA1_Stream7_IRQn 0 */
@ -414,8 +403,8 @@ void DMA1_Stream7_IRQHandler(void)
} }
/** /**
* @brief This function handles UART4 global interrupt. * @brief This function handles UART4 global interrupt.
*/ */
void UART4_IRQHandler(void) void UART4_IRQHandler(void)
{ {
/* USER CODE BEGIN UART4_IRQn 0 */ /* USER CODE BEGIN UART4_IRQn 0 */
@ -427,8 +416,8 @@ void UART4_IRQHandler(void)
} }
/** /**
* @brief This function handles UART5 global interrupt. * @brief This function handles UART5 global interrupt.
*/ */
void UART5_IRQHandler(void) void UART5_IRQHandler(void)
{ {
/* USER CODE BEGIN UART5_IRQn 0 */ /* USER CODE BEGIN UART5_IRQn 0 */
@ -439,8 +428,8 @@ void UART5_IRQHandler(void)
} }
/** /**
* @brief This function handles DMA2 stream2 global interrupt. * @brief This function handles DMA2 stream2 global interrupt.
*/ */
void DMA2_Stream2_IRQHandler(void) void DMA2_Stream2_IRQHandler(void)
{ {
/* USER CODE BEGIN DMA2_Stream2_IRQn 0 */ /* USER CODE BEGIN DMA2_Stream2_IRQn 0 */
@ -453,8 +442,8 @@ void DMA2_Stream2_IRQHandler(void)
} }
/** /**
* @brief This function handles Ethernet global interrupt. * @brief This function handles Ethernet global interrupt.
*/ */
void ETH_IRQHandler(void) void ETH_IRQHandler(void)
{ {
/* USER CODE BEGIN ETH_IRQn 0 */ /* USER CODE BEGIN ETH_IRQn 0 */
@ -467,8 +456,8 @@ void ETH_IRQHandler(void)
} }
/** /**
* @brief This function handles DMA2 stream7 global interrupt. * @brief This function handles DMA2 stream7 global interrupt.
*/ */
void DMA2_Stream7_IRQHandler(void) void DMA2_Stream7_IRQHandler(void)
{ {
/* USER CODE BEGIN DMA2_Stream7_IRQn 0 */ /* USER CODE BEGIN DMA2_Stream7_IRQn 0 */