73 lines
1.7 KiB
C
73 lines
1.7 KiB
C
#ifndef __FULL_BRIDGE_H_
|
|
#define __FULL_BRIDGE_H_
|
|
#include "gd32f4xx_it.h"
|
|
#include "includes.h"
|
|
|
|
|
|
/* 驱动器电源控制引脚 */
|
|
|
|
#define H_BRIDGE_POWER_OFF gpio_bit_reset(GPIOE,GPIO_PIN_0)
|
|
#define H_BRIDGE_POWER_ON gpio_bit_set(GPIOE,GPIO_PIN_0)
|
|
|
|
#define V_BRIDGE_POWER_OFF gpio_bit_reset(GPIOE,GPIO_PIN_1)
|
|
#define V_BRIDGE_POWER_ON gpio_bit_set(GPIOE,GPIO_PIN_1)
|
|
|
|
|
|
|
|
|
|
//H_EN1--PC9//H_EN2--PA8//H_EN3--PA11
|
|
#define H_EN1_ON gpio_bit_set(GPIOC,GPIO_PIN_9)//此版栅极驱动器下半桥为反向电平信号
|
|
#define H_EN1_OFF gpio_bit_reset(GPIOC,GPIO_PIN_9)
|
|
|
|
#define H_EN2_ON gpio_bit_set(GPIOA,GPIO_PIN_8)
|
|
#define H_EN2_OFF gpio_bit_reset(GPIOA,GPIO_PIN_8)
|
|
|
|
#define H_EN3_ON gpio_bit_set(GPIOA,GPIO_PIN_11)
|
|
#define H_EN3_OFF gpio_bit_reset(GPIOA,GPIO_PIN_11)
|
|
|
|
|
|
//V_EN1--PD10//V_EN2--PD11//V_EN3--PD15
|
|
#define V_EN1_ON gpio_bit_set(GPIOD,GPIO_PIN_10)
|
|
#define V_EN1_OFF gpio_bit_reset(GPIOD,GPIO_PIN_10)
|
|
|
|
#define V_EN2_ON gpio_bit_set(GPIOD,GPIO_PIN_11)
|
|
#define V_EN2_OFF gpio_bit_reset(GPIOD,GPIO_PIN_11)
|
|
|
|
#define V_EN3_ON gpio_bit_set(GPIOD,GPIO_PIN_15)
|
|
#define V_EN3_OFF gpio_bit_reset(GPIOD,GPIO_PIN_15)
|
|
|
|
|
|
|
|
typedef struct _HALL_State_
|
|
{
|
|
unsigned char Hall_H1_state;
|
|
unsigned char Hall_H2_state;
|
|
unsigned char Hall_H3_state;
|
|
unsigned char Hall_value;
|
|
}HALL_State;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void h_pwm_duty_change(unsigned int pwm_duty);
|
|
void v_pwm_duty_change(unsigned int pwm_duty);
|
|
void h_bldc_six_step();
|
|
void v_bldc_six_step();
|
|
void bridge_io_init(void);
|
|
|
|
void v_stop_motor();
|
|
void h_stop_motor();
|
|
void h_start_motor();
|
|
void v_start_motor();
|
|
|
|
|
|
|
|
void vert_dir_speed_start(unsigned int verf);
|
|
void vert_dir_speed_stop();
|
|
|
|
|
|
void hori_dir_speed_start(unsigned int verf);
|
|
void hori_dir_speed_stop();
|
|
#endif |