precision-converters-firmware
ad4170_support.h
Go to the documentation of this file.
1 /***************************************************************************//*
2  * @file ad4170_support.h
3  * @brief AD4170 No-OS driver support header file
4 ******************************************************************************
5  * Copyright (c) 2021-24 Analog Devices, Inc. All Rights Reserved.
6  *
7  * This software is proprietary to Analog Devices, Inc. and its licensors.
8  * By using this software you agree to the terms of the associated
9  * Analog Devices Software License Agreement.
10 ******************************************************************************/
11 #ifndef AD4170_SUPPORT_H_
12 #define AD4170_SUPPORT_H_
13 
14 /******************************************************************************/
15 /***************************** Include Files **********************************/
16 /******************************************************************************/
17 
18 #include <stdlib.h>
19 #include "ad4170.h"
20 
21 /******************************************************************************/
22 /********************* Macros and Constants Definitions ***********************/
23 /******************************************************************************/
24 
25 #define AD4170_PGA_GAIN(x) (1 << (x))
26 
27 /******************************************************************************/
28 /********************** Public/Extern Declarations ****************************/
29 /******************************************************************************/
30 
31 int32_t ad4170_read_single_sample(uint8_t input_chn, uint32_t *raw_data);
32 int32_t ad4170_read_converted_sample(uint32_t *adc_data);
33 int32_t perform_sign_conversion(uint32_t adc_raw_data, uint8_t chn);
34 float convert_adc_sample_into_voltage(uint32_t adc_raw, uint8_t chn);
35 float convert_adc_data_to_voltage_without_vref(int32_t data, uint8_t chn);
36 float convert_adc_data_to_voltage_wrt_vref(int32_t data, uint8_t chn);
37 float convert_adc_raw_into_rtd_resistance(uint32_t adc_raw, float rtd_res,
38  uint8_t chn);
39 float ad4170_get_reference_voltage(uint8_t chn);
40 float ad4170_get_gain_value(uint8_t chn);
41 int32_t ad4170_disable_conversion(void);
42 int32_t ad4170_enable_input_chn(uint8_t input_chn);
43 int32_t ad4170_disable_input_chn(uint8_t input_chn);
44 int32_t ad4170_apply_excitation(uint8_t input_chn);
45 int32_t ad4170_remove_excitation(uint8_t input_chn);
46 int32_t ad4170_set_filter(struct ad4170_dev *dev, uint8_t chn,
47  enum ad4170_filter_type filt_type);
48 int32_t ad4170_set_reference(struct ad4170_dev *dev, uint8_t chn,
49  enum ad4170_ref_select ref);
50 int32_t ad4170_set_fs(struct ad4170_dev *dev, uint8_t setup, uint8_t chn,
51  uint16_t fs_val);
52 #endif /* end of AD4170_SUPPORT_H_ */
int32_t ad4170_disable_input_chn(uint8_t input_chn)
Disable input channel.
Definition: ad4170_support.c:386
int32_t ad4170_disable_conversion(void)
Disable ADC conversion.
Definition: ad4170_support.c:348
float convert_adc_raw_into_rtd_resistance(uint32_t adc_raw, float rtd_res, uint8_t chn)
Convert the ADC raw value into equivalent RTD resistance.
Definition: ad4170_support.c:326
int32_t ad4170_set_reference(struct ad4170_dev *dev, uint8_t chn, enum ad4170_ref_select ref)
Set Reference.
Definition: ad4170_support.c:545
int32_t perform_sign_conversion(uint32_t adc_raw_data, uint8_t chn)
Perform the sign conversion for handling negative voltages in bipolar mode.
Definition: ad4170_support.c:174
int32_t ad4170_set_filter(struct ad4170_dev *dev, uint8_t chn, enum ad4170_filter_type filt_type)
Set filter type.
Definition: ad4170_support.c:515
float ad4170_get_reference_voltage(uint8_t chn)
Get the reference voltage based on the reference source.
Definition: ad4170_support.c:227
int32_t ad4170_read_single_sample(uint8_t input_chn, uint32_t *raw_data)
Read the single ADC sample (raw data) for input channel.
Definition: ad4170_support.c:39
float ad4170_get_gain_value(uint8_t chn)
Get the actual ADC gain decimal value.
Definition: ad4170_support.c:205
int32_t ad4170_apply_excitation(uint8_t input_chn)
Apply the excitation sources.
Definition: ad4170_support.c:493
float convert_adc_data_to_voltage_wrt_vref(int32_t data, uint8_t chn)
Convert ADC data to voltage w.r.t. Vref.
Definition: ad4170_support.c:299
int32_t ad4170_remove_excitation(uint8_t input_chn)
Remove the excitation sources.
Definition: ad4170_support.c:503
int32_t ad4170_read_converted_sample(uint32_t *adc_data)
Read ADC raw data for recently sampled channel.
Definition: ad4170_support.c:145
int32_t ad4170_set_fs(struct ad4170_dev *dev, uint8_t setup, uint8_t chn, uint16_t fs_val)
Set Reference.
Definition: ad4170_support.c:577
float convert_adc_sample_into_voltage(uint32_t adc_raw, uint8_t chn)
Convert the ADC raw value into equivalent voltage.
Definition: ad4170_support.c:253
float convert_adc_data_to_voltage_without_vref(int32_t data, uint8_t chn)
Convert ADC data to voltage without Vref.
Definition: ad4170_support.c:278
int32_t ad4170_enable_input_chn(uint8_t input_chn)
Enable input channel.
Definition: ad4170_support.c:372
Definition: ad77681.h:497