将警报声添加到DaemonTask

This commit is contained in:
chenfu
2023-06-23 17:05:55 +08:00
parent 4a45331d31
commit c85c13f959
7 changed files with 42 additions and 46 deletions

View File

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

View File

@@ -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