7 #ifndef HPM_BLDC_DEFINE_H
8 #define HPM_BLDC_DEFINE_H
10 #if defined(__cplusplus)
20 #ifdef CONFIG_BLDC_HAS_EXTRA_CONFIG
21 #include CONFIG_BLDC_HAS_EXTRA_CONFIG
36 #define BLDC_MOTOR_DIR_FORWARD 0
37 #define BLDC_MOTOR_DIR_REVERSE 1
43 #define BLDC_PWM_PIN_UH 0
44 #define BLDC_PWM_PIN_UL 1
45 #define BLDC_PWM_PIN_VH 2
46 #define BLDC_PWM_PIN_VL 3
47 #define BLDC_PWM_PIN_WH 4
48 #define BLDC_PWM_PIN_WL 5
54 #define BLDC_MOTOR0_INDEX (1)
55 #define BLDC_MOTOR1_INDEX (2)
56 #define BLDC_MOTOR2_INDEX (3)
57 #define BLDC_MOTOR3_INDEX (4)
63 #define ADCU_INDEX (0)
64 #define ADCV_INDEX (1)
65 #define ADCW_INDEX (2)
79 #define GET_ADC_12BIT_VALID_DATA(x) ((x & 0xffff) >> 4)
120 #define BLDC_MOTOR_PARA_DEFAULTS {0, 0, 0,\
143 #define BLDC_CONTRL_SPD_PARA_DEFAULTS {0, 0, 0, 0, 0,\
162 #define BLDC_CONTRL_PID_PARA_DEFAULTS {0, 0, 0, 0,\
183 #define BLDC_CONTROL_CURRENT_PARA_DEFAULTS {0, 0, 0,\
201 #define BLDC_CONTROL_PWMOUT_PARA_DEFAULTS {0, 0, 0,\
216 #define BLDC_CONTROL_PWM_PARA_DEFAULTS {0, 0, 0, 0,\
217 BLDC_CONTROL_PWMOUT_PARA_DEFAULTS,\
228 #define BLDC_FUNC_CAL_DEFAULTS {NULL, NULL}
249 #define BLDC_CONTROL_FOC_PARA_DEFAULTS {BLDC_CONTRL_PID_PARA_DEFAULTS, BLDC_CONTRL_PID_PARA_DEFAULTS,\
250 BLDC_CONTRL_SPD_PARA_DEFAULTS, 0,\
251 BLDC_CONTROL_CURRENT_PARA_DEFAULTS, BLDC_MOTOR_PARA_DEFAULTS,\
252 BLDC_CONTROL_PWM_PARA_DEFAULTS,\
253 BLDC_FUNC_CAL_DEFAULTS,\
261 #if defined(__cplusplus)
void hpm_mcl_nullcallback_func(void)
All function pointers defined in the middleware point to this function, and if the implementation of ...
Definition: hpm_foc.c:13
bldc_hall_phase
The mounting angle of the Hall sensor, 60 degrees or 120 degrees, is an inherent property of the moto...
Definition: hpm_bldc_define.h:94
struct bldc_contrl_foc_par BLDC_CONTROL_FOC_PARA
foc control
enum bldc_hall_phase bldc_hall_phase_t
The mounting angle of the Hall sensor, 60 degrees or 120 degrees, is an inherent property of the moto...
struct bldc_control_pwm_par BLDC_CONTROL_PWM_PARA
svpwm parameters
struct hpm_motor_par hpm_motor_para_t
Motor related structure definition. Parameters that need to be initialized follow this rule Naming ru...
struct bldc_func_cal BLDC_FUNC_CAL
Location estimation function.
struct bldc_contrl_spd_par BLDC_CONTRL_SPD_PARA
Speed calculation parameters.
struct bldc_control_pwmout_par BLDC_CONTROL_PWMOUT_PARA
PWM output parameters.
struct bldc_contrl_pid_par BLDC_CONTRL_PID_PARA
pid control parameters
struct bldc_contrl_current_par BLDC_CONTROL_CURRENT_PARA
Current sampling parameters.
@ bldc_hall_phase_120
Definition: hpm_bldc_define.h:96
@ bldc_hall_phase_60
Definition: hpm_bldc_define.h:95
float HPM_MOTOR_MATH_TYPE
Definition: hpm_motor_math.h:74
Current sampling parameters.
Definition: hpm_bldc_define.h:170
HPM_MOTOR_MATH_TYPE cal_u
Definition: hpm_bldc_define.h:177
void(* func_sampl)(void *str)
Definition: hpm_bldc_define.h:181
HPM_MOTOR_MATH_TYPE cal_v
Definition: hpm_bldc_define.h:178
uint16_t adc_w
Definition: hpm_bldc_define.h:173
uint16_t adc_u_middle
Definition: hpm_bldc_define.h:174
uint16_t adc_v
Definition: hpm_bldc_define.h:172
uint16_t adc_w_middle
Definition: hpm_bldc_define.h:176
uint16_t adc_v_middle
Definition: hpm_bldc_define.h:175
void * userdata
Definition: hpm_bldc_define.h:180
uint16_t adc_u
Definition: hpm_bldc_define.h:171
HPM_MOTOR_MATH_TYPE cal_w
Definition: hpm_bldc_define.h:179
foc control
Definition: hpm_bldc_define.h:234
void(* func_dqsvpwm)(void *str, void *str1, void *str2, void *data)
Definition: hpm_bldc_define.h:247
HPM_MOTOR_MATH_TYPE ialpha
Definition: hpm_bldc_define.h:245
BLDC_FUNC_CAL pos_estimator_par
Definition: hpm_bldc_define.h:242
HPM_MOTOR_MATH_TYPE ibeta
Definition: hpm_bldc_define.h:246
BLDC_CONTRL_PID_PARA currentdpipar
Definition: hpm_bldc_define.h:235
hpm_motor_para_t motorpar
Definition: hpm_bldc_define.h:240
BLDC_CONTRL_PID_PARA currentqpipar
Definition: hpm_bldc_define.h:236
BLDC_CONTROL_CURRENT_PARA samplcurpar
Definition: hpm_bldc_define.h:239
HPM_MOTOR_MATH_TYPE electric_angle
Definition: hpm_bldc_define.h:238
BLDC_CONTRL_SPD_PARA speedcalpar
Definition: hpm_bldc_define.h:237
BLDC_CONTROL_PWM_PARA pwmpar
Definition: hpm_bldc_define.h:241
HPM_MOTOR_MATH_TYPE ubeta
Definition: hpm_bldc_define.h:244
HPM_MOTOR_MATH_TYPE ualpha
Definition: hpm_bldc_define.h:243
pid control parameters
Definition: hpm_bldc_define.h:151
HPM_MOTOR_MATH_TYPE target
Definition: hpm_bldc_define.h:156
HPM_MOTOR_MATH_TYPE cur
Definition: hpm_bldc_define.h:158
HPM_MOTOR_MATH_TYPE i_kp
Definition: hpm_bldc_define.h:152
HPM_MOTOR_MATH_TYPE i_kd
Definition: hpm_bldc_define.h:154
HPM_MOTOR_MATH_TYPE outval
Definition: hpm_bldc_define.h:159
HPM_MOTOR_MATH_TYPE i_max
Definition: hpm_bldc_define.h:155
HPM_MOTOR_MATH_TYPE i_ki
Definition: hpm_bldc_define.h:153
void(* func_pid)(void *str)
Definition: hpm_bldc_define.h:160
HPM_MOTOR_MATH_TYPE mem
Definition: hpm_bldc_define.h:157
Speed calculation parameters.
Definition: hpm_bldc_define.h:129
HPM_MOTOR_MATH_TYPE speedtheta
Definition: hpm_bldc_define.h:133
HPM_MOTOR_MATH_TYPE i_speedlooptime_s
Definition: hpm_bldc_define.h:132
void(* func_getspd)(void *str)
Definition: hpm_bldc_define.h:140
hpm_motor_para_t * i_motorpar
Definition: hpm_bldc_define.h:139
HPM_MOTOR_MATH_TYPE speedthetalastn
Definition: hpm_bldc_define.h:135
HPM_MOTOR_MATH_TYPE o_speedout
Definition: hpm_bldc_define.h:138
HPM_MOTOR_MATH_TYPE i_speedfilter
Definition: hpm_bldc_define.h:136
HPM_MOTOR_MATH_TYPE speedlasttheta
Definition: hpm_bldc_define.h:134
uint16_t i_speedacq
Definition: hpm_bldc_define.h:130
HPM_MOTOR_MATH_TYPE o_speedout_filter
Definition: hpm_bldc_define.h:137
uint16_t num
Definition: hpm_bldc_define.h:131
svpwm parameters
Definition: hpm_bldc_define.h:208
uint32_t i_pwm_reload_max
Definition: hpm_bldc_define.h:212
HPM_MOTOR_MATH_TYPE target_beta
Definition: hpm_bldc_define.h:210
HPM_MOTOR_MATH_TYPE target_alpha
Definition: hpm_bldc_define.h:209
void(* func_spwm)(void *str)
Definition: hpm_bldc_define.h:214
BLDC_CONTROL_PWMOUT_PARA pwmout
Definition: hpm_bldc_define.h:213
int8_t sector
Definition: hpm_bldc_define.h:211
PWM output parameters.
Definition: hpm_bldc_define.h:192
uint32_t pwm_w
Definition: hpm_bldc_define.h:197
uint32_t pwm_u
Definition: hpm_bldc_define.h:195
uint8_t i_sync_id
Definition: hpm_bldc_define.h:194
uint8_t i_motor_id
Definition: hpm_bldc_define.h:193
void(* func_set_pwm)(void *str)
Definition: hpm_bldc_define.h:199
uint32_t i_pwm_reload
Definition: hpm_bldc_define.h:198
uint32_t pwm_v
Definition: hpm_bldc_define.h:196
Location estimation function.
Definition: hpm_bldc_define.h:223
void * par
Definition: hpm_bldc_define.h:224
void(* func)(void *str)
Definition: hpm_bldc_define.h:225
Motor related structure definition. Parameters that need to be initialized follow this rule Naming ru...
Definition: hpm_bldc_define.h:107
float i_phasecur_a
Definition: hpm_bldc_define.h:112
float i_samplingper_s
Definition: hpm_bldc_define.h:114
float i_poles_n
Definition: hpm_bldc_define.h:109
float i_maxspeed_rs
Definition: hpm_bldc_define.h:110
void(* func_smc_const)(void *str)
Definition: hpm_bldc_define.h:117
float i_phasevol_v
Definition: hpm_bldc_define.h:113
HPM_MOTOR_MATH_TYPE o_smc_f
Definition: hpm_bldc_define.h:115
HPM_MOTOR_MATH_TYPE o_smc_g
Definition: hpm_bldc_define.h:116
float i_lstator_h
Definition: hpm_bldc_define.h:111
float i_rstator_ohm
Definition: hpm_bldc_define.h:108