#ifndef V_ROTOR_H #define V_ROTOR_H #ifdef __cplusplus extern "C" { #endif void update_rot_sensors(void); void RotorMeasure(void); void RotorMeasurePBus(void); void rotorInit(void); int AnalisatorRotorSensorPBus(_iq d1, _iq d2, unsigned int *count_overfull_discret, unsigned int *count_zero_discret, _iq *prev_iqTimeRotor, unsigned int *discret_out, unsigned int discret_in, _iq *iqWRotorCalcBeforeRegul, _iq *iqWRotorCalc, int *RotorDirection, int modeS1, int modeS2, int valid_sensor_direct, int valid_sensor_90, unsigned int *error_count ); typedef struct { _iq iqWRotorRaw0; _iq iqWRotorRaw1; _iq iqWRotorRaw2; _iq iqWRotorRaw3; _iq iqWRotorFilter0; _iq iqWRotorFilter1; _iq iqWRotorFilter2; _iq iqWRotorFilter3; _iq iqWRotorDelta; _iq iqTimeSensor1; _iq iqTimeSensor2; _iq iqWRotorCalc1; _iq iqWRotorCalcBeforeRegul1; _iq iqWRotorCalc2; _iq iqWRotorCalcBeforeRegul2; int RotorDirection1; int RotorDirection2; _iq iqWRotorImpulses1; _iq iqWRotorImpulsesBeforeRegul1; _iq iqWRotorImpulses2; _iq iqWRotorImpulsesBeforeRegul2; } WRotorValues; #define WRotorValues_DEFAULTS {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0} typedef struct { _iq iqWRotorRaw0; _iq iqWRotorRaw1; _iq iqWRotorRaw2; _iq iqWRotorRaw3; _iq iqWRotorRawAngle1F; _iq iqWRotorRawAngle1R; _iq iqWRotorRawAngle2F; _iq iqWRotorRawAngle2R; _iq iqWRotorFilter0; _iq iqWRotorFilter1; _iq iqWRotorFilter2; _iq iqWRotorFilter3; _iq iqWRotorDelta; _iq iqWRotorCalcBeforeRegul; _iq iqWRotorCalcBeforeRegul1; _iq iqWRotorCalcBeforeRegul2; _iq iqTimeRotor1; _iq iqTimeRotor2; _iq iqTimeRotor; _iq iqWRotorCalc1; _iq iqWRotorCalc2; _iq iqWRotorCalc; int ModeAutoDiscret; int RotorDirection1; int RotorDirection2; _iq iqAngle1F; _iq iqAngle1R; _iq iqAngle2F; _iq iqAngle2R; _iq iqAngleCalc; } WRotorValuesAngle; #define WRotorValuesAngle_DEFAULTS {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0} extern WRotorValues WRotor; extern WRotorValuesAngle WRotorPBus; //#define NORMA_WROTOR 15 #define IQ_WROTOR_MAX_MIN_DELTA 3744914286 //17920 #define NORMA_ANGLE 360 #define WRMP_COEF 0.001 // 0.24 Hz per sec #define IQ_CONST_3 50331648 #define COUNT_DECODER_ZERO_WROTORPBus 65535 //0x00fe5000//0x01fca000 #define COUNT_DECODER_ZERO_WROTOR 65500 //0x00fe5000//0x01fca000 #define COUNT_DECODER_MAX_WROTOR 10 #ifdef __cplusplus } #endif #endif