precision-converters-firmware
Loading...
Searching...
No Matches
Macros | Functions
ad4134_support.c File Reference

Source file for for AD4134 IIO Application. More...

#include "ad4134_support.h"
#include "no_os_error.h"
#include "no_os_delay.h"
#include "app_config.h"
#include "stm32_tdm_support.h"
Include dependency graph for ad4134_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

enum ad4134_interface_modes ad4134_get_interface_mode (void)
 Get the interface mode.
 
enum ad4134_data_capture_modes ad4134_get_data_capture_mode (void)
 Get the data capture mode.
 
enum ad4134_asrc_modes ad4134_get_asrc_mode (void)
 Get the ASRC mode.
 
int32_t ad7134_data_capture_init (struct ad713x_dev *dev)
 Perform the data capture initialization.
 
int32_t ad7134_read_all_channels_bit_banging (uint16_t *chn_data, bool check_odr_state)
 Read ADC data over DOUT0 and DOUT1 pins using bit-banging method for all channels.
 
int32_t ad7134_perform_conv_and_read_sample (uint16_t *adc_data, uint8_t ch)
 Read ADC single sample data.
 

Detailed Description

Source file for for AD4134 IIO Application.

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

◆ ad4134_get_asrc_mode()

enum ad4134_asrc_modes ad4134_get_asrc_mode ( void  )
inline

Get the ASRC mode.

Returns
ASRC mode
Here is the caller graph for this function:

◆ ad4134_get_data_capture_mode()

enum ad4134_data_capture_modes ad4134_get_data_capture_mode ( void  )
inline

Get the data capture mode.

Returns
Data capture mode
Here is the caller graph for this function:

◆ ad4134_get_interface_mode()

enum ad4134_interface_modes ad4134_get_interface_mode ( void  )
inline

Get the interface mode.

Returns
Interface mode
Here is the caller graph for this function:

◆ 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

Here is the caller graph for this function:

◆ ad7134_perform_conv_and_read_sample()

int32_t ad7134_perform_conv_and_read_sample ( uint16_t *  adc_data,
uint8_t  ch 
)

Read ADC single sample data.

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

◆ ad7134_read_all_channels_bit_banging()

int32_t ad7134_read_all_channels_bit_banging ( uint16_t *  chn_data,
bool  check_odr_state 
)

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

Parameters
chn_data[in,out]- Pointer to array for adc data for all channels
check_odr_state[in]- Whether to check for ODR state change
Returns
0 in case of success, negative error code otherwise
Here is the caller graph for this function: