IDAC - Current DAC
Description
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:
Initialize peripheral with default settings and modify selected fields, such as output select:
Set output:
Data Structures |
|
struct | IDAC_Init_TypeDef |
IDAC initialization structure, common for both channels.
|
|
Functions |
|
void | IDAC_Init (IDAC_TypeDef *idac, const IDAC_Init_TypeDef *init) |
Initialize IDAC.
|
|
void | IDAC_Enable (IDAC_TypeDef *idac, bool enable) |
Enable/disable IDAC.
|
|
void | IDAC_Reset (IDAC_TypeDef *idac) |
Reset IDAC to the same state that it was in after a hardware reset.
|
|
void | IDAC_MinimalOutputTransitionMode (IDAC_TypeDef *idac, bool enable) |
Enable/disable Minimal Output Transition mode.
|
|
void | IDAC_RangeSet (IDAC_TypeDef *idac, const IDAC_Range_TypeDef range) |
Set the current range of the IDAC output.
|
|
void | IDAC_StepSet (IDAC_TypeDef *idac, const uint32_t step) |
Set the current step of the IDAC output.
|
|
void | IDAC_OutEnable (IDAC_TypeDef *idac, bool enable) |
Enable/disable the IDAC OUT pin.
|
|
Macros |
|
#define | IDAC_INIT_DEFAULT |
Default configuration for IDAC initialization structure.
|
|
Enumerations |
|
enum |
IDAC_OutMode_TypeDef
{
idacOutputPin = IDAC_CTRL_OUTMODE_PIN, idacOutputADC = IDAC_CTRL_OUTMODE_ADC } |
Output mode.
|
|
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 } |
Selects which Peripheral Reflex System (PRS) signal to use when PRS is set to control IDAC output.
|
|
enum |
IDAC_Range_TypeDef
{
idacCurrentRange0 = IDAC_CURPROG_RANGESEL_RANGE0, idacCurrentRange1 = IDAC_CURPROG_RANGESEL_RANGE1, idacCurrentRange2 = IDAC_CURPROG_RANGESEL_RANGE2, idacCurrentRange3 = IDAC_CURPROG_RANGESEL_RANGE3 } |
Selects which current range to use.
|
|
Function Documentation
◆ IDAC_Init()
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 IDAC prior to configuration.
- Parameters
-
[in] idac
A pointer to the IDAC peripheral register block. [in] init
A pointer to the IDAC initialization structure.
◆ IDAC_Enable()
void IDAC_Enable | ( | IDAC_TypeDef * |
idac,
|
bool |
enable
|
||
) |
Enable/disable IDAC.
- Parameters
-
[in] idac
A pointer to the IDAC peripheral register block. [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.
- Parameters
-
[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.
- Parameters
-
[in] idac
A pointer to the IDAC peripheral register block. [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.
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] idac
A pointer to the IDAC peripheral register block. [in] range
The current range value.
◆ IDAC_StepSet()
void IDAC_StepSet | ( | IDAC_TypeDef * |
idac,
|
const uint32_t |
step
|
||
) |
Set the current step of the IDAC output.
- Parameters
-
[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.
◆ IDAC_OutEnable()
void IDAC_OutEnable | ( | IDAC_TypeDef * |
idac,
|
bool |
enable
|
||
) |
Enable/disable the IDAC OUT pin.
- Warning
- This function will not enable/disable the IDAC OUT pin if APORTOUTENPRS is set because output enable will be controlled by PRS.
- Parameters
-
[in] idac
A pointer to the IDAC peripheral register block. [in] enable
True to enable the IDAC OUT pin, false to disable.
Macro Definition Documentation
◆ IDAC_INIT_DEFAULT
#define IDAC_INIT_DEFAULT |
Default configuration for IDAC initialization structure.
Enumeration Type Documentation
◆ IDAC_OutMode_TypeDef
enum IDAC_OutMode_TypeDef |
◆ IDAC_PRSSEL_TypeDef
enum IDAC_PRSSEL_TypeDef |
◆ IDAC_Range_TypeDef
enum IDAC_Range_TypeDef |