yincheng.zhong
8 天以前 68c43c5adef03f00836d83b37cb83a294d8b0354
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
/*******************************************************************************
 * File Name         : pwm_ctrol.h
 * Description       :
 * Created on        : 
 * Author            : 
 *******************************************************************************/
 
#ifndef FML_PWM_CTROL_H_
#define FML_PWM_CTROL_H_
/*******************************************************************************
 *                              Include Files                                  *
 *******************************************************************************/
#include "stm32h7xx_hal.h"
#include "stdint.h"
 
/*******************************************************************************
 *                                  Macro                                      *
 *******************************************************************************/
// PWM ���ͨ���궨�壨��������Ӳ�������޸ģ�
#define MOTOR_TIM          htim3
#define STEERING_TIM       htim3
 
#define MOTOR_CHANNEL      TIM_CHANNEL_1   // �� TIM3_CH1
#define STEERING_CHANNEL   TIM_CHANNEL_2   // �� TIM3_CH2
 
void set_all_pwm(uint16_t duty);
void set_pwm_left();
void set_pwm_right();
void Set_Steering_PWM(int16_t steer) ;
uint32_t Map(int16_t input, int16_t in_min, int16_t in_max, uint32_t out_min, uint32_t out_max);
void Set_Motor_PWM(int16_t speed) ;
void SBUS_Control_PWM(void);
// 直接设置脉宽(微秒),用于 failsafe 或外部直接控制
void Set_Steering_Pulse(uint32_t pulse_us);
void Set_Motor_Pulse(uint32_t pulse_us);
 
 
#endif