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

AD7689 no-os drivers support file. More...

#include <string.h>
#include "ad7689_support.h"
#include "ad7689_iio.h"
#include "ad7689_user_config.h"
#include "no_os_delay.h"
#include "no_os_spi.h"
#include "no_os_util.h"
#include "no_os_gpio.h"
#include "no_os_error.h"
Include dependency graph for ad7689_support.c:

Macros

#define BYTE_SIZE   8
 
#define CONFIG_OVERRIDE_BIT_POS   13
 
#define CHN_CONFIG_SELECT_BIT_POS   10
 
#define CHN_SELECT_BIT_POS   7
 
#define REF_SRC_SELECT_BIT_POS   3
 

Functions

int32_t ad7689_read_single_sample (uint8_t input_chn, uint32_t *raw_data)
 Read the single ADC sample (raw data) for input channel. More...
 
int32_t ad7689_read_converted_sample (uint8_t *adc_data, uint8_t next_chn)
 Read ADC raw data for recently sampled channel and trigger new conversion. More...
 
int32_t ad7689_perform_init_cnv (uint8_t first_active_chn, uint8_t second_active_chn, uint8_t num_of_active_channels)
 Perform the 2 dummy conversions after device initialization. More...
 

Detailed Description

AD7689 no-os drivers support file.

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

◆ BYTE_SIZE

#define BYTE_SIZE   8

◆ CHN_CONFIG_SELECT_BIT_POS

#define CHN_CONFIG_SELECT_BIT_POS   10

◆ CHN_SELECT_BIT_POS

#define CHN_SELECT_BIT_POS   7

◆ CONFIG_OVERRIDE_BIT_POS

#define CONFIG_OVERRIDE_BIT_POS   13

◆ REF_SRC_SELECT_BIT_POS

#define REF_SRC_SELECT_BIT_POS   3

Function Documentation

◆ ad7689_perform_init_cnv()

int32_t ad7689_perform_init_cnv ( uint8_t  first_active_chn,
uint8_t  second_active_chn,
uint8_t  num_of_active_channels 
)

Perform the 2 dummy conversions after device initialization.

Parameters
first_active_chn[in]- First ADC channel in sequencer
second_active_chn[in]- Second ADC channel in sequencer
num_of_active_channels[in]- Number of ADC channels in sequencer
Returns
0 in case of success, negative error code otherwise

◆ ad7689_read_converted_sample()

int32_t ad7689_read_converted_sample ( uint8_t *  adc_data,
uint8_t  next_chn 
)

Read ADC raw data for recently sampled channel and trigger new conversion.

Parameters
adc_data[in,out]- Pointer to adc data read variable
next_chn[in]- Next channel in sequence
Returns
0 in case of success, negative error code otherwise
Note
This function is intended to call from the conversion end trigger event. Therefore, this function should just read raw ADC data without further monitoring conversion end event

◆ ad7689_read_single_sample()

int32_t ad7689_read_single_sample ( uint8_t  input_chn,
uint32_t *  raw_data 
)

Read the single ADC sample (raw data) for input channel.

Parameters
input_chn[in]- Input channel to be sampled and read data for
raw_data[in,out]-ADC raw data
Returns
0 in case of success, negative error code otherwise