/* This API configures ADC module to be ready for convert the input from selected channel.  */
void ADC_Open(ADC_T *adc, uint32_t u32InputMode, uint32_t u32OpMode, uint32_t u32ChMask)
/* This API configures ADC module to be ready for convert the input from selected channel.  */
void ADC_Open(ADC_T *adc, uint32_t u32InputMode, uint32_t u32OpMode, uint32_t u32ChMask)
{
    uint32_t u32Ch = 0, i;
    if (u32InputMode == ADC_INPUT_MODE_NORMAL_CONV)
    {
        for (i = 0; i < ADC_CH_NUM; i++)
        {
            if (u32ChMask & (1 << i))
            {
                u32Ch = i;
                break;
            }
        }
        adc->CONF = (u32Ch << ADC_CONF_CHSEL_Pos) | u32OpMode | ADC_CONF_NACEN_Msk;
    }
    else if (u32InputMode == ADC_INPUT_MODE_4WIRE_TOUCH)
    {
        adc->CONF = 0;
    }
    else
    {
        adc->CTL |= ADC_CTL_WMSWCH_Msk;
        adc->CONF = 0;
    }
}