|
precision-converters-firmware
|
Implementation of ad559xr IIO application interfaces. More...
#include <string.h>#include <stdlib.h>#include "ad559xr_user_config.h"#include "ad559xr_iio.h"#include "no_os_error.h"#include "no_os_delay.h"#include "no_os_util.h"#include "app_config.h"#include "iio_trigger.h"#include "version.h"
Macros | |
| #define | AD559XR_IIO_TRIGGER_NAME "ad559xr_iio_trigger" |
| #define | NUM_OF_IIO_DEVICES 3 |
| #define | NO_OF_CHANNELS 8 |
| #define | GPIO_BIT 1 |
| #define | SAMPLING_FREQUENCY 1 |
| #define | DATA_BUFFER_SIZE (32768) |
| #define | AD559XR_CHN_ATTR(_name, _priv) |
| #define | AD559XR_GPIO_ATTR(_name, _priv) |
| #define | AD559XR_DEFAULT_CHN_SCAN |
| #define | AD559XR_GPIO_CHN_SCAN |
| #define | AD559XR_CHN_AVAIL_ATTR(_name, _priv) |
| #define | AD559XR_CH(_name, _dev, _idx, _type) |
| #define | AD5592R_REG_ADC_SEQ_ADDR_MSK(x) ((x >> 12) & 0x0F) |
| #define | MAX_ADC_CODE 4095.0 |
| #define | ADC_GAIN_LOW_CONVERSION_VALUE 2.654 |
| #define | ADC_GAIN_HIGH_CONVERSION_VALUE 1.327 |
| #define | TEMP_SAMPLE_SIZE 5 |
| #define | GPIO_CHANNEL_NAME_SIZE 6 |
| #define | CHANNEL_NAME_SIZE 9 |
Enumerations | |
| enum | ad559xr_attribute_ids { IIO_RAW , IIO_SCALE , IIO_OFFSET , POWER_DOWN , CH_MODE , CH_OFFSTATE , NUM_OF_CHN_ATTR , ADC_SAMPLING_FREQUENCY , ADC_RANGE , DAC_RANGE , REF_SELECT , VREF_IN_V , TEMP , ADC_BUFFER , LDAC_MODE , REPETITION , DEVICE_NAME , RESTART_IIO_ATTR_ID , NUM_OF_DEV_ATTR = RESTART_IIO_ATTR_ID - NUM_OF_CHN_ATTR } |
| enum | device_name { AD5592R , AD5593R } |
Functions | |
| int | ad559xr_read_die_temp (float *result) |
| Reads the temperature of the die. | |
| void | ad559xr_get_scale (uint8_t chn) |
| Function to get scale value. | |
| int | ad559xr_set_rep_bit (bool rep_status) |
| Function to set rep bit in adc sequencer. | |
| int | ad5592r_read_converted_data (struct ad5592r_dev *dev, uint16_t *values) |
| Read the converted data for channels enabled. | |
| int | ad5593r_read_converted_data (struct ad5592r_dev *dev, uint16_t *values) |
| Read the converted data for channels enabled. | |
| int | ad559xr_start_data_capture (void) |
| Start the ADC data capture. | |
| int | ad559xr_end_data_capture (void) |
| End the ADC data capture. | |
| int32_t | ad559xr_trigger_handler (struct iio_device_data *iio_dev_data) |
| Push data into IIO buffer when trigger handler IRQ is invoked. | |
| int32_t | iio_app_initialize (void) |
| Initialize the ad559xr IIO Interface. | |
| void | iio_app_event_handler (void) |
| Run the ad559xr IIO event handler. | |
Variables | |
| struct scan_type | ad559xr_iio_scan_type [NUM_OF_IIO_DEVICES][NO_OF_CHANNELS] |
| struct iio_device * | p_iio_ad559xr_dev [NUM_OF_IIO_DEVICES] |
| struct ad5592r_dev * | ad559xr_dev_inst = NULL |
| float | attr_scale [NO_OF_CHANNELS] |
| uint16_t | dac_value |
| uint8_t | num_of_active_channels = 0 |
| uint32_t | channel_mask |
| uint8_t | ad559xr_channels = 0 |
| bool | device_select = false |
| bool | gpio_enabled = false |
| bool | gpio_unused_enabled = false |
| bool | gpio_cached_val [NO_OF_CHANNELS] |
| uint8_t | active_device = AD5592R |
| uint16_t | addl_offset [NO_OF_CHANNELS] = { 0, 3000, 3000, 5500, 8500, 10500, 11500, 13500 } |
| uint8_t | non_gpio_channels [NO_OF_CHANNELS] |
| uint8_t | num_non_gpio_channels = 0 |
Implementation of ad559xr IIO application interfaces.
This module acts as an interface for ad559xr 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 AD5592R_REG_ADC_SEQ_ADDR_MSK | ( | x | ) | ((x >> 12) & 0x0F) |
| #define AD559XR_CH | ( | _name, | |
| _dev, | |||
| _idx, | |||
| _type | |||
| ) |
| #define AD559XR_CHN_ATTR | ( | _name, | |
| _priv | |||
| ) |
| #define AD559XR_CHN_AVAIL_ATTR | ( | _name, | |
| _priv | |||
| ) |
| #define AD559XR_DEFAULT_CHN_SCAN |
| #define AD559XR_GPIO_ATTR | ( | _name, | |
| _priv | |||
| ) |
| #define AD559XR_GPIO_CHN_SCAN |
| #define AD559XR_IIO_TRIGGER_NAME "ad559xr_iio_trigger" |
| #define ADC_GAIN_HIGH_CONVERSION_VALUE 1.327 |
| #define ADC_GAIN_LOW_CONVERSION_VALUE 2.654 |
| #define CHANNEL_NAME_SIZE 9 |
| #define DATA_BUFFER_SIZE (32768) |
| #define GPIO_BIT 1 |
| #define GPIO_CHANNEL_NAME_SIZE 6 |
| #define MAX_ADC_CODE 4095.0 |
| #define NO_OF_CHANNELS 8 |
| #define NUM_OF_IIO_DEVICES 3 |
| #define SAMPLING_FREQUENCY 1 |
| #define TEMP_SAMPLE_SIZE 5 |
| enum device_name |
| int ad5592r_read_converted_data | ( | struct ad5592r_dev * | dev, |
| uint16_t * | values | ||
| ) |
Read the converted data for channels enabled.
| dev[in] | - IIO device instance |
| values[in,out] | - ADC raw values |

| int ad5593r_read_converted_data | ( | struct ad5592r_dev * | dev, |
| uint16_t * | values | ||
| ) |
Read the converted data for channels enabled.
| dev[in] | - IIO device instance |
| values[in,out] | - ADC raw values |

| int ad559xr_end_data_capture | ( | void | ) |
End the ADC data capture.
| void ad559xr_get_scale | ( | uint8_t | chn | ) |
Function to get scale value.
| chn[in] | - Channel number |
| int ad559xr_read_die_temp | ( | float * | result | ) |
Reads the temperature of the die.
Sets the devices to perform a temperature readback. Performs a number of samples based on TEMP_SAMPLE_SIZE
| result[out] | - Result of the ADC Temp Channel |
| int ad559xr_set_rep_bit | ( | bool | rep_status | ) |
Function to set rep bit in adc sequencer.
| rep_status[in] | - Status of repeat bit |

| int ad559xr_start_data_capture | ( | void | ) |
Start the ADC data capture.
| int32_t ad559xr_trigger_handler | ( | struct iio_device_data * | iio_dev_data | ) |
Push data into IIO buffer when trigger handler IRQ is invoked.
| iio_dev_data[in] | - IIO device data instance |
| void iio_app_event_handler | ( | void | ) |
Run the ad559xr IIO event handler.
Run the AD3530R IIO event handler.
| int32_t iio_app_initialize | ( | void | ) |
Initialize the ad559xr IIO Interface.
Initialize the IIO interface for AD3530R IIO device.

| uint8_t active_device = AD5592R |
| uint8_t ad559xr_channels = 0 |
| struct ad5592r_dev* ad559xr_dev_inst = NULL |
| struct scan_type ad559xr_iio_scan_type[NUM_OF_IIO_DEVICES][NO_OF_CHANNELS] |
| uint16_t addl_offset[NO_OF_CHANNELS] = { 0, 3000, 3000, 5500, 8500, 10500, 11500, 13500 } |
| float attr_scale[NO_OF_CHANNELS] |
| uint32_t channel_mask |
| uint16_t dac_value |
| bool device_select = false |
| bool gpio_cached_val[NO_OF_CHANNELS] |
| bool gpio_enabled = false |
| bool gpio_unused_enabled = false |
| uint8_t non_gpio_channels[NO_OF_CHANNELS] |
| uint8_t num_non_gpio_channels = 0 |
| uint8_t num_of_active_channels = 0 |
| struct iio_device* p_iio_ad559xr_dev[NUM_OF_IIO_DEVICES] |