This module contains APIs to program and use the DAC module.
◆ DAC_LOCK_CONTROL
#define DAC_LOCK_CONTROL (0x1U) |
Header Files.
Lock the control register
◆ DAC_LOCK_SHADOW
#define DAC_LOCK_SHADOW (0x2U) |
Lock the shadow value register.
◆ DAC_LOCK_OUTPUT
#define DAC_LOCK_OUTPUT (0x4U) |
Lock the output enable register.
◆ DAC_REG_BYTE_MASK
#define DAC_REG_BYTE_MASK (0xFFU) |
◆ DAC_LOCK_KEY
#define DAC_LOCK_KEY (0xA000U) |
◆ DAC_ReferenceVoltage
Values that can be passed to DAC_setReferenceVoltage() as the source parameter.
Enumerator |
---|
DAC_REF_VREF | VREF reference voltage (external)
|
DAC_REF_VDDA | VDDA reference voltage (internal)
|
◆ DAC_LoadMode
Values that can be passed to DAC_setLoadMode() as the mode parameter.
Enumerator |
---|
DAC_LOAD_SYSCLK | Load on next SYSCLK.
|
DAC_LOAD_PWMSYNC | Load on next PWMSYNC specified by SYNCSEL.
|
◆ DAC_getRevision()
static uint16_t DAC_getRevision |
( |
uint32_t |
base | ) |
|
|
inlinestatic |
Get the DAC Revision value
- Parameters
-
base | is the DAC module base address |
This function gets the DAC revision value.
- Returns
- Returns the DAC revision value.
◆ DAC_setReferenceVoltage()
Sets the DAC Reference Voltage
- Parameters
-
base | is the DAC module base address |
source | is the selected reference voltage |
This function sets the DAC reference voltage.
The source parameter can have one of two values:
- DAC_REF_VREF - The VREF reference voltage (external)
- DAC_REF_VDDA - The VDDA reference voltage (internal)
- Returns
- None.
◆ DAC_setLoadMode()
static void DAC_setLoadMode |
( |
uint32_t |
base, |
|
|
DAC_LoadMode |
mode |
|
) |
| |
|
inlinestatic |
Sets the DAC Load Mode
- Parameters
-
base | is the DAC module base address |
mode | is the selected load mode |
This function sets the DAC load mode.
The mode parameter can have one of two values:
- DAC_LOAD_SYSCLK - Load on next SYSCLK
- DAC_LOAD_PWMSYNC - Load on next PWMSYNC specified by SYNCSEL
- Returns
- None.
◆ DAC_setPWMSyncSignal()
static void DAC_setPWMSyncSignal |
( |
uint32_t |
base, |
|
|
uint16_t |
signal |
|
) |
| |
|
inlinestatic |
Sets the DAC PWMSYNC Signal
- Parameters
-
base | is the DAC module base address |
signal | is the selected PWM signal |
This function sets the DAC PWMSYNC signal.
The signal parameter must be set to a number that represents the PWM signal that will be set. For instance, passing 2 into signal will select PWM sync signal 2.
- Returns
- None.
◆ DAC_getActiveValue()
static uint16_t DAC_getActiveValue |
( |
uint32_t |
base | ) |
|
|
inlinestatic |
Get the DAC Active Output Value
- Parameters
-
base | is the DAC module base address |
This function gets the DAC active output value.
- Returns
- Returns the DAC active output value.
◆ DAC_setShadowValue()
static void DAC_setShadowValue |
( |
uint32_t |
base, |
|
|
uint16_t |
value |
|
) |
| |
|
inlinestatic |
Set the DAC Shadow Output Value
- Parameters
-
base | is the DAC module base address |
value | is the 12-bit code to be loaded into the active value register |
This function sets the DAC shadow output value.
- Returns
- None.
◆ DAC_getShadowValue()
static uint16_t DAC_getShadowValue |
( |
uint32_t |
base | ) |
|
|
inlinestatic |
Get the DAC Shadow Output Value
- Parameters
-
base | is the DAC module base address |
This function gets the DAC shadow output value.
- Returns
- Returns the DAC shadow output value.
◆ DAC_enableOutput()
static void DAC_enableOutput |
( |
uint32_t |
base | ) |
|
|
inlinestatic |
Enable the DAC Output
- Parameters
-
base | is the DAC module base address |
This function enables the DAC output.
- Note
- A delay is required after enabling the DAC. Further details regarding the exact delay time length can be found in the device datasheet.
- Returns
- None.
◆ DAC_disableOutput()
static void DAC_disableOutput |
( |
uint32_t |
base | ) |
|
|
inlinestatic |
Disable the DAC Output
- Parameters
-
base | is the DAC module base address |
This function disables the DAC output.
- Returns
- None.
◆ DAC_setOffsetTrim()
static void DAC_setOffsetTrim |
( |
uint32_t |
base, |
|
|
int16_t |
offset |
|
) |
| |
|
inlinestatic |
Set DAC Offset Trim
- Parameters
-
base | is the DAC module base address |
offset | is the specified value for the offset trim |
This function sets the DAC offset trim. The offset value should be a signed number in the range of -128 to 127.
- Note
- The offset should not be modified unless specifically indicated by TI Errata or other documentation. Modifying the offset value could cause this module to operate outside of the datasheet specifications.
- Returns
- None.
◆ DAC_getOffsetTrim()
static int16_t DAC_getOffsetTrim |
( |
uint32_t |
base | ) |
|
|
inlinestatic |
Get DAC Offset Trim
- Parameters
-
base | is the DAC module base address |
This function gets the DAC offset trim value.
- Returns
- None.
◆ DAC_lockRegister()
static void DAC_lockRegister |
( |
uint32_t |
base, |
|
|
uint16_t |
reg |
|
) |
| |
|
inlinestatic |
Lock write-access to DAC Register
- Parameters
-
base | is the DAC module base address |
reg | is the selected DAC registers |
This function locks the write-access to the specified DAC register. Only a system reset can unlock the register once locked.
The reg parameter can be an ORed combination of any of the following values:
- DAC_LOCK_CONTROL - Lock the DAC control register
- DAC_LOCK_SHADOW - Lock the DAC shadow value register
- DAC_LOCK_OUTPUT - Lock the DAC output enable/disable register
- Returns
- None.
◆ DAC_isRegisterLocked()
static bool DAC_isRegisterLocked |
( |
uint32_t |
base, |
|
|
uint16_t |
reg |
|
) |
| |
|
inlinestatic |
Check if DAC Register is locked
- Parameters
-
base | is the DAC module base address |
reg | is the selected DAC register locks to check |
This function checks if write-access has been locked on the specified DAC register.
The reg parameter can be an ORed combination of any of the following values:
- DAC_LOCK_CONTROL - Lock the DAC control register
- DAC_LOCK_SHADOW - Lock the DAC shadow value register
- DAC_LOCK_OUTPUT - Lock the DAC output enable/disable register
- Returns
- Returns true if any of the registers specified are locked, and false if all specified registers aren't locked.
◆ DAC_tuneOffsetTrim()
void DAC_tuneOffsetTrim |
( |
uint32_t |
base, |
|
|
Float32 |
referenceVoltage |
|
) |
| |
Tune DAC Offset Trim
- Parameters
-
base | is the DAC module base address |
referenceVoltage | is the reference voltage the DAC module is operating at. |
This function adjusts/tunes the DAC offset trim. The referenceVoltage value should be a floating point number in the range specified in the device data manual.
- Note
- Use this function to adjust the DAC offset trim if operating at a reference voltage other than 2.5v. Since this function modifies the DAC offset trim register, it should only be called once after Device_cal. If it is called multiple times after Device_cal, the offset value scaled would be the wrong value.
- Returns
- None.