51 #ifndef ti_dl_dl_opa__include 52 #define ti_dl_dl_opa__include 57 #include <ti/devices/msp/msp.h> 60 #ifdef __MSPM0_HAS_OA__ 203 opa->GPRCM.PWREN = (OA_PWREN_KEY_UNLOCK_W | OA_PWREN_ENABLE_ENABLE);
219 opa->GPRCM.PWREN = (OA_PWREN_KEY_UNLOCK_W | OA_PWREN_ENABLE_DISABLE);
241 (opa->GPRCM.PWREN & OA_PWREN_ENABLE_MASK) == OA_PWREN_ENABLE_ENABLE);
251 opa->GPRCM.RSTCTL = (OA_RSTCTL_KEY_UNLOCK_W | OA_RSTCTL_RESETSTKYCLR_CLR |
252 OA_RSTCTL_RESETASSERT_ASSERT);
266 return ((opa->GPRCM.STAT & OA_GPRCM_STAT_RESETSTKY_MASK) ==
267 OA_GPRCM_STAT_RESETSTKY_RESET);
277 opa->CTL |= OA_CTL_ENABLE_ON;
293 return ((opa->CTL & OA_CTL_ENABLE_MASK) == OA_CTL_ENABLE_ON);
303 opa->CTL &= ~(OA_CTL_ENABLE_MASK);
322 OA_CFG_CHOP_MASK | OA_CFG_OUTPIN_MASK | OA_CFG_PSEL_MASK |
323 OA_CFG_NSEL_MASK | OA_CFG_MSEL_MASK | OA_CFG_GAIN_MASK);
338 OA_Regs *opa, DL_OPA_GBW bandwidth)
341 &opa->CFGBASE, (uint32_t) bandwidth, OA_CFGBASE_GBW_MASK);
355 uint32_t bandwidth = (opa->CFGBASE & OA_CFGBASE_GBW_MASK);
357 return (DL_OPA_GBW)(bandwidth);
372 opa->CFGBASE |= OA_CFGBASE_RRI_ON;
388 return ((opa->CFGBASE &= OA_CFGBASE_RRI_MASK) == OA_CFGBASE_RRI_ON);
398 opa->CFGBASE &= ~(OA_CFGBASE_RRI_MASK);
409 OA_Regs *opa, DL_OPA_CHOPPING_MODE mode)
425 uint32_t mode = (opa->CFG & OA_CFG_CHOP_MASK);
427 return (DL_OPA_CHOPPING_MODE)(mode);
445 OA_Regs *opa, DL_OPA_OUTPUT_PIN_STATE state)
469 uint32_t state = (opa->CFG & OA_CFG_OUTPIN_MASK);
471 return (DL_OPA_OUTPUT_PIN_STATE)(state);
485 opa->CFG &= ~(OA_CFG_OUTPIN_MASK);
499 OA_Regs *opa, DL_OPA_PSEL inputChannel)
516 uint32_t inputChannel = (opa->CFG & OA_CFG_PSEL_MASK);
518 return (DL_OPA_PSEL)(inputChannel);
532 OA_Regs *opa, DL_OPA_NSEL inputChannel)
548 uint32_t inputChannel = (opa->CFG & OA_CFG_NSEL_MASK);
550 return (DL_OPA_NSEL)(inputChannel);
564 OA_Regs *opa, DL_OPA_MSEL inputChannel)
580 uint32_t inputChannel = (opa->CFG & OA_CFG_MSEL_MASK);
582 return (DL_OPA_MSEL)(inputChannel);
615 uint32_t gain = (opa->CFG & OA_CFG_GAIN_MASK);
665 return ((opa->STAT & OA_STAT_RDY_MASK) == OA_STAT_RDY_TRUE);
DL_OPA_GAIN DL_OPA_increaseGain(OA_Regs *opa)
Increment gain to the next DL_OPA_GAIN enum value.
__STATIC_INLINE void DL_Common_updateReg(volatile uint32_t *reg, uint32_t val, uint32_t mask)
Writes value to specified register - retaining bits unaffected by mask.
Definition: dl_common.h:63
__STATIC_INLINE void DL_OPA_setInvertingInputChannel(OA_Regs *opa, DL_OPA_NSEL inputChannel)
Set the inverting input channel.
Definition: dl_opa.h:531
__STATIC_INLINE void DL_OPA_enablePower(OA_Regs *opa)
Enables the Peripheral Write Enable (PWREN) register for the OPA.
Definition: dl_opa.h:201
DL_OPA_GAIN DL_OPA_decreaseGain(OA_Regs *opa)
Decrement gain to the next DL_OPA_GAIN enum value.
DL_OPA_NSEL nselChannel
Definition: dl_opa.h:183
__STATIC_INLINE bool DL_OPA_isRailToRailInputEnabled(OA_Regs *opa)
Checks if the the rail-to-rail input (RRI) is enabled.
Definition: dl_opa.h:386
__STATIC_INLINE void DL_OPA_setGain(OA_Regs *opa, DL_OPA_GAIN gain)
Set the gain for the programmable gain stage.
Definition: dl_opa.h:597
__STATIC_INLINE void DL_OPA_setGainBandwidth(OA_Regs *opa, DL_OPA_GBW bandwidth)
Set the gain bandwidth (GBW)
Definition: dl_opa.h:337
__STATIC_INLINE bool DL_OPA_isReady(const OA_Regs *opa)
Checks if the OPA is ready.
Definition: dl_opa.h:663
__STATIC_INLINE void DL_OPA_setMMUXInputChannel(OA_Regs *opa, DL_OPA_MSEL inputChannel)
Set the M-MUX input channel.
Definition: dl_opa.h:563
__STATIC_INLINE void DL_OPA_disablePower(OA_Regs *opa)
Disables the Peripheral Write Enable (PWREN) register for the OPA.
Definition: dl_opa.h:217
__STATIC_INLINE void DL_OPA_disableOutputPin(OA_Regs *opa)
Disable the OPA output signal to be accessed by a device pin.
Definition: dl_opa.h:483
__STATIC_INLINE DL_OPA_MSEL DL_OPA_getMMUXInputChannel(const OA_Regs *opa)
Get the M-MUX input channel.
Definition: dl_opa.h:578
__STATIC_INLINE DL_OPA_NSEL DL_OPA_getInvertingInputChannel(const OA_Regs *opa)
Get the inverting input channel.
Definition: dl_opa.h:546
__STATIC_INLINE DL_OPA_OUTPUT_PIN_STATE DL_OPA_getOutputPinState(const OA_Regs *opa)
Get the state of the output pin.
Definition: dl_opa.h:466
__STATIC_INLINE DL_OPA_GBW DL_OPA_getGainBandwidth(const OA_Regs *opa)
Get the gain bandwidth (GBW)
Definition: dl_opa.h:353
__STATIC_INLINE void DL_OPA_disable(OA_Regs *opa)
Disable the OPA peripheral.
Definition: dl_opa.h:301
__STATIC_INLINE bool DL_OPA_isReset(const OA_Regs *opa)
Returns if OPA peripheral was reset.
Definition: dl_opa.h:264
__STATIC_INLINE void DL_OPA_reset(OA_Regs *opa)
Resets OPA peripheral.
Definition: dl_opa.h:249
__STATIC_INLINE void DL_OPA_enable(OA_Regs *opa)
Enable the OPA peripheral.
Definition: dl_opa.h:275
__STATIC_INLINE bool DL_OPA_isEnabled(const OA_Regs *opa)
Checks if the OPA peripheral is enabled.
Definition: dl_opa.h:291
__STATIC_INLINE DL_OPA_GAIN DL_OPA_getGain(const OA_Regs *opa)
Get the gain from the programmable gain stage.
Definition: dl_opa.h:613
__STATIC_INLINE DL_OPA_PSEL DL_OPA_getNonInvertingInputChannel(const OA_Regs *opa)
Get the non-inverting input channel.
Definition: dl_opa.h:513
__STATIC_INLINE DL_OPA_CHOPPING_MODE DL_OPA_getChoppingMode(const OA_Regs *opa)
Get the chopping mode.
Definition: dl_opa.h:423
DL_OPA_GBW
Definition: dl_opa.h:144
__STATIC_INLINE void DL_OPA_init(OA_Regs *opa, const DL_OPA_Config *config)
Initialize the OPA peripheral.
Definition: dl_opa.h:316
DL_OPA_CHOPPING_MODE
Definition: dl_opa.h:67
DL_OPA_MSEL
Definition: dl_opa.h:130
__STATIC_INLINE void DL_OPA_setChoppingMode(OA_Regs *opa, DL_OPA_CHOPPING_MODE mode)
Set and enable the chopping mode.
Definition: dl_opa.h:408
DL_OPA_MSEL mselChannel
Definition: dl_opa.h:185
__STATIC_INLINE void DL_OPA_setNonInvertingInputChannel(OA_Regs *opa, DL_OPA_PSEL inputChannel)
Set the non-inverting input channel.
Definition: dl_opa.h:498
DL_OPA_GAIN
Definition: dl_opa.h:152
__STATIC_INLINE bool DL_OPA_isPowerEnabled(const OA_Regs *opa)
Returns if the Peripheral Write Enable (PWREN) register for the OPA is enabled.
Definition: dl_opa.h:238
__STATIC_INLINE void DL_OPA_setOutputPinState(OA_Regs *opa, DL_OPA_OUTPUT_PIN_STATE state)
Set the state of the output pin.
Definition: dl_opa.h:444
__STATIC_INLINE void DL_OPA_enableRailToRailInput(OA_Regs *opa)
Enable the rail-to-rail input (RRI)
Definition: dl_opa.h:370
Configuration struct for DL_OPA_init.
Definition: dl_opa.h:175
DL_OPA_GAIN gain
Definition: dl_opa.h:187
DL_OPA_OUTPUT_PIN_STATE
Definition: dl_opa.h:78
__STATIC_INLINE void DL_OPA_disableRailToRailInput(OA_Regs *opa)
Disable the rail-to-rail input (RRI)
Definition: dl_opa.h:396
DL_OPA_NSEL
Definition: dl_opa.h:112
DL_OPA_PSEL
Definition: dl_opa.h:88
DL_OPA_OUTPUT_PIN_STATE outputPinState
Definition: dl_opa.h:179
DL_OPA_CHOPPING_MODE choppingMode
Definition: dl_opa.h:177
DL_OPA_PSEL pselChannel
Definition: dl_opa.h:181