/* Remap the correspondence between ADC channel and analog input pins.  */
void ADC_ChRemap(CM_ADC_TypeDef *ADCx, uint8_t u8Ch, uint8_t u8AdcPin)
/* Remap the correspondence between ADC channel and analog input pins.  */
void ADC_ChRemap(CM_ADC_TypeDef *ADCx, uint8_t u8Ch, uint8_t u8AdcPin)
{
    uint8_t u8FieldOfs;
    uint8_t u8RegIdx;
    __IO uint16_t *regCHMUXR;
    DDL_ASSERT(IS_ADC_REMAP_CH(ADCx, u8Ch));
    DDL_ASSERT(IS_ADC_REMAP_PIN(ADCx, u8AdcPin));
    regCHMUXR  = (__IO uint16_t *)((uint32_t)&ADCx->CHMUXR0);
    u8RegIdx   = u8Ch / 4U;
    u8FieldOfs = (u8Ch % 4U) * 4U;
    MODIFY_REG16(regCHMUXR[u8RegIdx], ((uint32_t)ADC_CHMUXR0_CH00MUX << u8FieldOfs), ((uint32_t)u8AdcPin << u8FieldOfs));
}