60 lines
1.2 KiB
C
60 lines
1.2 KiB
C
/*
|
|
* @Author: DaMing zxm5337@163.com
|
|
* @Date: 2024-04-10 11:25:32
|
|
* @LastEditors: 张小明 zxm5337@163.com
|
|
* @LastEditTime: 2024-05-30 10:19:51
|
|
* @FilePath: \Proxi_CheckBoard\User\App\bldc.h
|
|
* @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
|
|
*/
|
|
#ifndef __BLDC_H__
|
|
#define __BLDC_H__
|
|
#include "data_type_def.h"
|
|
#include "tim.h"
|
|
|
|
#define BLDC_DEFAULT_SPEED 65000
|
|
|
|
#define SYS_CLOCK 1
|
|
#define DELAY_5S 5 * 100
|
|
|
|
#define PWM_STEP 0.0005f
|
|
|
|
#define BLDC_VELOCITY 4000
|
|
#define BLDC_FREQUENCY BLDC_VELOCITY / 60
|
|
#define BLDC_PWM_MIN 5.5f
|
|
#define BLDC_PWM_MAX 10.0f
|
|
|
|
#define A_FREQ 50.0f // 频率加速度
|
|
|
|
typedef struct bldc
|
|
{
|
|
uint32_t count;
|
|
uint32_t count2;
|
|
uint32_t duty;
|
|
float32 freq;
|
|
float32 pre_freq;
|
|
float32 velocity;
|
|
uint32_t number;
|
|
uint32_t update_cnt;
|
|
uint32_t delay_out;
|
|
} freq_t;
|
|
|
|
typedef struct
|
|
{
|
|
BOOL seal_flag;
|
|
BOOL state;
|
|
uint16_t velocity_pv;
|
|
uint16_t velocity_sv;
|
|
float32 frequency_pv;
|
|
float32 pwm;
|
|
uint16_t pulse;
|
|
} bldc_t;
|
|
|
|
extern freq_t freq_opto;
|
|
extern freq_t freq_namur;
|
|
extern bldc_t bldc_A;
|
|
|
|
void fun_ini_freq(freq_t *freq);
|
|
void fun_ctr_bldc(bldc_t *bldc);
|
|
|
|
#endif
|