precision-converters-firmware
ad4170_user_config.h
Go to the documentation of this file.
1 /*************************************************************************/
13 #ifndef _AD4170_USER_CONFIG_H_
14 #define _AD4170_USER_CONFIG_H_
15 
16 /******************************************************************************/
17 /***************************** Include Files **********************************/
18 /******************************************************************************/
19 
20 #include <stdint.h>
21 #include <stdlib.h>
22 
23 #include "app_config.h"
24 #include "ad4170.h"
25 
26 /******************************************************************************/
27 /********************** Macros and Constants Definition ***********************/
28 /******************************************************************************/
29 
30 #define DIFFERENTIAL_CHN_CFG // comment to select single-ended chn config
31 
32 /* Select filter type for default user config (same for all channels) */
33 /* The filter type is chosen depending on the interface mode as it decides
34 /* output data rate that appears on the DIG_AUX1 pin and the upper limit
35 /* for the ODR is higher for TDM Mode compared to the SPI.
36  * Example -:
37  * Sinc5+averaging filter allows FS_CONFIG_VALUE to be configured from
38  * 4 (125ksps) to 8330 (60.4sps) in steps of 4,
39  * Sinc5 filter allows the same to be configured from 1 (500ksps) to 256 (1953sps) in
40  * steps of 2
41  * Please refer to the data sheet for more details on digital filters */
42 #if (INTERFACE_MODE == SPI_INTERRUPT_MODE)
43 #define AD4170_FILTER_CONFIG AD4170_FILT_SINC5_AVG
44 #else // TDM_MODE and SPI_DMA Mode
45 #define AD4170_FILTER_CONFIG AD4170_FILT_SINC5
46 #endif
47 
48 /* Select FS (or ODR) for default user config (same for all channels) */
49 #define AD4170_FS_CONFIG FS_CONFIG_VALUE
50 
51 /* Scaler factor used in FS value to ODR conversion (for SINC5+Avg filter) */
52 #define FS_TO_ODR_CONV_SCALER (32U * AD4170_FS_CONFIG)
53 
54 /* Select the ADC continuous conversion mode for default config
55  * Note: When supplying FIR coefficients, set this macro to 'AD4170_MODE_CONT_FIR' */
56 #define AD4170_CONT_CONV_MODE_CONFIG AD4170_MODE_CONT
57 
58 /* Select the positive and negative analog inputs for each channel */
59 #if defined(DIFFERENTIAL_CHN_CFG)
60 /* Differential-ended channel configuration */
61 #define CHN0_AINP AD4170_AIN0
62 #define CHN0_AINM AD4170_AIN1
63 #define CHN1_AINP AD4170_AIN3
64 #define CHN1_AINM AD4170_AIN4
65 #define CHN2_AINP AD4170_AIN5
66 #define CHN2_AINM AD4170_AIN6
67 #if (DIFFERENTIAL_CHNS > 3)
68 #define CHN3_AINP AD4170_AIN7
69 #define CHN3_AINM AD4170_AIN8
70 #endif
71 #if (DIFFERENTIAL_CHNS > 4)
72 #define CHN4_AINP AD4170_AIN8
73 #define CHN4_AINM AD4170_AIN9
74 #define CHN5_AINP AD4170_AIN10
75 #define CHN5_AINM AD4170_AIN11
76 #define CHN6_AINP AD4170_AIN12
77 #define CHN6_AINM AD4170_AIN13
78 #define CHN7_AINP AD4170_AIN14
79 #define CHN7_AINM AD4170_AIN15
80 #endif
81 #define TOTAL_CHANNELS DIFFERENTIAL_CHNS
82 #else
83 /* Single-ended channel configuration */
84 #define CHN0_AINP AD4170_AIN0
85 #define CHN0_AINM AD4170_DGND
86 #define CHN1_AINP AD4170_AIN1
87 #define CHN1_AINM AD4170_DGND
88 #define CHN2_AINP AD4170_AIN2
89 #define CHN2_AINM AD4170_DGND
90 #define CHN3_AINP AD4170_AIN3
91 #define CHN3_AINM AD4170_DGND
92 #define CHN4_AINP AD4170_AIN4
93 #define CHN4_AINM AD4170_DGND
94 #define CHN5_AINP AD4170_AIN5
95 #define CHN5_AINM AD4170_DGND
96 #if (SINGLE_ENDED_CHNS > 6)
97 #define CHN6_AINP AD4170_AIN6
98 #define CHN6_AINM AD4170_DGND
99 #define CHN7_AINP AD4170_AIN7
100 #define CHN7_AINM AD4170_DGND
101 #endif
102 #if (SINGLE_ENDED_CHNS > 8)
103 #define CHN8_AINP AD4170_AIN8
104 #define CHN8_AINM AD4170_DGND
105 #define CHN9_AINP AD4170_AIN9
106 #define CHN9_AINM AD4170_DGND
107 #define CHN10_AINP AD4170_AIN10
108 #define CHN10_AINM AD4170_DGND
109 #define CHN11_AINP AD4170_AIN11
110 #define CHN11_AINM AD4170_DGND
111 #define CHN12_AINP AD4170_AIN12
112 #define CHN12_AINM AD4170_DGND
113 #define CHN13_AINP AD4170_AIN13
114 #define CHN13_AINM AD4170_DGND
115 #define CHN14_AINP AD4170_AIN14
116 #define CHN14_AINM AD4170_DGND
117 #define CHN15_AINP AD4170_AIN15
118 #define CHN15_AINM AD4170_DGND
119 #endif
120 #define TOTAL_CHANNELS SINGLE_ENDED_CHNS
121 #endif
122 
123 /******************************************************************************/
124 /********************** Variables and User Defined Data Types *****************/
125 /******************************************************************************/
126 
127 extern struct ad4170_init_param ad4170_user_config_params;
128 
129 #endif /* end of _AD4170_USER_CONFIG_H_ */
struct ad4170_init_param ad4170_user_config_params
Definition: ad4170_user_config.c:49
Configuration file of nanodac firmware example program.