Zephyr API Documentation  2.7.0-rc2
A Scalable Open Source RTOS
adc.h File Reference

ADC public API header file. More...

#include <device.h>
#include <dt-bindings/adc/adc.h>
#include <syscalls/adc.h>

Go to the source code of this file.

Data Structures

struct  adc_channel_cfg
 Structure for specifying the configuration of an ADC channel. More...
 
struct  adc_sequence_options
 Structure defining additional options for an ADC sampling sequence. More...
 
struct  adc_sequence
 Structure defining an ADC sampling sequence. More...
 
struct  adc_driver_api
 ADC driver API. More...
 

Typedefs

typedef enum adc_action(* adc_sequence_callback) (const struct device *dev, const struct adc_sequence *sequence, uint16_t sampling_index)
 Type definition of the optional callback function to be called after a requested sampling is done. More...
 
typedef int(* adc_api_channel_setup) (const struct device *dev, const struct adc_channel_cfg *channel_cfg)
 Type definition of ADC API function for configuring a channel. See adc_channel_setup() for argument descriptions. More...
 
typedef int(* adc_api_read) (const struct device *dev, const struct adc_sequence *sequence)
 Type definition of ADC API function for setting a read request. See adc_read() for argument descriptions. More...
 
typedef int(* adc_api_read_async) (const struct device *dev, const struct adc_sequence *sequence, struct k_poll_signal *async)
 Type definition of ADC API function for setting an asynchronous read request. See adc_read_async() for argument descriptions. More...
 

Enumerations

enum  adc_gain {
  ADC_GAIN_1_6 , ADC_GAIN_1_5 , ADC_GAIN_1_4 , ADC_GAIN_1_3 ,
  ADC_GAIN_1_2 , ADC_GAIN_2_3 , ADC_GAIN_1 , ADC_GAIN_2 ,
  ADC_GAIN_3 , ADC_GAIN_4 , ADC_GAIN_6 , ADC_GAIN_8 ,
  ADC_GAIN_12 , ADC_GAIN_16 , ADC_GAIN_24 , ADC_GAIN_32 ,
  ADC_GAIN_64 , ADC_GAIN_128
}
 ADC channel gain factors. More...
 
enum  adc_reference {
  ADC_REF_VDD_1 , ADC_REF_VDD_1_2 , ADC_REF_VDD_1_3 , ADC_REF_VDD_1_4 ,
  ADC_REF_INTERNAL , ADC_REF_EXTERNAL0 , ADC_REF_EXTERNAL1
}
 ADC references. More...
 
enum  adc_action { ADC_ACTION_CONTINUE = 0 , ADC_ACTION_REPEAT , ADC_ACTION_FINISH }
 Action to be performed after a sampling is done. More...
 

Functions

int adc_gain_invert (enum adc_gain gain, int32_t *value)
 Invert the application of gain to a measurement value. More...
 
static int adc_raw_to_millivolts (int32_t ref_mv, enum adc_gain gain, uint8_t resolution, int32_t *valp)
 Convert a raw ADC value to millivolts. More...
 
int adc_channel_setup (const struct device *dev, const struct adc_channel_cfg *channel_cfg)
 Configure an ADC channel. More...
 
int adc_read (const struct device *dev, const struct adc_sequence *sequence)
 Set a read request. More...
 
int adc_read_async (const struct device *dev, const struct adc_sequence *sequence, struct k_poll_signal *async)
 Set an asynchronous read request. More...
 
static uint16_t adc_ref_internal (const struct device *dev)
 Get the internal reference voltage. More...
 

Detailed Description

ADC public API header file.