|
precision-converters-firmware
|
Implementation of AD4692 IIO application interfaces. More...
#include <string.h>#include "ad4692_user_config.h"#include "ad4692_support.h"#include "ad4692_iio.h"#include "iio_trigger.h"#include "no_os_error.h"#include "no_os_delay.h"#include "no_os_util.h"#include "no_os_alloc.h"#include "app_config.h"#include "common.h"#include "ad4692.h"#include "version.h"#include "ad4692_attrs.h"
Macros | |
| #define | AD4692_IIO_TRIGGER_NAME "ad4692_iio_trigger" |
| #define | adc_data_buffer SDRAM_START_ADDRESS |
| #define | DATA_BUFFER_SIZE SDRAM_SIZE_BYTES - (N_CYCLE_OFFSET * BYTES_PER_SAMPLE) |
| #define | DATA_BUFFER_SIZE_CONT (32768) |
| #define | AD4692_DEFAULT_CHN_SCAN |
| #define | AD4692_IIO_CH(_name, _dev, _idx) |
| #define | BUF_READ_TIMEOUT 0xffffffff |
| #define | ACC_COUNT_MIN_VAL 0 |
| #define | ACC_COUNT_MAX_VAL 64 |
| #define | ADC_MAX_COUNT_UNIPOLAR (uint32_t) ((1 << ADC_RESOLUTION) - 1) |
| #define | AD4692_SCALE (((float) (AD4692_VREF) / 1000000.0f) / (float)(ADC_MAX_COUNT_UNIPOLAR) * 1000.0f) |
| #define | AD4692_OFFSET 0 |
| #define | AD4692_MAX_PRIORITIES 2 |
| #define | AD4692_RES_16 16 |
| #define | AD4692_RES_24 24 |
Enumerations | |
| enum | ad4692_board_attribute_ids { PRIORITY , PRIORITY_AVAILABLE } |
Functions | |
| int | ad4692_iio_attr_get (void *device, char *buf, uint32_t len, const struct iio_ch_info *channel, intptr_t priv) |
| Getter/Setter for the raw, offset and scale attribute value. | |
| int | ad4692_iio_attr_set (void *device, char *buf, uint32_t len, const struct iio_ch_info *channel, intptr_t priv) |
| Setter function for AD4692 attributes. | |
| int | ad4692_iio_attr_available_get (void *device, char *buf, uint32_t len, const struct iio_ch_info *channel, intptr_t priv) |
| Attribute available getter function for AD4692 attributes. | |
| int | ad4692_iio_attr_available_set (void *device, char *buf, uint32_t len, const struct iio_ch_info *channel, intptr_t priv) |
| Attribute available setter function for AD4692 attributes. | |
| void | ad4692_data_capture_callback (void *ctx) |
| Interrupt Service Routine to monitor end of conversion event. | |
| void | iio_params_deinit (void) |
| DeInitialize the IIO parameters. | |
| int32_t | iio_adc_remove (void) |
| Remove the AD4692 Instance & IIO device. | |
| int32_t | iio_app_remove (void) |
| Remove the IIO application and free the allocated resources. | |
| int32_t | iio_app_initialize (void) |
| Initialize the AD4692 IIO Application. | |
| void | iio_app_event_handler (void) |
| Run the ad4692 IIO event handler. | |
Implementation of AD4692 IIO application interfaces.
This module acts as an interface for AD4692 IIO application
Copyright (c) 2026 Analog Devices, Inc.
This software is proprietary to Analog Devices, Inc. and its licensors. By using this software you agree to the terms of the associated Analog Devices Software License Agreement.
| #define ACC_COUNT_MAX_VAL 64 |
| #define ACC_COUNT_MIN_VAL 0 |
| #define AD4692_DEFAULT_CHN_SCAN |
| #define AD4692_IIO_CH | ( | _name, | |
| _dev, | |||
| _idx | |||
| ) |
| #define AD4692_IIO_TRIGGER_NAME "ad4692_iio_trigger" |
| #define AD4692_MAX_PRIORITIES 2 |
| #define AD4692_OFFSET 0 |
| #define AD4692_RES_16 16 |
| #define AD4692_RES_24 24 |
| #define AD4692_SCALE (((float) (AD4692_VREF) / 1000000.0f) / (float)(ADC_MAX_COUNT_UNIPOLAR) * 1000.0f) |
| #define adc_data_buffer SDRAM_START_ADDRESS |
| #define ADC_MAX_COUNT_UNIPOLAR (uint32_t) ((1 << ADC_RESOLUTION) - 1) |
| #define BUF_READ_TIMEOUT 0xffffffff |
| #define DATA_BUFFER_SIZE SDRAM_SIZE_BYTES - (N_CYCLE_OFFSET * BYTES_PER_SAMPLE) |
| #define DATA_BUFFER_SIZE_CONT (32768) |
| void ad4692_data_capture_callback | ( | void * | ctx | ) |
Interrupt Service Routine to monitor end of conversion event.
| ctx[in] | - Callback context (unused) |
| int ad4692_iio_attr_available_get | ( | void * | device, |
| char * | buf, | ||
| uint32_t | len, | ||
| const struct iio_ch_info * | channel, | ||
| intptr_t | priv | ||
| ) |
Attribute available getter function for AD4692 attributes.
| device[in,out]- | Pointer to IIO device instance |
| buf[in]- | IIO input data buffer |
| len[in]- | Number of input bytes |
| channel[in] | - input channel |
| priv[in] | - Attribute private ID |
| int ad4692_iio_attr_available_set | ( | void * | device, |
| char * | buf, | ||
| uint32_t | len, | ||
| const struct iio_ch_info * | channel, | ||
| intptr_t | priv | ||
| ) |
Attribute available setter function for AD4692 attributes.
| device[in,out]- | Pointer to IIO device instance |
| buf[in]- | IIO input data buffer |
| len[in]- | Number of input bytes |
| channel[in] | - input channel |
| priv[in] | - Attribute private ID |
| int ad4692_iio_attr_get | ( | void * | device, |
| char * | buf, | ||
| uint32_t | len, | ||
| const struct iio_ch_info * | channel, | ||
| intptr_t | priv | ||
| ) |
Getter/Setter for the raw, offset and scale attribute value.
| device[in,out]- | Pointer to IIO device instance |
| buf[in]- | IIO input data buffer |
| len[in]- | Number of input bytes |
| channel[in] | - input channel |
| priv[in] | - Attribute private ID |
| int ad4692_iio_attr_set | ( | void * | device, |
| char * | buf, | ||
| uint32_t | len, | ||
| const struct iio_ch_info * | channel, | ||
| intptr_t | priv | ||
| ) |
Setter function for AD4692 attributes.
| device[in,out]- | Pointer to IIO device instance |
| buf[in]- | IIO input data buffer |
| len[in]- | Number of expected bytes |
| channel[in] | - input channel |
| priv[in] | - Attribute private ID |
| int32_t iio_adc_remove | ( | void | ) |
Remove the AD4692 Instance & IIO device.

| void iio_app_event_handler | ( | void | ) |
Run the ad4692 IIO event handler.
Run the AD3530R IIO event handler.
| int32_t iio_app_initialize | ( | void | ) |
Initialize the AD4692 IIO Application.
Initialize the IIO interface for AD3530R IIO device.

| int32_t iio_app_remove | ( | void | ) |
Remove the IIO application and free the allocated resources.

| void iio_params_deinit | ( | void | ) |
DeInitialize the IIO parameters.

| uint8_t ad4692_acc_count[NO_OF_CHANNELS] = { 0x0 } |
| uint8_t ad4692_active_channels[NO_OF_CHANNELS] |
| volatile bool ad4692_conversion_flag = false |
| enum ad4692_data_capture_modes ad4692_data_capture_mode = BURST_DATA_CAPTURE |
| struct ad4692_desc* ad4692_dev = NULL |
| struct iio_hw_trig* ad4692_hw_trig_desc |
| struct scan_type ad4692_iio_scan_type[NUM_OF_IIO_DEVICES][NO_OF_CHANNELS] |
| enum ad4692_interface_modes ad4692_interface_mode = SPI_DMA |
| enum ad4692_int_osc_sel ad4692_osc_freq_id = AD4692_OSC_1MHZ |
| enum ad4692_readback_options ad4692_readback_option = AVERAGED_DATA |
| uint32_t ad4692_sampling_frequency |
| enum ad4692_sequencer_modes ad4692_sequencer_mode = STANDARD_SEQUENCER |
| uint16_t channel_mask = 0x1 |
| uint8_t channel_priorities[NO_OF_CHANNELS] = { 0x0 } |
| uint8_t channel_sequence[AD4692_MAX_SLOTS_AS] = { 0x0 } |
| struct iio_init_param iio_init_params |
| uint8_t n_bytes_per_transaction = AD4692_N_BYTES_TXN_16BIT |
| uint8_t n_data_bytes |
| uint8_t num_of_active_channels = 0 |
| uint8_t num_of_as_slots = 0 |
| struct stm32_spi_init_param* spi_init_param |