precision-converters-firmware
Loading...
Searching...
No Matches
ad7606_support.h
Go to the documentation of this file.
1/***************************************************************************/
14#ifndef AD7606_SUPPORT_H_
15#define AD7606_SUPPORT_H_
16
17/******************************************************************************/
18/***************************** Include Files **********************************/
19/******************************************************************************/
20
21#include "ad7606.h"
22
23/******************************************************************************/
24/********************** Macros and Constants Definition ***********************/
25/******************************************************************************/
26
27/* Offset b/w two channel selections in CHx_RANGE register */
28#define CHANNEL_RANGE_MSK_OFFSET 4
29
30/* AD7606_REG_OVERSAMPLING */
31#define AD7606_OVERSAMPLING_MSK NO_OS_GENMASK(3,0)
32
33/* Default channel range for AD7606 devices */
34#define DEFAULT_CHN_RANGE (10.0)
35
36/* Diagnostic channels Mux configurations */
37#define AD7606_DIAGN_MUX_CH_VAL(ch, val) (val << (3 * ((ch) % 2)))
38
39#define AD7606_OPEN_DETECT_ENABLE_MSK(ch) (NO_OS_GENMASK(7,0) & (~(1 << ch)))
40
41/* Diagnostic channels Mux select bits */
42#define ANALOG_INPUT_MUX 0X00
43#define TEMPERATURE_MUX 0x01
44#define VREF_MUX 0X02
45#define ALDO_MUX 0X03
46#define DLDO_MUX 0X04
47#define VDRIVE_MUX 0x05
48
49/* Diagnostic Mux multiplers */
50#define VREF_MUX_MULTIPLIER 4.0
51
52/* Unipolar inputs range bits for AD7606C */
53#define AD7606C_UNIPOLAR_RANGE_MIN 5
54#define AD7606C_UNIPOLAR_RANGE_MAX 7
55
56/* Number of AD7606 registers */
57#define NUM_OF_REGISTERS 0x2F
58
59/******************************************************************************/
60/********************** Variables and User Defined Data Types *****************/
61/******************************************************************************/
62
63/* Analog input polarity */
64typedef enum {
68
69/******************************************************************************/
70/************************ Public Declarations *********************************/
71/******************************************************************************/
72
73int32_t ad7606_read_converted_sample(struct ad7606_dev *dev, uint32_t *adc_data,
74 uint8_t input_chn);
75int32_t ad7606_read_single_sample(struct ad7606_dev *dev,
76 uint32_t *adc_data, uint8_t chn);
77polarity_e ad7606_get_input_polarity(uint8_t chn_range_bits);
78
79#endif /* AD7606_SUPPORT_H_ */
polarity_e ad7606_get_input_polarity(uint8_t chn_range_bits)
Function to get the polarity of analog input.
Definition ad7606_support.c:47
polarity_e
Definition ad7606_support.h:64
@ BIPOLAR
Definition ad7606_support.h:66
@ UNIPOLAR
Definition ad7606_support.h:65
int32_t ad7606_read_single_sample(struct ad7606_dev *dev, uint32_t *adc_data, uint8_t chn)
Perform conversion and read single conversion sample.
Definition ad7606_support.c:68
int32_t ad7606_read_converted_sample(struct ad7606_dev *dev, uint32_t *adc_data, uint8_t input_chn)
Read ADC raw data for recently sampled channel.
Definition ad7606_support.c:96
Definition ad77681.h:497