Introduction - If you have any usage issues, please Google them yourself
Based on the stm32f407, using the four timer 5 input capture channel to capture the two digital encoder output waveform, each encoder output two signals, there is a phase difference, which distinguish between positive and negative.