| 123456789101112131415161718192021222324252627282930313233343536373839404142434445 |
- #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 interpolation;
- float pll_bandwidth_shadow;
- float pll_bandwidth;
- float postion;
- 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(s8 direction);
- 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);
- #endif /* _Encoder_H__ */
|