precision-converters-firmware
Loading...
Searching...
No Matches
Macros | Enumerations | Functions | Variables
ad717x_iio.c File Reference

Source file for the AD717x IIO Application. More...

#include <stdio.h>
#include <string.h>
#include "ad717x_user_config.h"
#include "app_config.h"
#include "ad717x_iio.h"
#include "ad717x.h"
#include "iio.h"
#include "no_os_util.h"
#include "no_os_error.h"
#include "no_os_alloc.h"
#include "common.h"
#include "iio_trigger.h"
#include "ad717x_support.h"
#include "ad717x_system_config.h"
#include "version.h"
Include dependency graph for ad717x_iio.c:

Macros

#define BYTES_PER_SAMPLE   sizeof(uint32_t)
 
#define CHN_STORAGE_BITS   (BYTES_PER_SAMPLE * 8)
 
#define AD717x_OW_DETECT_THRESHOLD_IN_MV   300
 
#define AD717x_OW_DETECT_SE_CHN_A   0
 
#define AD717x_OW_DETECT_SE_CHN_B   15
 
#define AD717x_OW_DETECT_DIFF_CHN_A   1
 
#define AD717x_OW_DETECT_DIFF_CHN_B   2
 
#define AD717x_TEMP_SENSITIVITY   0.000477
 
#define AD717x_ABSOLUTE_ZERO_IN_CELSIUS   273.15
 
#define AD717x_DATA_BUFFER_SIZE   (8192)
 
#define AD717x_SCAN
 
#define AD717x_CHANNEL(_name, _priv)
 
#define AD717x_CHANNEL_AVAIL(_name, _priv)
 
#define IIO_AD411x_CHANNEL(_idx)
 
#define IIO_AD717x_CHANNEL(_idx)
 
#define DATA_BUFFER_SIZE   (32768)
 
#define AD717X_IIO_TRIGGER_NAME   "ad717x_iio_trigger"
 
#define NUM_OF_IIO_DEVICES   2
 
#define AD717x_CONV_TIMEOUT   10000
 
#define AD717x_OW_NUM_DIFF_OPTIONS   4
 

Enumerations

enum  ad717x_attribute_ids {
  AD717x_RAW_ATTR_ID ,
  AD717x_SCALE_ATTR_ID ,
  AD717x_OFFSET_ATTR_ID ,
  AD717x_ANALOG_INPUT_ID ,
  AD717x_ANALOG_INPUT_P_ID ,
  AD717x_ANALOG_INPUT_N_ID ,
  AD717x_SAMPLING_FREQUENCY_ID ,
  AD717x_OPEN_WIRE_ID ,
  AD717x_STATUS_ATTR_ID ,
  AD717x_TEMPERATURE_ATTR_ID ,
  AD717x_CALIBRATE_ATTR_ID ,
  AD717x_OPEN_WIRE_INPUT_ID
}
 

Functions

int32_t ad717x_trigger_cont_data_capture (void)
 Function to prepare the ADC for continuous capture.
 
int32_t ad717x_stop_cont_data_capture (void)
 Function to stop continuous data capture.
 
int32_t ad717x_trigger_handler (struct iio_device_data *iio_dev_data)
 
int32_t iio_ad717x_init (struct iio_device **desc)
 Init for reading/writing and parameterization of a AD717x IIO device.
 
int32_t iio_app_remove (void)
 Remove the IIO interface for AD717X IIO device.
 
int32_t iio_app_initialize (void)
 Initialize the AD717x IIO Interface.
 
void iio_app_event_handler (void)
 Run the AD717x IIO event handler.
 

Variables

int8_t adc_data_buffer [DATA_BUFFER_SIZE]
 
ad717x_dev * p_ad717x_dev_inst = NULL
 

Detailed Description

Source file for the AD717x IIO Application.

Copyright (c) 2021-23,2025-26 Analog Devices, Inc. All rights reserved.

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.

Macro Definition Documentation

◆ AD717x_ABSOLUTE_ZERO_IN_CELSIUS

#define AD717x_ABSOLUTE_ZERO_IN_CELSIUS   273.15

◆ AD717x_CHANNEL

#define AD717x_CHANNEL (   _name,
  _priv 
)
Value:
{\
.name = _name,\
.priv = _priv,\
.show = get_adc_attribute,\
.store = set_adc_attribute\
}

◆ AD717x_CHANNEL_AVAIL

#define AD717x_CHANNEL_AVAIL (   _name,
  _priv 
)
Value:
{\
.name = _name,\
.priv = _priv,\
.show = get_adc_available_attribute,\
.store = set_adc_available_attribute\
}

◆ AD717x_CONV_TIMEOUT

#define AD717x_CONV_TIMEOUT   10000

◆ AD717x_DATA_BUFFER_SIZE

#define AD717x_DATA_BUFFER_SIZE   (8192)

◆ AD717X_IIO_TRIGGER_NAME

#define AD717X_IIO_TRIGGER_NAME   "ad717x_iio_trigger"

◆ AD717x_OW_DETECT_DIFF_CHN_A

#define AD717x_OW_DETECT_DIFF_CHN_A   1

◆ AD717x_OW_DETECT_DIFF_CHN_B

#define AD717x_OW_DETECT_DIFF_CHN_B   2

◆ AD717x_OW_DETECT_SE_CHN_A

#define AD717x_OW_DETECT_SE_CHN_A   0

◆ AD717x_OW_DETECT_SE_CHN_B

#define AD717x_OW_DETECT_SE_CHN_B   15

◆ AD717x_OW_DETECT_THRESHOLD_IN_MV

#define AD717x_OW_DETECT_THRESHOLD_IN_MV   300

◆ AD717x_OW_NUM_DIFF_OPTIONS

#define AD717x_OW_NUM_DIFF_OPTIONS   4

◆ AD717x_SCAN

#define AD717x_SCAN
Value:
{\
.sign = 'u',\
.storagebits = CHN_STORAGE_BITS,\
.shift = 0,\
.is_big_endian = false\
}
#define CHN_STORAGE_BITS
Definition ad717x_iio.c:42

◆ AD717x_TEMP_SENSITIVITY

#define AD717x_TEMP_SENSITIVITY   0.000477

◆ BYTES_PER_SAMPLE

#define BYTES_PER_SAMPLE   sizeof(uint32_t)

◆ CHN_STORAGE_BITS

#define CHN_STORAGE_BITS   (BYTES_PER_SAMPLE * 8)

◆ DATA_BUFFER_SIZE

#define DATA_BUFFER_SIZE   (32768)

◆ IIO_AD411x_CHANNEL

#define IIO_AD411x_CHANNEL (   _idx)
Value:
{\
.name = "ch" # _idx,\
.ch_type = IIO_VOLTAGE,\
.channel = _idx,\
.scan_index = _idx,\
.indexed = true,\
.scan_type = &ad717x_scan_type[_idx],\
.ch_out = false,\
.attributes = ad411x_channel_attributes,\
}

◆ IIO_AD717x_CHANNEL

#define IIO_AD717x_CHANNEL (   _idx)
Value:
{\
.name = "ch" # _idx,\
.ch_type = IIO_VOLTAGE,\
.channel = _idx,\
.scan_index = _idx,\
.indexed = true,\
.scan_type = &ad717x_scan_type[_idx],\
.ch_out = false,\
.attributes = ad717x_channel_attributes,\
}

◆ NUM_OF_IIO_DEVICES

#define NUM_OF_IIO_DEVICES   2

Enumeration Type Documentation

◆ ad717x_attribute_ids

Enumerator
AD717x_RAW_ATTR_ID 
AD717x_SCALE_ATTR_ID 
AD717x_OFFSET_ATTR_ID 
AD717x_ANALOG_INPUT_ID 
AD717x_ANALOG_INPUT_P_ID 
AD717x_ANALOG_INPUT_N_ID 
AD717x_SAMPLING_FREQUENCY_ID 
AD717x_OPEN_WIRE_ID 
AD717x_STATUS_ATTR_ID 
AD717x_TEMPERATURE_ATTR_ID 
AD717x_CALIBRATE_ATTR_ID 
AD717x_OPEN_WIRE_INPUT_ID 

Function Documentation

◆ ad717x_stop_cont_data_capture()

int32_t ad717x_stop_cont_data_capture ( void  )

Function to stop continuous data capture.

Returns
0 in case of success, negative error code otherwise

◆ ad717x_trigger_cont_data_capture()

int32_t ad717x_trigger_cont_data_capture ( void  )

Function to prepare the ADC for continuous capture.

Returns
0 in case of success, negative error code otherwise

◆ ad717x_trigger_handler()

int32_t ad717x_trigger_handler ( struct iio_device_data *  iio_dev_data)
Here is the caller graph for this function:

◆ iio_ad717x_init()

int32_t iio_ad717x_init ( struct iio_device **  desc)

Init for reading/writing and parameterization of a AD717x IIO device.

Parameters
desc[in,out]IIO device descriptor
Returns
0 in case of success, negative error code otherwise
Here is the caller graph for this function:

◆ iio_app_event_handler()

void iio_app_event_handler ( void  )

Run the AD717x IIO event handler.

Run the AD3530R IIO event handler.

Returns
None
Here is the caller graph for this function:

◆ iio_app_initialize()

int32_t iio_app_initialize ( void  )

Initialize the AD717x IIO Interface.

Initialize the IIO interface for AD3530R IIO device.

Returns
0 in case of success, negative error code otherwise
Here is the caller graph for this function:

◆ iio_app_remove()

int32_t iio_app_remove ( void  )

Remove the IIO interface for AD717X IIO device.

Returns
0 in case of success,negative error code otherwise
Here is the caller graph for this function:

Variable Documentation

◆ adc_data_buffer

int8_t adc_data_buffer[DATA_BUFFER_SIZE]

◆ p_ad717x_dev_inst

ad717x_dev* p_ad717x_dev_inst = NULL