Zephyr API Documentation 4.4.99
A Scalable Open Source RTOS
Loading...
Searching...
No Matches
adc_driver_api Struct Reference

Driver Operations ADC driver operations More...

#include <zephyr/drivers/adc.h>

Data Fields

adc_api_channel_setup channel_setup
  REQ Configure an ADC channel.
adc_api_read read
  REQ Set a read request.
adc_api_read_async read_async
  REQ Set an asynchronous read request.
adc_api_submit submit
  REQ Submit a stream request.
adc_api_get_decoder get_decoder
  OPT Get decoder APIs for that device.
uint16_t ref_internal
  REQ Internal reference voltage, in millivolts.
adc_api_ref_get ref_get
  OPT Get the current voltage for a selected reference in millivolts.

Detailed Description

Driver Operations ADC driver operations

This is the driver API structure any ADC driver needs to define. It contains function pointers to the operations the driver implements, as well as any other driver-specific constant data.

Members marked with REQ MUST be set by the driver, whereas those marked with OPT are optional.

See also
DEVICE_DT_INST_DEFINE()
DEVICE_DT_DEFINE()
DEVICE_API()

Field Documentation

◆ channel_setup

adc_api_channel_setup adc_driver_api::channel_setup

REQ Configure an ADC channel.

◆ get_decoder

adc_api_get_decoder adc_driver_api::get_decoder

OPT Get decoder APIs for that device.

Attention
Available only when the following Kconfig option is enabled: CONFIG_ADC_STREAM.

◆ read

adc_api_read adc_driver_api::read

REQ Set a read request.

◆ read_async

adc_api_read_async adc_driver_api::read_async

REQ Set an asynchronous read request.

Attention
Available only when the following Kconfig option is enabled: CONFIG_ADC_ASYNC.

◆ ref_get

adc_api_ref_get adc_driver_api::ref_get

OPT Get the current voltage for a selected reference in millivolts.

When NULL, adc_ref_get falls back to ref_internal for ADC_REF_INTERNAL and returns -ENOTSUP for other references. When implemented, return the live/runtime value (for example a cached measurement); return -ENODATA when the reference is supported but no millivolt value is known yet, or -ENOTSUP when the reference is not supported by the device.

◆ ref_internal

uint16_t adc_driver_api::ref_internal

REQ Internal reference voltage, in millivolts.

Set to 0 if internal reference is not supported. Used as the fallback for ADC_REF_INTERNAL when ref_get is NULL.

◆ submit

adc_api_submit adc_driver_api::submit

REQ Submit a stream request.

Attention
Available only when the following Kconfig option is enabled: CONFIG_ADC_STREAM.

The documentation for this struct was generated from the following file: