precision-converters-firmware
|
Implementation of AD405X IIO Application Interface. More...
#include <string.h>
#include <math.h>
#include "app_config.h"
#include "ad405x.h"
#include "ad405x_iio.h"
#include "ad405x_user_config.h"
#include "common.h"
#include "no_os_error.h"
#include "no_os_gpio.h"
#include "no_os_pwm.h"
#include "no_os_alloc.h"
#include "no_os_util.h"
#include "iio_trigger.h"
Macros | |
#define | AD405X_CHN_ATTR(_name, _priv) |
#define | AD405X_CHN_AVAIL_ATTR(_name, _priv) |
#define | DATA_BUFFER_SIZE (131072) |
#define | NUM_OF_IIO_DEVICES 1 |
#define | AD405X_IIO_TRIGGER_NAME ACTIVE_DEVICE_NAME"_iio_trigger" |
#define | REAL_BITS ADC_SAMPLE_MODE_RESOLUTION |
#define | STORAGE_BITS 16 |
#define | BYTES_PER_SAMPLE (STORAGE_BITS/8) |
#define | INTERNAL_SAMPLING_CLK_NS 500 |
#define | CONVERSION_TIME_NS 250 |
#define | SPI_BURST_DATA_READ_TIME_NS 1100 |
#define | MAX_SAMPLING_TIME_NS (((float)(1.0/SAMPLING_RATE) * 1000000000) / 2) |
#define | MAX_SAMPLING_PERIOD_NSEC 1000000 |
#define | PWM_PERIOD_TO_FREQUENCY(x) (1000000000.0 / x) |
#define | BUF_READ_TIMEOUT 0xffffffff |
#define | BUFFER_UPDATE_RATE 400 |
#define | MAX_LOCAL_BUF_SIZE 32000 |
#define | MAX_DMA_NDTR (no_os_min(65535, MAX_LOCAL_BUF_SIZE/2)) |
Enumerations | |
enum | ad405x_attribute_ids { ADC_RAW , ADC_SCALE , ADC_OFFSET , ADC_OPERATING_MODE , ADC_SAMPLE_RATE } |
Functions | |
int32_t | ad405x_stop_data_capture (void) |
Stop a data capture from continuous/burst mode. More... | |
void | data_capture_callback (void *context) |
Interrupt Service Routine to monitor data ready event. More... | |
int32_t | iio_ad405x_initialize (void) |
Initialize the IIO interface for AD405X IIO device. More... | |
void | iio_ad405x_event_handler (void) |
Run the AD405X IIO event handler. More... | |
Variables | |
struct ad405x_dev * | p_ad405x_dev = NULL |
struct iio_device * | p_iio_ad405x_dev |
volatile bool | data_ready = false |
volatile uint32_t * | buff_start_addr |
uint8_t | local_buf [MAX_LOCAL_BUF_SIZE] |
volatile bool | dma_config_updated = false |
volatile struct iio_device_data * | iio_dev_data_g |
uint32_t | nb_of_samples_g |
int32_t | data_read |
struct no_os_spi_msg | ad405x_spi_msg |
struct stm32_spi_init_param * | spi_init_param |
Implementation of AD405X IIO Application Interface.
This module acts as an interface for AD405X IIO device
Copyright (c) 2022-2024 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 AD405X_CHN_ATTR | ( | _name, | |
_priv | |||
) |
#define AD405X_CHN_AVAIL_ATTR | ( | _name, | |
_priv | |||
) |
#define AD405X_IIO_TRIGGER_NAME ACTIVE_DEVICE_NAME"_iio_trigger" |
#define BUF_READ_TIMEOUT 0xffffffff |
#define BUFFER_UPDATE_RATE 400 |
#define BYTES_PER_SAMPLE (STORAGE_BITS/8) |
#define CONVERSION_TIME_NS 250 |
#define DATA_BUFFER_SIZE (131072) |
#define INTERNAL_SAMPLING_CLK_NS 500 |
#define MAX_DMA_NDTR (no_os_min(65535, MAX_LOCAL_BUF_SIZE/2)) |
#define MAX_LOCAL_BUF_SIZE 32000 |
#define MAX_SAMPLING_PERIOD_NSEC 1000000 |
#define MAX_SAMPLING_TIME_NS (((float)(1.0/SAMPLING_RATE) * 1000000000) / 2) |
#define NUM_OF_IIO_DEVICES 1 |
#define PWM_PERIOD_TO_FREQUENCY | ( | x | ) | (1000000000.0 / x) |
#define REAL_BITS ADC_SAMPLE_MODE_RESOLUTION |
#define SPI_BURST_DATA_READ_TIME_NS 1100 |
#define STORAGE_BITS 16 |
enum ad405x_attribute_ids |
int32_t ad405x_stop_data_capture | ( | void | ) |
Stop a data capture from continuous/burst mode.
void data_capture_callback | ( | void * | context | ) |
Interrupt Service Routine to monitor data ready event.
context[in] | - Callback context (unused) |
void iio_ad405x_event_handler | ( | void | ) |
Run the AD405X IIO event handler.
This function monitors the new IIO client event
int32_t iio_ad405x_initialize | ( | void | ) |
Initialize the IIO interface for AD405X IIO device.
struct no_os_spi_msg ad405x_spi_msg |
volatile uint32_t* buff_start_addr |
int32_t data_read |
volatile bool data_ready = false |
volatile bool dma_config_updated = false |
volatile struct iio_device_data* iio_dev_data_g |
uint8_t local_buf[MAX_LOCAL_BUF_SIZE] |
uint32_t nb_of_samples_g |
struct ad405x_dev* p_ad405x_dev = NULL |
struct iio_device* p_iio_ad405x_dev |
struct stm32_spi_init_param* spi_init_param |