| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849 |
- #ifndef _Encoder_H__
- #define _Encoder_H__
- #include "bsp/enc_intf.h"
- #include "foc/core/PI_Controller.h"
- typedef struct {
- bool b_index_found; //I 对齐
- float enc_offset;
- u8 motor_poles;
- float pwm_angle;
- u32 pwm_count;
- float abi_angle;
- float cali_angle;
- float interpolation;
- float pll_bandwidth_shadow;
- float pll_bandwidth;
- float position;
- PLL_t est_pll;
- bool b_timer_ov;
- bool b_lock_pos;
- u32 cpr;
- u32 last_cnt;
- u32 b_index_cnt;
- u32 last_us;
- s8 direction; //motor running dir, 逆时针 正,顺时针负
- float est_vel_counts; //每秒多少个计数
- float est_angle_counts;
- float rpm;
- u8 *encoder_off_count;
- s16 *encoder_off_map;
- }encoder_t;
- void encoder_init(void);
- void encoder_init_clear(void);
- float encoder_get_theta(void);
- float encoder_get_speed(void);
- void encoder_detect_offset(float angle);
- void encoder_set_direction(s8 direction);
- float encoder_get_vel_count(void);
- void encoder_lock_position(bool enable);
- bool encoder_detect_finish(void);
- float encoder_get_pwm_angle(void);
- float encoder_zero_phase_detect(void);
- bool ENC_Check_error(void);
- float encoder_get_abi_angle(void);
- float encoder_get_position(void);
- void encoder_detect_upload(void);
- #endif /* _Encoder_H__ */
|