Hi, Andy,
First of all, as you see that the K64 has 4 FTM modules:FTM0, FTM1, FTM2 and FTM3, only FTM1 and FTM2 supports quadrature decoder function, FTM0/FTM3 which have 8 PWM channels do not support quadrature decoder function. For detailed inf, pls refer to section 3.8.2 FlexTimer Configuration in Reference Manual of K64.
As you know that the quadrature decoder should have 4 signal: PhaseA, PhaseB, Index and Home, user can use Index signal to count the revolution, use the Home signal to Reset the quadrature decoder counter. But the quaduarure decoder feature of FlexFTM module does not have Index and Home pins, in other words, the quaduarure decoder feature of FlexFTM module does not implement the quadrature decoder function fully, it only implements the position counting. For revolution function, I suppose that byou can connect the Index pin to LPTMR input pin so that the LPTMR can gives the revolution. Of course, it is okay to use GPIO interrupt function to count index, but it needs core involvement.
The code you attached is used to generate PWM signals based on FTM0 and FTM1, maybe you posted by mistake.
Hope it can help you
BR
Xiangjun Rong