AM263x MCU+ SDK  10.00.00

Introduction

This module contains APIs to program and use the DAC module.

Functions

static uint16_t DAC_getRevision (uint32_t base)
 
static void DAC_setReferenceVoltage (uint32_t base, DAC_ReferenceVoltage source)
 
static void DAC_setLoadMode (uint32_t base, DAC_LoadMode mode)
 
static void DAC_setPWMSyncSignal (uint32_t base, uint16_t signal)
 
static uint16_t DAC_getActiveValue (uint32_t base)
 
static void DAC_setShadowValue (uint32_t base, uint16_t value)
 
static uint16_t DAC_getShadowValue (uint32_t base)
 
static void DAC_enableOutput (uint32_t base)
 
static void DAC_disableOutput (uint32_t base)
 
static void DAC_setOffsetTrim (uint32_t base, int16_t offset)
 
static int16_t DAC_getOffsetTrim (uint32_t base)
 
static void DAC_lockRegister (uint32_t base, uint16_t reg)
 
static bool DAC_isRegisterLocked (uint32_t base, uint16_t reg)
 
void DAC_tuneOffsetTrim (uint32_t base, Float32 referenceVoltage)
 

Enumerations

enum  DAC_ReferenceVoltage { DAC_REF_VREF = 0, DAC_REF_VDDA = 1 }
 
enum  DAC_LoadMode { DAC_LOAD_SYSCLK = 0, DAC_LOAD_PWMSYNC = 4 }
 Values that can be passed to DAC_setLoadMode() as the mode parameter. More...
 

Macros

#define DAC_LOCK_CONTROL   (0x1U)
 Header Files. More...
 
#define DAC_LOCK_SHADOW   (0x2U)
 Lock the shadow value register. More...
 
#define DAC_LOCK_OUTPUT   (0x4U)
 Lock the output enable register. More...
 
#define DAC_REG_BYTE_MASK   (0xFFU)
 Register Byte Mask. More...
 
#define DAC_LOCK_KEY   (0xA000U)
 DAC Lock Key. More...
 

Macro Definition Documentation

◆ 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)

Register Byte Mask.

◆ DAC_LOCK_KEY

#define DAC_LOCK_KEY   (0xA000U)

DAC Lock Key.

Enumeration Type Documentation

◆ 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.

Function Documentation

◆ DAC_getRevision()

static uint16_t DAC_getRevision ( uint32_t  base)
inlinestatic

Get the DAC Revision value

Parameters
baseis the DAC module base address

This function gets the DAC revision value.

Returns
Returns the DAC revision value.

◆ DAC_setReferenceVoltage()

static void DAC_setReferenceVoltage ( uint32_t  base,
DAC_ReferenceVoltage  source 
)
inlinestatic

Sets the DAC Reference Voltage

Parameters
baseis the DAC module base address
sourceis 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
baseis the DAC module base address
modeis 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
baseis the DAC module base address
signalis 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
baseis 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
baseis the DAC module base address
valueis 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
baseis 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
baseis 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
baseis 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
baseis the DAC module base address
offsetis 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
baseis 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
baseis the DAC module base address
regis 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
baseis the DAC module base address
regis 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
baseis the DAC module base address
referenceVoltageis 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.