更新蜂鸣器模块

This commit is contained in:
EN 2024-07-19 12:33:18 +08:00
parent e1c3c733f0
commit a76a286859

View File

@ -11,10 +11,16 @@ inline void BUZZER_Start()
inline void BUZZER_Stop() inline void BUZZER_Stop()
{ {
HAL_GPIO_WritePin(FM_K2_POWERC_GPIO_Port, FM_K2_POWERC_Pin, GPIO_PIN_SET); 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) void BUZZER_StartTimed(uint8_t time)
{ {
state = 1;
BUZZER_Start(); BUZZER_Start();
TIMER_AddLoopEvent(EVENT_BUZZER, BUZZER_Stop, time * 100); TIMER_AddLoopEvent(EVENT_BUZZER, BUZZER_Stop, time * 100);
} }