OPAMPEMLIB
Detailed Description
Operational Amplifier (OPAMP) peripheral API.
This module contains functions to:
- OPAMP_Enable() Configure and enable OPAMP.
- OPAMP_Disable() Disable OPAMP.
All OPAMP functions assume that the DAC clock is running. If DAC is not used, the clock can be turned off when OPAMPs are configured.
If the available gain values don't suit the application at hand, the resistor ladders can be disabled and external gain programming resistors used.
A number of predefined OPAMP setup macros are available for configuration of the most common OPAMP topologies (see figures below).
- Note
- The terms POSPAD and NEGPAD in the figures are used to indicate that these pads should be connected to a suitable signal ground.
      
      
       Unity gain voltage follower.
      
      
      Use predefined macros
      
       OPA_INIT_UNITY_GAIN
      
      and
      
       OPA_INIT_UNITY_GAIN_OPA2
      
      .
     
                    |\
         ___________|+\
                    |  \_______
                 ___|_ /    |
                |   | /     |
                |   |/      |
                |___________|
     
      
      
       Non-inverting amplifier.
      
      
      Use predefined macros
      
       OPA_INIT_NON_INVERTING
      
      and
      
       OPA_INIT_NON_INVERTING_OPA2
      
      .
     
                    |\
         ___________|+\
                    |  \_______
                 ___|_ /    |
                |   | /     |
                |   |/      |
                |_____R2____|
                |
                R1
                |
              NEGPAD 
     
      
      
       Inverting amplifier.
      
      
      Use predefined macros
      
       OPA_INIT_INVERTING
      
      and
      
       OPA_INIT_INVERTING_OPA2
      
      .
     
                 _____R2____
                |           |
                |   |\      |
         ____R1_|___|_\     |
                    |  \____|___
                 ___|  /
                |   |+/
                |   |/
                |
              POSPAD 
     
      
      
       Cascaded non-inverting amplifiers.
      
      
      Use predefined macros
      
       OPA_INIT_CASCADED_NON_INVERTING_OPA0
      
      ,
      
       OPA_INIT_CASCADED_NON_INVERTING_OPA1
      
      and
      
       OPA_INIT_CASCADED_NON_INVERTING_OPA2
      
      .
     
                    |\                       |\                       |\
         ___________|+\ OPA0      ___________|+\ OPA1      ___________|+\ OPA2
                    |  \_________|           |  \_________|           |  \_______
                 ___|_ /    |             ___|_ /    |             ___|_ /    |
                |   | /     |            |   | /     |            |   | /     |
                |   |/      |            |   |/      |            |   |/      |
                |_____R2____|            |_____R2____|            |_____R2____|
                |                        |                        |
                R1                       R1                       R1
                |                        |                        |
              NEGPAD                   NEGPAD                   NEGPAD 
     
      
      
       Cascaded inverting amplifiers.
      
      
      Use predefined macros
      
       OPA_INIT_CASCADED_INVERTING_OPA0
      
      ,
      
       OPA_INIT_CASCADED_INVERTING_OPA1
      
      and
      
       OPA_INIT_CASCADED_INVERTING_OPA2
      
      .
     
                 _____R2____              _____R2____              _____R2____
                |           |            |           |            |           |
                |   |\      |            |   |\      |            |   |\      |
         ____R1_|___|_\     |     ____R1_|___|_\     |     ____R1_|___|_\     |
                    |  \____|____|           |  \____|___|            |  \____|__
                 ___|  /                  ___|  /                  ___|  /
                |   |+/ OPA0             |   |+/ OPA1             |   |+/ OPA2
                |   |/                   |   |/                   |   |/
                |                        |                        |
              POSPAD                   POSPAD                   POSPAD 
     
      
      
       Differential driver with two opamp's.
      
      
      Use predefined macros
      
       OPA_INIT_DIFF_DRIVER_OPA0
      
      and
      
       OPA_INIT_DIFF_DRIVER_OPA1
      
      .
     
                                  __________________________
                                 |                          +
                                 |        _____R2____
                    |\           |       |           |
         ___________|+\ OPA0     |       |   |\ OPA1 |
                    |  \_________|____R1_|___|_\     |      _
                 ___|_ /         |           |  \____|______
                |   | /          |        ___|  /
                |   |/           |       |   |+/
                |________________|       |   |/
                                         |
                                       POSPAD 
     
      
      
       Differential receiver with three opamp's.
      
      
      Use predefined macros
      
       OPA_INIT_DIFF_RECEIVER_OPA0
      
      ,
      
       OPA_INIT_DIFF_RECEIVER_OPA1
      
      and
      
       OPA_INIT_DIFF_RECEIVER_OPA2
      
      .
     
                    |\
          __________|+\ OPA1
         _          |  \_________
                 ___|_ /    |    |        _____R2____
                |   | /     |    |       |           |
                |   |/      |    |       |   |\      |
                |___________|    |____R1_|___|_\     |
                                             |  \____|___
                    |\            ____R1_ ___|  /
         +__________|+\ OPA0     |       |   |+/ OPA2
                    |  \_________|       |   |/
                 ___|_ /    |            R2
                |   | /     |            |
                |   |/      |          NEGPAD OPA0
                |___________|
     | Data Structures | |
| struct | OPAMP_Init_TypeDef | 
| Macros | |
| #define | OPA_INIT_CASCADED_INVERTING_OPA0 | 
| #define | OPA_INIT_CASCADED_INVERTING_OPA1 | 
| #define | OPA_INIT_CASCADED_INVERTING_OPA2 | 
| #define | OPA_INIT_CASCADED_NON_INVERTING_OPA0 | 
| #define | OPA_INIT_CASCADED_NON_INVERTING_OPA1 | 
| #define | OPA_INIT_CASCADED_NON_INVERTING_OPA2 | 
| #define | OPA_INIT_DIFF_DRIVER_OPA0 | 
| #define | OPA_INIT_DIFF_DRIVER_OPA1 | 
| #define | OPA_INIT_DIFF_RECEIVER_OPA0 | 
| #define | OPA_INIT_DIFF_RECEIVER_OPA1 | 
| #define | OPA_INIT_DIFF_RECEIVER_OPA2 | 
| #define | OPA_INIT_INVERTING | 
| #define | OPA_INIT_INVERTING_OPA2 | 
| #define | OPA_INIT_NON_INVERTING | 
| #define | OPA_INIT_NON_INVERTING_OPA2 | 
| #define | OPA_INIT_UNITY_GAIN | 
| #define | OPA_INIT_UNITY_GAIN_OPA2 | 
| Enumerations | |
| enum | OPAMP_NegSel_TypeDef
         
         { opaNegSelDisable = DAC_OPA0MUX_NEGSEL_DISABLE, opaNegSelUnityGain = DAC_OPA0MUX_NEGSEL_UG, opaNegSelResTap = DAC_OPA0MUX_NEGSEL_OPATAP, opaNegSelNegPad = DAC_OPA0MUX_NEGSEL_NEGPAD } | 
| enum | OPAMP_OutMode_TypeDef
         
         { opaOutModeDisable = DAC_OPA0MUX_OUTMODE_DISABLE, opaOutModeMain = DAC_OPA0MUX_OUTMODE_MAIN, opaOutModeAlt = DAC_OPA0MUX_OUTMODE_ALT, opaOutModeAll = DAC_OPA0MUX_OUTMODE_ALL } | 
| enum | OPAMP_PosSel_TypeDef
         
         { opaPosSelDisable = DAC_OPA0MUX_POSSEL_DISABLE, opaPosSelDac = DAC_OPA0MUX_POSSEL_DAC, opaPosSelPosPad = DAC_OPA0MUX_POSSEL_POSPAD, opaPosSelOpaIn = DAC_OPA0MUX_POSSEL_OPA0INP, opaPosSelResTapOpa0 = DAC_OPA0MUX_POSSEL_OPATAP } | 
| enum | OPAMP_ResInMux_TypeDef
         
         { opaResInMuxDisable = DAC_OPA0MUX_RESINMUX_DISABLE, opaResInMuxOpaIn = DAC_OPA0MUX_RESINMUX_OPA0INP, opaResInMuxNegPad = DAC_OPA0MUX_RESINMUX_NEGPAD, opaResInMuxPosPad = DAC_OPA0MUX_RESINMUX_POSPAD, opaResInMuxVss = DAC_OPA0MUX_RESINMUX_VSS } | 
| enum | OPAMP_ResSel_TypeDef
         
         { opaResSelDefault = DAC_OPA0MUX_RESSEL_DEFAULT, opaResSelR2eq0_33R1 = DAC_OPA0MUX_RESSEL_RES0, opaResSelR2eqR1 = DAC_OPA0MUX_RESSEL_RES1, opaResSelR1eq1_67R1 = DAC_OPA0MUX_RESSEL_RES2, opaResSelR2eq2R1 = DAC_OPA0MUX_RESSEL_RES3, opaResSelR2eq3R1 = DAC_OPA0MUX_RESSEL_RES4, opaResSelR2eq4_33R1 = DAC_OPA0MUX_RESSEL_RES5, opaResSelR2eq7R1 = DAC_OPA0MUX_RESSEL_RES6, opaResSelR2eq15R1 = DAC_OPA0MUX_RESSEL_RES7 } | 
| enum | OPAMP_TypeDef
         
         { OPA0 = 0, OPA1 = 1, OPA2 = 2 } | 
| Functions | |
| void | OPAMP_Disable ( DAC_TypeDef *dac, OPAMP_TypeDef opa) | 
| Disable an Operational Amplifier. | |
| void | OPAMP_Enable ( DAC_TypeDef *dac, OPAMP_TypeDef opa, const OPAMP_Init_TypeDef *init) | 
| Configure and enable an Operational Amplifier. | |
Macro Definition Documentation
| #define OPA_INIT_CASCADED_INVERTING_OPA0 | 
Configuration of OPA0 in cascaded inverting amplifier mode.
        Definition at line
        
         730
        
        of file
        
         em_opamp.h
        
        .
       
| #define OPA_INIT_CASCADED_INVERTING_OPA1 | 
Configuration of OPA1 in cascaded inverting amplifier mode.
        Definition at line
        
         752
        
        of file
        
         em_opamp.h
        
        .
       
| #define OPA_INIT_CASCADED_INVERTING_OPA2 | 
Configuration of OPA2 in cascaded inverting amplifier mode.
        Definition at line
        
         774
        
        of file
        
         em_opamp.h
        
        .
       
| #define OPA_INIT_CASCADED_NON_INVERTING_OPA0 | 
Configuration of OPA0 in cascaded non-inverting amplifier mode.
        Definition at line
        
         664
        
        of file
        
         em_opamp.h
        
        .
       
| #define OPA_INIT_CASCADED_NON_INVERTING_OPA1 | 
Configuration of OPA1 in cascaded non-inverting amplifier mode.
        Definition at line
        
         686
        
        of file
        
         em_opamp.h
        
        .
       
| #define OPA_INIT_CASCADED_NON_INVERTING_OPA2 | 
Configuration of OPA2 in cascaded non-inverting amplifier mode.
        Definition at line
        
         708
        
        of file
        
         em_opamp.h
        
        .
       
| #define OPA_INIT_DIFF_DRIVER_OPA0 | 
Configuration of OPA0 in two-opamp differential driver mode.
        Definition at line
        
         796
        
        of file
        
         em_opamp.h
        
        .
       
| #define OPA_INIT_DIFF_DRIVER_OPA1 | 
Configuration of OPA1 in two-opamp differential driver mode.
        Definition at line
        
         818
        
        of file
        
         em_opamp.h
        
        .
       
| #define OPA_INIT_DIFF_RECEIVER_OPA0 | 
Configuration of OPA0 in three-opamp differential receiver mode.
        Definition at line
        
         840
        
        of file
        
         em_opamp.h
        
        .
       
| #define OPA_INIT_DIFF_RECEIVER_OPA1 | 
Configuration of OPA1 in three-opamp differential receiver mode.
        Definition at line
        
         862
        
        of file
        
         em_opamp.h
        
        .
       
| #define OPA_INIT_DIFF_RECEIVER_OPA2 | 
Configuration of OPA2 in three-opamp differential receiver mode.
        Definition at line
        
         884
        
        of file
        
         em_opamp.h
        
        .
       
| #define OPA_INIT_INVERTING | 
Configuration of OPA0/1 in inverting amplifier mode.
        Definition at line
        
         620
        
        of file
        
         em_opamp.h
        
        .
       
| #define OPA_INIT_INVERTING_OPA2 | 
Configuration of OPA2 in inverting amplifier mode.
        Definition at line
        
         642
        
        of file
        
         em_opamp.h
        
        .
       
| #define OPA_INIT_NON_INVERTING | 
Configuration of OPA0/1 in non-inverting amplifier mode.
        Definition at line
        
         576
        
        of file
        
         em_opamp.h
        
        .
       
| #define OPA_INIT_NON_INVERTING_OPA2 | 
Configuration of OPA2 in non-inverting amplifier mode.
        Definition at line
        
         598
        
        of file
        
         em_opamp.h
        
        .
       
| #define OPA_INIT_UNITY_GAIN | 
Configuration of OPA0/1 in unity gain voltage follower mode.
        Definition at line
        
         532
        
        of file
        
         em_opamp.h
        
        .
       
| #define OPA_INIT_UNITY_GAIN_OPA2 | 
Configuration of OPA2 in unity gain voltage follower mode.
        Definition at line
        
         554
        
        of file
        
         em_opamp.h
        
        .
       
Enumeration Type Documentation
| enum OPAMP_NegSel_TypeDef | 
| enum OPAMP_PosSel_TypeDef | 
OPAMP positive terminal input selection values.
        Definition at line
        
         182
        
        of file
        
         em_opamp.h
        
        .
       
OPAMP resistor ladder input selector values.
        Definition at line
        
         367
        
        of file
        
         em_opamp.h
        
        .
       
| enum OPAMP_ResSel_TypeDef | 
OPAMP gain values.
        Definition at line
        
         342
        
        of file
        
         em_opamp.h
        
        .
       
| enum OPAMP_TypeDef | 
Function Documentation
| void OPAMP_Disable | ( | DAC_TypeDef * | 
            dac,
            | 
| OPAMP_TypeDef | 
            opa
            | ||
| ) | 
Disable an Operational Amplifier.
- Parameters
- 
         [in] dacA pointer to the DAC peripheral register block. [in] opaSelects an OPA, valid values are OPA0 , OPA1 , and OPA2 . 
        Definition at line
        
         260
        
        of file
        
         em_opamp.c
        
        .
       
References DAC_CH0CTRL_EN , DAC_CH1CTRL_EN , DAC_OPACTRL_OPA0EN , DAC_OPACTRL_OPA1EN , DAC_OPACTRL_OPA2EN , OPA0 , OPA1 , and OPA2 .
Referenced by OPAMP_Enable() .
| void OPAMP_Enable | ( | DAC_TypeDef * | 
            dac,
            | 
| OPAMP_TypeDef | 
            opa,
            | ||
| const OPAMP_Init_TypeDef * | 
            init
            | ||
| ) | 
Configure and enable an Operational Amplifier.
- Note
- 
         The value of the alternate output enable bit mask in the
         
          OPAMP_Init_TypeDef
         
         structure should consist of one or more of the DAC_OPA[opa#]MUX_OUTPEN_OUT[output#] flags (defined in <part_name>_dac.h) OR'ed together.
         
 
 For OPA0:- DAC_OPA0MUX_OUTPEN_OUT0
- DAC_OPA0MUX_OUTPEN_OUT1
- DAC_OPA0MUX_OUTPEN_OUT2
- DAC_OPA0MUX_OUTPEN_OUT3
- DAC_OPA0MUX_OUTPEN_OUT4
 - DAC_OPA1MUX_OUTPEN_OUT0
- DAC_OPA1MUX_OUTPEN_OUT1
- DAC_OPA1MUX_OUTPEN_OUT2
- DAC_OPA1MUX_OUTPEN_OUT3
- DAC_OPA1MUX_OUTPEN_OUT4
 - DAC_OPA2MUX_OUTPEN_OUT0
- DAC_OPA2MUX_OUTPEN_OUT1
 
 init.outPen = DAC_OPA0MUX_OUTPEN_OUT0 | DAC_OPA0MUX_OUTPEN_OUT4;
- Parameters
- 
         [in] dacA pointer to the DAC peripheral register block. [in] opaSelects an OPA, valid values are OPA0 , OPA1 , and OPA2 . [in] initA pointer to a structure containing OPAMP initialization information. 
        Definition at line
        
         371
        
        of file
        
         em_opamp.c
        
        .
       
References _DAC_BIASPROG_BIASPROG_MASK , _DAC_BIASPROG_BIASPROG_SHIFT , _DAC_BIASPROG_OPA2BIASPROG_MASK , _DAC_BIASPROG_OPA2BIASPROG_SHIFT , _DAC_CAL_CH0OFFSET_MASK , _DAC_CAL_CH0OFFSET_SHIFT , _DAC_CAL_CH1OFFSET_MASK , _DAC_CAL_CH1OFFSET_SHIFT , _DAC_CAL_GAIN_MASK , _DAC_OPA0MUX_OUTPEN_MASK , _DAC_OPA1MUX_OUTPEN_MASK , _DAC_OPA2MUX_OUTPEN_MASK , _DAC_OPACTRL_OPA0LPFDIS_MASK , _DAC_OPACTRL_OPA1LPFDIS_MASK , _DAC_OPACTRL_OPA2LPFDIS_MASK , _DAC_OPAOFFSET_OPA2OFFSET_MASK , _DAC_OPAOFFSET_OPA2OFFSET_SHIFT , OPAMP_Init_TypeDef::bias , DAC_BIASPROG_HALFBIAS , DAC_BIASPROG_OPA2HALFBIAS , DAC_CH0CTRL_EN , DAC_CH1CTRL_EN , DAC_OPA0MUX_NEXTOUT , DAC_OPA0MUX_NPEN , DAC_OPA0MUX_PPEN , DAC_OPA1MUX_NEXTOUT , DAC_OPA1MUX_NPEN , DAC_OPA1MUX_PPEN , DAC_OPA2MUX_NEXTOUT , DAC_OPA2MUX_NPEN , DAC_OPA2MUX_OUTMODE , DAC_OPA2MUX_POSSEL_DISABLE , DAC_OPA2MUX_POSSEL_OPA1INP , DAC_OPA2MUX_POSSEL_OPATAP , DAC_OPA2MUX_POSSEL_POSPAD , DAC_OPA2MUX_PPEN , DAC_OPACTRL_OPA0EN , DAC_OPACTRL_OPA0HCMDIS , DAC_OPACTRL_OPA0LPFDIS_NLPFDIS , DAC_OPACTRL_OPA0LPFDIS_PLPFDIS , DAC_OPACTRL_OPA0SHORT , DAC_OPACTRL_OPA1EN , DAC_OPACTRL_OPA1HCMDIS , DAC_OPACTRL_OPA1LPFDIS_NLPFDIS , DAC_OPACTRL_OPA1LPFDIS_PLPFDIS , DAC_OPACTRL_OPA1SHORT , DAC_OPACTRL_OPA2EN , DAC_OPACTRL_OPA2HCMDIS , DAC_OPACTRL_OPA2LPFDIS_NLPFDIS , DAC_OPACTRL_OPA2LPFDIS_PLPFDIS , DAC_OPACTRL_OPA2SHORT , OPAMP_Init_TypeDef::defaultOffset , DEVINFO , OPAMP_Init_TypeDef::halfBias , OPAMP_Init_TypeDef::hcmDisable , OPAMP_Init_TypeDef::lpfNegPadDisable , OPAMP_Init_TypeDef::lpfPosPadDisable , OPAMP_Init_TypeDef::negSel , OPAMP_Init_TypeDef::nextOut , OPAMP_Init_TypeDef::npEn , OPAMP_Init_TypeDef::offset , OPA0 , OPA1 , OPA2 , OPAMP_Disable() , opaNegSelResTap , OPAMP_Init_TypeDef::outMode , OPAMP_Init_TypeDef::outPen , OPAMP_Init_TypeDef::posSel , OPAMP_Init_TypeDef::ppEn , OPAMP_Init_TypeDef::resInMux , OPAMP_Init_TypeDef::resSel , OPAMP_Init_TypeDef::shortInputs , and SYSTEM_GetCalibrationValue() .