From 7dc2985c99db42f170d93ba6d013c4dd4e429eeb Mon Sep 17 00:00:00 2001 From: Wenxue <wenxue.guo@avnet.com> Date: Tue, 02 Sep 2025 09:35:50 +0800 Subject: [PATCH] 按键中断程序 --- Core/Src/board/miscdev.c | 23 +++++++++++++++++++++++ 1 files changed, 23 insertions(+), 0 deletions(-) diff --git a/Core/Src/board/miscdev.c b/Core/Src/board/miscdev.c index 45a6d8d..b89d071 100644 --- a/Core/Src/board/miscdev.c +++ b/Core/Src/board/miscdev.c @@ -130,3 +130,26 @@ return leds[which].status; } + +/* + *+----------------------+ + *| GPIO Key API | + *+----------------------+ + */ +#include "main.h" /* Key1_pin, Key2_Pin, Key3_Pin 定义在该头文件下 */ +void HAL_GPIO_EXTI_Callback(uint16_t GPIO_Pin) +{ + if( Key1_Pin == GPIO_Pin ) + { + blink_led( Led_R, 500 ); + } + else if( Key2_Pin == GPIO_Pin ) + { + blink_led( Led_G, 500 ); + } + else if( Key3_Pin == GPIO_Pin ) + { + blink_led( Led_B, 500 ); + } +} + -- Gitblit v1.9.1