The MCUXpresso SDK provides a peripheral driver for the OPAMP module of MCUXpresso SDK devices. OPAMP driver is created to help user to operate the OPAMP module. The APIs can use enable OPAMP module initialize it and de-initialize OPAMP module.
Function groups
The OPAMP driver supports operating the module as a operational amplifier.
Initialization and deinitialization
The OPAMP_Init() function will initialize the OPAMP and enable the clock for OPAMP. The OPAMP_Deinit() function will disable OPAMP module and shut down the bus clock of OPAMP.
OPAMP positive and negative port gain configuration
The OPAMP_DoPosGainConfig() function is used to set positive port gain. The OPAMP_DoNegGainConfig() function is used to set negative port gain.
OPAMP reference buffer
The OPAMP_EnableRefBuffer() is enable bias voltage input buffer.
OPAMP trigger mode
The OPAMP_EnableTriggerMode() is enable OPAMP trigger mode.
Typical use case
Refer to the driver examples codes located at <SDK_ROOT>/boards/<BOARD>/driver_examples/OPAMP/
|
| struct | opamp_config_t |
| | OPAMP configuraion, including mode, internal reference voltage, positive gain, negative gain and so on. More...
|
| |
|
| enum | opamp_mode_t {
kOPAMP_LowNoiseMode = 0U,
kOPAMP_HighSpeedMode
} |
| | The enumeration of OPAMP mode, including low noise mode and high speed mode. More...
|
| |
| enum | opamp_bias_current_trim_option_t {
kOPAMP_TrimOptionDefault = 0U,
kOPAMP_TrimOptionIncreaseCurrent,
kOPAMP_TrimOptionDecreaseCurrent,
kOPAMP_TrimOptionFurtherDecreaseCurrent
} |
| | The enumeration of bias current trim option. More...
|
| |
| enum | opamp_internal_ref_voltage_t {
kOPAMP_IntRefVoltVddaDiv2 = 0U,
kOPAMP_IntRefVoltVdda3V,
kOPAMP_IntRefVoltVssa3V,
kOPAMP_IntRefVoltNotAllowed
} |
| | The enumeration of internal reference voltage. More...
|
| |
| enum | opamp_positive_ref_voltage_t {
kOPAMP_PosRefVoltVrefh3 = 0U,
kOPAMP_PosRefVoltVrefh0 = 1U,
kOPAMP_PosRefVoltVrefh1 = 2U,
kOPAMP_PosRefVoltVrefh4 = 3U
} |
| | The enumeration of positive reference voltage(please refer to manual use). More...
|
| |
| enum | opamp_positive_gain_t {
kOPAMP_PosGainReserved = 0U,
kOPAMP_PosGainNonInvert1X = 1U,
kOPAMP_PosGainNonInvert2X = 2U,
kOPAMP_PosGainNonInvert4X = 3U,
kOPAMP_PosGainNonInvert8X = 4U,
kOPAMP_PosGainNonInvert16X = 5U,
kOPAMP_PosGainNonInvert33X = 6U,
kOPAMP_PosGainNonInvert64X = 7U,
kOPAMP_PosGainNonInvertDisableBuffer2X = 8U,
kOPAMP_PosGainNonInvertDisableBuffer3X = 9U,
kOPAMP_PosGainNonInvertDisableBuffer5X = 10U,
kOPAMP_PosGainNonInvertDisableBuffer9X = 11U,
kOPAMP_PosGainNonInvertDisableBuffer17X = 12U,
kOPAMP_PosGainNonInvertDisableBuffer34X = 13U,
kOPAMP_PosGainNonInvertDisableBuffer65X = 14U
} |
| | The enumeration of positive programmable gain (please refer to manual use). More...
|
| |
| enum | opamp_negative_gain_t {
kOPAMP_NegGainBufferMode = 0U,
kOPAMP_NegGainInvert1X,
kOPAMP_NegGainInvert2X,
kOPAMP_NegGainInvert4X,
kOPAMP_NegGainInvert8X,
kOPAMP_NegGainInvert16X,
kOPAMP_NegGainInvert33X,
kOPAMP_NegGainInvert64X
} |
| | The enumeration of negative programmable gain. More...
|
| |
| enum | opamp_positive_input_channel_selection_t {
kOPAMP_PosInputChannel0 = 0U,
kOPAMP_PosInputChannel1 = 1U
} |
| | The enumeration of positive input channel selection. More...
|
| |
| bool opamp_config_t::enable |
| bool opamp_config_t::enableOutputSwitch |
| bool opamp_config_t::enablePosADCSw1 |
- true Positive part reference voltage switch to ADC channel.
- false Positive part reference voltage do not switch to ADC channel.
| bool opamp_config_t::enablePosADCSw2 |
- true Positive part reference voltage switch to ADC channel.
- false Positive part reference voltage do not switch to ADC channel.
| bool opamp_config_t::enableRefBuffer |
| bool opamp_config_t::enableTriggerMode |
| Enumerator |
|---|
| kOPAMP_LowNoiseMode |
Set opamp mode as low noise mode.
|
| kOPAMP_HighSpeedMode |
Set opamp mode as high speed mode.
|
| Enumerator |
|---|
| kOPAMP_TrimOptionDefault |
Default Bias current trim option.
|
| kOPAMP_TrimOptionIncreaseCurrent |
Trim option selected as increase current.
|
| kOPAMP_TrimOptionDecreaseCurrent |
Trim option selected as decrease current.
|
| kOPAMP_TrimOptionFurtherDecreaseCurrent |
Trim option selected as further decrease current.
|
| Enumerator |
|---|
| kOPAMP_IntRefVoltVddaDiv2 |
Internal reference voltage selected as Vdda/2.
|
| kOPAMP_IntRefVoltVdda3V |
Internal reference voltage selected as Vdda_3V.
|
| kOPAMP_IntRefVoltVssa3V |
Internal reference voltage selected as Vssa_3V.
|
| kOPAMP_IntRefVoltNotAllowed |
Internal reference voltage not allowed.
|
| Enumerator |
|---|
| kOPAMP_PosRefVoltVrefh3 |
Positive part reference voltage select Vrefh3, connected from DAC output.
|
| kOPAMP_PosRefVoltVrefh0 |
Positive part reference voltage select Vrefh0, connected from VDDA supply.
|
| kOPAMP_PosRefVoltVrefh1 |
Positive part reference voltage select Vrefh1, connected from Voltage reference output.
|
| kOPAMP_PosRefVoltVrefh4 |
Positive part reference voltage select 520mv or reserved.
|
| Enumerator |
|---|
| kOPAMP_PosGainReserved |
Positive Gain reserved.
|
| kOPAMP_PosGainNonInvert1X |
Positive non-inverting gain application 1X.
|
| kOPAMP_PosGainNonInvert2X |
Positive non-inverting gain application 2X.
|
| kOPAMP_PosGainNonInvert4X |
Positive non-inverting gain application 4X.
|
| kOPAMP_PosGainNonInvert8X |
Positive non-inverting gain application 8X.
|
| kOPAMP_PosGainNonInvert16X |
Positive non-inverting gain application 16X.
|
| kOPAMP_PosGainNonInvert33X |
Positive non-inverting gain application 33X.
|
| kOPAMP_PosGainNonInvert64X |
Positive non-inverting gain application 64X.
|
| kOPAMP_PosGainNonInvertDisableBuffer2X |
Positive non-inverting gain application 2X.
|
| kOPAMP_PosGainNonInvertDisableBuffer3X |
Positive non-inverting gain application 3X.
|
| kOPAMP_PosGainNonInvertDisableBuffer5X |
Positive non-inverting gain application 5X.
|
| kOPAMP_PosGainNonInvertDisableBuffer9X |
Positive non-inverting gain application 9X.
|
| kOPAMP_PosGainNonInvertDisableBuffer17X |
Positive non-inverting gain application 17X.
|
| kOPAMP_PosGainNonInvertDisableBuffer34X |
Positive non-inverting gain application 34X.
|
| kOPAMP_PosGainNonInvertDisableBuffer65X |
Positive non-inverting gain application 65X.
|
| Enumerator |
|---|
| kOPAMP_NegGainBufferMode |
Negative Buffer Mode.
|
| kOPAMP_NegGainInvert1X |
Negative inverting gain application -1X.
|
| kOPAMP_NegGainInvert2X |
Negative inverting gain application -2X.
|
| kOPAMP_NegGainInvert4X |
Negative inverting gain application -4X.
|
| kOPAMP_NegGainInvert8X |
Negative inverting gain application -8X.
|
| kOPAMP_NegGainInvert16X |
Negative inverting gain application -16X.
|
| kOPAMP_NegGainInvert33X |
Negative inverting gain application -33X.
|
| kOPAMP_NegGainInvert64X |
Negative inverting gain application -64X.
|
| Enumerator |
|---|
| kOPAMP_PosInputChannel0 |
When OPAMP not in trigger mode, select positive input 0 (INP0).
|
| kOPAMP_PosInputChannel1 |
When OPAMP not in trigger mode, select positive input 1 (INP1).
|
- Parameters
-
| base | OPAMP peripheral base address. |
| config | The pointer to opamp_config_t. |
| void OPAMP_Deinit |
( |
OPAMP_Type * |
base | ) |
|
- Parameters
-
| base | OPAMP peripheral base address. |
* config->enable = false;
* config->enablePosADCSw = false;
*
- Parameters
-
- Parameters
-
| base | OPAMP peripheral base address. |
| option | OPAMP positive port gain. |
- Parameters
-
| base | OPAMP peripheral base address. |
| option | OPAMP negative port gain. |
| static void OPAMP_EnableRefBuffer |
( |
OPAMP_Type * |
base, |
|
|
bool |
enable |
|
) |
| |
|
inlinestatic |
- Parameters
-
| base | OPAMP peripheral base address. |
| enable | true to enable and false to disable. |
| static void OPAMP_EnableTriggerMode |
( |
OPAMP_Type * |
base, |
|
|
bool |
enable |
|
) |
| |
|
inlinestatic |
- Parameters
-
| base | OPAMP peripheral base address. |
| enable | true to enable and false to disable. |