precision-converters-firmware
Macros | Enumerations | Functions | Variables
ad719x_iio.c File Reference

Implementation of AD719X IIO application interfaces. More...

#include <stdint.h>
#include <stdio.h>
#include <string.h>
#include <inttypes.h>
#include <math.h>
#include <errno.h>
#include "ad719x_iio.h"
#include "ad719x.h"
#include "ad719x_user_config.h"
#include "ad719x_support.h"
#include "app_config.h"
#include "no_os_error.h"
#include "no_os_util.h"
#include "no_os_print_log.h"
#include "iio_trigger.h"
#include "common.h"
Include dependency graph for ad719x_iio.c:

Macros

#define AD719X_CHN_ATTR(_name, _priv)
 
#define AD719X_CHN_AVAIL_ATTR(_name, _priv)
 
#define AD719X_IIO_CH(_idx, chn_no)
 
#define DATA_BUFFER_SIZE   (32768)
 
#define NUM_OF_IIO_DEVICES   1
 
#define ad719x_IIO_TRIGGER_NAME   "ad719x_iio_trigger"
 
#define BYTES_PER_SAMPLE   (STORAGE_BITS/8)
 
#define AD719X_DEFAULT_SCALE(x)   ((AD719X_DEFAULT_REF_VOLTAGE / (ADC_MAX_COUNT_UNIPOLAR * x)) * 1000)
 
#define AD7194_CH(chn)   chn
 
#define BUF_READ_TIMEOUT   0xffffffff
 

Enumerations

enum  ad719x_attribute_ids {
  ADC_RANGE ,
  ADC_BRIDGE_SWITCH ,
  ADC_OPERATING_MODE ,
  ADC_SAMPLING_FREQUENCY ,
  ADC_RAW ,
  ADC_SCALE ,
  ADC_OFFSET
}
 

Functions

void burst_capture_callback (void *context)
 Interrupt Service Routine to monitor data ready event. More...
 
int32_t ad719x_iio_initialize (void)
 Initialize the ad719x IIO Interface. More...
 
void ad719x_iio_event_handler (void)
 Run the ad719x IIO event handler. More...
 

Variables

struct ad719x_dev * p_ad719x_dev_inst = NULL
 
struct iio_device * p_iio_ad719x_dev
 
struct scan_type ad719x_iio_scan_type
 

Detailed Description

Implementation of AD719X IIO application interfaces.

Copyright (c) 2021-24 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

◆ AD7194_CH

#define AD7194_CH (   chn)    chn

◆ AD719X_CHN_ATTR

#define AD719X_CHN_ATTR (   _name,
  _priv 
)
Value:
{\
.name = _name,\
.priv = _priv,\
.show = iio_ad719x_attr_get,\
.store = iio_ad719x_attr_set\
}

◆ AD719X_CHN_AVAIL_ATTR

#define AD719X_CHN_AVAIL_ATTR (   _name,
  _priv 
)
Value:
{\
.name = _name,\
.priv = _priv,\
.show = iio_ad719x_attr_available_get,\
.store = iio_ad719x_attr_available_set\
}

◆ AD719X_DEFAULT_SCALE

#define AD719X_DEFAULT_SCALE (   x)    ((AD719X_DEFAULT_REF_VOLTAGE / (ADC_MAX_COUNT_UNIPOLAR * x)) * 1000)

◆ AD719X_IIO_CH

#define AD719X_IIO_CH (   _idx,
  chn_no 
)
Value:
{\
.name = _idx, \
.ch_type = IIO_VOLTAGE,\
.ch_out = false,\
.indexed = true,\
.channel = chn_no,\
.scan_index = chn_no,\
.scan_type = &ad719x_iio_scan_type,\
.attributes = iio_ad719x_ch_attributes\
}
struct scan_type ad719x_iio_scan_type
Definition: ad719x_iio.c:166

◆ ad719x_IIO_TRIGGER_NAME

#define ad719x_IIO_TRIGGER_NAME   "ad719x_iio_trigger"

◆ BUF_READ_TIMEOUT

#define BUF_READ_TIMEOUT   0xffffffff

◆ BYTES_PER_SAMPLE

#define BYTES_PER_SAMPLE   (STORAGE_BITS/8)

◆ DATA_BUFFER_SIZE

#define DATA_BUFFER_SIZE   (32768)

◆ NUM_OF_IIO_DEVICES

#define NUM_OF_IIO_DEVICES   1

Enumeration Type Documentation

◆ ad719x_attribute_ids

Enumerator
ADC_RANGE 
ADC_BRIDGE_SWITCH 
ADC_OPERATING_MODE 
ADC_SAMPLING_FREQUENCY 
ADC_RAW 
ADC_SCALE 
ADC_OFFSET 

Function Documentation

◆ ad719x_iio_event_handler()

void ad719x_iio_event_handler ( void  )

Run the ad719x IIO event handler.

Returns
None
Here is the caller graph for this function:

◆ ad719x_iio_initialize()

int32_t ad719x_iio_initialize ( void  )

Initialize the ad719x IIO Interface.

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

◆ burst_capture_callback()

void burst_capture_callback ( void *  context)

Interrupt Service Routine to monitor data ready event.

Interrupt Service Routine to monitor end of conversion event.

Parameters
context[in]- Callback context (unused)
Returns
none

Variable Documentation

◆ ad719x_iio_scan_type

struct scan_type ad719x_iio_scan_type
Initial value:
= {
.sign = 'u',
.realbits = REAL_BITS,
.storagebits = STORAGE_BITS,
.shift = false,
.is_big_endian = false
}
#define STORAGE_BITS
Definition: ad405x_iio.c:93
#define REAL_BITS
Definition: ad719x_iio.h:27

◆ p_ad719x_dev_inst

struct ad719x_dev* p_ad719x_dev_inst = NULL

◆ p_iio_ad719x_dev

struct iio_device* p_iio_ad719x_dev