Zephyr API Documentation 4.0.0
A Scalable Open Source RTOS
|
ADC public API header file. More...
#include <zephyr/device.h>
#include <zephyr/dt-bindings/adc/adc.h>
#include <zephyr/kernel.h>
#include <zephyr/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_dt_spec |
Container for ADC channel information specified in devicetree. 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... | |
Macros | |
#define | ADC_CHANNEL_CFG_DT(node_id) |
Get ADC channel configuration from a given devicetree node. | |
#define | ADC_DT_SPEC_GET_BY_NAME(node_id, name) |
Get ADC io-channel information from devicetree by name. | |
#define | ADC_DT_SPEC_INST_GET_BY_NAME(inst, name) |
Get ADC io-channel information from a DT_DRV_COMPAT devicetree instance by name. | |
#define | ADC_DT_SPEC_GET_BY_IDX(node_id, idx) |
Get ADC io-channel information from devicetree. | |
#define | ADC_DT_SPEC_INST_GET_BY_IDX(inst, idx) |
Get ADC io-channel information from a DT_DRV_COMPAT devicetree instance. | |
#define | ADC_DT_SPEC_GET(node_id) |
Equivalent to ADC_DT_SPEC_GET_BY_IDX(node_id, 0). | |
#define | ADC_DT_SPEC_INST_GET(inst) |
Equivalent to ADC_DT_SPEC_INST_GET_BY_IDX(inst, 0). | |
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. | |
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. | |
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. | |
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. | |
Enumerations | |
enum | adc_gain { ADC_GAIN_1_6 , ADC_GAIN_1_5 , ADC_GAIN_1_4 , ADC_GAIN_1_3 , ADC_GAIN_2_5 , ADC_GAIN_1_2 , ADC_GAIN_2_3 , ADC_GAIN_4_5 , 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. | |
int | adc_channel_setup (const struct device *dev, const struct adc_channel_cfg *channel_cfg) |
Configure an ADC channel. | |
static int | adc_channel_setup_dt (const struct adc_dt_spec *spec) |
Configure an ADC channel from a struct adc_dt_spec. | |
int | adc_read (const struct device *dev, const struct adc_sequence *sequence) |
Set a read request. | |
static int | adc_read_dt (const struct adc_dt_spec *spec, const struct adc_sequence *sequence) |
Set a read request from a struct adc_dt_spec. | |
int | adc_read_async (const struct device *dev, const struct adc_sequence *sequence, struct k_poll_signal *async) |
Set an asynchronous read request. | |
static uint16_t | adc_ref_internal (const struct device *dev) |
Get the internal reference voltage. | |
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. | |
static int | adc_raw_to_millivolts_dt (const struct adc_dt_spec *spec, int32_t *valp) |
Convert a raw ADC value to millivolts using information stored in a struct adc_dt_spec. | |
static int | adc_sequence_init_dt (const struct adc_dt_spec *spec, struct adc_sequence *seq) |
Initialize a struct adc_sequence from information stored in struct adc_dt_spec. | |
static bool | adc_is_ready_dt (const struct adc_dt_spec *spec) |
Validate that the ADC device is ready. | |
ADC public API header file.