ADCBuf_Handle
/*!
* @brief ADC driver's custom @ref driver_configuration "configuration"
* structure.
* @sa ADCBuf_init()
* @sa ADCBuf_open()
*/
typedef struct ADCBuf_Config
{
/*! Pointer to a @ref driver_function_table "function pointer table"
* with driver-specific implementations of ADC APIs */
const ADCBuf_FxnTable *fxnTablePtr;
/*! Pointer to a driver specific @ref driver_objects "data object". */
void *object;
/*! Pointer to a driver specific @ref driver_hardware_attributes
* "hardware attributes structure". */
void const *hwAttrs;
} ADCBuf_Config;
ADCBuf_Params
/*!
* @brief ADCBuf parameters used with ADCBuf_open().
*
* #ADCBuf_Params_init() must be called prior to setting fields in
* this structure.
*
* @sa ADCBuf_Params_init()
*/
typedef struct
{
/*!
* Timeout in system clock ticks. This value is only valid when using
* #ADCBuf_RETURN_MODE_BLOCKING. A call to ADCBuf_convert() will block
* for a duration up to @p blockingTimeout ticks. The call to
* ADCBuf_convert() will return prior if the requested number of samples
* in #ADCBuf_Conversion.samplesRequestedCount are completed. The
* @p blockingTimeout should be large enough to allow for
* #ADCBuf_Conversion.samplesRequestedCount samples to be collected
* given the #ADCBuf_Params.samplingFrequency.
*
* @sa #ADCBuf_RETURN_MODE_BLOCKING
*/
uint32_t blockingTimeout;
/*!
* The frequency at which the ADC will sample in Hertz (Hz). After a
* call to ADCBuf_convert(), the ADC will perform @p samplingFrequency
* samples per second.
* 模数转换器采样的频率,单位为赫兹(Hz)。在调用ADCBuf_convert()之后,ADC将执行@p samplingFrequency每秒采样。
*/
uint32_t samplingFrequency;
/*! #ADCBuf_Return_Mode for all conversions. */
ADCBuf_Return_Mode returnMode;
/*!
* Pointer to a #ADCBuf_Callback function to be invoked after a
* conversion completes when operating in #ADCBuf_RETURN_MODE_CALLBACK.
*/
ADCBuf_Callback callbackFxn;
/*! #ADCBuf_Recurrence_Mode for all conversions. */
ADCBuf_Recurrence_Mode recurrenceMode;
/*! Pointer to a device specific extension of the #ADCBuf_Params */
void *custom;
} ADCBuf_Params;
ADCBuf_Conversion
/*!
* @brief Defines a conversion to be used with ADCBuf_convert().
*
* @sa ADCBuf_convert()
* @sa #ADCBuf_Recurrence_Mode
* @sa #ADCBuf_Return_Mode
*/
typedef struct
{
/*!
* Defines the number of samples to be performed on the
* ADCBuf_Conversion.channel. The application buffers provided by
* #ADCBuf_Conversion.sampleBuffer and #ADCBuf_Conversion.sampleBufferTwo
* must be large enough to hold @p samplesRequestedCount samples.
*/
uint16_t samplesRequestedCount;
/*!
* Buffer to store ADCBuf conversion results. This buffer must be at least
* (#ADCBuf_Conversion.samplesRequestedCount * 2) bytes. When using
* #ADCBuf_RECURRENCE_MODE_ONE_SHOT, only this buffer is used.
*/
void *sampleBuffer;
/*!
* Buffer to store ADCBuf conversion results. This buffer must be at least
* (#ADCBuf_Conversion.samplesRequestedCount * 2) bytes. When using
* #ADCBuf_RECURRENCE_MODE_ONE_SHOT, this buffer is not used. When
* using #ADCBuf_RECURRENCE_MODE_CONTINUOUS, this must point to
* a valid buffer.
*
* @sa #ADCBuf_RECURRENCE_MODE_CONTINUOUS
*/
void *sampleBufferTwo;
/*!
* Pointer to a custom argument to be passed to the #ADCBuf_Callback
* function via the #ADCBuf_Conversion structure.
*
* @note The #ADCBuf_Callback function is only called when operating in
* #ADCBuf_RETURN_MODE_CALLBACK.
*
* @sa #ADCBuf_RETURN_MODE_CALLBACK
* @sa #ADCBuf_Callback
*/
void *arg;
/*!
* ADCBuf channel to perform conversions on. Mapping of channel to pin or
* internal signal is device specific. Refer to the device specific
* implementation.
*/
uint32_t adcChannel;
} ADCBuf_Conversion;
网友评论