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 ADC. */
IDAC_Init_TypeDef init = IDAC_INIT_DEFAULT;
init.outMode = idacOutputADC;
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.
Macros#
Default configuration for IDAC initialization structure.
Enumeration Documentation#
IDAC_OutMode_TypeDef#
IDAC_OutMode_TypeDef
Output mode.
Enumerator | |
---|---|
idacOutputPin | Output to IDAC OUT pin. |
idacOutputADC | Output to ADC. |
86
of file platform/emlib/inc/em_idac.h
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. |
128
of file platform/emlib/inc/em_idac.h
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. |
148
of file platform/emlib/inc/em_idac.h
Function Documentation#
IDAC_Init#
void IDAC_Init (IDAC_TypeDef * idac, const IDAC_Init_TypeDef * init)
Initialize IDAC.
[in] | idac | A pointer to the IDAC peripheral register block. |
[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.
71
of file platform/emlib/src/em_idac.c
IDAC_Enable#
void IDAC_Enable (IDAC_TypeDef * idac, bool enable)
Enable/disable IDAC.
[in] | idac | A pointer to the IDAC peripheral register block. |
[in] | enable | True to enable IDAC, false to disable. |
113
of file platform/emlib/src/em_idac.c
IDAC_Reset#
void IDAC_Reset (IDAC_TypeDef * idac)
Reset IDAC to the same state that it was in after a hardware reset.
[in] | idac | A pointer to the IDAC peripheral register block. |
126
of file platform/emlib/src/em_idac.c
IDAC_MinimalOutputTransitionMode#
void IDAC_MinimalOutputTransitionMode (IDAC_TypeDef * idac, bool enable)
Enable/disable Minimal Output Transition mode.
[in] | idac | A pointer to the IDAC peripheral register block. |
[in] | enable | True to enable Minimal Output Transition mode, false to disable. |
164
of file platform/emlib/src/em_idac.c
IDAC_RangeSet#
void IDAC_RangeSet (IDAC_TypeDef * idac, const IDAC_Range_TypeDef range)
Set the current range of the IDAC output.
[in] | idac | A pointer to the IDAC peripheral register block. |
[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.
186
of file platform/emlib/src/em_idac.c
IDAC_StepSet#
void IDAC_StepSet (IDAC_TypeDef * idac, const uint32_t step)
Set the current step of the IDAC output.
[in] | idac | A pointer to the IDAC peripheral register block. |
[in] | step | A step value for the IDAC output. A valid range is 0-31. |
306
of file platform/emlib/src/em_idac.c
IDAC_OutEnable#
void IDAC_OutEnable (IDAC_TypeDef * idac, bool enable)
Enable/disable the IDAC OUT pin.
[in] | idac | A pointer to the IDAC peripheral register block. |
[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.
333
of file platform/emlib/src/em_idac.c
Macro Definition Documentation#
IDAC_INIT_DEFAULT#
#define IDAC_INIT_DEFAULTValue:
Default configuration for IDAC initialization structure.
194
of file platform/emlib/inc/em_idac.h