precision-converters-firmware
Macros | Functions
ad7134_support.c File Reference

Source file for for AD7134 No-OS driver support. More...

#include <stdio.h>
#include "ad7134_support.h"
#include "no_os_gpio.h"
#include "no_os_error.h"
#include "no_os_delay.h"
#include "app_config.h"
#include "ad7134_iio.h"
Include dependency graph for ad7134_support.c:

Macros

#define GPIO_MIN_DBNCE_CNT   (2U)
 
#define ODR_TRIGGER_WAIT_DBNCE_CNT   (20000U)
 
#define DUAL_CHN_MODE_OFFSET   (2)
 
#define LT6373_GPIO_DIR_CTRL_VAL   0xFF
 
#define LT6373_GPIO_DATA_VAL   0x84
 
#define DCLK_FREQ_SELECT   5
 
#define MCLK_FREQ   (48000000)
 
#define MCLK_DIVISOR   (2)
 
#define ODR_INT_VAL   (uint32_t)(MCLK_FREQ / MCLK_DIVISOR / SAMPLING_RATE)
 
#define ODR_VAL_INT_LSB   (uint8_t)(ODR_INT_VAL)
 
#define ODR_VAL_INT_MID   (uint8_t)(ODR_INT_VAL >> 8)
 
#define ODR_VAL_INT_MSB   (uint8_t)(ODR_INT_VAL >> 16)
 
#define ODR_VAL_FLT_LSB   0x00
 
#define ODR_VAL_FLT_MID0   0x00
 
#define ODR_VAL_FLT_MID1   0x00
 
#define ODR_VAL_FLT_MSB   0x00
 

Functions

int32_t ad7134_data_capture_init (struct ad713x_dev *dev)
 Perform the data capture initialization. More...
 
int32_t ad7134_read_data (uint16_t *adc_data, uint8_t curr_chn)
 Read ADC data over DOUT0 and DOUT1 pins using bit-banging method. More...
 
int32_t ad7134_read_tdm_data (uint16_t *adc_data, uint8_t curr_chn)
 Read ADC data over SAI TDM Peripheral. More...
 
int32_t ad7134_read_all_channels (uint16_t *chn_data)
 Read all chahnnels over DOUT0 and DOUT1 pins using bit-banging method. More...
 
int32_t ad7134_perform_conv_and_read_sample (uint8_t input_chn, uint16_t *adc_data)
 Read ADC single sample data. More...
 

Detailed Description

Source file for for AD7134 No-OS driver support.

Copyright (c) 2023 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

◆ DCLK_FREQ_SELECT

#define DCLK_FREQ_SELECT   5

◆ DUAL_CHN_MODE_OFFSET

#define DUAL_CHN_MODE_OFFSET   (2)

◆ GPIO_MIN_DBNCE_CNT

#define GPIO_MIN_DBNCE_CNT   (2U)

◆ LT6373_GPIO_DATA_VAL

#define LT6373_GPIO_DATA_VAL   0x84

◆ LT6373_GPIO_DIR_CTRL_VAL

#define LT6373_GPIO_DIR_CTRL_VAL   0xFF

◆ MCLK_DIVISOR

#define MCLK_DIVISOR   (2)

◆ MCLK_FREQ

#define MCLK_FREQ   (48000000)

◆ ODR_INT_VAL

#define ODR_INT_VAL   (uint32_t)(MCLK_FREQ / MCLK_DIVISOR / SAMPLING_RATE)

◆ ODR_TRIGGER_WAIT_DBNCE_CNT

#define ODR_TRIGGER_WAIT_DBNCE_CNT   (20000U)

◆ ODR_VAL_FLT_LSB

#define ODR_VAL_FLT_LSB   0x00

◆ ODR_VAL_FLT_MID0

#define ODR_VAL_FLT_MID0   0x00

◆ ODR_VAL_FLT_MID1

#define ODR_VAL_FLT_MID1   0x00

◆ ODR_VAL_FLT_MSB

#define ODR_VAL_FLT_MSB   0x00

◆ ODR_VAL_INT_LSB

#define ODR_VAL_INT_LSB   (uint8_t)(ODR_INT_VAL)

◆ ODR_VAL_INT_MID

#define ODR_VAL_INT_MID   (uint8_t)(ODR_INT_VAL >> 8)

◆ ODR_VAL_INT_MSB

#define ODR_VAL_INT_MSB   (uint8_t)(ODR_INT_VAL >> 16)

Function Documentation

◆ ad7134_data_capture_init()

int32_t ad7134_data_capture_init ( struct ad713x_dev *  dev)

Perform the data capture initialization.

Parameters
dev[in]- AD7134 Device descriptor.
Returns
0 in case of success, negative error code otherwise

This function configures the AD7134 registers to capture the data

◆ ad7134_perform_conv_and_read_sample()

int32_t ad7134_perform_conv_and_read_sample ( uint8_t  input_chn,
uint16_t *  adc_data 
)

Read ADC single sample data.

Parameters
input_chn[in]- Channel for which data is to read
adc_data[out]- Pointer to adc data read variable
Returns
0 in case of success, negative error code otherwise

◆ ad7134_read_all_channels()

int32_t ad7134_read_all_channels ( uint16_t *  chn_data)

Read all chahnnels over DOUT0 and DOUT1 pins using bit-banging method.

Parameters
chn_data[out]- Pointer to adc data read variable
Returns
0 in case of success, negative error code otherwise

◆ ad7134_read_data()

int32_t ad7134_read_data ( uint16_t *  adc_data,
uint8_t  curr_chn 
)

Read ADC data over DOUT0 and DOUT1 pins using bit-banging method.

Parameters
adc_data[out]- Pointer to adc data read variable
curr_chn[in]- Channel for which data is to read
Returns
0 in case of success, negative error code otherwise

◆ ad7134_read_tdm_data()

int32_t ad7134_read_tdm_data ( uint16_t *  adc_data,
uint8_t  curr_chn 
)

Read ADC data over SAI TDM Peripheral.

Parameters
adc_data[out]- Pointer to adc data read variable
curr_chn[in]- Channel for which data is to read
Returns
0 in case of success, negative error code otherwise