IDAC - Current DAC#
Current Digital-to-Analog Converter (IDAC) Peripheral API.
IDAC can source or sink a configurable constant current, which can be output on, or sinked from pin or ADC. Current is configurable with several ranges of various step sizes. IDAC can be used with PRS and can operate down to EM3.
The following steps are necessary for basic operation:
Clock enable:
/* IDAC is a HFPERCLK peripheral */
CMU_ClockEnable(cmuClock_HFPER, true);
CMU_ClockEnable(cmuClock_IDAC0, true);
Initialize peripheral with default settings and modify selected fields, such as output select:
/* Initialize with default settings. Change output to APORT1YCH1. */
IDAC_Init_TypeDef init = IDAC_INIT_DEFAULT;
init.outMode = idacOutputAPORT1YCH1;
IDAC_Init(IDAC0, &init);
Set output:
/* Set 50nA step and enable output */
IDAC_StepSet(IDAC0, 0);
IDAC_OutEnable(IDAC0, true);
Modules#
Enumerations#
Output mode.
Selects which Peripheral Reflex System (PRS) signal to use when PRS is set to control IDAC output.
Selects which current range to use.
Functions#
Initialize IDAC.
Enable/disable IDAC.
Reset IDAC to the same state that it was in after a hardware reset.
Enable/disable Minimal Output Transition mode.
Set the current range of the IDAC output.
Set the current step of the IDAC output.
Enable/disable the IDAC OUT pin.
Enable/disable the IDAC OUTPAD output.
Clear one or more pending IDAC interrupts.
Disable one or more IDAC interrupts.
Enable one or more IDAC interrupts.
Get pending IDAC interrupt flags.
Get enabled and pending IDAC interrupt flags.
Set one or more pending IDAC interrupts from SW.
Macros#
Default configuration for IDAC initialization structure.
Enumeration Documentation#
IDAC_OutMode_TypeDef#
IDAC_OutMode_TypeDef
Output mode.
Enumerator | |
---|---|
idacOutputAPORT1XCH0 | Output to APORT 1X CH0. |
idacOutputAPORT1YCH1 | Output to APORT 1Y CH1. |
idacOutputAPORT1XCH2 | Output to APORT 1X CH2. |
idacOutputAPORT1YCH3 | Output to APORT 1Y CH3. |
idacOutputAPORT1XCH4 | Output to APORT 1X CH4. |
idacOutputAPORT1YCH5 | Output to APORT 1Y CH5. |
idacOutputAPORT1XCH6 | Output to APORT 1X CH6. |
idacOutputAPORT1YCH7 | Output to APORT 1Y CH7. |
idacOutputAPORT1XCH8 | Output to APORT 1X CH8. |
idacOutputAPORT1YCH9 | Output to APORT 1Y CH9. |
idacOutputAPORT1XCH10 | Output to APORT 1X CH10. |
idacOutputAPORT1YCH11 | Output to APORT 1Y CH11. |
idacOutputAPORT1XCH12 | Output to APORT 1X CH12. |
idacOutputAPORT1YCH13 | Output to APORT 1Y CH13. |
idacOutputAPORT1XCH14 | Output to APORT 1X CH14. |
idacOutputAPORT1YCH15 | Output to APORT 1Y CH15. |
idacOutputAPORT1XCH16 | Output to APORT 1X CH16. |
idacOutputAPORT1YCH17 | Output to APORT 1Y CH17. |
idacOutputAPORT1XCH18 | Output to APORT 1X CH18. |
idacOutputAPORT1YCH19 | Output to APORT 1Y CH19. |
idacOutputAPORT1XCH20 | Output to APORT 1X CH20. |
idacOutputAPORT1YCH21 | Output to APORT 1Y CH21. |
idacOutputAPORT1XCH22 | Output to APORT 1X CH22. |
idacOutputAPORT1YCH23 | Output to APORT 1Y CH23. |
idacOutputAPORT1XCH24 | Output to APORT 1X CH24. |
idacOutputAPORT1YCH25 | Output to APORT 1Y CH25. |
idacOutputAPORT1XCH26 | Output to APORT 1X CH26. |
idacOutputAPORT1YCH27 | Output to APORT 1Y CH27. |
idacOutputAPORT1XCH28 | Output to APORT 1X CH28. |
idacOutputAPORT1YCH29 | Output to APORT 1Y CH29. |
idacOutputAPORT1XCH30 | Output to APORT 1X CH30. |
idacOutputAPORT1YCH31 | Output to APORT 1Y CH31. |
IDAC_PRSSEL_TypeDef#
IDAC_PRSSEL_TypeDef
Selects which Peripheral Reflex System (PRS) signal to use when PRS is set to control 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. |
idacPRSSELCh6 | PRS channel 6. |
idacPRSSELCh7 | PRS channel 7. |
idacPRSSELCh8 | PRS channel 8. |
idacPRSSELCh9 | PRS channel 9. |
idacPRSSELCh10 | PRS channel 10. |
idacPRSSELCh11 | PRS channel 11. |
IDAC_Range_TypeDef#
IDAC_Range_TypeDef
Selects which current range to use.
Enumerator | |
---|---|
idacCurrentRange0 | current range 0. |
idacCurrentRange1 | current range 1. |
idacCurrentRange2 | current range 2. |
idacCurrentRange3 | current range 3. |
Function Documentation#
IDAC_Init#
void IDAC_Init (IDAC_TypeDef * idac, const IDAC_Init_TypeDef * init)
Initialize IDAC.
Type | Direction | Argument Name | Description |
---|---|---|---|
IDAC_TypeDef * | [in] | idac | A pointer to the IDAC peripheral register block. |
const IDAC_Init_TypeDef * | [in] | init | A pointer to the IDAC initialization structure. |
Initializes IDAC according to the initialization structure parameter and sets the default calibration value stored in the DEVINFO structure.
Note
This function will disable IDAC prior to configuration.
IDAC_Enable#
void IDAC_Enable (IDAC_TypeDef * idac, bool enable)
Enable/disable IDAC.
Type | Direction | Argument Name | Description |
---|---|---|---|
IDAC_TypeDef * | [in] | idac | A pointer to the IDAC peripheral register block. |
bool | [in] | enable | True to enable IDAC, false to disable. |
IDAC_Reset#
void IDAC_Reset (IDAC_TypeDef * idac)
Reset IDAC to the same state that it was in after a hardware reset.
Type | Direction | Argument Name | Description |
---|---|---|---|
IDAC_TypeDef * | [in] | idac | A pointer to the IDAC peripheral register block. |
IDAC_MinimalOutputTransitionMode#
void IDAC_MinimalOutputTransitionMode (IDAC_TypeDef * idac, bool enable)
Enable/disable Minimal Output Transition mode.
Type | Direction | Argument Name | Description |
---|---|---|---|
IDAC_TypeDef * | [in] | idac | A pointer to the IDAC peripheral register block. |
bool | [in] | enable | True to enable Minimal Output Transition mode, false to disable. |
IDAC_RangeSet#
void IDAC_RangeSet (IDAC_TypeDef * idac, const IDAC_Range_TypeDef range)
Set the current range of the IDAC output.
Type | Direction | Argument Name | Description |
---|---|---|---|
IDAC_TypeDef * | [in] | idac | A pointer to the IDAC peripheral register block. |
const IDAC_Range_TypeDef | [in] | range | The current range value. |
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.
IDAC_StepSet#
void IDAC_StepSet (IDAC_TypeDef * idac, const uint32_t step)
Set the current step of the IDAC output.
Type | Direction | Argument Name | Description |
---|---|---|---|
IDAC_TypeDef * | [in] | idac | A pointer to the IDAC peripheral register block. |
const uint32_t | [in] | step | A step value for the IDAC output. A valid range is 0-31. |
IDAC_OutEnable#
void IDAC_OutEnable (IDAC_TypeDef * idac, bool enable)
Enable/disable the IDAC OUT pin.
Type | Direction | Argument Name | Description |
---|---|---|---|
IDAC_TypeDef * | [in] | idac | A pointer to the IDAC peripheral register block. |
bool | [in] | enable | True to enable the IDAC OUT pin, false to disable. |
Warnings
This function will not enable/disable the IDAC OUT pin if APORTOUTENPRS is set because output enable will be controlled by PRS.
IDAC_OutpadEnable#
void IDAC_OutpadEnable (IDAC_TypeDef * idac, bool enable)
Enable/disable the IDAC OUTPAD output.
Type | Direction | Argument Name | Description |
---|---|---|---|
IDAC_TypeDef * | [in] | idac | A pointer to the IDAC peripheral register block. |
bool | [in] | enable | True to enable the IDAC OUTPAD, false to disable. |
Note
IDAC OUTPAD is not available on some EFR32xG1 series devices as well as on non-BGA125 EFR32MG12 devices either because of lack of that feature (former) or because OUTPAD pin is not available on other packages (latter).
Warnings
This function will not enable/disable the IDAC OUTPAD pin if MAINOUTENPRS is set because output enable will be controlled by PRS.
IDAC_IntClear#
void IDAC_IntClear (IDAC_TypeDef * idac, uint32_t flags)
Clear one or more pending IDAC interrupts.
Type | Direction | Argument Name | Description |
---|---|---|---|
IDAC_TypeDef * | [in] | idac | Pointer to IDAC peripheral register block. |
uint32_t | [in] | flags | Pending IDAC interrupt source(s) to clear. Use one or more valid interrupt flags for the IDAC module (IDAC_IF_nnn) OR'ed together. |
IDAC_IntDisable#
void IDAC_IntDisable (IDAC_TypeDef * idac, uint32_t flags)
Disable one or more IDAC interrupts.
Type | Direction | Argument Name | Description |
---|---|---|---|
IDAC_TypeDef * | [in] | idac | Pointer to IDAC peripheral register block. |
uint32_t | [in] | flags | IDAC interrupt source(s) to disable. Use one or more valid interrupt flags for the IDAC module (IDAC_IF_nnn) OR'ed together. |
IDAC_IntEnable#
void IDAC_IntEnable (IDAC_TypeDef * idac, uint32_t flags)
Enable one or more IDAC interrupts.
Type | Direction | Argument Name | Description |
---|---|---|---|
IDAC_TypeDef * | [in] | idac | Pointer to IDAC peripheral register block. |
uint32_t | [in] | flags | IDAC interrupt source(s) to enable. Use one or more valid interrupt flags for IDAC module (IDAC_IF_nnn) OR'ed together. |
Note
Depending on the use, a pending interrupt may already be set prior to enabling the interrupt. To ignore a pending interrupt, consider using IDAC_IntClear() prior to enabling the interrupt.
IDAC_IntGet#
uint32_t IDAC_IntGet (IDAC_TypeDef * idac)
Get pending IDAC interrupt flags.
Type | Direction | Argument Name | Description |
---|---|---|---|
IDAC_TypeDef * | [in] | idac | Pointer to IDAC peripheral register block. |
Note
Event bits are not cleared by the use of this function.
Returns
IDAC interrupt source(s) pending. Returns one or more valid interrupt flags for IDAC module (IDAC_IF_nnn) OR'ed together.
IDAC_IntGetEnabled#
uint32_t IDAC_IntGetEnabled (IDAC_TypeDef * idac)
Get enabled and pending IDAC interrupt flags.
Type | Direction | Argument Name | Description |
---|---|---|---|
IDAC_TypeDef * | [in] | idac | Pointer to IDAC peripheral register block. |
Useful for handling more interrupt sources in the same interrupt handler.
Note
Interrupt flags are not cleared by the use of this function.
Returns
Pending and enabled IDAC interrupt sources. Return value is the bitwise AND combination of
the OR combination of enabled interrupt sources in IDACx_IEN_nnn register (IDACx_IEN_nnn) and
the OR combination of valid interrupt flags of IDAC module (IDACx_IF_nnn).
IDAC_IntSet#
void IDAC_IntSet (IDAC_TypeDef * idac, uint32_t flags)
Set one or more pending IDAC interrupts from SW.
Type | Direction | Argument Name | Description |
---|---|---|---|
IDAC_TypeDef * | [in] | idac | Pointer to IDAC peripheral register block. |
uint32_t | [in] | flags | IDAC interrupt source(s) to set to pending. Use one or more valid interrupt flags for IDAC module (IDAC_IF_nnn) OR'ed together. |