IDACEMLIB
Detailed Description
Current Digital-to-Analog Converter (IDAC) Peripheral API.
The current digital-to-analog converter (IDAC) can source or sink a configurable constant current, which can be output on, or sinked from pin or ADC. The current is configurable with several ranges of various step sizes. The IDAC can be used with PRS and it can operate down to EM3.
The following steps are necessary for basic operation:
Clock enable:
Initialize the peripheral with default settings and modify selected fields such as output select:
Set output:
         Data Structures | 
       |
| struct | IDAC_Init_TypeDef | 
         Macros | 
       |
| #define | IDAC_INIT_DEFAULT | 
         Enumerations | 
       |
| enum | 
         
          IDAC_OutMode_TypeDef
         
         {
          idacOutputPin = IDAC_CTRL_OUTMODE_PIN, idacOutputADC = IDAC_CTRL_OUTMODE_ADC }  | 
       
| enum | 
         
          IDAC_PRSSEL_TypeDef
         
         {
          idacPRSSELCh0 = IDAC_CTRL_PRSSEL_PRSCH0, idacPRSSELCh1 = IDAC_CTRL_PRSSEL_PRSCH1, idacPRSSELCh2 = IDAC_CTRL_PRSSEL_PRSCH2, idacPRSSELCh3 = IDAC_CTRL_PRSSEL_PRSCH3, idacPRSSELCh4 = IDAC_CTRL_PRSSEL_PRSCH4, idacPRSSELCh5 = IDAC_CTRL_PRSSEL_PRSCH5 }  | 
       
| enum | 
         
          IDAC_Range_TypeDef
         
         {
          idacCurrentRange0 = IDAC_CURPROG_RANGESEL_RANGE0, idacCurrentRange1 = IDAC_CURPROG_RANGESEL_RANGE1, idacCurrentRange2 = IDAC_CURPROG_RANGESEL_RANGE2, idacCurrentRange3 = IDAC_CURPROG_RANGESEL_RANGE3 }  | 
       
         Functions | 
       |
| void | IDAC_Enable ( IDAC_TypeDef *idac, bool enable) | 
| 
         Enable/disable IDAC.
          | 
       |
| void | IDAC_Init ( IDAC_TypeDef *idac, const IDAC_Init_TypeDef *init) | 
| 
         Initialize IDAC.
          | 
       |
| void | IDAC_MinimalOutputTransitionMode ( IDAC_TypeDef *idac, bool enable) | 
| 
         Enable/disable Minimal Output Transition mode.
          | 
       |
| void | IDAC_OutEnable ( IDAC_TypeDef *idac, bool enable) | 
| 
         Enable/disable the IDAC OUT pin.
          | 
       |
| void | IDAC_RangeSet ( IDAC_TypeDef *idac, const IDAC_Range_TypeDef range) | 
| 
         Set the current range of the IDAC output.
          | 
       |
| void | IDAC_Reset ( IDAC_TypeDef *idac) | 
| 
         Reset IDAC to same state as after a HW reset.
          | 
       |
| void | IDAC_StepSet ( IDAC_TypeDef *idac, const uint32_t step) | 
| 
         Set the current step of the IDAC output.
          | 
       |
Macro Definition Documentation
| #define IDAC_INIT_DEFAULT | 
Default config for IDAC init structure.
        Definition at line
        
         193
        
        of file
        
         em_idac.h
        
        .
       
Enumeration Type Documentation
| enum IDAC_OutMode_TypeDef | 
| enum IDAC_PRSSEL_TypeDef | 
Selects which Peripheral Reflex System (PRS) signal to use when PRS is set to control the IDAC output.
| Enumerator | |
|---|---|
| idacPRSSELCh0 | 
            PRS channel 0.  | 
         
| idacPRSSELCh1 | 
            PRS channel 1.  | 
         
| idacPRSSELCh2 | 
            PRS channel 2.  | 
         
| idacPRSSELCh3 | 
            PRS channel 3.  | 
         
| idacPRSSELCh4 | 
            PRS channel 4.  | 
         
| idacPRSSELCh5 | 
            PRS channel 5.  | 
         
        Definition at line
        
         135
        
        of file
        
         em_idac.h
        
        .
       
| enum IDAC_Range_TypeDef | 
Function Documentation
| void IDAC_Enable | ( | IDAC_TypeDef * | 
           
            idac,
           
           | 
         
| bool | 
           
            enable
           
           | 
         ||
| ) | 
Enable/disable IDAC.
- Parameters
 - 
         
[in] idacPointer to IDAC peripheral register block. [in] enabletrue to enable IDAC, false to disable.  
        Definition at line
        
         115
        
        of file
        
         em_idac.c
        
        .
       
References _IDAC_CTRL_EN_SHIFT , BUS_RegBitWrite() , and IDAC_TypeDef::CTRL .
| void IDAC_Init | ( | IDAC_TypeDef * | 
           
            idac,
           
           | 
         
| const IDAC_Init_TypeDef * | 
           
            init
           
           | 
         ||
| ) | 
Initialize IDAC.
Initializes IDAC according to the initialization structure parameter, and sets the default calibration value stored in the DEVINFO structure.
- Note
 - This function will disable the IDAC prior to configuration.
 
- Parameters
 - 
         
[in] idacPointer to IDAC peripheral register block. [in] initPointer to IDAC initialization structure.  
        Definition at line
        
         78
        
        of file
        
         em_idac.c
        
        .
       
References IDAC_TypeDef::CTRL , IDAC_Init_TypeDef::enable , IDAC_CTRL_CURSINK , IDAC_CTRL_EN , IDAC_CTRL_OUTENPRS , IDAC_Init_TypeDef::outMode , IDAC_Init_TypeDef::prsEnable , IDAC_Init_TypeDef::prsSel , and IDAC_Init_TypeDef::sinkEnable .
| void IDAC_MinimalOutputTransitionMode | ( | IDAC_TypeDef * | 
           
            idac,
           
           | 
         
| bool | 
           
            enable
           
           | 
         ||
| ) | 
Enable/disable Minimal Output Transition mode.
- Parameters
 - 
         
[in] idacPointer to IDAC peripheral register block. [in] enabletrue to enable Minimal Output Transition mode, false to disable.  
        Definition at line
        
         166
        
        of file
        
         em_idac.c
        
        .
       
References _IDAC_CTRL_MINOUTTRANS_SHIFT , BUS_RegBitWrite() , and IDAC_TypeDef::CTRL .
| void IDAC_OutEnable | ( | IDAC_TypeDef * | 
           
            idac,
           
           | 
         
| bool | 
           
            enable
           
           | 
         ||
| ) | 
Enable/disable the IDAC OUT pin.
- Parameters
 - 
         
[in] idacPointer to IDAC peripheral register block. [in] enabletrue to enable the IDAC OUT pin, false to disable.  
        Definition at line
        
         331
        
        of file
        
         em_idac.c
        
        .
       
References _IDAC_CTRL_OUTEN_SHIFT , BUS_RegBitWrite() , and IDAC_TypeDef::CTRL .
| void IDAC_RangeSet | ( | IDAC_TypeDef * | 
           
            idac,
           
           | 
         
| const IDAC_Range_TypeDef | 
           
            range
           
           | 
         ||
| ) | 
Set the current range of the IDAC output.
This function sets the current range of the IDAC output. The function also updates the IDAC calibration register (IDAC_CAL) with the default calibration value from DEVINFO (factory calibration) corresponding to the specified range.
- Parameters
 - 
         
[in] idacPointer to IDAC peripheral register block. [in] rangeCurrent range value.  
        Definition at line
        
         188
        
        of file
        
         em_idac.c
        
        .
       
References _DEVINFO_IDAC0CAL0_RANGE0_MASK , _DEVINFO_IDAC0CAL0_RANGE0_SHIFT , _DEVINFO_IDAC0CAL0_RANGE1_MASK , _DEVINFO_IDAC0CAL0_RANGE1_SHIFT , _DEVINFO_IDAC0CAL0_RANGE2_MASK , _DEVINFO_IDAC0CAL0_RANGE2_SHIFT , _DEVINFO_IDAC0CAL0_RANGE3_MASK , _DEVINFO_IDAC0CAL0_RANGE3_SHIFT , _IDAC_CURPROG_RANGESEL_MASK , _IDAC_CURPROG_RANGESEL_SHIFT , IDAC_TypeDef::CAL , IDAC_TypeDef::CTRL , IDAC_TypeDef::CURPROG , DEVINFO , IDAC0 , IDAC_CTRL_CURSINK , idacCurrentRange0 , idacCurrentRange1 , idacCurrentRange2 , and idacCurrentRange3 .
| void IDAC_Reset | ( | IDAC_TypeDef * | 
           
            idac
           
           | 
          ) | 
Reset IDAC to same state as after a HW reset.
- Parameters
 - 
         
[in] idacPointer to IDAC peripheral register block.  
        Definition at line
        
         128
        
        of file
        
         em_idac.c
        
        .
       
References _IDAC_CAL_RESETVALUE , _IDAC_CTRL_RESETVALUE , _IDAC_CURPROG_RESETVALUE , _IDAC_CURPROG_STEPSEL_SHIFT , _IDAC_DUTYCONFIG_RESETVALUE , IDAC_TypeDef::CAL , IDAC_TypeDef::CTRL , IDAC_TypeDef::CURPROG , IDAC_TypeDef::DUTYCONFIG , IDAC_CTRL_EN , IDAC_CURPROG_RANGESEL_RANGE0 , and IDAC_DUTYCONFIG_DUTYCYCLEEN .
| void IDAC_StepSet | ( | IDAC_TypeDef * | 
           
            idac,
           
           | 
         
| const uint32_t | 
           
            step
           
           | 
         ||
| ) | 
Set the current step of the IDAC output.
- Parameters
 - 
         
[in] idacPointer to IDAC peripheral register block. [in] stepStep value for IDAC output. Valid range is 0-31.  
        Definition at line
        
         308
        
        of file
        
         em_idac.c
        
        .
       
References _IDAC_CURPROG_STEPSEL_MASK , _IDAC_CURPROG_STEPSEL_SHIFT , and IDAC_TypeDef::CURPROG .