Zephyr API Documentation 4.0.0-rc2
A Scalable Open Source RTOS
|
Structure for specifying the configuration of an ADC channel. More...
#include <adc.h>
Data Fields | |
enum adc_gain | gain |
Gain selection. | |
enum adc_reference | reference |
Reference selection. | |
uint16_t | acquisition_time |
Acquisition time. | |
uint8_t | channel_id: 5 |
Channel identifier. | |
uint8_t | differential: 1 |
Channel type: single-ended or differential. | |
Structure for specifying the configuration of an ADC channel.
uint16_t adc_channel_cfg::acquisition_time |
Acquisition time.
Use the ADC_ACQ_TIME macro to compose the value for this field or pass ADC_ACQ_TIME_DEFAULT to use the default setting for a given hardware (e.g. when the hardware does not allow to configure the acquisition time). Particular drivers do not necessarily support all the possible units. Value range is 0-16383 for a given unit.
uint8_t adc_channel_cfg::channel_id |
Channel identifier.
This value primarily identifies the channel within the ADC API - when a read request is done, the corresponding bit in the "channels" field of the "adc_sequence" structure must be set to include this channel in the sampling. For hardware that does not allow selection of analog inputs for given channels, but rather have dedicated ones, this value also selects the physical ADC input to be used in the sampling. Otherwise, when it is needed to explicitly select an analog input for the channel, or two inputs when the channel is a differential one, the selection is done in "input_positive" and "input_negative" fields. Particular drivers indicate which one of the above two cases they support by selecting or not a special hidden Kconfig option named ADC_CONFIGURABLE_INPUTS. If this option is not selected, the macro CONFIG_ADC_CONFIGURABLE_INPUTS is not defined and consequently the mentioned two fields are not present in this structure. While this API allows identifiers from range 0-31, particular drivers may support only a limited number of channel identifiers (dependent on the underlying hardware capabilities or configured via a dedicated Kconfig option).
uint8_t adc_channel_cfg::differential |
Channel type: single-ended or differential.
enum adc_gain adc_channel_cfg::gain |
Gain selection.
enum adc_reference adc_channel_cfg::reference |
Reference selection.