![]() |
![]() |
|
MSPM0G1X0X_G3X0X Driver Library
2.05.00.05
|
Data Structures | |
| struct | DL_OPA_Config |
| Configuration struct for DL_OPA_init. More... | |
Enumerations | |
| enum | DL_OPA_CHOPPING_MODE { DL_OPA_CHOPPING_MODE_DISABLE = OA_CFG_CHOP_OFF, DL_OPA_CHOPPING_MODE_STANDARD = OA_CFG_CHOP_ON, DL_OPA_CHOPPING_MODE_ADC_AVERAGING = OA_CFG_CHOP_AVGON } |
| enum | DL_OPA_OUTPUT_PIN_STATE { DL_OPA_OUTPUT_PIN_ENABLED = OA_CFG_OUTPIN_ENABLED, DL_OPA_OUTPUT_PIN_DISABLED = OA_CFG_OUTPIN_DISABLED } |
| enum | DL_OPA_PSEL { DL_OPA_PSEL_OPEN = OA_CFG_PSEL_NC, DL_OPA_PSEL_IN0_POS = OA_CFG_PSEL_EXTPIN0, DL_OPA_PSEL_IN1_POS = OA_CFG_PSEL_EXTPIN1, DL_OPA_PSEL_DAC_OUT = OA_CFG_PSEL_DAC12OUT, DL_OPA_PSEL_DAC8_OUT = OA_CFG_PSEL_DAC8OUT, DL_OPA_PSEL_VREF = OA_CFG_PSEL_VREF, DL_OPA_PSEL_RTOP = OA_CFG_PSEL_OANM1RTOP, DL_OPA_PSEL_GPAMP_OUT = OA_CFG_PSEL_GPAMP_OUT_INT, DL_OPA_PSEL_GND = OA_CFG_PSEL_VSS } |
| enum | DL_OPA_NSEL { DL_OPA_NSEL_OPEN = OA_CFG_NSEL_NC, DL_OPA_NSEL_IN0_NEG = OA_CFG_NSEL_EXTPIN0, DL_OPA_NSEL_IN1_NEG = OA_CFG_NSEL_EXTPIN1, DL_OPA_NSEL_RBOT = OA_CFG_NSEL_OANP1RBOT, DL_OPA_NSEL_RTAP = OA_CFG_NSEL_OANRTAP, DL_OPA_NSEL_RTOP = OA_CFG_NSEL_OANRTOP, DL_OPA_NSEL_SPARE = OA_CFG_NSEL_SPARE } |
| enum | DL_OPA_MSEL { DL_OPA_MSEL_OPEN = OA_CFG_MSEL_NC, DL_OPA_MSEL_IN1_NEG = OA_CFG_MSEL_EXTNPIN1, DL_OPA_MSEL_GND = OA_CFG_MSEL_VSS, DL_OPA_MSEL_DAC_OUT = OA_CFG_MSEL_DAC12OUT, DL_OPA_MSEL_RTOP = OA_CFG_MSEL_OANM1RTOP } |
| enum | DL_OPA_GBW { DL_OPA_GBW_HIGH = OA_CFGBASE_GBW_HIGHGAIN, DL_OPA_GBW_LOW = OA_CFGBASE_GBW_LOWGAIN } |
| enum | DL_OPA_GAIN { DL_OPA_GAIN_N0_P1 = (((uint32_t) 0x0) << OA_CFG_GAIN_OFS), DL_OPA_GAIN_N1_P2 = (((uint32_t) 0x1) << OA_CFG_GAIN_OFS), DL_OPA_GAIN_N3_P4 = (((uint32_t) 0x2) << OA_CFG_GAIN_OFS), DL_OPA_GAIN_N7_P8 = (((uint32_t) 0x3) << OA_CFG_GAIN_OFS), DL_OPA_GAIN_N15_P16 = (((uint32_t) 0x4) << OA_CFG_GAIN_OFS), DL_OPA_GAIN_N31_P32 = (((uint32_t) 0x5) << OA_CFG_GAIN_OFS) } |
Functions | |
| __STATIC_INLINE void | DL_OPA_enablePower (OA_Regs *opa) |
| Enables the Peripheral Write Enable (PWREN) register for the OPA. More... | |
| __STATIC_INLINE void | DL_OPA_disablePower (OA_Regs *opa) |
| Disables the Peripheral Write Enable (PWREN) register for the OPA. More... | |
| __STATIC_INLINE bool | DL_OPA_isPowerEnabled (const OA_Regs *opa) |
| Returns if the Peripheral Write Enable (PWREN) register for the OPA is enabled. More... | |
| __STATIC_INLINE void | DL_OPA_reset (OA_Regs *opa) |
| Resets OPA peripheral. More... | |
| __STATIC_INLINE bool | DL_OPA_isReset (const OA_Regs *opa) |
| Returns if OPA peripheral was reset. More... | |
| __STATIC_INLINE void | DL_OPA_enable (OA_Regs *opa) |
| Enable the OPA peripheral. More... | |
| __STATIC_INLINE bool | DL_OPA_isEnabled (const OA_Regs *opa) |
| Checks if the OPA peripheral is enabled. More... | |
| __STATIC_INLINE void | DL_OPA_disable (OA_Regs *opa) |
| Disable the OPA peripheral. More... | |
| __STATIC_INLINE void | DL_OPA_init (OA_Regs *opa, const DL_OPA_Config *config) |
| Initialize the OPA peripheral. More... | |
| __STATIC_INLINE void | DL_OPA_setGainBandwidth (OA_Regs *opa, DL_OPA_GBW bandwidth) |
| Set the gain bandwidth (GBW) More... | |
| __STATIC_INLINE DL_OPA_GBW | DL_OPA_getGainBandwidth (const OA_Regs *opa) |
| Get the gain bandwidth (GBW) More... | |
| __STATIC_INLINE void | DL_OPA_enableRailToRailInput (OA_Regs *opa) |
| Enable the rail-to-rail input (RRI) More... | |
| __STATIC_INLINE bool | DL_OPA_isRailToRailInputEnabled (OA_Regs *opa) |
| Checks if the the rail-to-rail input (RRI) is enabled. More... | |
| __STATIC_INLINE void | DL_OPA_disableRailToRailInput (OA_Regs *opa) |
| Disable the rail-to-rail input (RRI) More... | |
| __STATIC_INLINE void | DL_OPA_setChoppingMode (OA_Regs *opa, DL_OPA_CHOPPING_MODE mode) |
| Set and enable the chopping mode. More... | |
| __STATIC_INLINE DL_OPA_CHOPPING_MODE | DL_OPA_getChoppingMode (const OA_Regs *opa) |
| Get the chopping mode. More... | |
| __STATIC_INLINE void | DL_OPA_setOutputPinState (OA_Regs *opa, DL_OPA_OUTPUT_PIN_STATE state) |
| Set the state of the output pin. More... | |
| __STATIC_INLINE DL_OPA_OUTPUT_PIN_STATE | DL_OPA_getOutputPinState (const OA_Regs *opa) |
| Get the state of the output pin. More... | |
| __STATIC_INLINE void | DL_OPA_disableOutputPin (OA_Regs *opa) |
| Disable the OPA output signal to be accessed by a device pin. More... | |
| __STATIC_INLINE void | DL_OPA_setNonInvertingInputChannel (OA_Regs *opa, DL_OPA_PSEL inputChannel) |
| Set the non-inverting input channel. More... | |
| __STATIC_INLINE DL_OPA_PSEL | DL_OPA_getNonInvertingInputChannel (const OA_Regs *opa) |
| Get the non-inverting input channel. More... | |
| __STATIC_INLINE void | DL_OPA_setInvertingInputChannel (OA_Regs *opa, DL_OPA_NSEL inputChannel) |
| Set the inverting input channel. More... | |
| __STATIC_INLINE DL_OPA_NSEL | DL_OPA_getInvertingInputChannel (const OA_Regs *opa) |
| Get the inverting input channel. More... | |
| __STATIC_INLINE void | DL_OPA_setMMUXInputChannel (OA_Regs *opa, DL_OPA_MSEL inputChannel) |
| Set the M-MUX input channel. More... | |
| __STATIC_INLINE DL_OPA_MSEL | DL_OPA_getMMUXInputChannel (const OA_Regs *opa) |
| Get the M-MUX input channel. More... | |
| __STATIC_INLINE void | DL_OPA_setGain (OA_Regs *opa, DL_OPA_GAIN gain) |
| Set the gain for the programmable gain stage. More... | |
| __STATIC_INLINE DL_OPA_GAIN | DL_OPA_getGain (const OA_Regs *opa) |
| Get the gain from the programmable gain stage. More... | |
| DL_OPA_GAIN | DL_OPA_increaseGain (OA_Regs *opa) |
| Increment gain to the next DL_OPA_GAIN enum value. More... | |
| DL_OPA_GAIN | DL_OPA_decreaseGain (OA_Regs *opa) |
| Decrement gain to the next DL_OPA_GAIN enum value. More... | |
| __STATIC_INLINE bool | DL_OPA_isReady (const OA_Regs *opa) |
| Checks if the OPA is ready. More... | |
The OP-Amp Driver Library allows full configuration of the MSPM0 OPA module. The OPA is a zero-drift chopper stabilized operational amplifier with a programmable gain stage.
| enum DL_OPA_CHOPPING_MODE |
| enum DL_OPA_PSEL |
| enum DL_OPA_NSEL |
| enum DL_OPA_MSEL |
| enum DL_OPA_GBW |
| enum DL_OPA_GAIN |
| __STATIC_INLINE void DL_OPA_enablePower | ( | OA_Regs * | opa | ) |
Enables the Peripheral Write Enable (PWREN) register for the OPA.
Before any peripheral registers can be configured by software, the peripheral itself must be enabled by writing the ENABLE bit together with the appropriate KEY value to the peripheral's PWREN register.
| [in] | opa | Pointer to the register overlay for the peripheral |
| __STATIC_INLINE void DL_OPA_disablePower | ( | OA_Regs * | opa | ) |
Disables the Peripheral Write Enable (PWREN) register for the OPA.
When the PWREN.ENABLE bit is cleared, the peripheral's registers are not accessible for read/write operations.
| [in] | opa | Pointer to the register overlay for the peripheral |
| __STATIC_INLINE bool DL_OPA_isPowerEnabled | ( | const OA_Regs * | opa | ) |
Returns if the Peripheral Write Enable (PWREN) register for the OPA is enabled.
Before any peripheral registers can be configured by software, the peripheral itself must be enabled by writing the ENABLE bit together with the appropriate KEY value to the peripheral's PWREN register.
When the PWREN.ENABLE bit is cleared, the peripheral's registers are not accessible for read/write operations.
| [in] | opa | Pointer to the register overlay for the peripheral |
| __STATIC_INLINE void DL_OPA_reset | ( | OA_Regs * | opa | ) |
Resets OPA peripheral.
| [in] | opa | Pointer to the register overlay for the peripheral |
| __STATIC_INLINE bool DL_OPA_isReset | ( | const OA_Regs * | opa | ) |
Returns if OPA peripheral was reset.
| [in] | opa | Pointer to the register overlay for the peripheral |
| __STATIC_INLINE void DL_OPA_enable | ( | OA_Regs * | opa | ) |
Enable the OPA peripheral.
| [in] | opa | Pointer to the register overlay for the peripheral |
| __STATIC_INLINE bool DL_OPA_isEnabled | ( | const OA_Regs * | opa | ) |
Checks if the OPA peripheral is enabled.
| [in] | opa | Pointer to the register overlay for the peripheral |
| true | The OPA peripheral is enabled |
| false | The OPA peripheral is disabled |
| __STATIC_INLINE void DL_OPA_disable | ( | OA_Regs * | opa | ) |
Disable the OPA peripheral.
| [in] | opa | Pointer to the register overlay for the peripheral |
| __STATIC_INLINE void DL_OPA_init | ( | OA_Regs * | opa, |
| const DL_OPA_Config * | config | ||
| ) |
Initialize the OPA peripheral.
Initializes all the common configurable options for the OPA peripheral. Any other custom configuration can be done after calling this API. The OPA is not enabled in this API.
| [in] | opa | Pointer to the register overlay for the peripheral |
| [in] | config | Configuration for OPA peripheral |
References DL_OPA_Config::choppingMode, DL_Common_updateReg(), DL_OPA_Config::gain, DL_OPA_Config::mselChannel, DL_OPA_Config::nselChannel, DL_OPA_Config::outputPinState, and DL_OPA_Config::pselChannel.
| __STATIC_INLINE void DL_OPA_setGainBandwidth | ( | OA_Regs * | opa, |
| DL_OPA_GBW | bandwidth | ||
| ) |
Set the gain bandwidth (GBW)
| [in] | opa | Pointer to the register overlay for the peripheral |
| [in] | bandwidth | The gain bandwidth to set. One of DL_OPA_GBW |
References DL_Common_updateReg().
| __STATIC_INLINE DL_OPA_GBW DL_OPA_getGainBandwidth | ( | const OA_Regs * | opa | ) |
Get the gain bandwidth (GBW)
| [in] | opa | Pointer to the register overlay for the peripheral |
| One | of DL_OPA_GBW |
| __STATIC_INLINE void DL_OPA_enableRailToRailInput | ( | OA_Regs * | opa | ) |
Enable the rail-to-rail input (RRI)
| [in] | opa | Pointer to the register overlay for the peripheral |
| __STATIC_INLINE bool DL_OPA_isRailToRailInputEnabled | ( | OA_Regs * | opa | ) |
Checks if the the rail-to-rail input (RRI) is enabled.
| [in] | opa | Pointer to the register overlay for the peripheral |
| true | The rail-to-rail input is enabled |
| false | The rail-to-rail input is disabled |
| __STATIC_INLINE void DL_OPA_disableRailToRailInput | ( | OA_Regs * | opa | ) |
Disable the rail-to-rail input (RRI)
| [in] | opa | Pointer to the register overlay for the peripheral |
| __STATIC_INLINE void DL_OPA_setChoppingMode | ( | OA_Regs * | opa, |
| DL_OPA_CHOPPING_MODE | mode | ||
| ) |
Set and enable the chopping mode.
| [in] | opa | Pointer to the register overlay for the peripheral |
| [in] | mode | The chopping mode to set. One of DL_OPA_CHOPPING_MODE |
References DL_Common_updateReg().
| __STATIC_INLINE DL_OPA_CHOPPING_MODE DL_OPA_getChoppingMode | ( | const OA_Regs * | opa | ) |
Get the chopping mode.
| [in] | opa | Pointer to the register overlay for the peripheral |
| One | of DL_OPA_CHOPPING_MODE |
| __STATIC_INLINE void DL_OPA_setOutputPinState | ( | OA_Regs * | opa, |
| DL_OPA_OUTPUT_PIN_STATE | state | ||
| ) |
Set the state of the output pin.
When the output pin is enabled, the OPA output goes to the device pin while still maintaining connection to the programmable gain stage and other analog peripherals. When disabled, the OPA output is a purely internal signal and is internally connected to the programmable gain stage and capable of being routed to other on-board analog peripherals.
| [in] | opa | Pointer to the register overlay for the peripheral |
| [in] | state | The state to set the output pin to One of DL_OPA_OUTPUT_PIN_STATE |
References DL_Common_updateReg().
| __STATIC_INLINE DL_OPA_OUTPUT_PIN_STATE DL_OPA_getOutputPinState | ( | const OA_Regs * | opa | ) |
Get the state of the output pin.
When the output pin is enabled, the OPA output goes to the device pin while still maintaining connection to the programmable gain stage and other analog peripherals. When disabled, the OPA output is a purely internal signal and is internally connected to the programmable gain stage and capable of being routed to other on-board analog peripherals.
| [in] | opa | Pointer to the register overlay for the peripheral |
| One | of DL_OPA_OUTPUT_PIN_STATE |
| __STATIC_INLINE void DL_OPA_disableOutputPin | ( | OA_Regs * | opa | ) |
Disable the OPA output signal to be accessed by a device pin.
When disabled, the OPA output is a purely internal signal and is internally connected to the programmable gain stage and capable of being routed to other on-board analog peripherals.
| [in] | opa | Pointer to the register overlay for the peripheral |
| __STATIC_INLINE void DL_OPA_setNonInvertingInputChannel | ( | OA_Regs * | opa, |
| DL_OPA_PSEL | inputChannel | ||
| ) |
Set the non-inverting input channel.
This API sets the PSEL control bit to select the non-inverting input channel of the amplifier.
| [in] | opa | Pointer to the register overlay for the peripheral |
| [in] | inputChannel | The non-inverting input channel to set. One of DL_OPA_PSEL. |
References DL_Common_updateReg().
| __STATIC_INLINE DL_OPA_PSEL DL_OPA_getNonInvertingInputChannel | ( | const OA_Regs * | opa | ) |
Get the non-inverting input channel.
| [in] | opa | Pointer to the register overlay for the peripheral |
| One | of DL_OPA_PSEL |
| __STATIC_INLINE void DL_OPA_setInvertingInputChannel | ( | OA_Regs * | opa, |
| DL_OPA_NSEL | inputChannel | ||
| ) |
Set the inverting input channel.
This API sets the NSEL control bit to select the inverting input channel of the amplifier.
| [in] | opa | Pointer to the register overlay for the peripheral |
| [in] | inputChannel | The inverting input channel to set. One of DL_OPA_NSEL. |
References DL_Common_updateReg().
| __STATIC_INLINE DL_OPA_NSEL DL_OPA_getInvertingInputChannel | ( | const OA_Regs * | opa | ) |
Get the inverting input channel.
| [in] | opa | Pointer to the register overlay for the peripheral |
| One | of DL_OPA_NSEL |
| __STATIC_INLINE void DL_OPA_setMMUXInputChannel | ( | OA_Regs * | opa, |
| DL_OPA_MSEL | inputChannel | ||
| ) |
Set the M-MUX input channel.
This API sets the MSEL control bit to select the input channel for M-MUX, which is connected to the programmable gain stage resistor ladder.
| [in] | opa | Pointer to the register overlay for the peripheral |
| [in] | inputChannel | The M-MUX input channel to set. One of DL_OPA_MSEL. |
References DL_Common_updateReg().
| __STATIC_INLINE DL_OPA_MSEL DL_OPA_getMMUXInputChannel | ( | const OA_Regs * | opa | ) |
Get the M-MUX input channel.
| [in] | opa | Pointer to the register overlay for the peripheral |
| One | of DL_OPA_MSEL |
| __STATIC_INLINE void DL_OPA_setGain | ( | OA_Regs * | opa, |
| DL_OPA_GAIN | gain | ||
| ) |
Set the gain for the programmable gain stage.
The OPA integrates a programmable gain stage in the feedback loop to configure the OPA as a PGA(programmable gain amplifier). The gain stage is a feedback resistance ladder and it supports up to 32x amplification.
Refer to the TRM for gain enumeration information.
| [in] | opa | Pointer to the register overlay for the peripheral |
| [in] | gain | The gain to set. One of DL_OPA_GAIN. |
References DL_Common_updateReg().
| __STATIC_INLINE DL_OPA_GAIN DL_OPA_getGain | ( | const OA_Regs * | opa | ) |
Get the gain from the programmable gain stage.
Refer to the TRM for gain enumeration information.
| [in] | opa | Pointer to the register overlay for the peripheral |
| The | gain. One of DL_OPA_GAIN |
References DL_OPA_decreaseGain(), and DL_OPA_increaseGain().
| DL_OPA_GAIN DL_OPA_increaseGain | ( | OA_Regs * | opa | ) |
Increment gain to the next DL_OPA_GAIN enum value.
The OPA allows dynamic gain changes. If the gain is already at the maximum setting DL_OPA_GAIN_N31_P32 (CFG.GAIN = 0x5), this function does nothing.
Refer to the TRM for more information about changing gain dynamically.
| [in] | opa | Pointer to the register overlay for the peripheral |
| The | applied gain. One of DL_OPA_GAIN |
Referenced by DL_OPA_getGain().
| DL_OPA_GAIN DL_OPA_decreaseGain | ( | OA_Regs * | opa | ) |
Decrement gain to the next DL_OPA_GAIN enum value.
The OPA allows dynamic gain changes. If the gain is at the minimum setting DL_OPA_GAIN_N1_P2 (CFG.GAIN = 0x1), this function does nothing.
Refer to the TRM for more information about changing gain dynamically.
| [in] | opa | Pointer to the register overlay for the peripheral |
| The | applied gain. One of DL_OPA_GAIN |
Referenced by DL_OPA_getGain().
| __STATIC_INLINE bool DL_OPA_isReady | ( | const OA_Regs * | opa | ) |
Checks if the OPA is ready.
| [in] | opa | Pointer to the register overlay for the peripheral |
| true | The OPA is ready |
| false | The OPA is not ready |