static void FTM0_ISR(void) { if(FTM_IsChnInterupt(HW_FTM0, HW_FTM_CH0)) { InputCaptureValue = FTM_GetChlCounter(HW_FTM0, HW_FTM_CH0); // FTM_SetMoudleCounter(HW_FTM0, 0); /* 复位计数值 */ } if(FTM_IsChnInterupt(HW_FTM0, HW_FTM_CH1)) { InputCaptureValue1 = FTM_GetChlCounter(HW_FTM0, HW_FTM_CH1); FTM_SetMoudleCounter(HW_FTM0, 0); /* 复位计数值 */ } }
static void FTM1_ISR(void) { uint32_t clock; InputCaptureValue = FTM_GetChlCounter(HW_FTM1, HW_FTM_CH0); clock = GetClock(kBusClock); FTM_SetMoudleCounter(HW_FTM1, 0); /* 复位计数值 */ InputCaptureValue = (clock/4/InputCaptureValue); /* 频率 = FTM输入时钟/分频/计数值 */ }