34 #if ((defined(_SILICON_LABS_32B_SERIES_0) && defined(OPAMP_PRESENT) && (OPAMP_COUNT == 1)) \
35 || (defined(_SILICON_LABS_32B_SERIES_1) && defined(VDAC_PRESENT) && (VDAC_COUNT > 0)))
262 #elif defined(_SILICON_LABS_32B_SERIES_1)
267 #if defined(_SILICON_LABS_32B_SERIES_0)
268 EFM_ASSERT(DAC_REF_VALID(dac));
269 EFM_ASSERT(DAC_OPA_VALID(opa));
276 else if (opa ==
OPA1)
286 #elif defined(_SILICON_LABS_32B_SERIES_1)
287 EFM_ASSERT(VDAC_REF_VALID(dac));
288 EFM_ASSERT(VDAC_OPA_VALID(opa));
292 dac->CMD |= VDAC_CMD_OPA0DIS;
293 while (dac->STATUS & VDAC_STATUS_OPA0ENS)
297 else if (opa ==
OPA1)
299 dac->CMD |= VDAC_CMD_OPA1DIS;
300 while (dac->STATUS & VDAC_STATUS_OPA1ENS)
306 dac->CMD |= VDAC_CMD_OPA2DIS;
307 while (dac->STATUS & VDAC_STATUS_OPA2ENS)
375 #elif defined(_SILICON_LABS_32B_SERIES_1)
381 #if defined(_SILICON_LABS_32B_SERIES_0)
384 EFM_ASSERT(DAC_REF_VALID(dac));
385 EFM_ASSERT(DAC_OPA_VALID(opa));
393 dac->BIASPROG = (dac->BIASPROG
414 dac->OPA0MUX = (uint32_t)init->
resSel
425 dac->OPACTRL = (dac->OPACTRL
437 else if ( opa ==
OPA1 )
441 dac->BIASPROG = (dac->BIASPROG
462 dac->OPA1MUX = (uint32_t)init->
resSel
473 dac->OPACTRL = (dac->OPACTRL
496 dac->BIASPROG = (dac->BIASPROG
516 dac->OPA2MUX = (uint32_t)init->
resSel
526 dac->OPACTRL = (dac->OPACTRL
539 #elif defined(_SILICON_LABS_32B_SERIES_1)
540 uint32_t calData = 0;
543 EFM_ASSERT(VDAC_REF_VALID(dac));
544 EFM_ASSERT(VDAC_OPA_VALID(opa));
545 EFM_ASSERT(init->settleTime <= (_VDAC_OPA_TIMER_SETTLETIME_MASK
546 >> _VDAC_OPA_TIMER_SETTLETIME_SHIFT));
547 EFM_ASSERT(init->startupDly <= (_VDAC_OPA_TIMER_STARTUPDLY_MASK
548 >> _VDAC_OPA_TIMER_STARTUPDLY_SHIFT));
549 EFM_ASSERT((init->
outPen & ~_VDAC_OPA_OUT_ALTOUTPADEN_MASK) == 0);
550 EFM_ASSERT(!((init->gain3xEn ==
true)
552 || (init->
posSel == opaPosSelResTap))));
553 EFM_ASSERT((init->drvStr == opaDrvStrLowerAccLowStr)
554 || (init->drvStr == opaDrvStrLowAccLowStr)
555 || (init->drvStr == opaDrvStrHighAccHighStr)
556 || (init->drvStr == opaDrvStrHigherAccHighStr));
565 switch (init->drvStr)
567 case opaDrvStrLowerAccLowStr:
568 calData = (init->ugBwScale ?
DEVINFO->OPA0CAL0 :
DEVINFO->OPA0CAL4);
570 case opaDrvStrLowAccLowStr:
571 calData = (init->ugBwScale ?
DEVINFO->OPA0CAL1 :
DEVINFO->OPA0CAL5);
573 case opaDrvStrHighAccHighStr:
574 calData = (init->ugBwScale ?
DEVINFO->OPA0CAL2 :
DEVINFO->OPA0CAL6);
576 case opaDrvStrHigherAccHighStr:
577 calData = (init->ugBwScale ?
DEVINFO->OPA0CAL3 :
DEVINFO->OPA0CAL7);
583 switch (init->drvStr)
585 case opaDrvStrLowerAccLowStr:
586 calData = (init->ugBwScale ?
DEVINFO->OPA1CAL0 :
DEVINFO->OPA1CAL4);
588 case opaDrvStrLowAccLowStr:
589 calData = (init->ugBwScale ?
DEVINFO->OPA1CAL1 :
DEVINFO->OPA1CAL5);
591 case opaDrvStrHighAccHighStr:
592 calData = (init->ugBwScale ?
DEVINFO->OPA1CAL2 :
DEVINFO->OPA1CAL6);
594 case opaDrvStrHigherAccHighStr:
595 calData = (init->ugBwScale ?
DEVINFO->OPA1CAL3 :
DEVINFO->OPA1CAL7);
601 switch (init->drvStr)
603 case opaDrvStrLowerAccLowStr:
604 calData = (init->ugBwScale ?
DEVINFO->OPA2CAL0 :
DEVINFO->OPA2CAL4);
606 case opaDrvStrLowAccLowStr:
607 calData = (init->ugBwScale ?
DEVINFO->OPA2CAL1 :
DEVINFO->OPA2CAL5);
609 case opaDrvStrHighAccHighStr:
610 calData = (init->ugBwScale ?
DEVINFO->OPA2CAL2 :
DEVINFO->OPA2CAL6);
612 case opaDrvStrHigherAccHighStr:
613 calData = (init->ugBwScale ?
DEVINFO->OPA2CAL3 :
DEVINFO->OPA2CAL7);
618 if (!init->defaultOffsetN)
620 EFM_ASSERT(init->offsetN <= (_VDAC_OPA_CAL_OFFSETN_MASK
621 >> _VDAC_OPA_CAL_OFFSETN_SHIFT));
622 calData = (calData & ~_VDAC_OPA_CAL_OFFSETN_MASK)
623 | (init->offsetN << _VDAC_OPA_CAL_OFFSETN_SHIFT);
625 if (!init->defaultOffsetP)
627 EFM_ASSERT(init->offsetP <= (_VDAC_OPA_CAL_OFFSETP_MASK
628 >> _VDAC_OPA_CAL_OFFSETP_SHIFT));
629 calData = (calData & ~_VDAC_OPA_CAL_OFFSETP_MASK)
630 | (init->offsetP << _VDAC_OPA_CAL_OFFSETP_SHIFT);
633 dac->OPA[opa].CAL = (calData & _VDAC_OPA_CAL_MASK);
635 dac->OPA[opa].MUX = (uint32_t)init->
resSel
636 | (init->gain3xEn ? VDAC_OPA_MUX_GAIN3X : 0)
641 dac->OPA[opa].OUT = (uint32_t)init->
outMode
644 switch (init->drvStr)
646 case opaDrvStrHigherAccHighStr:
650 case opaDrvStrHighAccHighStr:
654 case opaDrvStrLowAccLowStr:
658 case opaDrvStrLowerAccLowStr:
664 dac->OPA[opa].TIMER = (uint32_t)(init->settleTime
665 << _VDAC_OPA_TIMER_SETTLETIME_SHIFT)
666 | (uint32_t)(warmupTime
667 << _VDAC_OPA_TIMER_WARMUPTIME_SHIFT)
668 | (uint32_t)(init->startupDly
669 << _VDAC_OPA_TIMER_STARTUPDLY_SHIFT);
671 dac->OPA[opa].CTRL = (init->aportYMasterDisable
672 ? VDAC_OPA_CTRL_APORTYMASTERDIS : 0)
673 | (init->aportXMasterDisable
674 ? VDAC_OPA_CTRL_APORTXMASTERDIS : 0)
675 | (uint32_t)init->prsOutSel
676 | (uint32_t)init->prsSel
677 | (uint32_t)init->prsMode
678 | (init->prsEn ? VDAC_OPA_CTRL_PRSEN : 0)
680 ? VDAC_OPA_CTRL_OUTSCALE_HALF
681 : VDAC_OPA_CTRL_OUTSCALE_FULL)
682 | (init->
hcmDisable ? VDAC_OPA_CTRL_HCMDIS : 0)
683 | (init->ugBwScale ? VDAC_OPA_CTRL_INCBW : 0)
684 | (uint32_t)init->drvStr;
688 dac->CMD |= VDAC_CMD_OPA0EN;
690 else if (opa ==
OPA1)
692 dac->CMD |= VDAC_CMD_OPA1EN;
696 dac->CMD |= VDAC_CMD_OPA2EN;
#define _DAC_OPA1MUX_OUTPEN_MASK
void OPAMP_Enable(DAC_TypeDef *dac, OPAMP_TypeDef opa, const OPAMP_Init_TypeDef *init)
Configure and enable an Operational Amplifier.
OPAMP_PosSel_TypeDef posSel
Emlib peripheral API "assert" implementation.
#define DAC_OPA2MUX_POSSEL_POSPAD
#define DAC_OPA0MUX_NEXTOUT
#define _DAC_BIASPROG_BIASPROG_SHIFT
#define DAC_OPACTRL_OPA1HCMDIS
#define DAC_OPA2MUX_POSSEL_OPATAP
#define _DAC_CAL_CH1OFFSET_SHIFT
#define DAC_OPACTRL_OPA0HCMDIS
#define DAC_OPA2MUX_NEXTOUT
#define DAC_OPACTRL_OPA1EN
#define _DAC_OPACTRL_OPA0LPFDIS_MASK
#define DAC_OPACTRL_OPA1SHORT
#define DAC_BIASPROG_HALFBIAS
OPAMP_ResInMux_TypeDef resInMux
#define _DAC_CAL_CH0OFFSET_SHIFT
#define _DAC_BIASPROG_OPA2BIASPROG_SHIFT
#define DAC_OPACTRL_OPA1LPFDIS_PLPFDIS
OPAMP_NegSel_TypeDef negSel
bool SYSTEM_GetCalibrationValue(volatile uint32_t *regAddress)
Get factory calibration value for a given peripheral register.
#define DAC_OPACTRL_OPA0LPFDIS_PLPFDIS
#define _DAC_BIASPROG_BIASPROG_MASK
#define DAC_OPA2MUX_POSSEL_DISABLE
#define DAC_OPACTRL_OPA2HCMDIS
#define DAC_OPACTRL_OPA2SHORT
#define DAC_OPACTRL_OPA0EN
#define _DAC_OPACTRL_OPA1LPFDIS_MASK
#define DAC_OPA2MUX_POSSEL_OPA1INP
OPAMP_ResSel_TypeDef resSel
#define DAC_OPACTRL_OPA2LPFDIS_NLPFDIS
#define DAC_OPA1MUX_NEXTOUT
#define DAC_OPACTRL_OPA0SHORT
#define DAC_BIASPROG_OPA2HALFBIAS
#define DAC_OPACTRL_OPA0LPFDIS_NLPFDIS
#define _SILICON_LABS_32B_SERIES_0
#define DAC_OPA2MUX_OUTMODE
#define _DAC_CAL_CH0OFFSET_MASK
#define DAC_OPACTRL_OPA2EN
#define _DAC_OPA2MUX_OUTPEN_MASK
#define _DAC_OPA0MUX_OUTPEN_MASK
#define _DAC_OPACTRL_OPA2LPFDIS_MASK
#define _DAC_OPAOFFSET_OPA2OFFSET_MASK
#define DAC_OPACTRL_OPA1LPFDIS_NLPFDIS
#define DAC_OPACTRL_OPA2LPFDIS_PLPFDIS
void OPAMP_Disable(DAC_TypeDef *dac, OPAMP_TypeDef opa)
Disable an Operational Amplifier.
#define _DAC_CAL_CH1OFFSET_MASK
#define _DAC_OPAOFFSET_OPA2OFFSET_SHIFT
Operational Amplifier (OPAMP) peripheral API.
#define _DAC_BIASPROG_OPA2BIASPROG_MASK
OPAMP_OutMode_TypeDef outMode