precision-converters-firmware
|
#include <inttypes.h>
#include <string.h>
#include <errno.h>
#include <math.h>
#include "app_config.h"
#include "ad7606_iio.h"
#include "ad7606.h"
#include "ad7606_support.h"
#include "ad7606_user_config.h"
#include "common.h"
#include "no_os_error.h"
#include "no_os_gpio.h"
#include "iio_trigger.h"
Macros | |
#define | DEFAULT_SCALE ((DEFAULT_CHN_RANGE / ADC_MAX_COUNT_BIPOLAR) * 1000) |
#define | MANUAL_OPEN_DETECT_ENTRY_TRHLD 350 |
#define | MANUAL_OPEN_DETECT_THRESHOLD_RPD50K 20 |
#define | MANUAL_OPEN_DETECT_CONV_CNTS 10 |
#define | MANUAL_OPEN_DETECT_CONV_TRSHLD 10 |
#define | MANUAL_OPEN_DETECT_CM_CNV_CNT 3 |
#define | AUTO_OPEN_DETECT_QUEUE_MAX_CNT 128 |
#define | AUTO_OPEN_DETECT_QUEUE_EXTRA_CONV_CNT 15 |
#define | ADC_CALIBRATION_GAIN_MAX 64.0 |
#define | OFFSET_REG_RESOLUTION 1 |
#define | NUM_OF_IIO_DEVICES 1 |
#define | IIO_TRIGGER_NAME "ad7606_iio_trigger" |
#define | CHN_STORAGE_BITS (BYTES_PER_SAMPLE * 8) |
#define | DATA_BUFFER_SIZE (32768) |
Enumerations | |
enum | ad7606_attribute_id { RAW_ATTR_ID , SCALE_ATTR_ID , OFFSET_ATTR_ID , SAMPLING_FREQ_ATTR_ID } |
enum | range_e { LOW , HIGH } |
Functions | |
int32_t | debug_reg_read (void *dev, uint32_t reg, uint32_t *readval) |
Read the debug register value. | |
int32_t | debug_reg_write (void *dev, uint32_t reg, uint32_t writeval) |
Write into the debug register. | |
int32_t | iio_ad7606_trigger_handler (struct iio_device_data *iio_dev_data) |
Push data into IIO buffer when trigger handler IRQ is invoked. | |
int32_t | ad7606_iio_remove (struct iio_desc *desc) |
Release resources allocated for IIO device. | |
int32_t | ad7606_iio_initialize (void) |
Initialize the IIO interface for AD7606 IIO device. | |
void | ad7606_iio_event_handler (void) |
Run the AD7606 IIO event handler. | |
Variables | |
struct ad7606_dev * | p_ad7606_dev_inst = NULL |
struct iio_attribute | channel_input_attributes [] |
#define ADC_CALIBRATION_GAIN_MAX 64.0 |
#define AUTO_OPEN_DETECT_QUEUE_EXTRA_CONV_CNT 15 |
#define AUTO_OPEN_DETECT_QUEUE_MAX_CNT 128 |
#define CHN_STORAGE_BITS (BYTES_PER_SAMPLE * 8) |
#define DATA_BUFFER_SIZE (32768) |
#define DEFAULT_SCALE ((DEFAULT_CHN_RANGE / ADC_MAX_COUNT_BIPOLAR) * 1000) |
#define IIO_TRIGGER_NAME "ad7606_iio_trigger" |
#define MANUAL_OPEN_DETECT_CM_CNV_CNT 3 |
#define MANUAL_OPEN_DETECT_CONV_CNTS 10 |
#define MANUAL_OPEN_DETECT_CONV_TRSHLD 10 |
#define MANUAL_OPEN_DETECT_ENTRY_TRHLD 350 |
#define MANUAL_OPEN_DETECT_THRESHOLD_RPD50K 20 |
#define NUM_OF_IIO_DEVICES 1 |
#define OFFSET_REG_RESOLUTION 1 |
enum ad7606_attribute_id |
enum range_e |
void ad7606_iio_event_handler | ( | void | ) |
Run the AD7606 IIO event handler.
This function monitors the new IIO client event
int32_t ad7606_iio_initialize | ( | void | ) |
Initialize the IIO interface for AD7606 IIO device.
int32_t ad7606_iio_remove | ( | struct iio_desc * | desc | ) |
Release resources allocated for IIO device.
desc[in] | - IIO device descriptor |
int32_t debug_reg_read | ( | void * | dev, |
uint32_t | reg, | ||
uint32_t * | readval | ||
) |
Read the debug register value.
dev[in]- | Pointer to IIO device instance |
reg[in]- | Register address to read from |
readval[out]- | Pointer to variable to read data into |
int32_t debug_reg_write | ( | void * | dev, |
uint32_t | reg, | ||
uint32_t | writeval | ||
) |
Write into the debug register.
dev[in]- | Pointer to IIO device instance |
reg[in]- | Register address to write into |
writeval[in]- | Register value to write |
int32_t iio_ad7606_trigger_handler | ( | struct iio_device_data * | iio_dev_data | ) |
Push data into IIO buffer when trigger handler IRQ is invoked.
iio_dev_data[in] | - IIO device data instance |
struct iio_attribute channel_input_attributes[] |
struct ad7606_dev* p_ad7606_dev_inst = NULL |
Pointer to the struct representing the AD7606 IIO device