1 /**************************************************************************//**
\r
3 * @brief Operational Amplifier (OPAMP) peripheral API
\r
5 ******************************************************************************
\r
7 * <b>(C) Copyright 2015 Silicon Labs, http://www.silabs.com</b>
\r
8 *******************************************************************************
\r
10 * Permission is granted to anyone to use this software for any purpose,
\r
11 * including commercial applications, and to alter it and redistribute it
\r
12 * freely, subject to the following restrictions:
\r
14 * 1. The origin of this software must not be misrepresented; you must not
\r
15 * claim that you wrote the original software.
\r
16 * 2. Altered source versions must be plainly marked as such, and must not be
\r
17 * misrepresented as being the original software.
\r
18 * 3. This notice may not be removed or altered from any source distribution.
\r
20 * DISCLAIMER OF WARRANTY/LIMITATION OF REMEDIES: Silicon Labs has no
\r
21 * obligation to support this Software. Silicon Labs is providing the
\r
22 * Software "AS IS", with no express or implied warranties of any kind,
\r
23 * including, but not limited to, any implied warranties of merchantability
\r
24 * or fitness for any particular purpose or warranties against infringement
\r
25 * of any proprietary rights of a third party.
\r
27 * Silicon Labs will not be liable for any consequential, incidental, or
\r
28 * special damages, or any other relief, or for any claim by any third party,
\r
29 * arising from your use of this Software.
\r
31 ******************************************************************************/
\r
33 #ifndef __SILICON_LABS_EM_OPAMP_H__
\r
34 #define __SILICON_LABS_EM_OPAMP_H__
\r
36 #include "em_device.h"
\r
37 #if defined(OPAMP_PRESENT) && (OPAMP_COUNT == 1)
\r
44 #include <stdbool.h>
\r
47 /***************************************************************************//**
\r
48 * @addtogroup EM_Library
\r
50 ******************************************************************************/
\r
52 /***************************************************************************//**
\r
55 ******************************************************************************/
\r
57 /** @cond DO_NOT_INCLUDE_WITH_DOXYGEN */
\r
59 /** Validation of DAC OPA number for assert statements. */
\r
60 #define DAC_OPA_VALID(opa) ((opa) <= OPA2)
\r
64 /*******************************************************************************
\r
65 ******************************** ENUMS ************************************
\r
66 ******************************************************************************/
\r
68 /** OPAMP selector values. */
\r
71 OPA0 = 0, /**< Select OPA0. */
\r
72 OPA1 = 1, /**< Select OPA1. */
\r
73 OPA2 = 2 /**< Select OPA2. */
\r
76 /** OPAMP negative terminal input selection values. */
\r
79 opaNegSelDisable = DAC_OPA0MUX_NEGSEL_DISABLE, /**< Input disabled. */
\r
80 opaNegSelUnityGain = DAC_OPA0MUX_NEGSEL_UG, /**< Unity gain feedback path. */
\r
81 opaNegSelResTap = DAC_OPA0MUX_NEGSEL_OPATAP, /**< Feedback resistor ladder tap. */
\r
82 opaNegSelNegPad = DAC_OPA0MUX_NEGSEL_NEGPAD /**< Negative pad as input. */
\r
83 } OPAMP_NegSel_TypeDef;
\r
85 /** OPAMP positive terminal input selection values. */
\r
88 opaPosSelDisable = DAC_OPA0MUX_POSSEL_DISABLE, /**< Input disabled. */
\r
89 opaPosSelDac = DAC_OPA0MUX_POSSEL_DAC, /**< DAC as input (not OPA2). */
\r
90 opaPosSelPosPad = DAC_OPA0MUX_POSSEL_POSPAD, /**< Positive pad as input. */
\r
91 opaPosSelOpaIn = DAC_OPA0MUX_POSSEL_OPA0INP, /**< Input from OPAx. */
\r
92 opaPosSelResTapOpa0 = DAC_OPA0MUX_POSSEL_OPATAP /**< Feedback resistor ladder tap from OPA0. */
\r
93 } OPAMP_PosSel_TypeDef;
\r
95 /** OPAMP output terminal selection values. */
\r
98 opaOutModeDisable = DAC_OPA0MUX_OUTMODE_DISABLE, /**< OPA output disabled. */
\r
99 opaOutModeMain = DAC_OPA0MUX_OUTMODE_MAIN, /**< Main output to pin enabled. */
\r
100 opaOutModeAlt = DAC_OPA0MUX_OUTMODE_ALT, /**< Alternate output(s) enabled (not OPA2). */
\r
101 opaOutModeAll = DAC_OPA0MUX_OUTMODE_ALL /**< Both main and alternate enabled (not OPA2). */
\r
102 } OPAMP_OutMode_TypeDef;
\r
104 /** OPAMP gain values. */
\r
107 opaResSelDefault = DAC_OPA0MUX_RESSEL_DEFAULT, /**< Default value when resistor ladder is unused. */
\r
108 opaResSelR2eq0_33R1 = DAC_OPA0MUX_RESSEL_RES0, /**< R2 = 0.33 * R1 */
\r
109 opaResSelR2eqR1 = DAC_OPA0MUX_RESSEL_RES1, /**< R2 = R1 */
\r
110 opaResSelR1eq1_67R1 = DAC_OPA0MUX_RESSEL_RES2, /**< R2 = 1.67 R1 */
\r
111 opaResSelR2eq2R1 = DAC_OPA0MUX_RESSEL_RES3, /**< R2 = 2 * R1 */
\r
112 opaResSelR2eq3R1 = DAC_OPA0MUX_RESSEL_RES4, /**< R2 = 3 * R1 */
\r
113 opaResSelR2eq4_33R1 = DAC_OPA0MUX_RESSEL_RES5, /**< R2 = 4.33 * R1 */
\r
114 opaResSelR2eq7R1 = DAC_OPA0MUX_RESSEL_RES6, /**< R2 = 7 * R1 */
\r
115 opaResSelR2eq15R1 = DAC_OPA0MUX_RESSEL_RES7 /**< R2 = 15 * R1 */
\r
116 } OPAMP_ResSel_TypeDef;
\r
118 /** OPAMP resistor ladder input selector values. */
\r
121 opaResInMuxDisable = DAC_OPA0MUX_RESINMUX_DISABLE, /**< Resistor ladder disabled. */
\r
122 opaResInMuxOpaIn = DAC_OPA0MUX_RESINMUX_OPA0INP, /**< Input from OPAx. */
\r
123 opaResInMuxNegPad = DAC_OPA0MUX_RESINMUX_NEGPAD, /**< Input from negative pad. */
\r
124 opaResInMuxPosPad = DAC_OPA0MUX_RESINMUX_POSPAD, /**< Input from positive pad. */
\r
125 opaResInMuxVss = DAC_OPA0MUX_RESINMUX_VSS /**< Input connected to Vss. */
\r
126 } OPAMP_ResInMux_TypeDef;
\r
128 /*******************************************************************************
\r
129 ******************************* STRUCTS ***********************************
\r
130 ******************************************************************************/
\r
132 /** OPAMP init structure. */
\r
135 OPAMP_NegSel_TypeDef negSel; /**< Select input source for negative terminal. */
\r
136 OPAMP_PosSel_TypeDef posSel; /**< Select input source for positive terminal. */
\r
137 OPAMP_OutMode_TypeDef outMode; /**< Output terminal connection. */
\r
138 OPAMP_ResSel_TypeDef resSel; /**< Select R2/R1 resistor ratio. */
\r
139 OPAMP_ResInMux_TypeDef resInMux; /**< Select input source for resistor ladder. */
\r
140 uint32_t outPen; /**< Alternate output enable bit mask. This value
\r
141 should consist of one or more of the
\r
142 DAC_OPA[opa#]MUX_OUTPEN_OUT[output#] flags
\r
143 (defined in \<part_name\>_dac.h) OR'ed together.
\r
146 @li DAC_OPA0MUX_OUTPEN_OUT0
\r
147 @li DAC_OPA0MUX_OUTPEN_OUT1
\r
148 @li DAC_OPA0MUX_OUTPEN_OUT2
\r
149 @li DAC_OPA0MUX_OUTPEN_OUT3
\r
150 @li DAC_OPA0MUX_OUTPEN_OUT4
\r
153 @li DAC_OPA1MUX_OUTPEN_OUT0
\r
154 @li DAC_OPA1MUX_OUTPEN_OUT1
\r
155 @li DAC_OPA1MUX_OUTPEN_OUT2
\r
156 @li DAC_OPA1MUX_OUTPEN_OUT3
\r
157 @li DAC_OPA1MUX_OUTPEN_OUT4
\r
160 @li DAC_OPA2MUX_OUTPEN_OUT0
\r
161 @li DAC_OPA2MUX_OUTPEN_OUT1
\r
164 init.outPen = DAC_OPA0MUX_OUTPEN_OUT0 |
\r
165 DAC_OPA0MUX_OUTPEN_OUT2 |
\r
166 DAC_OPA0MUX_OUTPEN_OUT4; */
\r
167 uint32_t bias; /**< Set OPAMP bias current. */
\r
168 bool halfBias; /**< Divide OPAMP bias current by 2. */
\r
169 bool lpfPosPadDisable; /**< Disable low pass filter on positive pad. */
\r
170 bool lpfNegPadDisable; /**< Disable low pass filter on negative pad. */
\r
171 bool nextOut; /**< Enable NEXTOUT signal source. */
\r
172 bool npEn; /**< Enable positive pad. */
\r
173 bool ppEn; /**< Enable negative pad. */
\r
174 bool shortInputs; /**< Short OPAMP input terminals. */
\r
175 bool hcmDisable; /**< Disable input rail-to-rail capability. */
\r
176 bool defaultOffset; /**< Use factory calibrated opamp offset value. */
\r
177 uint32_t offset; /**< Opamp offset value when @ref defaultOffset is false.*/
\r
178 } OPAMP_Init_TypeDef;
\r
180 /** Configuration of OPA0/1 in unity gain voltage follower mode. */
\r
181 #define OPA_INIT_UNITY_GAIN \
\r
183 opaNegSelUnityGain, /* Unity gain. */ \
\r
184 opaPosSelPosPad, /* Pos input from pad. */ \
\r
185 opaOutModeMain, /* Main output enabled. */ \
\r
186 opaResSelDefault, /* Resistor ladder is not used. */ \
\r
187 opaResInMuxDisable, /* Resistor ladder disabled. */ \
\r
188 0, /* No alternate outputs enabled. */ \
\r
189 _DAC_BIASPROG_BIASPROG_DEFAULT, /* Default bias setting. */ \
\r
190 _DAC_BIASPROG_HALFBIAS_DEFAULT, /* Default half-bias setting. */ \
\r
191 false, /* No low pass filter on pos pad. */ \
\r
192 false, /* No low pass filter on neg pad. */ \
\r
193 false, /* No nextout output enabled. */ \
\r
194 false, /* Neg pad disabled. */ \
\r
195 true, /* Pos pad enabled, used as signal input. */ \
\r
196 false, /* No shorting of inputs. */ \
\r
197 false, /* Rail-to-rail input enabled. */ \
\r
198 true, /* Use factory calibrated opamp offset. */ \
\r
199 0 /* Opamp offset value (not used). */ \
\r
202 /** Configuration of OPA2 in unity gain voltage follower mode. */
\r
203 #define OPA_INIT_UNITY_GAIN_OPA2 \
\r
205 opaNegSelUnityGain, /* Unity gain. */ \
\r
206 opaPosSelPosPad, /* Pos input from pad. */ \
\r
207 opaOutModeMain, /* Main output enabled. */ \
\r
208 opaResSelDefault, /* Resistor ladder is not used. */ \
\r
209 opaResInMuxDisable, /* Resistor ladder disabled. */ \
\r
210 DAC_OPA0MUX_OUTPEN_OUT0, /* Alternate output 0 enabled. */ \
\r
211 _DAC_BIASPROG_BIASPROG_DEFAULT, /* Default bias setting. */ \
\r
212 _DAC_BIASPROG_HALFBIAS_DEFAULT, /* Default half-bias setting. */ \
\r
213 false, /* No low pass filter on pos pad. */ \
\r
214 false, /* No low pass filter on neg pad. */ \
\r
215 false, /* No nextout output enabled. */ \
\r
216 false, /* Neg pad disabled. */ \
\r
217 true, /* Pos pad enabled, used as signal input. */ \
\r
218 false, /* No shorting of inputs. */ \
\r
219 false, /* Rail-to-rail input enabled. */ \
\r
220 true, /* Use factory calibrated opamp offset. */ \
\r
221 0 /* Opamp offset value (not used). */ \
\r
224 /** Configuration of OPA0/1 in non-inverting amplifier mode. */
\r
225 #define OPA_INIT_NON_INVERTING \
\r
227 opaNegSelResTap, /* Neg input from resistor ladder tap. */ \
\r
228 opaPosSelPosPad, /* Pos input from pad. */ \
\r
229 opaOutModeMain, /* Main output enabled. */ \
\r
230 opaResSelR2eq0_33R1, /* R2 = 1/3 R1 */ \
\r
231 opaResInMuxNegPad, /* Resistor ladder input from neg pad. */ \
\r
232 0, /* No alternate outputs enabled. */ \
\r
233 _DAC_BIASPROG_BIASPROG_DEFAULT, /* Default bias setting. */ \
\r
234 _DAC_BIASPROG_HALFBIAS_DEFAULT, /* Default half-bias setting. */ \
\r
235 false, /* No low pass filter on pos pad. */ \
\r
236 false, /* No low pass filter on neg pad. */ \
\r
237 false, /* No nextout output enabled. */ \
\r
238 true, /* Neg pad enabled, used as signal ground. */ \
\r
239 true, /* Pos pad enabled, used as signal input. */ \
\r
240 false, /* No shorting of inputs. */ \
\r
241 false, /* Rail-to-rail input enabled. */ \
\r
242 true, /* Use factory calibrated opamp offset. */ \
\r
243 0 /* Opamp offset value (not used). */ \
\r
246 /** Configuration of OPA2 in non-inverting amplifier mode. */
\r
247 #define OPA_INIT_NON_INVERTING_OPA2 \
\r
249 opaNegSelResTap, /* Neg input from resistor ladder tap. */ \
\r
250 opaPosSelPosPad, /* Pos input from pad. */ \
\r
251 opaOutModeMain, /* Main output enabled. */ \
\r
252 opaResSelR2eq0_33R1, /* R2 = 1/3 R1 */ \
\r
253 opaResInMuxNegPad, /* Resistor ladder input from neg pad. */ \
\r
254 DAC_OPA0MUX_OUTPEN_OUT0, /* Alternate output 0 enabled. */ \
\r
255 _DAC_BIASPROG_BIASPROG_DEFAULT, /* Default bias setting. */ \
\r
256 _DAC_BIASPROG_HALFBIAS_DEFAULT, /* Default half-bias setting. */ \
\r
257 false, /* No low pass filter on pos pad. */ \
\r
258 false, /* No low pass filter on neg pad. */ \
\r
259 false, /* No nextout output enabled. */ \
\r
260 true, /* Neg pad enabled, used as signal ground. */ \
\r
261 true, /* Pos pad enabled, used as signal input. */ \
\r
262 false, /* No shorting of inputs. */ \
\r
263 false, /* Rail-to-rail input enabled. */ \
\r
264 true, /* Use factory calibrated opamp offset. */ \
\r
265 0 /* Opamp offset value (not used). */ \
\r
268 /** Configuration of OPA0/1 in inverting amplifier mode. */
\r
269 #define OPA_INIT_INVERTING \
\r
271 opaNegSelResTap, /* Neg input from resistor ladder tap. */ \
\r
272 opaPosSelPosPad, /* Pos input from pad. */ \
\r
273 opaOutModeMain, /* Main output enabled. */ \
\r
274 opaResSelR2eqR1, /* R2 = R1 */ \
\r
275 opaResInMuxNegPad, /* Resistor ladder input from neg pad. */ \
\r
276 0, /* No alternate outputs enabled. */ \
\r
277 _DAC_BIASPROG_BIASPROG_DEFAULT, /* Default bias setting. */ \
\r
278 _DAC_BIASPROG_HALFBIAS_DEFAULT, /* Default half-bias setting. */ \
\r
279 false, /* No low pass filter on pos pad. */ \
\r
280 false, /* No low pass filter on neg pad. */ \
\r
281 false, /* No nextout output enabled. */ \
\r
282 true, /* Neg pad enabled, used as signal input. */ \
\r
283 true, /* Pos pad enabled, used as signal ground. */ \
\r
284 false, /* No shorting of inputs. */ \
\r
285 false, /* Rail-to-rail input enabled. */ \
\r
286 true, /* Use factory calibrated opamp offset. */ \
\r
287 0 /* Opamp offset value (not used). */ \
\r
290 /** Configuration of OPA2 in inverting amplifier mode. */
\r
291 #define OPA_INIT_INVERTING_OPA2 \
\r
293 opaNegSelResTap, /* Neg input from resistor ladder tap. */ \
\r
294 opaPosSelPosPad, /* Pos input from pad. */ \
\r
295 opaOutModeMain, /* Main output enabled. */ \
\r
296 opaResSelR2eqR1, /* R2 = R1 */ \
\r
297 opaResInMuxNegPad, /* Resistor ladder input from neg pad. */ \
\r
298 DAC_OPA0MUX_OUTPEN_OUT0, /* Alternate output 0 enabled. */ \
\r
299 _DAC_BIASPROG_BIASPROG_DEFAULT, /* Default bias setting. */ \
\r
300 _DAC_BIASPROG_HALFBIAS_DEFAULT, /* Default half-bias setting. */ \
\r
301 false, /* No low pass filter on pos pad. */ \
\r
302 false, /* No low pass filter on neg pad. */ \
\r
303 false, /* No nextout output enabled. */ \
\r
304 true, /* Neg pad enabled, used as signal input. */ \
\r
305 true, /* Pos pad enabled, used as signal ground. */ \
\r
306 false, /* No shorting of inputs. */ \
\r
307 false, /* Rail-to-rail input enabled. */ \
\r
308 true, /* Use factory calibrated opamp offset. */ \
\r
309 0 /* Opamp offset value (not used). */ \
\r
312 /** Configuration of OPA0 in cascaded non-inverting amplifier mode. */
\r
313 #define OPA_INIT_CASCADED_NON_INVERTING_OPA0 \
\r
315 opaNegSelResTap, /* Neg input from resistor ladder tap. */ \
\r
316 opaPosSelPosPad, /* Pos input from pad. */ \
\r
317 opaOutModeAll, /* Both main and alternate outputs. */ \
\r
318 opaResSelR2eq0_33R1, /* R2 = 1/3 R1 */ \
\r
319 opaResInMuxNegPad, /* Resistor ladder input from neg pad. */ \
\r
320 0, /* No alternate outputs enabled. */ \
\r
321 _DAC_BIASPROG_BIASPROG_DEFAULT, /* Default bias setting. */ \
\r
322 _DAC_BIASPROG_HALFBIAS_DEFAULT, /* Default half-bias setting. */ \
\r
323 false, /* No low pass filter on pos pad. */ \
\r
324 false, /* No low pass filter on neg pad. */ \
\r
325 true, /* Pass output to next stage (OPA1). */ \
\r
326 true, /* Neg pad enabled, used as signal ground. */ \
\r
327 true, /* Pos pad enabled, used as signal input. */ \
\r
328 false, /* No shorting of inputs. */ \
\r
329 false, /* Rail-to-rail input enabled. */ \
\r
330 true, /* Use factory calibrated opamp offset. */ \
\r
331 0 /* Opamp offset value (not used). */ \
\r
334 /** Configuration of OPA1 in cascaded non-inverting amplifier mode. */
\r
335 #define OPA_INIT_CASCADED_NON_INVERTING_OPA1 \
\r
337 opaNegSelResTap, /* Neg input from resistor ladder tap. */ \
\r
338 opaPosSelOpaIn, /* Pos input from OPA0 output. */ \
\r
339 opaOutModeAll, /* Both main and alternate outputs. */ \
\r
340 opaResSelR2eq0_33R1, /* R2 = 1/3 R1 */ \
\r
341 opaResInMuxNegPad, /* Resistor ladder input from neg pad. */ \
\r
342 0, /* No alternate outputs enabled. */ \
\r
343 _DAC_BIASPROG_BIASPROG_DEFAULT, /* Default bias setting. */ \
\r
344 _DAC_BIASPROG_HALFBIAS_DEFAULT, /* Default half-bias setting. */ \
\r
345 false, /* No low pass filter on pos pad. */ \
\r
346 false, /* No low pass filter on neg pad. */ \
\r
347 true, /* Pass output to next stage (OPA2). */ \
\r
348 true, /* Neg pad enabled, used as signal ground. */ \
\r
349 false, /* Pos pad disabled. */ \
\r
350 false, /* No shorting of inputs. */ \
\r
351 false, /* Rail-to-rail input enabled. */ \
\r
352 true, /* Use factory calibrated opamp offset. */ \
\r
353 0 /* Opamp offset value (not used). */ \
\r
356 /** Configuration of OPA2 in cascaded non-inverting amplifier mode. */
\r
357 #define OPA_INIT_CASCADED_NON_INVERTING_OPA2 \
\r
359 opaNegSelResTap, /* Neg input from resistor ladder tap. */ \
\r
360 opaPosSelOpaIn, /* Pos input from OPA1 output. */ \
\r
361 opaOutModeMain, /* Main output enabled. */ \
\r
362 opaResSelR2eq0_33R1, /* R2 = 1/3 R1 */ \
\r
363 opaResInMuxNegPad, /* Resistor ladder input from neg pad. */ \
\r
364 DAC_OPA0MUX_OUTPEN_OUT0, /* Alternate output 0 enabled. */ \
\r
365 _DAC_BIASPROG_BIASPROG_DEFAULT, /* Default bias setting. */ \
\r
366 _DAC_BIASPROG_HALFBIAS_DEFAULT, /* Default half-bias setting. */ \
\r
367 false, /* No low pass filter on pos pad. */ \
\r
368 false, /* No low pass filter on neg pad. */ \
\r
369 false, /* No nextout output enabled. */ \
\r
370 true, /* Neg pad enabled, used as signal ground. */ \
\r
371 false, /* Pos pad disabled. */ \
\r
372 false, /* No shorting of inputs. */ \
\r
373 false, /* Rail-to-rail input enabled. */ \
\r
374 true, /* Use factory calibrated opamp offset. */ \
\r
375 0 /* Opamp offset value (not used). */ \
\r
378 /** Configuration of OPA0 in cascaded inverting amplifier mode. */
\r
379 #define OPA_INIT_CASCADED_INVERTING_OPA0 \
\r
381 opaNegSelResTap, /* Neg input from resistor ladder tap. */ \
\r
382 opaPosSelPosPad, /* Pos input from pad. */ \
\r
383 opaOutModeAll, /* Both main and alternate outputs. */ \
\r
384 opaResSelR2eqR1, /* R2 = R1 */ \
\r
385 opaResInMuxNegPad, /* Resistor ladder input from neg pad. */ \
\r
386 0, /* No alternate outputs enabled. */ \
\r
387 _DAC_BIASPROG_BIASPROG_DEFAULT, /* Default bias setting. */ \
\r
388 _DAC_BIASPROG_HALFBIAS_DEFAULT, /* Default half-bias setting. */ \
\r
389 false, /* No low pass filter on pos pad. */ \
\r
390 false, /* No low pass filter on neg pad. */ \
\r
391 true, /* Pass output to next stage (OPA1). */ \
\r
392 true, /* Neg pad enabled, used as signal input. */ \
\r
393 true, /* Pos pad enabled, used as signal ground. */ \
\r
394 false, /* No shorting of inputs. */ \
\r
395 false, /* Rail-to-rail input enabled. */ \
\r
396 true, /* Use factory calibrated opamp offset. */ \
\r
397 0 /* Opamp offset value (not used). */ \
\r
400 /** Configuration of OPA1 in cascaded inverting amplifier mode. */
\r
401 #define OPA_INIT_CASCADED_INVERTING_OPA1 \
\r
403 opaNegSelResTap, /* Neg input from resistor ladder tap. */ \
\r
404 opaPosSelPosPad, /* Pos input from pad. */ \
\r
405 opaOutModeAll, /* Both main and alternate outputs. */ \
\r
406 opaResSelR2eqR1, /* R2 = R1 */ \
\r
407 opaResInMuxOpaIn, /* Resistor ladder input from OPA0. */ \
\r
408 0, /* No alternate outputs enabled. */ \
\r
409 _DAC_BIASPROG_BIASPROG_DEFAULT, /* Default bias setting. */ \
\r
410 _DAC_BIASPROG_HALFBIAS_DEFAULT, /* Default half-bias setting. */ \
\r
411 false, /* No low pass filter on pos pad. */ \
\r
412 false, /* No low pass filter on neg pad. */ \
\r
413 true, /* Pass output to next stage (OPA2). */ \
\r
414 false, /* Neg pad disabled. */ \
\r
415 true, /* Pos pad enabled, used as signal ground. */ \
\r
416 false, /* No shorting of inputs. */ \
\r
417 false, /* Rail-to-rail input enabled. */ \
\r
418 true, /* Use factory calibrated opamp offset. */ \
\r
419 0 /* Opamp offset value (not used). */ \
\r
422 /** Configuration of OPA2 in cascaded inverting amplifier mode. */
\r
423 #define OPA_INIT_CASCADED_INVERTING_OPA2 \
\r
425 opaNegSelResTap, /* Neg input from resistor ladder tap. */ \
\r
426 opaPosSelPosPad, /* Pos input from pad. */ \
\r
427 opaOutModeMain, /* Main output enabled. */ \
\r
428 opaResSelR2eqR1, /* R2 = R1 */ \
\r
429 opaResInMuxOpaIn, /* Resistor ladder input from OPA1. */ \
\r
430 DAC_OPA0MUX_OUTPEN_OUT0, /* Alternate output 0 enabled. */ \
\r
431 _DAC_BIASPROG_BIASPROG_DEFAULT, /* Default bias setting. */ \
\r
432 _DAC_BIASPROG_HALFBIAS_DEFAULT, /* Default half-bias setting. */ \
\r
433 false, /* No low pass filter on pos pad. */ \
\r
434 false, /* No low pass filter on neg pad. */ \
\r
435 false, /* No nextout output enabled. */ \
\r
436 false, /* Neg pad disabled. */ \
\r
437 true, /* Pos pad enabled, used as signal ground. */ \
\r
438 false, /* No shorting of inputs. */ \
\r
439 false, /* Rail-to-rail input enabled. */ \
\r
440 true, /* Use factory calibrated opamp offset. */ \
\r
441 0 /* Opamp offset value (not used). */ \
\r
444 /** Configuration of OPA0 in two-opamp differential driver mode. */
\r
445 #define OPA_INIT_DIFF_DRIVER_OPA0 \
\r
447 opaNegSelUnityGain, /* Unity gain. */ \
\r
448 opaPosSelPosPad, /* Pos input from pad. */ \
\r
449 opaOutModeAll, /* Both main and alternate outputs. */ \
\r
450 opaResSelDefault, /* Resistor ladder is not used. */ \
\r
451 opaResInMuxDisable, /* Resistor ladder disabled. */ \
\r
452 0, /* No alternate outputs enabled. */ \
\r
453 _DAC_BIASPROG_BIASPROG_DEFAULT, /* Default bias setting. */ \
\r
454 _DAC_BIASPROG_HALFBIAS_DEFAULT, /* Default half-bias setting. */ \
\r
455 false, /* No low pass filter on pos pad. */ \
\r
456 false, /* No low pass filter on neg pad. */ \
\r
457 true, /* Pass output to next stage (OPA1). */ \
\r
458 false, /* Neg pad disabled. */ \
\r
459 true, /* Pos pad enabled, used as signal input. */ \
\r
460 false, /* No shorting of inputs. */ \
\r
461 false, /* Rail-to-rail input enabled. */ \
\r
462 true, /* Use factory calibrated opamp offset. */ \
\r
463 0 /* Opamp offset value (not used). */ \
\r
466 /** Configuration of OPA1 in two-opamp differential driver mode. */
\r
467 #define OPA_INIT_DIFF_DRIVER_OPA1 \
\r
469 opaNegSelResTap, /* Neg input from resistor ladder tap. */ \
\r
470 opaPosSelPosPad, /* Pos input from pad. */ \
\r
471 opaOutModeMain, /* Main output enabled. */ \
\r
472 opaResSelR2eqR1, /* R2 = R1 */ \
\r
473 opaResInMuxOpaIn, /* Resistor ladder input from OPA0. */ \
\r
474 0, /* No alternate outputs enabled. */ \
\r
475 _DAC_BIASPROG_BIASPROG_DEFAULT, /* Default bias setting. */ \
\r
476 _DAC_BIASPROG_HALFBIAS_DEFAULT, /* Default half-bias setting. */ \
\r
477 false, /* No low pass filter on pos pad. */ \
\r
478 false, /* No low pass filter on neg pad. */ \
\r
479 false, /* No nextout output enabled. */ \
\r
480 false, /* Neg pad disabled. */ \
\r
481 true, /* Pos pad enabled, used as signal ground. */ \
\r
482 false, /* No shorting of inputs. */ \
\r
483 false, /* Rail-to-rail input enabled. */ \
\r
484 true, /* Use factory calibrated opamp offset. */ \
\r
485 0 /* Opamp offset value (not used). */ \
\r
488 /** Configuration of OPA0 in three-opamp differential receiver mode. */
\r
489 #define OPA_INIT_DIFF_RECEIVER_OPA0 \
\r
491 opaNegSelUnityGain, /* Unity gain. */ \
\r
492 opaPosSelPosPad, /* Pos input from pad. */ \
\r
493 opaOutModeAll, /* Both main and alternate outputs. */ \
\r
494 opaResSelR2eqR1, /* R2 = R1 */ \
\r
495 opaResInMuxNegPad, /* Resistor ladder input from neg pad. */ \
\r
496 0, /* No alternate outputs enabled. */ \
\r
497 _DAC_BIASPROG_BIASPROG_DEFAULT, /* Default bias setting. */ \
\r
498 _DAC_BIASPROG_HALFBIAS_DEFAULT, /* Default half-bias setting. */ \
\r
499 false, /* No low pass filter on pos pad. */ \
\r
500 false, /* No low pass filter on neg pad. */ \
\r
501 true, /* Pass output to next stage (OPA2). */ \
\r
502 true, /* Neg pad enabled, used as signal ground. */ \
\r
503 true, /* Pos pad enabled, used as signal input. */ \
\r
504 false, /* No shorting of inputs. */ \
\r
505 false, /* Rail-to-rail input enabled. */ \
\r
506 true, /* Use factory calibrated opamp offset. */ \
\r
507 0 /* Opamp offset value (not used). */ \
\r
510 /** Configuration of OPA1 in three-opamp differential receiver mode. */
\r
511 #define OPA_INIT_DIFF_RECEIVER_OPA1 \
\r
513 opaNegSelUnityGain, /* Unity gain. */ \
\r
514 opaPosSelPosPad, /* Pos input from pad. */ \
\r
515 opaOutModeAll, /* Both main and alternate outputs. */ \
\r
516 opaResSelDefault, /* Resistor ladder is not used. */ \
\r
517 opaResInMuxDisable, /* Disable resistor ladder. */ \
\r
518 0, /* No alternate outputs enabled. */ \
\r
519 _DAC_BIASPROG_BIASPROG_DEFAULT, /* Default bias setting. */ \
\r
520 _DAC_BIASPROG_HALFBIAS_DEFAULT, /* Default half-bias setting. */ \
\r
521 false, /* No low pass filter on pos pad. */ \
\r
522 false, /* No low pass filter on neg pad. */ \
\r
523 true, /* Pass output to next stage (OPA2). */ \
\r
524 false, /* Neg pad disabled. */ \
\r
525 true, /* Pos pad enabled, used as signal input. */ \
\r
526 false, /* No shorting of inputs. */ \
\r
527 false, /* Rail-to-rail input enabled. */ \
\r
528 true, /* Use factory calibrated opamp offset. */ \
\r
529 0 /* Opamp offset value (not used). */ \
\r
532 /** Configuration of OPA2 in three-opamp differential receiver mode. */
\r
533 #define OPA_INIT_DIFF_RECEIVER_OPA2 \
\r
535 opaNegSelResTap, /* Input from resistor ladder tap. */ \
\r
536 opaPosSelResTapOpa0, /* Input from OPA0 resistor ladder tap. */ \
\r
537 opaOutModeMain, /* Main output enabled. */ \
\r
538 opaResSelR2eqR1, /* R2 = R1 */ \
\r
539 opaResInMuxOpaIn, /* Resistor ladder input from OPA1. */ \
\r
540 DAC_OPA0MUX_OUTPEN_OUT0, /* Enable alternate output 0. */ \
\r
541 _DAC_BIASPROG_BIASPROG_DEFAULT, /* Default bias setting. */ \
\r
542 _DAC_BIASPROG_HALFBIAS_DEFAULT, /* Default half-bias setting. */ \
\r
543 false, /* No low pass filter on pos pad. */ \
\r
544 false, /* No low pass filter on neg pad. */ \
\r
545 false, /* No nextout output enabled. */ \
\r
546 false, /* Neg pad disabled. */ \
\r
547 false, /* Pos pad disabled. */ \
\r
548 false, /* No shorting of inputs. */ \
\r
549 false, /* Rail-to-rail input enabled. */ \
\r
550 true, /* Use factory calibrated opamp offset. */ \
\r
551 0 /* Opamp offset value (not used). */ \
\r
554 /*******************************************************************************
\r
555 ***************************** PROTOTYPES **********************************
\r
556 ******************************************************************************/
\r
558 void OPAMP_Disable(DAC_TypeDef *dac, OPAMP_TypeDef opa);
\r
559 void OPAMP_Enable(DAC_TypeDef *dac, OPAMP_TypeDef opa, const OPAMP_Init_TypeDef *init);
\r
561 /** @} (end addtogroup OPAMP) */
\r
562 /** @} (end addtogroup EM_Library) */
\r
568 #endif /* defined( OPAMP_PRESENT ) && ( OPAMP_COUNT == 1 ) */
\r
569 #endif /* __SILICON_LABS_EM_OPAMP_H__ */
\r