| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162 |
- #ifndef _PHASE_CURRENT_H__
- #define _PHASE_CURRENT_H__
- #include "math/fix_math.h"
- typedef struct _phase_time {
- s32 A;
- s32 B;
- s32 C;
- s32 A_next;
- s32 B_next;
- s32 C_next;
- u32 Samp_p1; //单电阻方案两个采样时刻可能不是连续的
- u32 Samp_p2;
- u8 sampe_phase_1;
- u8 sampe_phase_2;
- u8 boundary3_flags;
- u8 three_shunts_flags;
- }phase_time_t; //����pwn��duty cnt
- #define IGNORE_NONE 0
- #define IGNORE_A 1
- #define IGNORE_B 2
- #define IGNORE_C 3
- #define IGNORE_ALL 4
- typedef struct current_sample {
- s32 adc_offset_a;
- s32 adc_offset_b;
- s32 adc_offset_c;
- s16 adc_ia;
- s16 adc_ib;
- s16 adc_ic;
- s16 adc_ia_filter;
- s16 adc_ib_filter;
- s16 adc_ic_filter;
- u8 c_phases;
- u8 c_ignore_phase;
- phase_time_t time;
- volatile int sample_count;
- volatile bool is_calibrating_offset;
- volatile bool is_calibrating_sensor;
- float calibrate_current;
- float sensor_samples_1;
- float sensor_samples_2;
- float sensor_k1;
- float sensor_k2;
- }current_samp_t;
- void phase_current_init(void);
- void phase_current_get(float *iABC);
- bool phase_current_offset(void);
- void phase_current_point(void *);
- void phase_current_adc_triger(void);
- void phase_current_offset_calibrate(void);
- void phase_current_calibrate_wait(void);
- void phase_current_sensor_start_calibrate(float calibrate_current);
- bool phase_current_sensor_do_calibrate(void);
- bool phase_curr_offset_check(void);
- #endif /* _PHASE_CURRENT_H__ */
|