获得Volunme的值
Volume = Get_ADC_Knob();
函数定义如下:
uint32_t Get_ADC_Knob(void)
{
uint32_t ADC_Raw_Data;
/* Clear the A/D ADI NT0 interrupt flag */
EADC_CLR_INT_FLAG(EADC, 0x1);
//Trigger sample module 0 to start A/D conversion
EADC_START_CONV(EADC, 0x1);
/* Wait ADC interrupt (g_u32AdcIntFlag will be set at IRQ_Handler function) */
while(EADC_GET_INT_FLAG(EADC, 0x1) == 0);
ADC_Raw_Data = EADC_GET_CONV_DATA(EADC, 0);
return ADC_Raw_Data;
}
EADC_GET_CONV_DATA函数的定义如下:
/**
* @brief Get the conversion data of the user-specified sample module.
* @param[in] eadc Base address of EADC module.
* @param[in] u32ModuleNum Decides the sample module number, valid value are from 0 to 18.
* @return Return the conversion data of the user-specified sample module.
* @details This macro is used to read RESULT bit (EADC_DATn[15:0], n=0~18) field to get conversion data.
*/
#define EADC_GET_CONV_DATA(eadc, u32ModuleNum) ((eadc)->DAT[(u32ModuleNum)] & EADC_DAT_RESULT_Msk)
我的问题是在函数Get_ADC_Knob()中EADC_GET_CONV_DATA(EADC, 0),u32ModuleNum的值不是已经被设定为0了吗,那么它又是如何根据我旋转按钮而最终改变volume的值的??
还是我的理解有错?volume的值究竟是如何根据我旋转MCU上的按钮而随之改变的? |