precision-converters-firmware
Macros | 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 "common.h"
#include "iio_trigger.h"
#include "ad717x_support.h"
Include dependency graph for ad717x_iio.c:

Macros

#define AD717x_RESOLUTION   24
 
#define ADC_MAX_COUNT_UNIPOLAR   (uint32_t)((1 << AD717x_RESOLUTION) - 1)
 
#define ADC_MAX_COUNT_BIPOLAR   (uint32_t)(1 << (AD717x_RESOLUTION-1))
 
#define BYTES_PER_SAMPLE   sizeof(uint32_t)
 
#define CHN_STORAGE_BITS   (BYTES_PER_SAMPLE * 8)
 
#define AD717x_RAW_ATTR_ID   0
 
#define AD717x_SCALE_ATTR_ID   1
 
#define AD717x_OFFSET_ATTR_ID   2
 
#define AD717x_SAMPLING_FREQUENCY_ID   3
 
#define AD717x_DATA_BUFFER_SIZE   (8192)
 
#define AD717x_SCAN
 
#define AD717x_CHANNEL(_name, _priv)
 
#define IIO_AD717x_CHANNEL(_idx)
 
#define DATA_BUFFER_SIZE   (32768)
 
#define AD717X_IIO_TRIGGER_NAME   "ad717x_iio_trigger"
 
#define NUM_OF_IIO_DEVICES   1
 
#define AD717x_CONV_TIMEOUT   10000
 

Functions

int32_t ad717x_trigger_cont_data_capture (void)
 Function to prepare the ADC for continuous capture. More...
 
int32_t ad717x_stop_cont_data_capture (void)
 Function to stop continuous data capture. More...
 
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. More...
 
int32_t ad717x_iio_initialize (void)
 Initialize the AD717x IIO Interface. More...
 
void ad717x_iio_event_handler (void)
 Run the AD717x IIO event handler. More...
 

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 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_CHANNEL

#define AD717x_CHANNEL (   _name,
  _priv 
)
Value:
{\
.name = _name,\
.priv = _priv,\
.show = get_adc_attribute,\
.store = set_adc_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_OFFSET_ATTR_ID

#define AD717x_OFFSET_ATTR_ID   2

◆ AD717x_RAW_ATTR_ID

#define AD717x_RAW_ATTR_ID   0

◆ AD717x_RESOLUTION

#define AD717x_RESOLUTION   24

◆ AD717x_SAMPLING_FREQUENCY_ID

#define AD717x_SAMPLING_FREQUENCY_ID   3

◆ AD717x_SCALE_ATTR_ID

#define AD717x_SCALE_ATTR_ID   1

◆ AD717x_SCAN

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

◆ ADC_MAX_COUNT_BIPOLAR

#define ADC_MAX_COUNT_BIPOLAR   (uint32_t)(1 << (AD717x_RESOLUTION-1))

◆ ADC_MAX_COUNT_UNIPOLAR

#define ADC_MAX_COUNT_UNIPOLAR   (uint32_t)((1 << AD717x_RESOLUTION) - 1)

◆ 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_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   1

Function Documentation

◆ ad717x_iio_event_handler()

void ad717x_iio_event_handler ( void  )

Run the AD717x IIO event handler.

Returns
None
Here is the caller graph for this function:

◆ ad717x_iio_initialize()

int32_t ad717x_iio_initialize ( void  )

Initialize the AD717x IIO Interface.

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

◆ 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)

◆ 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

Variable Documentation

◆ adc_data_buffer

int8_t adc_data_buffer[DATA_BUFFER_SIZE]

◆ p_ad717x_dev_inst

ad717x_dev* p_ad717x_dev_inst = NULL