获取扫描采样模式下指定通道的采样值
en_result_t Adc_GetScanResult(uint8_t u8Channel, uint16_t* pu16AdcResult)
{
if (NULL == pu16AdcResult)
{
return ErrorInvalidParameter;
}
switch (u8Channel)
{
case AdcExInputCH0:
*pu16AdcResult = M0P_ADC->RESULT0_f.RESULT0;
break;
case AdcExInputCH1:
*pu16AdcResult = M0P_ADC->RESULT1_f.RESULT1;
break;
case AdcExInputCH2:
*pu16AdcResult = M0P_ADC->RESULT2_f.RESULT2;
break;
case AdcExInputCH3:
*pu16AdcResult = M0P_ADC->RESULT3_f.RESULT3;
break;
case AdcExInputCH4:
*pu16AdcResult = M0P_ADC->RESULT4_f.RESULT4;
break;
case AdcExInputCH5:
*pu16AdcResult = M0P_ADC->RESULT5_f.RESULT5;
break;
case AdcExInputCH6:
*pu16AdcResult = M0P_ADC->RESULT6_f.RESULT6;
break;
case AdcExInputCH7:
*pu16AdcResult = M0P_ADC->RESULT7_f.RESULT7;
break;
default:
return ErrorInvalidParameter;
}
return Ok;
} |