This document consists of sections titled with Driver Overview, Data Structures, Enumerations, Functions, etc., each with an overview list and detailed documentation. It is recommended to read the Driver Overview first for it includes a comprehensive description of the peripheral, driver and driver changes. Other sections give detailed information for APIs, enums, macros, etc., for your further reference.
|
enum | opamp_config_reg_sel_t {
kOPAMP_ConfigRegSelCFG0 = 0U,
kOPAMP_ConfigRegSelCFG1 = 1U,
kOPAMP_ConfigRegSelCFG2 = 2U,
kOPAMP_ConfigRegSelCFG3 = 3U,
kOPAMP_ConfigRegSelA1OrA0 = 0x28U,
kOPAMP_ConfigRegSelA1OrB0 = 0x30U,
kOPAMP_ConfigRegSelA1OrC0 = 0x38U,
kOPAMP_configRegSelB1OrA0 = 0x48U,
kOPAMP_configRegSelB1OrB0 = 0x50U,
kOPAMP_configRegSelB1OrC0 = 0x58U,
kOPAMP_ConfigRegSelC1OrA0 = 0x68U,
kOPAMP_ConfigRegSelC1OrB0 = 0x70U,
kOPAMP_ConfigRegSelC1OrC0 = 0x78U
} |
| The enumeration lists all options for software controlled opamps and other external signal controlled opamps. More...
|
|
enum | opamp_load_mode_t {
kOPAMP_LoadModeDelayLoad = 0U,
kOPAMP_LoadModeImmediatelyLoad = 1U
} |
| The enumeration lists the opamp buffer's loading modes, delay loading and immediately loading modes. More...
|
|
enum | opamp_power_mode_t {
kOPAMP_PowerModeLowPower = 0U,
kOPAMP_PowerModeHighSpeed = 1U
} |
| The enumeration lists the power modes of the opamp, including low power and high power modes. More...
|
|
enum | opamp_positive_channel_t {
kOPAMP_PosChannel0 = 0U,
kOPAMP_PosChannel1 = 1U,
kOPAMP_PosChannel2 = 2U,
kOPAMP_PosChannel3 = 3U
} |
| The enumeration of positive input channel selection. More...
|
|
enum | opamp_negative_channel_t {
kOPAMP_NegChannel0 = 0U,
kOPAMP_NegChannel1 = 1U,
kOPAMP_NegChannel2 = 2U,
kOPAMP_NegChannel3 = 3U
} |
| The enumeration of negative input channel selection. More...
|
|
enum | opamp_config_set_index_t {
kOPAMP_ConfigSet0 = 0U,
kOPAMP_ConfigSet1,
kOPAMP_ConfigSet2,
kOPAMP_ConfigSet3
} |
| The enumeration of configuration set index. More...
|
|
enum | opamp_work_mode_t {
kOPAMP_WorkModeBufferMode = 0U,
kOPAMP_WorkModeInternalGain2X = OPAMP_CFG_GAIN_EN_MASK | OPAMP_CFG_GAIN_SEL(0),
kOPAMP_WorkModeInternalGain4X = OPAMP_CFG_GAIN_EN_MASK | OPAMP_CFG_GAIN_SEL(1),
kOPAMP_WorkModeInternalGain8X = OPAMP_CFG_GAIN_EN_MASK | OPAMP_CFG_GAIN_SEL(2),
kOPAMP_WorkModeInternalGain16X = OPAMP_CFG_GAIN_EN_MASK | OPAMP_CFG_GAIN_SEL(3),
kOPAMP_WorkModeExternalGain = OPAMP_CFG_VNEG_EN_MASK
} |
| The enumeration lists the operating modes of the opamp, including buffer mode, internal gain and external gain mode. More...
|
|
struct opamp_config_set_t |
bool opamp_config_t::bEnableWriteProtection |
Enumerator |
---|
kOPAMP_ConfigRegSelCFG0 |
Software work register select CFG0 (internal signal).
|
kOPAMP_ConfigRegSelCFG1 |
Software work register select CFG1 (internal signal).
|
kOPAMP_ConfigRegSelCFG2 |
Software work register select CFG2 (internal signal).
|
kOPAMP_ConfigRegSelCFG3 |
Software work register select CFG3 (internal signal).
|
kOPAMP_ConfigRegSelA1OrA0 |
External signal cfg_sel_a1 or cfg_sel_a0 selects configuartion register.
|
kOPAMP_ConfigRegSelA1OrB0 |
External signal cfg_sel_a1 or cfg_sel_b0 selects configuartion register.
|
kOPAMP_ConfigRegSelA1OrC0 |
External signal cfg_sel_a1 or cfg_sel_c0 selects configuartion register.
|
kOPAMP_configRegSelB1OrA0 |
External signal cfg_sel_b1 or cfg_sel_a0 selects configuartion register.
|
kOPAMP_configRegSelB1OrB0 |
External signal cfg_sel_b1 or cfg_sel_b0 selects configuartion register.
|
kOPAMP_configRegSelB1OrC0 |
External signal cfg_sel_b1 or cfg_sel_c0 selects configuartion register.
|
kOPAMP_ConfigRegSelC1OrA0 |
External signal cfg_sel_c1 or cfg_sel_a0 selects configuartion register.
|
kOPAMP_ConfigRegSelC1OrB0 |
External signal cfg_sel_c1 or cfg_sel_b0 selects configuartion register.
|
kOPAMP_ConfigRegSelC1OrC0 |
External signal cfg_sel_c1 or cfg_sel_c0 selects configuartion register.
|
Enumerator |
---|
kOPAMP_LoadModeDelayLoad |
The buffer registers are loaded when the next configuration is complete, if CTRL[LDOK] is set.
|
kOPAMP_LoadModeImmediatelyLoad |
The buffer register shall be loaded immediately after CTRL[LDOK] is set.
|
Enumerator |
---|
kOPAMP_PowerModeLowPower |
Lower current consumption with slower slew rate and narrower unity gain bandwidth performance.
|
kOPAMP_PowerModeHighSpeed |
Higher current consumption with higher slew rate and wider unity gain bandwidth performance.
|
Enumerator |
---|
kOPAMP_PosChannel0 |
Positive channel 0.
|
kOPAMP_PosChannel1 |
Positive channel 1.
|
kOPAMP_PosChannel2 |
Positive channel 2.
|
kOPAMP_PosChannel3 |
Positive channel 3.
|
Enumerator |
---|
kOPAMP_NegChannel0 |
Negative channel 0.
|
kOPAMP_NegChannel1 |
Negative channel 1.
|
kOPAMP_NegChannel2 |
Negative channel 2.
|
kOPAMP_NegChannel3 |
Negative channel 3.
|
Enumerator |
---|
kOPAMP_ConfigSet0 |
Configuration set 0.
|
kOPAMP_ConfigSet1 |
Configuration set 1.
|
kOPAMP_ConfigSet2 |
Configuration set 2.
|
kOPAMP_ConfigSet3 |
Configuration set 3.
|
Enumerator |
---|
kOPAMP_WorkModeBufferMode |
Buffer mode.
|
kOPAMP_WorkModeInternalGain2X |
Internal gain 2X mode.
|
kOPAMP_WorkModeInternalGain4X |
Internal gain 4X mode.
|
kOPAMP_WorkModeInternalGain8X |
Internal gain 8X mode.
|
kOPAMP_WorkModeInternalGain16X |
Internal gain 16X mode.
|
kOPAMP_WorkModeExternalGain |
External gain mode.
|
void OPAMP_Init |
( |
OPAMP_Type * |
base, |
|
|
const opamp_config_t * |
psConfig |
|
) |
| |
This function does initialization when using OPAMP module. The operations are:
- Enable the clock for OPAMP.
- Enable the write protection.
- Enable the load completion interrupt.
- Set configuration register for OPAMP.
- Set Positive channel and Negative channel.
- Set the power mode.
- Set the gain value.
- Set the load mode.
- Enable the OPAMP.
- Parameters
-
base | OPAMP peripheral base address. |
psConfig | Pointer to configuration structure.See opamp_config_t. |
The default value:
psConfig->bEnableLoadCompletionInterrupt = false;
psConfig->bEnableWriteProtection = false;
- Parameters
-
psConfig | Pointer to configuration structure. |
void OPAMP_Deinit |
( |
OPAMP_Type * |
base | ) |
|
This function does de-initialization when using OPAMP module. The operations are:
- Disable the OPAMP.
- Disable the clock for OPAMP.
- Parameters
-
base | OPAMP peripheral base address. |
This function only sets the configuration set, application should call OPAMP_EnableConfigLoad to enable the load after setting all desired configuration sets.
- Parameters
-
This function can configure the working registers of the software and external signal. When the configuration set is updated using OPAMP_SetOneConfigSet and the external signal is not used, the software working register should also select the corresponding software working register according to the update of the configuration set.
- Parameters
-
base | OPAMP peripheral base address. |
eConfigRegSel | configuration register selection, please see opamp_config_reg_sel_t for details. |
static void OPAMP_EnableOPAMP |
( |
OPAMP_Type * |
base, |
|
|
bool |
bEnable |
|
) |
| |
|
inlinestatic |
- Note
- Please use function OPAMP_EnableOPAMP to re-enable the OPAMP if it is disabled. Then load it with function OPAMP_EnableConfigLoad.
- Parameters
-
base | OPAMP peripheral base address. |
bEnable | Enables/disables the module. |
static void OPAMP_EnableConfigLoad |
( |
OPAMP_Type * |
base | ) |
|
|
inlinestatic |
After configuration load enabled, the new set configuration will be loaded at the time determined by load mode. Application could monitor the load completion by OPAMP_CheckLoadCompletionFlag or the interrupt. When the load finishes, the configuration load shall be disabled automatically.
- Parameters
-
base | OPAMP peripheral base address. |
static void OPAMP_DisableWriteProtection |
( |
OPAMP_Type * |
base | ) |
|
|
inlinestatic |
Write 10b to this field to disable the write protection.
- Parameters
-
base | OPAMP peripheral base address. |
- Parameters
-
base | OPAMP peripheral base address. |
ePowerMode | Power mode, please see opamp_power_mode_t for details. |
- Parameters
-
base | OPAMP peripheral base address. |
eLoadMode | load mode, please see opamp_load_mode_t for details. |
static void OPAMP_EnableLoadCompletionInterrupt |
( |
OPAMP_Type * |
base | ) |
|
|
inlinestatic |
- Parameters
-
base | OPAMP peripheral base address. |
static void OPAMP_DisableLoadCompletionInterrupt |
( |
OPAMP_Type * |
base | ) |
|
|
inlinestatic |
- Parameters
-
base | OPAMP peripheral base address. |
static bool OPAMP_CheckLoadCompletionFlag |
( |
OPAMP_Type * |
base | ) |
|
|
inlinestatic |
- Parameters
-
base | OPAMP peripheral base address. |
- Returns
- Return true if the flag is set, otherwise return false.
static void OPAMP_ClearLoadCompletionFlag |
( |
OPAMP_Type * |
base | ) |
|
|
inlinestatic |
- Parameters
-
base | OPAMP peripheral base address. |