新增了电机相关功能函数 修改旋钮的接口

This commit is contained in:
bmy
2023-12-15 21:42:43 +08:00
parent ece70343e5
commit b908ae8593
6 changed files with 54 additions and 11 deletions

26
app/by_fan_control.c Normal file
View File

@@ -0,0 +1,26 @@
#include "by_fan_control.h"
#include "zf_common_headfile.h"
void by_pwm_init(void)
{
pwm_init(TIM4_PWM_MAP1_CH1_D12, 10000, 0); // 浮力风扇左
pwm_init(TIM4_PWM_MAP1_CH2_D13, 10000, 0); // 浮力风扇右
pwm_init(TIM4_PWM_MAP1_CH3_D14, 10000, 0); // 动力风扇左
pwm_init(TIM4_PWM_MAP1_CH4_D15, 10000, 0); // 动力风扇右
}
void by_pwm_update_duty(uint32_t update_pwm_duty)
{
if (7000UL > update_pwm_duty) {
update_pwm_duty = 7000UL;
}
pwm_set_duty(TIM4_PWM_MAP1_CH1_D12, update_pwm_duty);
pwm_set_duty(TIM4_PWM_MAP1_CH2_D13, update_pwm_duty);
}
void by_pwm_power_duty(uint32_t power_pwm_duty_l, uint32_t power_pwm_duty_r)
{
pwm_set_duty(TIM4_PWM_MAP1_CH3_D14, power_pwm_duty_l);
pwm_set_duty(TIM4_PWM_MAP1_CH4_D15, power_pwm_duty_r);
}