mirror of
https://gitee.com/dlmu-cone/bf_original_balance_chassis
synced 2026-07-24 11:37:45 +08:00
将警报声添加到DaemonTask
This commit is contained in:
@@ -1,28 +0,0 @@
|
||||
#include "bsp_buzzer.h"
|
||||
#include "main.h"
|
||||
|
||||
#warning this is a legacy support file, please use the new version
|
||||
|
||||
extern TIM_HandleTypeDef htim4;
|
||||
static uint8_t tmp_warning_level = 0;
|
||||
|
||||
void BuzzerInit()
|
||||
{
|
||||
HAL_TIM_PWM_Start(&htim4, TIM_CHANNEL_3);
|
||||
}
|
||||
|
||||
void BuzzerOn(uint16_t psc, uint16_t pwm, uint8_t level)
|
||||
{
|
||||
if (level > tmp_warning_level)
|
||||
{
|
||||
tmp_warning_level = level;
|
||||
__HAL_TIM_PRESCALER(&htim4, psc);
|
||||
__HAL_TIM_SetCompare(&htim4, TIM_CHANNEL_3, pwm);
|
||||
}
|
||||
}
|
||||
|
||||
void BuzzerOff(void)
|
||||
{
|
||||
__HAL_TIM_SetCompare(&htim4, TIM_CHANNEL_3, 0);
|
||||
tmp_warning_level = 0;
|
||||
}
|
||||
|
||||
@@ -1,10 +0,0 @@
|
||||
#ifndef BSP_BUZZER_H
|
||||
#define BSP_BUZZER_H
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
void BuzzerInit();
|
||||
extern void BuzzerOn(uint16_t psc, uint16_t pwm, uint8_t level);
|
||||
extern void BuzzerOff(void);
|
||||
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user