precision-converters-firmware
|
Implementation of AD4080 IIO Appication Interface. More...
#include <string.h>
#include <stdint.h>
#include <stdio.h>
#include "common.h"
#include "app_config.h"
#include "ad4080_iio.h"
#include "ad4080.h"
#include "ad4080_regs.h"
#include "ad4080_user_config.h"
#include "no_os_error.h"
#include "no_os_delay.h"
#include "no_os_alloc.h"
#include "iio.h"
#include "iio_trigger.h"
#include "version.h"
Macros | |
#define | BYTES_PER_SAMPLE sizeof(uint32_t) |
#define | CHN_STORAGE_BITS (BYTES_PER_SAMPLE * 8) |
#define | AD4080_IIO_TRIGGER_NAME "ad4080_iio_trigger" |
#define | AD4080_SCAN |
#define | AD4080_CHN_ATTR(_name, _priv) |
#define | AD4080_CHN_AVAIL_ATTR(_name, _priv) |
#define | IIO_AD4080_CHANNEL(_idx) |
#define | DATA_BUFFER_SIZE 65536 |
#define | AD4080_DEFAULT_SCALE ((((float)ADC_REF_VOLTAGE) / ADC_MAX_COUNT) * 1E3) |
#define | AD4080_LAST_REG_ADDR AD4080_REG_FILTER_CONFIG |
#define | FIFO_SIZE 16384 |
#define | MAX_THRESHOLD_CODE 0x7FF |
#define | MAX_HYSTERESIS_CODE 0x7FF |
#define | OFFSET_CORRECTION_COEFF_VAL_BITS 12 |
#define | BUF_READ_TIMEOUT 0xffffffff |
Functions | |
int32_t | ad4080_deassert_oscillators (void) |
Deassert all oscillators. | |
int32_t | ad4080_iio_start_fifo_mode_capture (uint32_t samples, bool update_fifo_watermark) |
Initiates data capture into FIFO. | |
int32_t | ad4080_read_fifo_data (struct ad4080_dev *dev, uint8_t *adc_data, int32_t samples) |
Reads data from the ADC FIFO. | |
int32_t | ad4080_iio_end_fifo_mode_capture (uint32_t *formatted_fifo_data, uint8_t *raw_fifo_data, uint32_t samples) |
Initiates data capture into FIFO. | |
int32_t | ad4080_iio_initialize (void) |
Initialize the IIO interface for AD4080 IIO device. | |
void | ad4080_iio_event_handler (void) |
Run the AD4080 IIO event handler. | |
Variables | |
uint32_t | ad4080_sampling_freq = AD4080_CNV_CLK_FREQ_HZ |
Implementation of AD4080 IIO Appication Interface.
This module acts as an interface for AD4080 IIO device
Copyright (c) 2023-25 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 AD4080_CHN_ATTR | ( | _name, | |
_priv | |||
) |
#define AD4080_CHN_AVAIL_ATTR | ( | _name, | |
_priv | |||
) |
#define AD4080_DEFAULT_SCALE ((((float)ADC_REF_VOLTAGE) / ADC_MAX_COUNT) * 1E3) |
#define AD4080_IIO_TRIGGER_NAME "ad4080_iio_trigger" |
#define AD4080_LAST_REG_ADDR AD4080_REG_FILTER_CONFIG |
#define AD4080_SCAN |
#define BUF_READ_TIMEOUT 0xffffffff |
#define BYTES_PER_SAMPLE sizeof(uint32_t) |
#define CHN_STORAGE_BITS (BYTES_PER_SAMPLE * 8) |
#define DATA_BUFFER_SIZE 65536 |
#define FIFO_SIZE 16384 |
#define IIO_AD4080_CHANNEL | ( | _idx | ) |
#define MAX_HYSTERESIS_CODE 0x7FF |
#define MAX_THRESHOLD_CODE 0x7FF |
#define OFFSET_CORRECTION_COEFF_VAL_BITS 12 |
enum ad4080_attribute_id |
int32_t ad4080_deassert_oscillators | ( | void | ) |
Deassert all oscillators.
int32_t ad4080_iio_end_fifo_mode_capture | ( | uint32_t * | formatted_fifo_data, |
uint8_t * | raw_fifo_data, | ||
uint32_t | samples | ||
) |
Initiates data capture into FIFO.
formatted_fifo_data[out] | - Pointer to formatted FIFO data buffer. |
raw_fifo_data[in] | - Pointer to raw FIFO data buffer. |
samples[in] | - Number of requested samples. |
void ad4080_iio_event_handler | ( | void | ) |
Run the AD4080 IIO event handler.
This function monitors the new IIO client event
int32_t ad4080_iio_initialize | ( | void | ) |
Initialize the IIO interface for AD4080 IIO device.
int32_t ad4080_iio_start_fifo_mode_capture | ( | uint32_t | samples, |
bool | update_fifo_watermark | ||
) |
Initiates data capture into FIFO.
samples[in] | - Number of requested samples. |
update_fifo_watermark[in] | - Indication to update ADC FIFO watermark. |
int32_t ad4080_read_fifo_data | ( | struct ad4080_dev * | dev, |
uint8_t * | adc_data, | ||
int32_t | samples | ||
) |
Reads data from the ADC FIFO.
dev[in,out]- | Pointer to IIO device instance |
adc_data[in,out]- | Pointer to array to hold FIFO data |
samples[in]- | Number of samples to read from FIFO |
uint32_t ad4080_sampling_freq = AD4080_CNV_CLK_FREQ_HZ |