LW21-01B/BSP/Driver/speed/speed_to_hall.h

41 lines
1.0 KiB
C
Raw Normal View History

2025-06-07 09:07:44 +00:00
#ifndef __BSP_DRIVER_SPEED_HALL_H_
#define __BSP_DRIVER_SPEED_HALL_H_
//#include "ptz_type_select.h"
#include "gd32f4xx.h"
typedef struct _speed_t {
uint32_t hallNum; //霍尔编码器次数(运行方向的)
uint32_t startTime_60ms; //开始时间
uint32_t startTime_us;
uint32_t endTime_60ms; //结束时间
uint32_t endTime_us;
uint8_t flag; //标志位
}speed_t;
typedef struct _speed_to_hall {
speed_t hori_speed_t;
speed_t vert_speed_t;
uint32_t time_60ms;
}speed_hall;
typedef enum _calculation_speed_type {
calculation_disable = 0, //未开始计算速度
calculation_enable = 1, //使能计算速度
calculation_ok = 2, //达到计算速度时间
calculation_start = 3, //开始计算速度
calculation_end = 4, //结束计算速度
}calculation_speed_type;
extern speed_hall g_speed_to_hall;
#define TIME_60MS_MAX 4000000000
#define SPEED_TIMER_PERIOD 60000
void init_hall_speed_module(void);
#endif