27 lines
518 B
C
27 lines
518 B
C
#include "buzzer.h"
|
|
#include "timer.h"
|
|
|
|
static uint8_t state;
|
|
|
|
inline void BUZZER_Start()
|
|
{
|
|
HAL_GPIO_WritePin(FM_K2_POWERC_GPIO_Port, FM_K2_POWERC_Pin, GPIO_PIN_RESET);
|
|
}
|
|
|
|
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);
|
|
}
|