/* Open QEI in specified mode and enable input.  */
void QEI_Open(QEI_T *qei, uint32_t u32Mode, uint32_t u32Value)
/* Open QEI in specified mode and enable input.  */
void QEI_Open(QEI_T *qei, uint32_t u32Mode, uint32_t u32Value)
{
    qei->CTL = (qei->CTL & (~QEI_CTL_MODE_Msk)) | ((u32Mode) | QEI_CTL_CHAEN_Msk | QEI_CTL_CHBEN_Msk | QEI_CTL_IDXEN_Msk);
    qei->CNTMAX = u32Value;
}