#ifndef _ROT_SPEED #define _ROT_SPEED #include "IQmathLib.h" #define SENSORS_NUMBER 10 #define SENSORS_NUMBER_ONLY_IN 6 #define IMPULSES_PER_TURN (1LL << 13) //Old sensor //#define IMPULSES_PER_TURN (1LL << 10) //New sensor #define ANGLE_RESOLUTION (1LL << 18) //2^18 typedef struct { int direct_rotor; int direct_rotor_in1; int direct_rotor_in2; int direct_rotor_angle; union { unsigned int sens_err1:1; unsigned int sens_err2:1; unsigned int reserved:14; } error; _iq iqFsensors[SENSORS_NUMBER]; _iq iqF; _iq iqFout; _iq iqFlong; _iq iqFrotFromOptica; unsigned int error_update_count; } ROTOR_VALUE; #define ROTOR_VALUE_DEFAULTS {0,0,0,0,0, {0,0,0,0,0,0,0,0},0,0,0,0,0} extern ROTOR_VALUE rotor; void Rotor_measure(void); void rotorInit(void); void update_rot_sensors(); #endif //_ROT_SPEED