库函数:
void TIM_SetCompare2(TIM_TypeDef* TIMx, uint16_t Compare2)
{
/* Check the parameters */
assert_param(IS_TIM_LIST6_PERIPH(TIMx));
/* Set the Capture Compare2 Register value */
TIMx->CCR2 = Compare2;
}
uint16_t TIM_GetCapture2(TIM_TypeDef* TIMx)
{
/* Check the parameters */
assert_param(IS_TIM_LIST6_PERIPH(TIMx));
/* Get the Capture 2 Register value */
return TIMx->CCR2;
}
貌似只说CRR2=TIM_GetCapture2(TIM3)+1,因为TIM_GetCapture2的返回值是CCR2,而TIMx->CCR2 = Compare2=TIM_GetCapture2(TIM3)+1,其实就是TIM_GetCapture2=TIM_GetCapture2(TIM3)+1,所以是自加 |