| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455 |
- #ifndef _PHASE_CURRENT_H__
- #define _PHASE_CURRENT_H__
- #include "math/fix_math.h"
- /* boundary zone definition */
- #define REGULAR ((uint8_t)0u)
- #define BOUNDARY_1 ((uint8_t)1u) /* Two small, one big */
- #define BOUNDARY_2 ((uint8_t)2u) /* Two big, one small */
- #define BOUNDARY_3 ((uint8_t)3u) /* Three equal */
- #define SAMP_NO 0u
- #define SAMP_IA 1u
- #define SAMP_IB 2u
- #define SAMP_IC 3u
- #define SAMP_NIA 4u
- #define SAMP_NIB 5u
- #define SAMP_NIC 6u
- #define SAMP_OLDA 7u
- #define SAMP_OLDB 8u
- #define SAMP_OLDC 9u
- 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
- 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;
- u8 sector;
- phase_time_t time;
- volatile int offset_sample_count;
- bool is_calibrating_offset;
- }current_samp_t;
- void phase_current_init(void);
- void phase_current_get(s16 *iABC);
- bool phase_current_offset(void);
- void phase_current_point(void *);
- void phase_current_adc_triger(void);
- void phase_current_start_cali(void);
- #endif /* _PHASE_CURRENT_H__ */
|