precision-converters-firmware
ad469x_support.h
Go to the documentation of this file.
1 /***************************************************************************/
14 #ifndef AD469X_SUPPORT_H_
15 #define AD469X_SUPPORT_H_
16 
17 /******************************************************************************/
18 /***************************** Include Files **********************************/
19 /******************************************************************************/
20 
21 #include "ad469x.h"
22 #include "no_os_util.h"
23 
24 /******************************************************************************/
25 /********************** Macros and Constants Definition ***********************/
26 /******************************************************************************/
27 
28 /* Number of AD469x registers */
29 #define NUM_OF_REGISTERS 0x17F
30 
31 /* AD469x_REG_TEMPERATURE */
32 #define AD469x_TEMPERATURE_MSK NO_OS_GENMASK(0,0)
33 
34 /* AD469x Sequencer Lower Byte Configuration */
35 #define AD469x_SEQ_LB_CONFIG(x) ( x & NO_OS_GENMASK(7,0))
36 
37 /* AD469x Sequencer Upper Byte Configuration */
38 #define AD469x_SEQ_UB_CONFIG(x) ( x >> 8)
39 
40 /* AD469x Sequencer Lower Byte Register */
41 #define AD469x_REG_SEQ_LB AD469x_REG_STD_SEQ_CONFIG
42 
43 /* AD469x Sequencer Upper Byte Register */
44 #define AD469x_REG_SEQ_UB (AD469x_REG_STD_SEQ_CONFIG + 0x01)
45 
46 /* AD469x Sequencer Lower Byte Configuration */
47 #define AD469x_SINGLE_CHANNEL_EN(x) AD469x_CHANNEL(x)
48 
49 /* AD469x Enable Autocycle Mode*/
50 #define AD469x_SEQ_CHANNELS_RESET 0x00
51 
52 /* AD469x Sequencer disable all channels */
53 #define AD469x_EN_AUTOCYLE_MODE 0x01
54 
55 /* AD469x Manual Trigger Configurations */
56 #define AD469x_REG_SETUP_RESET 0x10
57 #define AD469x_REG_SEQ_CTRL_RESET 0x80
58 
59 /* AD469x Sequencer disable all channels */
60 #define AD469x_SEQ_CHANNEL_EN 1
61 #define AD469x_SEQ_CHANNEL_DI 0
62 
63 /******************************************************************************/
64 /********************** Variables and User Defined Data Types *****************/
65 /******************************************************************************/
73 };
74 
75 /******************************************************************************/
76 /************************ Public Declarations *********************************/
77 /******************************************************************************/
78 int32_t ad469x_polarity_mode_select(struct ad469x_dev *device,
79  enum ad469x_polarity_select polarity_sel);
80 int32_t ad469x_reference_config(struct ad469x_dev *device);
81 int32_t ad469x_trigger_conversion(struct ad469x_dev *device);
82 int32_t ad469x_read_single_sample(struct ad469x_dev *device,
83  uint8_t chn_num,
84  uint32_t *data);
85 
86 #endif /* AD469X_SUPPORT_H_ */
ad469x_polarity_select
Channel polarity modes.
Definition: ad469x_support.h:70
@ AD469x_PSEUDO_BIPOLAR_MODE
Definition: ad469x_support.h:72
@ AD469x_UNIPOLAR_MODE
Definition: ad469x_support.h:71
int32_t ad469x_polarity_mode_select(struct ad469x_dev *device, enum ad469x_polarity_select polarity_sel)
Select between polarity modes.
Definition: ad469x_support.c:49
int32_t ad469x_reference_config(struct ad469x_dev *device)
Configures the reference voltage setting.
Definition: ad469x_support.c:92
int32_t ad469x_read_single_sample(struct ad469x_dev *device, uint8_t chn_num, uint32_t *data)
Read single sample from the ADC.
Definition: ad469x_support.c:164
int32_t ad469x_trigger_conversion(struct ad469x_dev *device)
Toggles conversion pin to trigger a new conversion.
Definition: ad469x_support.c:114
struct ad5933_dev * device
Definition: main.c:77