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

Implementation of AD7689 IIO application interfaces. More...

#include <stdint.h>
#include <stdio.h>
#include <string.h>
#include <errno.h>
#include "ad7689_iio.h"
#include "app_config.h"
#include "ad7689_user_config.h"
#include "ad7689_support.h"
#include "common.h"
#include "no_os_error.h"
#include "no_os_delay.h"
#include "iio_trigger.h"
Include dependency graph for ad7689_iio.c:

Macros

#define ADC_DEFAULT_SCALE   ((ADC_DEFAULT_REF_VOLTAGE / ADC_MAX_COUNT_UNIPOLAR) * 1000)
 
#define TEMPERATURE_SENSITIVITY   0.283
 
#define ROOM_TEMPERATURE   25.0
 
#define TEMPERATURE_CONV_SCALE
 
#define NUM_OF_IIO_DEVICES   1
 
#define AD7689_IIO_TRIGGER_NAME   "ad7689_iio_trigger"
 
#define BYTES_PER_SAMPLE   sizeof(uint16_t)
 
#define CHN_STORAGE_BITS   (BYTES_PER_SAMPLE * 8)
 
#define IIO_RAW_ATTR_ID   0
 
#define IIO_SCALE_ATTR_ID   1
 
#define IIO_OFFSET_ATTR_ID   2
 
#define END_OF_CHN   0xff
 
#define DATA_BUFFER_SIZE   (32768)
 

Functions

int32_t iio_ad7689_trigger_handler (struct iio_device_data *iio_dev_data)
 Push data into IIO buffer when trigger handler IRQ is invoked. More...
 
int32_t ad7689_iio_initialize (void)
 Initialize the IIO interface for AD7689 IIO device. More...
 
void ad7689_iio_event_handler (void)
 Run the AD7689 IIO event handler. More...
 

Variables

struct ad7689_dev * p_ad7689_dev_inst = NULL
 
struct ad7689_config ad7689_current_config
 
struct iio_attribute channel_input_attributes []
 
struct scan_type chn_scan
 

Detailed Description

Implementation of AD7689 IIO application interfaces.

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

◆ AD7689_IIO_TRIGGER_NAME

#define AD7689_IIO_TRIGGER_NAME   "ad7689_iio_trigger"

◆ ADC_DEFAULT_SCALE

#define ADC_DEFAULT_SCALE   ((ADC_DEFAULT_REF_VOLTAGE / ADC_MAX_COUNT_UNIPOLAR) * 1000)

◆ BYTES_PER_SAMPLE

#define BYTES_PER_SAMPLE   sizeof(uint16_t)

◆ CHN_STORAGE_BITS

#define CHN_STORAGE_BITS   (BYTES_PER_SAMPLE * 8)

◆ DATA_BUFFER_SIZE

#define DATA_BUFFER_SIZE   (32768)

◆ END_OF_CHN

#define END_OF_CHN   0xff

◆ IIO_OFFSET_ATTR_ID

#define IIO_OFFSET_ATTR_ID   2

◆ IIO_RAW_ATTR_ID

#define IIO_RAW_ATTR_ID   0

◆ IIO_SCALE_ATTR_ID

#define IIO_SCALE_ATTR_ID   1

◆ NUM_OF_IIO_DEVICES

#define NUM_OF_IIO_DEVICES   1

◆ ROOM_TEMPERATURE

#define ROOM_TEMPERATURE   25.0

◆ TEMPERATURE_CONV_SCALE

#define TEMPERATURE_CONV_SCALE
Value:
#define ADC_MAX_COUNT_UNIPOLAR
Definition: app_config.h:184
#define ADC_DEFAULT_REF_VOLTAGE
Definition: ad7134_iio.c:36
#define ROOM_TEMPERATURE
Definition: ad7689_iio.c:45
#define TEMPERATURE_SENSITIVITY
Definition: ad7689_iio.c:44

◆ TEMPERATURE_SENSITIVITY

#define TEMPERATURE_SENSITIVITY   0.283

Function Documentation

◆ ad7689_iio_event_handler()

void ad7689_iio_event_handler ( void  )

Run the AD7689 IIO event handler.

Returns
none

This function monitors the new IIO client event

Here is the caller graph for this function:

◆ ad7689_iio_initialize()

int32_t ad7689_iio_initialize ( void  )

Initialize the IIO interface for AD7689 IIO device.

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

◆ iio_ad7689_trigger_handler()

int32_t iio_ad7689_trigger_handler ( struct iio_device_data *  iio_dev_data)

Push data into IIO buffer when trigger handler IRQ is invoked.

Parameters
iio_dev_data[in]- IIO device data instance
Returns
0 in case of success or negative value otherwise

Variable Documentation

◆ ad7689_current_config

struct ad7689_config ad7689_current_config

◆ channel_input_attributes

struct iio_attribute channel_input_attributes[]
Initial value:
= {
{
.name = "raw",
.show = get_adc_raw,
.store = set_adc_raw,
},
{
.name = "scale",
.show = get_adc_raw,
.store = set_adc_raw,
},
{
.name = "offset",
.show = get_adc_raw,
.store = set_adc_raw,
},
END_ATTRIBUTES_ARRAY
}
#define IIO_SCALE_ATTR_ID
Definition: ad7689_iio.c:69
#define IIO_RAW_ATTR_ID
Definition: ad7689_iio.c:68
#define IIO_OFFSET_ATTR_ID
Definition: ad7689_iio.c:70

◆ chn_scan

struct scan_type chn_scan
Initial value:
= {
.sign = 'u',
.realbits = CHN_STORAGE_BITS,
.storagebits = CHN_STORAGE_BITS,
.shift = 0,
.is_big_endian = false
}
#define CHN_STORAGE_BITS
Definition: ad7689_iio.c:65

◆ p_ad7689_dev_inst

struct ad7689_dev* p_ad7689_dev_inst = NULL