void TIM4_COUNT_Config(void)
{
TIM_ICInitTypeDef TIM_ICInitStructure;
TIM_DeInit(TIM4);
TIM_ICStructInit(&TIM_ICInitStructure);
TIM_ICInitStructure.TIM_ICMode = TIM_ICMode_ICAP; //使用输入捕获模式
TIM_ICInitStructure.TIM_Channel = TIM_Channel_3; //使用TIM通道3
TIM_ICInitStructure.TIM_ICPolarity = TIM_ICPolarity_Rising; //输入捕捉 上升沿
TIM_ICInitStructure.TIM_ICSelection = TIM_ICSelection_DirectTI;
TIM_ICInitStructure.TIM_ICPrescaler = TIM_ICPSC_DIV1;
TIM_ICInitStructure.TIM_ICFilter = 0x0;
TIM_ICInit(TIM4, &TIM_ICInitStructure);
TIM_ITConfig(TIM4,TIM_IT_Update,ENABLE);
}
|