#define F_u 50 #define T_t (1/F_u) #define alpha_max 180 #define alpha_min 0 #define steps 20 #define TIM_PRESCAL 8 #define TIM_PERIOD 10000 #define TIM_F (8000000/TIM_PRESCAL) #define TIM_UPD_F (8000000/TIM_PRESCAL/TIM_PERIOD) #define Tstab 1 //#define alpha2cnt(_alpha_) ((_alpha_)*Ft/(2*180)/f) #define alpha2cnt(_alpha_) (uint16_t)(TIM_PERIOD*(_alpha_)/180) #define UpdatePWM(_alpha_) TIM1->CCR1 = alpha2cnt(_alpha_); TIM2->CCR1 = alpha2cnt(_alpha_); TIM3->CCR1 = alpha2cnt(_alpha_)