precision-converters-firmware
app_config.h
Go to the documentation of this file.
1 /*************************************************************************/
14 #ifndef _APP_CONFIG_H_
15 #define _APP_CONFIG_H_
16 
17 /******************************************************************************/
18 /***************************** Include Files **********************************/
19 /******************************************************************************/
20 
21 #include <stdint.h>
22 #include <PinNames.h>
23 
24 /******************************************************************************/
25 /********************** Macros and Constants Definitions **********************/
26 /******************************************************************************/
27 
35 //#define ARDUINO
36 
37 // **** Note for User: ACTIVE_DEVICE selection ****
38 // Define the device type here from the list of below device type defines
39 // e.g. #define DEV_AD5677R -> This will make AD5677R as an ACTIVE_DEVICE.
40 // The ACTIVE_DEVICE is default set to AD5686, if device type is not defined.
41 
42 //#define DEV_AD5677R
43 
44 #if defined(DEV_AD5671R)
45 #define ACTIVE_DEVICE ID_AD5671R
46 #define ACTIVE_DEVICE_NAME "AD5671R"
47 #elif defined(DEV_AD5672R)
48 #define ACTIVE_DEVICE ID_AD5672R
49 #define ACTIVE_DEVICE_NAME "AD5672R"
50 #elif defined(DEV_AD5673R)
51 #define ACTIVE_DEVICE ID_AD5673R
52 #define ACTIVE_DEVICE_NAME "AD5673R"
53 #elif defined(DEV_AD5674)
54 #define ACTIVE_DEVICE ID_AD5674
55 #define ACTIVE_DEVICE_NAME "AD5674"
56 #elif defined(DEV_AD5674R)
57 #define ACTIVE_DEVICE ID_AD5674R
58 #define ACTIVE_DEVICE_NAME "AD5674R"
59 #elif defined(DEV_AD5675R)
60 #define ACTIVE_DEVICE ID_AD5675R
61 #define ACTIVE_DEVICE_NAME "AD5675R"
62 #elif defined(DEV_AD5676)
63 #define ACTIVE_DEVICE ID_AD5676
64 #define ACTIVE_DEVICE_NAME "AD5676"
65 #elif defined(DEV_AD5676R)
66 #define ACTIVE_DEVICE ID_AD5676R
67 #define ACTIVE_DEVICE_NAME "AD5676R"
68 #elif defined(DEV_AD5677R)
69 #define ACTIVE_DEVICE ID_AD5677R
70 #define ACTIVE_DEVICE_NAME "AD5677R"
71 #elif defined(DEV_AD5679)
72 #define ACTIVE_DEVICE ID_AD5679
73 #define ACTIVE_DEVICE_NAME "AD5679"
74 #elif defined(DEV_AD5679R)
75 #define ACTIVE_DEVICE ID_AD5679R
76 #define ACTIVE_DEVICE_NAME "AD5679R"
77 #elif defined(DEV_AD5686)
78 #define ACTIVE_DEVICE ID_AD5686
79 #define ACTIVE_DEVICE_NAME "AD5686"
80 #elif defined(DEV_AD5684R)
81 #define ACTIVE_DEVICE ID_AD5684R
82 #define ACTIVE_DEVICE_NAME "AD5684R"
83 #elif defined(DEV_AD5685R)
84 #define ACTIVE_DEVICE ID_AD5685R
85 #define ACTIVE_DEVICE_NAME "AD5685R"
86 #elif defined(DEV_AD5686R)
87 #define ACTIVE_DEVICE ID_AD5686R
88 #define ACTIVE_DEVICE_NAME "AD5686R"
89 #elif defined(DEV_AD5687)
90 #define ACTIVE_DEVICE ID_AD5687
91 #define ACTIVE_DEVICE_NAME "AD5687"
92 #elif defined(DEV_AD5687R)
93 #define ACTIVE_DEVICE ID_AD5687R
94 #define ACTIVE_DEVICE_NAME "AD5687R"
95 #elif defined(DEV_AD5689)
96 #define ACTIVE_DEVICE ID_AD5689
97 #define ACTIVE_DEVICE_NAME "AD5689"
98 #elif defined(DEV_AD5689R)
99 #define ACTIVE_DEVICE ID_AD5689R
100 #define ACTIVE_DEVICE_NAME "AD5689R"
101 #elif defined(DEV_AD5697R)
102 #define ACTIVE_DEVICE ID_AD5697R
103 #define ACTIVE_DEVICE_NAME "AD5697R"
104 #elif defined(DEV_AD5694)
105 #define ACTIVE_DEVICE ID_AD5694
106 #define ACTIVE_DEVICE_NAME "AD5694"
107 #elif defined(DEV_AD5694R)
108 #define ACTIVE_DEVICE ID_AD5694R
109 #define ACTIVE_DEVICE_NAME "AD5694R"
110 #elif defined(DEV_AD5695R)
111 #define ACTIVE_DEVICE ID_AD5695R
112 #define ACTIVE_DEVICE_NAME "AD5695R"
113 #elif defined(DEV_AD5696)
114 #define ACTIVE_DEVICE ID_AD5696
115 #define ACTIVE_DEVICE_NAME "AD5696"
116 #elif defined(DEV_AD5696R)
117 #define ACTIVE_DEVICE ID_AD5696R
118 #define ACTIVE_DEVICE_NAME "AD5696R"
119 #elif defined(DEV_AD5681R)
120 #define ACTIVE_DEVICE ID_AD5681R
121 #define ACTIVE_DEVICE_NAME "AD5681R"
122 #elif defined(DEV_AD5682R)
123 #define ACTIVE_DEVICE ID_AD5682R
124 #define ACTIVE_DEVICE_NAME "AD5682R"
125 #elif defined(DEV_AD5683R)
126 #define ACTIVE_DEVICE ID_AD5683R
127 #define ACTIVE_DEVICE_NAME "AD5683R"
128 #elif defined(DEV_AD5683)
129 #define ACTIVE_DEVICE ID_AD5683
130 #define ACTIVE_DEVICE_NAME "AD5683"
131 #elif defined(DEV_AD5691R)
132 #define ACTIVE_DEVICE ID_AD5691R
133 #define ACTIVE_DEVICE_NAME "AD5691R"
134 #elif defined(DEV_AD5692R)
135 #define ACTIVE_DEVICE ID_AD5692R
136 #define ACTIVE_DEVICE_NAME "AD5692R"
137 #elif defined(DEV_AD5693R)
138 #define ACTIVE_DEVICE ID_AD5693R
139 #define ACTIVE_DEVICE_NAME "AD5693R"
140 #elif defined(DEV_AD5693)
141 #define ACTIVE_DEVICE ID_AD5693
142 #define ACTIVE_DEVICE_NAME "AD5693"
143 #else
144 #warning No/Unsupported ADxxxxy symbol defined. AD5686R defined
145 #define DEV_AD5686R
146 #define ACTIVE_DEVICE ID_AD5686R
147 #define ACTIVE_DEVICE_NAME "AD5686R"
148 #endif
149 
150 
151 // Pin mapping of nanoDAC+ with SDP-120 way or Arduino connectors
152 #ifdef ARDUINO
153 #define I2C_SCL ARDUINO_UNO_D15
154 #define I2C_SDA ARDUINO_UNO_D14
155 
156 #define SPI_CSB ARDUINO_UNO_D10
157 #define SPI_HOST_SDO ARDUINO_UNO_D11
158 #define SPI_HOST_SDI ARDUINO_UNO_D12
159 #define SPI_SCK ARDUINO_UNO_D13
160 
161 #define GAIN_PIN ARDUINO_UNO_D8
162 #define RESET_PIN ARDUINO_UNO_D9
163 #define LDAC_PIN ARDUINO_UNO_D7
164 #define ADDR0_PIN ARDUINO_UNO_D6
165 #else
166 #define I2C_SCL SDP_I2C_SCL // PH_7
167 #define I2C_SDA SDP_I2C_SDA // PC_9
168 
169 #define SPI_CSB SDP_SPI_CS_A // PB_9
170 #define SPI_HOST_SDO SDP_SPI_MOSI // PF_9
171 #define SPI_HOST_SDI SDP_SPI_MISO // PF_8
172 #define SPI_SCK SDP_SPI_SCK // PH_6
173 #endif
174 
175 // Define the other GPIO mapping based on the compatible EVAL board
176 // *Note: The 7-bit I2C slave address mentioned below is the default address for the
177 // device, set by combination of slave address bits (7:3) from the device
178 // datasheet and default logic level of A1 and A0 pins (bits 2:1) on the
179 // respective device EVAL board. For more information, refer the device
180 // datasheet and EVAL board manual.
181 
182 #if defined(DEV_AD5686R) || defined(DEV_AD5686) || \
183  defined(DEV_AD5684R) || defined(DEV_AD5684) || \
184  defined(DEV_AD5685R)
185 // These devices support EVAL-AD5686RSDZ board
186 #if !defined ARDUINO
187 #define GAIN_PIN SDP_GPIO_0
188 #define RESET_PIN SDP_GPIO_2
189 #define LDAC_PIN SDP_GPIO_3
190 #endif
191 #elif defined(DEV_AD5696R) || defined(DEV_AD5696) || \
192  defined(DEV_AD5694R) || defined(DEV_AD5694) || \
193  defined(DEV_AD5695R) || defined(DEV_AD5697R)
194 // These devices support EVAL-AD5696RSDZ board
195 #if !defined ARDUINO
196 #define GAIN_PIN SDP_GPIO_0
197 #define RESET_PIN SDP_GPIO_2
198 #define LDAC_PIN SDP_GPIO_3
199 #endif
200 #define I2C_SLAVE_ADDRESS 0x18
201 #elif defined(DEV_AD5683) || defined(DEV_AD5683R) || defined(DEV_AD5682R) || \
202  defined(DEV_AD5681R)
203 // These devices uses EVAL-AD5683R board
204 #if !defined ARDUINO
205 #define GAIN_PIN SDP_GPIO_2
206 #define RESET_PIN SDP_GPIO_1
207 #define LDAC_PIN SDP_GPIO_0
208 #endif
209 #elif defined(DEV_AD5693) || defined(DEV_AD5693R) || defined(DEV_AD5692R) || \
210  defined(DEV_AD5691R)
211 // These devices uses EVAL-AD5693R board
212 #if !defined ARDUINO
213 #define GAIN_PIN SDP_GPIO_2
214 #define RESET_PIN SDP_GPIO_1
215 #define LDAC_PIN SDP_GPIO_0
216 #endif
217 #define I2C_SLAVE_ADDRESS 0x98
218 #elif defined (DEV_AD5674R) || defined (DEV_AD5674) || \
219  defined (DEV_AD5679R) || defined (DEV_AD5679) || \
220  defined (DEV_AD5677R) || defined (DEV_AD5673R)
221 // These devices uses EVAL-AD5679RSDZ/EVAL-AD567xRSDZ board
222 #if !defined ARDUINO
223 #define GAIN_PIN SDP_GPIO_0
224 #define RESET_PIN SDP_GPIO_2
225 #define LDAC_PIN SDP_GPIO_1
226 #endif
227 #define I2C_SLAVE_ADDRESS 0x1E
228 #elif defined (DEV_AD5676R) || defined (DEV_AD5676) || \
229  defined (DEV_AD5672R)
230 // These devices uses EVAL-AD5676RSDZ board
231 #if !defined ARDUINO
232 #define GAIN_PIN SDP_GPIO_2
233 #define RESET_PIN SDP_GPIO_1
234 #define LDAC_PIN SDP_GPIO_0
235 #endif
236 #elif defined (DEV_AD5671R) || defined (DEV_AD5675R)
237 // These devices uses EVAL-AD5675RSDZ board
238 #if !defined ARDUINO
239 #define GAIN_PIN SDP_GPIO_2
240 #define RESET_PIN SDP_GPIO_1
241 #define LDAC_PIN SDP_GPIO_0
242 #endif
243 #define I2C_SLAVE_ADDRESS 0x18
244 #else
245 #warning No/Unsupported EVAL board found. Using EVAL-AD5686R as default.
246 #if !defined ARDUINO
247 #define GAIN_PIN SDP_GPIO_0
248 #define RESET_PIN SDP_GPIO_2
249 #define LDAC_PIN SDP_GPIO_3
250 #endif
251 #endif
252 
253 
254 // Common pin mappings
255 #define LED_GREEN LED3 // PK_5
256 
257 #endif //_APP_CONFIG_H_