/* Sets the TIMx Autoreload Register(TIMx_ARR) value to change period.  */
void RTIM_ChangePeriodImmediate(RTIM_TypeDef *TIMx, u32 Autoreload)
/* Sets the TIMx Autoreload Register(TIMx_ARR) value to change period.  */
void RTIM_ChangePeriodImmediate(RTIM_TypeDef *TIMx, u32 Autoreload)
{
	assert_param(IS_TIM_ALL_TIM(TIMx));
	TIMx->CR &= ~TIM_CR_ARPE;
	TIMx->ARR = Autoreload;
	TIMx->EGR = TIM_PSCReloadMode_Immediate;
	while (1) {
		if (TIMx->SR & TIM_SR_UG_DONE)
			break;
	}
}