From a76a2868594845725313ea1051f689ba98db3a60 Mon Sep 17 00:00:00 2001 From: EN Date: Fri, 19 Jul 2024 12:33:18 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=96=B0=E8=9C=82=E9=B8=A3=E5=99=A8?= =?UTF-8?q?=E6=A8=A1=E5=9D=97?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Peripheral/Src/buzzer.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/Peripheral/Src/buzzer.c b/Peripheral/Src/buzzer.c index 99e80bc..b9bb26a 100644 --- a/Peripheral/Src/buzzer.c +++ b/Peripheral/Src/buzzer.c @@ -11,10 +11,16 @@ inline void BUZZER_Start() inline void BUZZER_Stop() { HAL_GPIO_WritePin(FM_K2_POWERC_GPIO_Port, FM_K2_POWERC_Pin, GPIO_PIN_SET); + if (state == 1) + { + state = 0; + TIMER_DelLoopEvent(EVENT_BUZZER); + } } void BUZZER_StartTimed(uint8_t time) { + state = 1; BUZZER_Start(); TIMER_AddLoopEvent(EVENT_BUZZER, BUZZER_Stop, time * 100); }