1 /**************************************************************************//**
\r
3 * @brief Operational Amplifier (OPAMP) peripheral API
\r
5 ******************************************************************************
\r
7 * <b>(C) Copyright 2014 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
34 #ifndef __SILICON_LABS_EM_OPAMP_H_
\r
35 #define __SILICON_LABS_EM_OPAMP_H_
\r
37 #include "em_device.h"
\r
38 #if defined(OPAMP_PRESENT) && (OPAMP_COUNT == 1)
\r
45 #include <stdbool.h>
\r
48 /***************************************************************************//**
\r
49 * @addtogroup EM_Library
\r
51 ******************************************************************************/
\r
53 /***************************************************************************//**
\r
56 ******************************************************************************/
\r
58 /** @cond DO_NOT_INCLUDE_WITH_DOXYGEN */
\r
60 /** Validation of DAC OPA number for assert statements. */
\r
61 #define DAC_OPA_VALID(opa) ((opa) <= OPA2)
\r
65 /*******************************************************************************
\r
66 ******************************** ENUMS ************************************
\r
67 ******************************************************************************/
\r
69 /** OPAMP selector values. */
\r
72 OPA0 = 0, /**< Select OPA0. */
\r
73 OPA1 = 1, /**< Select OPA1. */
\r
74 OPA2 = 2 /**< Select OPA2. */
\r
77 /** OPAMP negative terminal input selection values. */
\r
80 opaNegSelDisable = DAC_OPA0MUX_NEGSEL_DISABLE, /**< Input disabled. */
\r
81 opaNegSelUnityGain = DAC_OPA0MUX_NEGSEL_UG, /**< Unity gain feedback path. */
\r
82 opaNegSelResTap = DAC_OPA0MUX_NEGSEL_OPATAP, /**< Feedback resistor ladder tap. */
\r
83 opaNegSelNegPad = DAC_OPA0MUX_NEGSEL_NEGPAD /**< Negative pad as input. */
\r
84 } OPAMP_NegSel_TypeDef;
\r
86 /** OPAMP positive terminal input selection values. */
\r
89 opaPosSelDisable = DAC_OPA0MUX_POSSEL_DISABLE, /**< Input disabled. */
\r
90 opaPosSelDac = DAC_OPA0MUX_POSSEL_DAC, /**< DAC as input (not OPA2). */
\r
91 opaPosSelPosPad = DAC_OPA0MUX_POSSEL_POSPAD, /**< Positive pad as input. */
\r
92 opaPosSelOpaIn = DAC_OPA0MUX_POSSEL_OPA0INP, /**< Input from OPAx. */
\r
93 opaPosSelResTapOpa0 = DAC_OPA0MUX_POSSEL_OPATAP /**< Feedback resistor ladder tap from OPA0. */
\r
94 } OPAMP_PosSel_TypeDef;
\r
96 /** OPAMP output terminal selection values. */
\r
99 opaOutModeDisable = DAC_OPA0MUX_OUTMODE_DISABLE, /**< OPA output disabled. */
\r
100 opaOutModeMain = DAC_OPA0MUX_OUTMODE_MAIN, /**< Main output to pin enabled. */
\r
101 opaOutModeAlt = DAC_OPA0MUX_OUTMODE_ALT, /**< Alternate output(s) enabled (not OPA2). */
\r
102 opaOutModeAll = DAC_OPA0MUX_OUTMODE_ALL /**< Both main and alternate enabled (not OPA2). */
\r
103 } OPAMP_OutMode_TypeDef;
\r
105 /** OPAMP gain values. */
\r
108 opaResSelDefault = DAC_OPA0MUX_RESSEL_DEFAULT, /**< Default value when resistor ladder is unused. */
\r
109 opaResSelR2eq0_33R1 = DAC_OPA0MUX_RESSEL_RES0, /**< R2 = 0.33 * R1 */
\r
110 opaResSelR2eqR1 = DAC_OPA0MUX_RESSEL_RES1, /**< R2 = R1 */
\r
111 opaResSelR1eq1_67R1 = DAC_OPA0MUX_RESSEL_RES2, /**< R2 = 1.67 R1 */
\r
112 opaResSelR2eq2R1 = DAC_OPA0MUX_RESSEL_RES3, /**< R2 = 2 * R1 */
\r
113 opaResSelR2eq3R1 = DAC_OPA0MUX_RESSEL_RES4, /**< R2 = 3 * R1 */
\r
114 opaResSelR2eq4_33R1 = DAC_OPA0MUX_RESSEL_RES5, /**< R2 = 4.33 * R1 */
\r
115 opaResSelR2eq7R1 = DAC_OPA0MUX_RESSEL_RES6, /**< R2 = 7 * R1 */
\r
116 opaResSelR2eq15R1 = DAC_OPA0MUX_RESSEL_RES7 /**< R2 = 15 * R1 */
\r
117 } OPAMP_ResSel_TypeDef;
\r
119 /** OPAMP resistor ladder input selector values. */
\r
122 opaResInMuxDisable = DAC_OPA0MUX_RESINMUX_DISABLE, /**< Resistor ladder disabled. */
\r
123 opaResInMuxOpaIn = DAC_OPA0MUX_RESINMUX_OPA0INP, /**< Input from OPAx. */
\r
124 opaResInMuxNegPad = DAC_OPA0MUX_RESINMUX_NEGPAD, /**< Input from negative pad. */
\r
125 opaResInMuxPosPad = DAC_OPA0MUX_RESINMUX_POSPAD, /**< Input from positive pad. */
\r
126 opaResInMuxVss = DAC_OPA0MUX_RESINMUX_VSS /**< Input connected to Vss. */
\r
127 } OPAMP_ResInMux_TypeDef;
\r
129 /*******************************************************************************
\r
130 ******************************* STRUCTS ***********************************
\r
131 ******************************************************************************/
\r
133 /** OPAMP init structure. */
\r
136 OPAMP_NegSel_TypeDef negSel; /**< Select input source for negative terminal. */
\r
137 OPAMP_PosSel_TypeDef posSel; /**< Select input source for positive terminal. */
\r
138 OPAMP_OutMode_TypeDef outMode; /**< Output terminal connection. */
\r
139 OPAMP_ResSel_TypeDef resSel; /**< Select R2/R1 resistor ratio. */
\r
140 OPAMP_ResInMux_TypeDef resInMux; /**< Select input source for resistor ladder. */
\r
141 uint32_t outPen; /**< Alternate output enable bit mask. This value
\r
142 should consist of one or more of the
\r
143 DAC_OPA[opa#]MUX_OUTPEN_OUT[output#] flags
\r
144 (defined in \<part_name\>_dac.h) OR'ed together.
\r
147 @li DAC_OPA0MUX_OUTPEN_OUT0
\r
148 @li DAC_OPA0MUX_OUTPEN_OUT1
\r
149 @li DAC_OPA0MUX_OUTPEN_OUT2
\r
150 @li DAC_OPA0MUX_OUTPEN_OUT3
\r
151 @li DAC_OPA0MUX_OUTPEN_OUT4
\r
154 @li DAC_OPA1MUX_OUTPEN_OUT0
\r
155 @li DAC_OPA1MUX_OUTPEN_OUT1
\r
156 @li DAC_OPA1MUX_OUTPEN_OUT2
\r
157 @li DAC_OPA1MUX_OUTPEN_OUT3
\r
158 @li DAC_OPA1MUX_OUTPEN_OUT4
\r
161 @li DAC_OPA2MUX_OUTPEN_OUT0
\r
162 @li DAC_OPA2MUX_OUTPEN_OUT1
\r
165 init.outPen = DAC_OPA0MUX_OUTPEN_OUT0 |
\r
166 DAC_OPA0MUX_OUTPEN_OUT2 |
\r
167 DAC_OPA0MUX_OUTPEN_OUT4; */
\r
168 uint32_t bias; /**< Set OPAMP bias current. */
\r
169 bool halfBias; /**< Divide OPAMP bias current by 2. */
\r
170 bool lpfPosPadDisable; /**< Disable low pass filter on positive pad. */
\r
171 bool lpfNegPadDisable; /**< Disable low pass filter on negative pad. */
\r
172 bool nextOut; /**< Enable NEXTOUT signal source. */
\r
173 bool npEn; /**< Enable positive pad. */
\r
174 bool ppEn; /**< Enable negative pad. */
\r
175 bool shortInputs; /**< Short OPAMP input terminals. */
\r
176 bool hcmDisable; /**< Disable input rail-to-rail capability. */
\r
177 bool defaultOffset; /**< Use factory calibrated opamp offset value. */
\r
178 uint32_t offset; /**< Opamp offset value when @ref defaultOffset is false.*/
\r
179 } OPAMP_Init_TypeDef;
\r
181 /** Configuration of OPA0/1 in unity gain voltage follower mode. */
\r
182 #define OPA_INIT_UNITY_GAIN \
\r
184 opaNegSelUnityGain, /* Unity gain. */ \
\r
185 opaPosSelPosPad, /* Pos input from pad. */ \
\r
186 opaOutModeMain, /* Main output enabled. */ \
\r
187 opaResSelDefault, /* Resistor ladder is not used. */ \
\r
188 opaResInMuxDisable, /* Resistor ladder disabled. */ \
\r
189 0, /* No alternate outputs enabled. */ \
\r
190 _DAC_BIASPROG_BIASPROG_DEFAULT, /* Default bias setting. */ \
\r
191 _DAC_BIASPROG_HALFBIAS_DEFAULT, /* Default half-bias setting. */ \
\r
192 false, /* No low pass filter on pos pad. */ \
\r
193 false, /* No low pass filter on neg pad. */ \
\r
194 false, /* No nextout output enabled. */ \
\r
195 false, /* Neg pad disabled. */ \
\r
196 true, /* Pos pad enabled, used as signal input. */ \
\r
197 false, /* No shorting of inputs. */ \
\r
198 false, /* Rail-to-rail input enabled. */ \
\r
199 true, /* Use factory calibrated opamp offset. */ \
\r
200 0 /* Opamp offset value (not used). */ \
\r
203 /** Configuration of OPA2 in unity gain voltage follower mode. */
\r
204 #define OPA_INIT_UNITY_GAIN_OPA2 \
\r
206 opaNegSelUnityGain, /* Unity gain. */ \
\r
207 opaPosSelPosPad, /* Pos input from pad. */ \
\r
208 opaOutModeMain, /* Main output enabled. */ \
\r
209 opaResSelDefault, /* Resistor ladder is not used. */ \
\r
210 opaResInMuxDisable, /* Resistor ladder disabled. */ \
\r
211 DAC_OPA0MUX_OUTPEN_OUT0, /* Alternate output 0 enabled. */ \
\r
212 _DAC_BIASPROG_BIASPROG_DEFAULT, /* Default bias setting. */ \
\r
213 _DAC_BIASPROG_HALFBIAS_DEFAULT, /* Default half-bias setting. */ \
\r
214 false, /* No low pass filter on pos pad. */ \
\r
215 false, /* No low pass filter on neg pad. */ \
\r
216 false, /* No nextout output enabled. */ \
\r
217 false, /* Neg pad disabled. */ \
\r
218 true, /* Pos pad enabled, used as signal input. */ \
\r
219 false, /* No shorting of inputs. */ \
\r
220 false, /* Rail-to-rail input enabled. */ \
\r
221 true, /* Use factory calibrated opamp offset. */ \
\r
222 0 /* Opamp offset value (not used). */ \
\r
225 /** Configuration of OPA0/1 in non-inverting amplifier mode. */
\r
226 #define OPA_INIT_NON_INVERTING \
\r
228 opaNegSelResTap, /* Neg input from resistor ladder tap. */ \
\r
229 opaPosSelPosPad, /* Pos input from pad. */ \
\r
230 opaOutModeMain, /* Main output enabled. */ \
\r
231 opaResSelR2eq0_33R1, /* R2 = 1/3 R1 */ \
\r
232 opaResInMuxNegPad, /* Resistor ladder input from neg pad. */ \
\r
233 0, /* No alternate outputs enabled. */ \
\r
234 _DAC_BIASPROG_BIASPROG_DEFAULT, /* Default bias setting. */ \
\r
235 _DAC_BIASPROG_HALFBIAS_DEFAULT, /* Default half-bias setting. */ \
\r
236 false, /* No low pass filter on pos pad. */ \
\r
237 false, /* No low pass filter on neg pad. */ \
\r
238 false, /* No nextout output enabled. */ \
\r
239 true, /* Neg pad enabled, used as signal ground. */ \
\r
240 true, /* Pos pad enabled, used as signal input. */ \
\r
241 false, /* No shorting of inputs. */ \
\r
242 false, /* Rail-to-rail input enabled. */ \
\r
243 true, /* Use factory calibrated opamp offset. */ \
\r
244 0 /* Opamp offset value (not used). */ \
\r
247 /** Configuration of OPA2 in non-inverting amplifier mode. */
\r
248 #define OPA_INIT_NON_INVERTING_OPA2 \
\r
250 opaNegSelResTap, /* Neg input from resistor ladder tap. */ \
\r
251 opaPosSelPosPad, /* Pos input from pad. */ \
\r
252 opaOutModeMain, /* Main output enabled. */ \
\r
253 opaResSelR2eq0_33R1, /* R2 = 1/3 R1 */ \
\r
254 opaResInMuxNegPad, /* Resistor ladder input from neg pad. */ \
\r
255 DAC_OPA0MUX_OUTPEN_OUT0, /* Alternate output 0 enabled. */ \
\r
256 _DAC_BIASPROG_BIASPROG_DEFAULT, /* Default bias setting. */ \
\r
257 _DAC_BIASPROG_HALFBIAS_DEFAULT, /* Default half-bias setting. */ \
\r
258 false, /* No low pass filter on pos pad. */ \
\r
259 false, /* No low pass filter on neg pad. */ \
\r
260 false, /* No nextout output enabled. */ \
\r
261 true, /* Neg pad enabled, used as signal ground. */ \
\r
262 true, /* Pos pad enabled, used as signal input. */ \
\r
263 false, /* No shorting of inputs. */ \
\r
264 false, /* Rail-to-rail input enabled. */ \
\r
265 true, /* Use factory calibrated opamp offset. */ \
\r
266 0 /* Opamp offset value (not used). */ \
\r
269 /** Configuration of OPA0/1 in inverting amplifier mode. */
\r
270 #define OPA_INIT_INVERTING \
\r
272 opaNegSelResTap, /* Neg input from resistor ladder tap. */ \
\r
273 opaPosSelPosPad, /* Pos input from pad. */ \
\r
274 opaOutModeMain, /* Main output enabled. */ \
\r
275 opaResSelR2eqR1, /* R2 = R1 */ \
\r
276 opaResInMuxNegPad, /* Resistor ladder input from neg pad. */ \
\r
277 0, /* No alternate outputs enabled. */ \
\r
278 _DAC_BIASPROG_BIASPROG_DEFAULT, /* Default bias setting. */ \
\r
279 _DAC_BIASPROG_HALFBIAS_DEFAULT, /* Default half-bias setting. */ \
\r
280 false, /* No low pass filter on pos pad. */ \
\r
281 false, /* No low pass filter on neg pad. */ \
\r
282 false, /* No nextout output enabled. */ \
\r
283 true, /* Neg pad enabled, used as signal input. */ \
\r
284 true, /* Pos pad enabled, used as signal ground. */ \
\r
285 false, /* No shorting of inputs. */ \
\r
286 false, /* Rail-to-rail input enabled. */ \
\r
287 true, /* Use factory calibrated opamp offset. */ \
\r
288 0 /* Opamp offset value (not used). */ \
\r
291 /** Configuration of OPA2 in inverting amplifier mode. */
\r
292 #define OPA_INIT_INVERTING_OPA2 \
\r
294 opaNegSelResTap, /* Neg input from resistor ladder tap. */ \
\r
295 opaPosSelPosPad, /* Pos input from pad. */ \
\r
296 opaOutModeMain, /* Main output enabled. */ \
\r
297 opaResSelR2eqR1, /* R2 = R1 */ \
\r
298 opaResInMuxNegPad, /* Resistor ladder input from neg pad. */ \
\r
299 DAC_OPA0MUX_OUTPEN_OUT0, /* Alternate output 0 enabled. */ \
\r
300 _DAC_BIASPROG_BIASPROG_DEFAULT, /* Default bias setting. */ \
\r
301 _DAC_BIASPROG_HALFBIAS_DEFAULT, /* Default half-bias setting. */ \
\r
302 false, /* No low pass filter on pos pad. */ \
\r
303 false, /* No low pass filter on neg pad. */ \
\r
304 false, /* No nextout output enabled. */ \
\r
305 true, /* Neg pad enabled, used as signal input. */ \
\r
306 true, /* Pos pad enabled, used as signal ground. */ \
\r
307 false, /* No shorting of inputs. */ \
\r
308 false, /* Rail-to-rail input enabled. */ \
\r
309 true, /* Use factory calibrated opamp offset. */ \
\r
310 0 /* Opamp offset value (not used). */ \
\r
313 /** Configuration of OPA0 in cascaded non-inverting amplifier mode. */
\r
314 #define OPA_INIT_CASCADED_NON_INVERTING_OPA0 \
\r
316 opaNegSelResTap, /* Neg input from resistor ladder tap. */ \
\r
317 opaPosSelPosPad, /* Pos input from pad. */ \
\r
318 opaOutModeAll, /* Both main and alternate outputs. */ \
\r
319 opaResSelR2eq0_33R1, /* R2 = 1/3 R1 */ \
\r
320 opaResInMuxNegPad, /* Resistor ladder input from neg pad. */ \
\r
321 0, /* No alternate outputs enabled. */ \
\r
322 _DAC_BIASPROG_BIASPROG_DEFAULT, /* Default bias setting. */ \
\r
323 _DAC_BIASPROG_HALFBIAS_DEFAULT, /* Default half-bias setting. */ \
\r
324 false, /* No low pass filter on pos pad. */ \
\r
325 false, /* No low pass filter on neg pad. */ \
\r
326 true, /* Pass output to next stage (OPA1). */ \
\r
327 true, /* Neg pad enabled, used as signal ground. */ \
\r
328 true, /* Pos pad enabled, used as signal input. */ \
\r
329 false, /* No shorting of inputs. */ \
\r
330 false, /* Rail-to-rail input enabled. */ \
\r
331 true, /* Use factory calibrated opamp offset. */ \
\r
332 0 /* Opamp offset value (not used). */ \
\r
335 /** Configuration of OPA1 in cascaded non-inverting amplifier mode. */
\r
336 #define OPA_INIT_CASCADED_NON_INVERTING_OPA1 \
\r
338 opaNegSelResTap, /* Neg input from resistor ladder tap. */ \
\r
339 opaPosSelOpaIn, /* Pos input from OPA0 output. */ \
\r
340 opaOutModeAll, /* Both main and alternate outputs. */ \
\r
341 opaResSelR2eq0_33R1, /* R2 = 1/3 R1 */ \
\r
342 opaResInMuxNegPad, /* Resistor ladder input from neg pad. */ \
\r
343 0, /* No alternate outputs enabled. */ \
\r
344 _DAC_BIASPROG_BIASPROG_DEFAULT, /* Default bias setting. */ \
\r
345 _DAC_BIASPROG_HALFBIAS_DEFAULT, /* Default half-bias setting. */ \
\r
346 false, /* No low pass filter on pos pad. */ \
\r
347 false, /* No low pass filter on neg pad. */ \
\r
348 true, /* Pass output to next stage (OPA2). */ \
\r
349 true, /* Neg pad enabled, used as signal ground. */ \
\r
350 false, /* Pos pad disabled. */ \
\r
351 false, /* No shorting of inputs. */ \
\r
352 false, /* Rail-to-rail input enabled. */ \
\r
353 true, /* Use factory calibrated opamp offset. */ \
\r
354 0 /* Opamp offset value (not used). */ \
\r
357 /** Configuration of OPA2 in cascaded non-inverting amplifier mode. */
\r
358 #define OPA_INIT_CASCADED_NON_INVERTING_OPA2 \
\r
360 opaNegSelResTap, /* Neg input from resistor ladder tap. */ \
\r
361 opaPosSelOpaIn, /* Pos input from OPA1 output. */ \
\r
362 opaOutModeMain, /* Main output enabled. */ \
\r
363 opaResSelR2eq0_33R1, /* R2 = 1/3 R1 */ \
\r
364 opaResInMuxNegPad, /* Resistor ladder input from neg pad. */ \
\r
365 DAC_OPA0MUX_OUTPEN_OUT0, /* Alternate output 0 enabled. */ \
\r
366 _DAC_BIASPROG_BIASPROG_DEFAULT, /* Default bias setting. */ \
\r
367 _DAC_BIASPROG_HALFBIAS_DEFAULT, /* Default half-bias setting. */ \
\r
368 false, /* No low pass filter on pos pad. */ \
\r
369 false, /* No low pass filter on neg pad. */ \
\r
370 false, /* No nextout output enabled. */ \
\r
371 true, /* Neg pad enabled, used as signal ground. */ \
\r
372 false, /* Pos pad disabled. */ \
\r
373 false, /* No shorting of inputs. */ \
\r
374 false, /* Rail-to-rail input enabled. */ \
\r
375 true, /* Use factory calibrated opamp offset. */ \
\r
376 0 /* Opamp offset value (not used). */ \
\r
379 /** Configuration of OPA0 in cascaded inverting amplifier mode. */
\r
380 #define OPA_INIT_CASCADED_INVERTING_OPA0 \
\r
382 opaNegSelResTap, /* Neg input from resistor ladder tap. */ \
\r
383 opaPosSelPosPad, /* Pos input from pad. */ \
\r
384 opaOutModeAll, /* Both main and alternate outputs. */ \
\r
385 opaResSelR2eqR1, /* R2 = R1 */ \
\r
386 opaResInMuxNegPad, /* Resistor ladder input from neg pad. */ \
\r
387 0, /* No alternate outputs enabled. */ \
\r
388 _DAC_BIASPROG_BIASPROG_DEFAULT, /* Default bias setting. */ \
\r
389 _DAC_BIASPROG_HALFBIAS_DEFAULT, /* Default half-bias setting. */ \
\r
390 false, /* No low pass filter on pos pad. */ \
\r
391 false, /* No low pass filter on neg pad. */ \
\r
392 true, /* Pass output to next stage (OPA1). */ \
\r
393 true, /* Neg pad enabled, used as signal input. */ \
\r
394 true, /* Pos pad enabled, used as signal ground. */ \
\r
395 false, /* No shorting of inputs. */ \
\r
396 false, /* Rail-to-rail input enabled. */ \
\r
397 true, /* Use factory calibrated opamp offset. */ \
\r
398 0 /* Opamp offset value (not used). */ \
\r
401 /** Configuration of OPA1 in cascaded inverting amplifier mode. */
\r
402 #define OPA_INIT_CASCADED_INVERTING_OPA1 \
\r
404 opaNegSelResTap, /* Neg input from resistor ladder tap. */ \
\r
405 opaPosSelPosPad, /* Pos input from pad. */ \
\r
406 opaOutModeAll, /* Both main and alternate outputs. */ \
\r
407 opaResSelR2eqR1, /* R2 = R1 */ \
\r
408 opaResInMuxOpaIn, /* Resistor ladder input from OPA0. */ \
\r
409 0, /* No alternate outputs enabled. */ \
\r
410 _DAC_BIASPROG_BIASPROG_DEFAULT, /* Default bias setting. */ \
\r
411 _DAC_BIASPROG_HALFBIAS_DEFAULT, /* Default half-bias setting. */ \
\r
412 false, /* No low pass filter on pos pad. */ \
\r
413 false, /* No low pass filter on neg pad. */ \
\r
414 true, /* Pass output to next stage (OPA2). */ \
\r
415 false, /* Neg pad disabled. */ \
\r
416 true, /* Pos pad enabled, used as signal ground. */ \
\r
417 false, /* No shorting of inputs. */ \
\r
418 false, /* Rail-to-rail input enabled. */ \
\r
419 true, /* Use factory calibrated opamp offset. */ \
\r
420 0 /* Opamp offset value (not used). */ \
\r
423 /** Configuration of OPA2 in cascaded inverting amplifier mode. */
\r
424 #define OPA_INIT_CASCADED_INVERTING_OPA2 \
\r
426 opaNegSelResTap, /* Neg input from resistor ladder tap. */ \
\r
427 opaPosSelPosPad, /* Pos input from pad. */ \
\r
428 opaOutModeMain, /* Main output enabled. */ \
\r
429 opaResSelR2eqR1, /* R2 = R1 */ \
\r
430 opaResInMuxOpaIn, /* Resistor ladder input from OPA1. */ \
\r
431 DAC_OPA0MUX_OUTPEN_OUT0, /* Alternate output 0 enabled. */ \
\r
432 _DAC_BIASPROG_BIASPROG_DEFAULT, /* Default bias setting. */ \
\r
433 _DAC_BIASPROG_HALFBIAS_DEFAULT, /* Default half-bias setting. */ \
\r
434 false, /* No low pass filter on pos pad. */ \
\r
435 false, /* No low pass filter on neg pad. */ \
\r
436 false, /* No nextout output enabled. */ \
\r
437 false, /* Neg pad disabled. */ \
\r
438 true, /* Pos pad enabled, used as signal ground. */ \
\r
439 false, /* No shorting of inputs. */ \
\r
440 false, /* Rail-to-rail input enabled. */ \
\r
441 true, /* Use factory calibrated opamp offset. */ \
\r
442 0 /* Opamp offset value (not used). */ \
\r
445 /** Configuration of OPA0 in two-opamp differential driver mode. */
\r
446 #define OPA_INIT_DIFF_DRIVER_OPA0 \
\r
448 opaNegSelUnityGain, /* Unity gain. */ \
\r
449 opaPosSelPosPad, /* Pos input from pad. */ \
\r
450 opaOutModeAll, /* Both main and alternate outputs. */ \
\r
451 opaResSelDefault, /* Resistor ladder is not used. */ \
\r
452 opaResInMuxDisable, /* Resistor ladder disabled. */ \
\r
453 0, /* No alternate outputs enabled. */ \
\r
454 _DAC_BIASPROG_BIASPROG_DEFAULT, /* Default bias setting. */ \
\r
455 _DAC_BIASPROG_HALFBIAS_DEFAULT, /* Default half-bias setting. */ \
\r
456 false, /* No low pass filter on pos pad. */ \
\r
457 false, /* No low pass filter on neg pad. */ \
\r
458 true, /* Pass output to next stage (OPA1). */ \
\r
459 false, /* Neg pad disabled. */ \
\r
460 true, /* Pos pad enabled, used as signal input. */ \
\r
461 false, /* No shorting of inputs. */ \
\r
462 false, /* Rail-to-rail input enabled. */ \
\r
463 true, /* Use factory calibrated opamp offset. */ \
\r
464 0 /* Opamp offset value (not used). */ \
\r
467 /** Configuration of OPA1 in two-opamp differential driver mode. */
\r
468 #define OPA_INIT_DIFF_DRIVER_OPA1 \
\r
470 opaNegSelResTap, /* Neg input from resistor ladder tap. */ \
\r
471 opaPosSelPosPad, /* Pos input from pad. */ \
\r
472 opaOutModeMain, /* Main output enabled. */ \
\r
473 opaResSelR2eqR1, /* R2 = R1 */ \
\r
474 opaResInMuxOpaIn, /* Resistor ladder input from OPA0. */ \
\r
475 0, /* No alternate outputs enabled. */ \
\r
476 _DAC_BIASPROG_BIASPROG_DEFAULT, /* Default bias setting. */ \
\r
477 _DAC_BIASPROG_HALFBIAS_DEFAULT, /* Default half-bias setting. */ \
\r
478 false, /* No low pass filter on pos pad. */ \
\r
479 false, /* No low pass filter on neg pad. */ \
\r
480 false, /* No nextout output enabled. */ \
\r
481 false, /* Neg pad disabled. */ \
\r
482 true, /* Pos pad enabled, used as signal ground. */ \
\r
483 false, /* No shorting of inputs. */ \
\r
484 false, /* Rail-to-rail input enabled. */ \
\r
485 true, /* Use factory calibrated opamp offset. */ \
\r
486 0 /* Opamp offset value (not used). */ \
\r
489 /** Configuration of OPA0 in three-opamp differential receiver mode. */
\r
490 #define OPA_INIT_DIFF_RECEIVER_OPA0 \
\r
492 opaNegSelUnityGain, /* Unity gain. */ \
\r
493 opaPosSelPosPad, /* Pos input from pad. */ \
\r
494 opaOutModeAll, /* Both main and alternate outputs. */ \
\r
495 opaResSelR2eqR1, /* R2 = R1 */ \
\r
496 opaResInMuxNegPad, /* Resistor ladder input from neg pad. */ \
\r
497 0, /* No alternate outputs enabled. */ \
\r
498 _DAC_BIASPROG_BIASPROG_DEFAULT, /* Default bias setting. */ \
\r
499 _DAC_BIASPROG_HALFBIAS_DEFAULT, /* Default half-bias setting. */ \
\r
500 false, /* No low pass filter on pos pad. */ \
\r
501 false, /* No low pass filter on neg pad. */ \
\r
502 true, /* Pass output to next stage (OPA2). */ \
\r
503 true, /* Neg pad enabled, used as signal ground. */ \
\r
504 true, /* Pos pad enabled, used as signal input. */ \
\r
505 false, /* No shorting of inputs. */ \
\r
506 false, /* Rail-to-rail input enabled. */ \
\r
507 true, /* Use factory calibrated opamp offset. */ \
\r
508 0 /* Opamp offset value (not used). */ \
\r
511 /** Configuration of OPA1 in three-opamp differential receiver mode. */
\r
512 #define OPA_INIT_DIFF_RECEIVER_OPA1 \
\r
514 opaNegSelUnityGain, /* Unity gain. */ \
\r
515 opaPosSelPosPad, /* Pos input from pad. */ \
\r
516 opaOutModeAll, /* Both main and alternate outputs. */ \
\r
517 opaResSelDefault, /* Resistor ladder is not used. */ \
\r
518 opaResInMuxDisable, /* Disable resistor ladder. */ \
\r
519 0, /* No alternate outputs enabled. */ \
\r
520 _DAC_BIASPROG_BIASPROG_DEFAULT, /* Default bias setting. */ \
\r
521 _DAC_BIASPROG_HALFBIAS_DEFAULT, /* Default half-bias setting. */ \
\r
522 false, /* No low pass filter on pos pad. */ \
\r
523 false, /* No low pass filter on neg pad. */ \
\r
524 true, /* Pass output to next stage (OPA2). */ \
\r
525 false, /* Neg pad disabled. */ \
\r
526 true, /* Pos pad enabled, used as signal input. */ \
\r
527 false, /* No shorting of inputs. */ \
\r
528 false, /* Rail-to-rail input enabled. */ \
\r
529 true, /* Use factory calibrated opamp offset. */ \
\r
530 0 /* Opamp offset value (not used). */ \
\r
533 /** Configuration of OPA2 in three-opamp differential receiver mode. */
\r
534 #define OPA_INIT_DIFF_RECEIVER_OPA2 \
\r
536 opaNegSelResTap, /* Input from resistor ladder tap. */ \
\r
537 opaPosSelResTapOpa0, /* Input from OPA0 resistor ladder tap. */ \
\r
538 opaOutModeMain, /* Main output enabled. */ \
\r
539 opaResSelR2eqR1, /* R2 = R1 */ \
\r
540 opaResInMuxOpaIn, /* Resistor ladder input from OPA1. */ \
\r
541 DAC_OPA0MUX_OUTPEN_OUT0, /* Enable alternate output 0. */ \
\r
542 _DAC_BIASPROG_BIASPROG_DEFAULT, /* Default bias setting. */ \
\r
543 _DAC_BIASPROG_HALFBIAS_DEFAULT, /* Default half-bias setting. */ \
\r
544 false, /* No low pass filter on pos pad. */ \
\r
545 false, /* No low pass filter on neg pad. */ \
\r
546 false, /* No nextout output enabled. */ \
\r
547 false, /* Neg pad disabled. */ \
\r
548 false, /* Pos pad disabled. */ \
\r
549 false, /* No shorting of inputs. */ \
\r
550 false, /* Rail-to-rail input enabled. */ \
\r
551 true, /* Use factory calibrated opamp offset. */ \
\r
552 0 /* Opamp offset value (not used). */ \
\r
555 /*******************************************************************************
\r
556 ***************************** PROTOTYPES **********************************
\r
557 ******************************************************************************/
\r
559 void OPAMP_Disable(DAC_TypeDef *dac, OPAMP_TypeDef opa);
\r
560 void OPAMP_Enable(DAC_TypeDef *dac, OPAMP_TypeDef opa, const OPAMP_Init_TypeDef *init);
\r
562 /** @} (end addtogroup OPAMP) */
\r
563 /** @} (end addtogroup EM_Library) */
\r
569 #endif /* defined( OPAMP_PRESENT ) && ( OPAMP_COUNT == 1 ) */
\r
570 #endif /* __SILICON_LABS_EM_OPAMP_H_ */
\r