74 lines
2.1 KiB
C
74 lines
2.1 KiB
C
#ifndef __L6235D_H_
|
|
#define __L6235D_H_
|
|
#include <includes.h>
|
|
#include "gd32f4xx_gpio.h"
|
|
#include "ptz_type_select.h"
|
|
#ifdef L6235D
|
|
|
|
//中断里面使用
|
|
#define L6235D_HORI_H1_PIN 13
|
|
#define L6235D_HORI_H2_PIN 14
|
|
#define L6235D_HORI_H3_PIN 15
|
|
|
|
#define L6235D_VERT_H1_PIN 6
|
|
#define L6235D_VERT_H2_PIN 7
|
|
#define L6235D_VERT_H3_PIN 8
|
|
|
|
|
|
//水平电机,水平电机PD11-EN,PD12-F/R,PD10-BRK
|
|
//DrvGPIO_ClrBit(L6235D_HORI_DIAG_PORT,L6235D_HORI_DIAG_PIN);
|
|
#define L6235D_HORI_REV gpio_bit_reset(GPIOD,GPIO_PIN_12)
|
|
#define L6235D_HORI_FWD gpio_bit_set(GPIOD,GPIO_PIN_12)
|
|
|
|
#define L6235D_HORI_BRAKE_STOP gpio_bit_reset(GPIOD,GPIO_PIN_10)
|
|
#define L6235D_HORI_BRAKE_START gpio_bit_set(GPIOD,GPIO_PIN_10)
|
|
|
|
#define L6235D_HORI_EN_ENABLE gpio_bit_set(GPIOD,GPIO_PIN_11)
|
|
#define L6235D_HORI_EN_DISABLE gpio_bit_reset(GPIOD,GPIO_PIN_11)
|
|
|
|
/****************************************************************/
|
|
|
|
//垂直电机PA8-EN,PA11-F/R,PC9-BRK
|
|
//DrvGPIO_ClrBit(L6235D_VERT_DIAG_PORT,L6235D_VERT_DIAG_PIN);
|
|
#define L6235D_VERT_REV gpio_bit_reset(GPIOA,GPIO_PIN_11)
|
|
#define L6235D_VERT_FWD gpio_bit_set(GPIOA,GPIO_PIN_11)
|
|
|
|
#define L6235D_VERT_BRAKE_STOP gpio_bit_reset(GPIOC,GPIO_PIN_9)
|
|
#define L6235D_VERT_BRAKE_START gpio_bit_set(GPIOC,GPIO_PIN_9)
|
|
|
|
#define L6235D_VERT_EN_ENABLE gpio_bit_set(GPIOA,GPIO_PIN_8)
|
|
#define L6235D_VERT_EN_DISABLE gpio_bit_reset(GPIOA,GPIO_PIN_8)
|
|
|
|
/****************************************************************/
|
|
|
|
|
|
///电机转动方向
|
|
///电机正转
|
|
#define L6235D_MOTOR_DIR_FWD 0
|
|
///电机反转
|
|
#define L6235D_MOTOR_DIR_REV 1
|
|
|
|
///电机是否刹车
|
|
///电机刹车
|
|
#define L6235D_MOTOR_STOP 0
|
|
///电机启动
|
|
#define L6235D_MOTOR_START 1
|
|
|
|
#define L6235D_HALL_H1 1 //霍尔传感器1
|
|
#define L6235D_HALL_H2 2 //霍尔传感器2
|
|
#define L6235D_HALL_H3 3 //霍尔传感器3
|
|
|
|
|
|
#define L6235D_HALL_SAVE_NUM 100//霍尔状态保存总数
|
|
|
|
void l6235d_init();
|
|
char l6235d_hori_set_direction(char dir);
|
|
char l6235d_vert_set_direction(char dir);
|
|
char l6235d_hori_start_stop(char flag);
|
|
char l6235d_vert_start_stop(char flag);
|
|
//DAC输出
|
|
void dac_hori_vr(unsigned int Vref);
|
|
void dac_vert_vr(unsigned int Vref);
|
|
|
|
#endif
|
|
#endif |