增加了遥控器按键功能并修改所有函数和类型定义为标准格式

This commit is contained in:
NeoZng
2022-12-05 21:01:26 +08:00
parent 3947c48230
commit 9c9ea14bde
40 changed files with 352 additions and 251 deletions

View File

@@ -2,24 +2,24 @@
#include "main.h"
extern TIM_HandleTypeDef htim4;
static uint8_t tmp_warning_level=0;
static uint8_t tmp_warning_level = 0;
void buzzer_init()
void BuzzerInit()
{
HAL_TIM_PWM_Start(&htim4,TIM_CHANNEL_3);
HAL_TIM_PWM_Start(&htim4, TIM_CHANNEL_3);
}
void buzzer_on(uint16_t psc, uint16_t pwm,uint8_t level)
void BuzzerOn(uint16_t psc, uint16_t pwm, uint8_t level)
{
if(level>tmp_warning_level)
if (level > tmp_warning_level)
{
tmp_warning_level=level;
tmp_warning_level = level;
__HAL_TIM_PRESCALER(&htim4, psc);
__HAL_TIM_SetCompare(&htim4, TIM_CHANNEL_3, pwm);
}
}
void buzzer_off(void)
void BuzzerOff(void)
{
__HAL_TIM_SetCompare(&htim4, TIM_CHANNEL_3, 0);
tmp_warning_level=0;
tmp_warning_level = 0;
}