All these TIM_GetITStatus() things could probably be replaced with tim->SR & TIM_IT_CC1 etc instead of function call.