Hi,大家好,
在通过adcBufContinuousSampling中设置 ADCBuf时,
/* Set up an ADCBuf peripheral in ADCBuf_RECURRENCE_MODE_CONTINUOUS */
ADCBuf_Params_init(&adcBufParams);
adcBufParams.callbackFxn = adcBufCallback;//当ADC缓冲区满时,调用回调函数
adcBufParams.recurrenceMode = ADCBuf_RECURRENCE_MODE_CONTINUOUS;
adcBufParams.returnMode = ADCBuf_RETURN_MODE_CALLBACK;
adcBufParams.samplingFrequency = 200;
adcBuf = ADCBuf_open(Board_ADCBuf0, &adcBufParams);
/* Configure the conversion struct */
continuousConversion.arg = NULL;
// continuousConversion.adcChannel = Board_ADCBufChannel0;
continuousConversion.adcChannel = 3;//指向第三个元素Board_DIO23_ANALOG
continuousConversion.sampleBuffer = sampleBufferOne;
continuousConversion.sampleBufferTwo = sampleBufferTwo;
continuousConversion.samplesRequestedCount = ADCBUFFERSIZE;
1. adcBufParams.samplingFrequency = 200;采样率为200k吗?
2. sampleBufferOne,sampleBufferTwo这两个是储存转换后数据的buffer吗,他们是怎么样的存储形式呢,先储存sampleBufferOne,存满后再储存到sampleBufferTwo?可以直接把其中的首地址传递到发送数据包吗?
3. 在buffer存储满后调用的adcBufCallback,其中的completedADCBuffer是怎么样获取存储数据的两个buffer的呢?
谢谢!
Susan Yang:
adcBufParams.samplingFrequency = 200000;
typedef struct ADCBuf_Conversion_ {uint16_tsamplesRequestedCount;/*!< Number of samples to convert and return */void*sampleBuffer;/*!< Buffer the results of the conversions are stored in */void*sampleBufferTwo;/*!< A second buffer that is filled in ::ADCBuf_RECURRENCE_MODE_CONTINUOUS mode whilethe first buffer is processed by the application. The value is not used in::ADCBuf_RECURRENCE_MODE_ONE_SHOT mode. */void*arg;/*!< Argument to be passed to the callback function in ::ADCBuf_RETURN_MODE_CALLBACK */uint32_tadcChannel;/*!< Channel to perform the ADC conversion on. Mapping of channel to pin or internal signal is device specific. */ } ADCBuf_Conversion;
Mings Liu:
回复 Susan Yang:
谢谢您的回复,
就是在ADCBuf_RECURRENCE_MODE_CONTINUOUS模式下,转换后的数据会先储存在sampleBufferOne,当它存储满后会被应用程序调用,此时在该模式下数据存储在sampleBufferTwo中,我这么理解对吗?
我在传递数据时,先判断sampleBufferOne是否存满,如果满的话,然后在访问sampleBufferTwo,这样有问题吗?
谢谢!