precision-converters-firmware
|
Implementation of AD7091R IIO application interfaces. More...
#include <stdio.h>
#include <string.h>
#include "app_config.h"
#include "ad7091r_iio.h"
#include "ad7091r_user_config.h"
#include "ad7091r_support.h"
#include "common.h"
#include "iio_trigger.h"
#include "no_os_util.h"
#include "no_os_pwm.h"
#include "no_os_irq.h"
Macros | |
#define | AD7091R_CHN_ATTR(_name, _priv) |
#define | AD7091R_CHN_AVAIL_ATTR(_name, _priv) |
#define | AD7091R_CH(_name, _dev, _idx, _type) |
#define | AD7091R_DEFAULT_CHN_SCAN |
#define | NUM_OF_IIO_DEVICES 1 |
#define | AD7091R_IIO_TRIGGER_NAME "ad7091r_iio_trigger" |
#define | BYTES_PER_SAMPLE sizeof(uint16_t) |
#define | CHN_STORAGE_BITS (BYTES_PER_SAMPLE * 8) |
#define | REGISTER_MAX_VAL AD7091R8_REG_CH_HYSTERESIS(7) |
#define | DATA_BUFFER_SIZE (32768) |
#define | BUF_READ_TIMEOUT 0xffffffff |
#define | MAX_LOCAL_BUF_SIZE 8000 |
#define | MAX_DMA_NDTR (no_os_min(65535, MAX_LOCAL_BUF_SIZE)) |
Enumerations | |
enum | ad7091r_iio_attr_id { ADC_RAW , ADC_SCALE , ADC_OFFSET , ADC_LOW_LIMIT_REG , ADC_HIGH_LIMIT_REG , ADC_HYSTERESIS_REG , ADC_THRESHOLD_ALERT , NUM_OF_CHN_ATTR , REFERENCE_SELECT , REFERENCE_IN_VOLTS , DEVICE_MODE , SAMPLING_FREQUENCY , ALERT_BUSY_GPO0_EN , ALERT_POL_OR_GPO0_VAL , NUM_OF_DEV_ATTR = ALERT_POL_OR_GPO0_VAL - NUM_OF_CHN_ATTR } |
Functions | |
int32_t | ad7091r_set_sampling_rate (uint32_t *sampling_rate) |
Set the sampling rate and get the updated value supported by MCU platform. More... | |
void | burst_capture_callback (void *context) |
Interrupt Service Routine to monitor end of conversion event. More... | |
int32_t | ad7091r_trigger_handler (struct iio_device_data *iio_dev_data) |
Push data into IIO buffer when trigger handler IRQ is invoked. More... | |
int | ad7091r_iio_init () |
Initialize the IIO interface for AD7091R IIO device. More... | |
void | ad7091r_iio_event_handler (void) |
Run the AD7091R IIO event handler. More... | |
Variables | |
struct ad7091r8_dev * | ad7091r_dev_desc |
struct scan_type | ad7091r_iio_scan_type = AD7091R_DEFAULT_CHN_SCAN |
volatile bool | ad7091r_conversion_flag = false |
volatile struct iio_device_data * | global_iio_dev_data |
uint32_t | global_nb_of_samples |
int32_t | data_read |
volatile uint32_t * | buff_start_addr |
volatile bool | dma_config_updated = false |
struct stm32_spi_init_param * | spi_init_param |
uint8_t | local_buf [MAX_LOCAL_BUF_SIZE] |
Implementation of AD7091R IIO application interfaces.
Copyright (c) 2024 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.
#define AD7091R_CH | ( | _name, | |
_dev, | |||
_idx, | |||
_type | |||
) |
#define AD7091R_CHN_ATTR | ( | _name, | |
_priv | |||
) |
#define AD7091R_CHN_AVAIL_ATTR | ( | _name, | |
_priv | |||
) |
#define AD7091R_DEFAULT_CHN_SCAN |
#define AD7091R_IIO_TRIGGER_NAME "ad7091r_iio_trigger" |
#define BUF_READ_TIMEOUT 0xffffffff |
#define BYTES_PER_SAMPLE sizeof(uint16_t) |
#define CHN_STORAGE_BITS (BYTES_PER_SAMPLE * 8) |
#define DATA_BUFFER_SIZE (32768) |
#define MAX_DMA_NDTR (no_os_min(65535, MAX_LOCAL_BUF_SIZE)) |
#define MAX_LOCAL_BUF_SIZE 8000 |
#define NUM_OF_IIO_DEVICES 1 |
#define REGISTER_MAX_VAL AD7091R8_REG_CH_HYSTERESIS(7) |
enum ad7091r_iio_attr_id |
void ad7091r_iio_event_handler | ( | void | ) |
Run the AD7091R IIO event handler.
This function monitors the new IIO client event.
int ad7091r_iio_init | ( | void | ) |
Initialize the IIO interface for AD7091R IIO device.
int32_t ad7091r_set_sampling_rate | ( | uint32_t * | sampling_rate | ) |
Set the sampling rate and get the updated value supported by MCU platform.
samplig_rate[in,out] | - Sampling rate value |
int32_t ad7091r_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 |
void burst_capture_callback | ( | void * | context | ) |
Interrupt Service Routine to monitor end of conversion event.
context[in] | - Callback context (unused) |
volatile bool ad7091r_conversion_flag = false |
struct ad7091r8_dev* ad7091r_dev_desc |
struct scan_type ad7091r_iio_scan_type = AD7091R_DEFAULT_CHN_SCAN |
volatile uint32_t* buff_start_addr |
int32_t data_read |
volatile bool dma_config_updated = false |
volatile struct iio_device_data* global_iio_dev_data |
uint32_t global_nb_of_samples |
uint8_t local_buf[MAX_LOCAL_BUF_SIZE] |
struct stm32_spi_init_param* spi_init_param |