Zephyr API Documentation  3.7.0-rc3
A Scalable Open Source RTOS
Loading...
Searching...
No Matches
adc_sequence Struct Reference

Structure defining an ADC sampling sequence. More...

#include <adc.h>

Data Fields

const struct adc_sequence_optionsoptions
 Pointer to a structure defining additional options for the sequence.
 
uint32_t channels
 Bit-mask indicating the channels to be included in each sampling of this sequence.
 
void * buffer
 Pointer to a buffer where the samples are to be written.
 
size_t buffer_size
 Specifies the actual size of the buffer pointed by the "buffer" field (in bytes).
 
uint8_t resolution
 ADC resolution.
 
uint8_t oversampling
 Oversampling setting.
 
bool calibrate
 Perform calibration before the reading is taken if requested.
 

Detailed Description

Structure defining an ADC sampling sequence.

Field Documentation

◆ buffer

void* adc_sequence::buffer

Pointer to a buffer where the samples are to be written.

Samples from subsequent samplings are written sequentially in the buffer. The number of samples written for each sampling is determined by the number of channels selected in the "channels" field. The values written to the buffer represent a sample from each selected channel starting from the one with the lowest ID. The buffer must be of an appropriate size, taking into account the number of selected channels and the ADC resolution used, as well as the number of samplings contained in the sequence.

◆ buffer_size

size_t adc_sequence::buffer_size

Specifies the actual size of the buffer pointed by the "buffer" field (in bytes).

The driver must ensure that samples are not written beyond the limit and it must return an error if the buffer turns out to be not large enough to hold all the requested samples.

◆ calibrate

bool adc_sequence::calibrate

Perform calibration before the reading is taken if requested.

The impact of channel configuration on the calibration process is specific to the underlying hardware. ADC implementations that do not support calibration should ignore this flag.

◆ channels

uint32_t adc_sequence::channels

Bit-mask indicating the channels to be included in each sampling of this sequence.

All selected channels must be configured with adc_channel_setup() before they are used in a sequence. The least significant bit corresponds to channel 0.

◆ options

const struct adc_sequence_options* adc_sequence::options

Pointer to a structure defining additional options for the sequence.

If NULL, the sequence consists of a single sampling.

◆ oversampling

uint8_t adc_sequence::oversampling

Oversampling setting.

Each sample is averaged from 2^oversampling conversion results. This feature may be unsupported by a given ADC hardware, or in a specific mode (e.g. when sampling multiple channels).

◆ resolution

uint8_t adc_sequence::resolution

ADC resolution.

For single-ended channels the sample values are from range: 0 .. 2^resolution - 1, for differential ones:

  • 2^(resolution-1) .. 2^(resolution-1) - 1.

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