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); }