DAC - Digital to Analog Converter

Description

Digital to Analog Converter (DAC) Peripheral API.

This module contains functions to control the DAC peripheral of Silicon Labs 32-bit MCUs and SoCs. The DAC converts digital values to analog signals at up to 500 ksps with 12-bit accuracy. The DAC is designed for low-energy consumption and can also provide very good performance.

Data Structures

struct DAC_Init_TypeDef
DAC initialization structure, common for both channels.
struct DAC_InitChannel_TypeDef
DAC channel initialization structure.

Functions

void DAC_Enable (DAC_TypeDef *dac, unsigned int ch, bool enable)
Enable/disable the DAC channel.
void DAC_Init (DAC_TypeDef *dac, const DAC_Init_TypeDef *init)
Initialize DAC.
void DAC_InitChannel (DAC_TypeDef *dac, const DAC_InitChannel_TypeDef *init, unsigned int ch)
Initialize DAC channel.
void DAC_ChannelOutputSet (DAC_TypeDef *dac, unsigned int channel, uint32_t value)
Set the output signal of a DAC channel to a given value.
uint8_t DAC_PrescaleCalc (uint32_t dacFreq, uint32_t hfperFreq)
Calculate prescaler value used to determine the DAC clock.
void DAC_Reset (DAC_TypeDef *dac)
Reset DAC to the same state that it was in after a hardware reset.
void DAC_Channel0OutputSet (DAC_TypeDef *dac, uint32_t value)
Set the output signal of DAC channel 0 to a given value.
void DAC_Channel1OutputSet (DAC_TypeDef *dac, uint32_t value)
Set the output signal of DAC channel 1 to a given value.
void DAC_IntClear (DAC_TypeDef *dac, uint32_t flags)
Clear one or more pending DAC interrupts.
void DAC_IntDisable (DAC_TypeDef *dac, uint32_t flags)
Disable one or more DAC interrupts.
void DAC_IntEnable (DAC_TypeDef *dac, uint32_t flags)
Enable one or more DAC interrupts.
uint32_t DAC_IntGet (DAC_TypeDef *dac)
Get pending DAC interrupt flags.
uint32_t DAC_IntGetEnabled (DAC_TypeDef *dac)
Get enabled and pending DAC interrupt flags.
void DAC_IntSet (DAC_TypeDef *dac, uint32_t flags)
Set one or more pending DAC interrupts from SW.

Macros

#define DAC_INIT_DEFAULT
Default configuration for DAC initialization structure.
#define DAC_INITCHANNEL_DEFAULT
Default configuration for DAC channel initialization structure.

Enumerations

enum DAC_ConvMode_TypeDef {
dacConvModeContinuous = _DAC_CTRL_CONVMODE_CONTINUOUS,
dacConvModeSampleHold = _DAC_CTRL_CONVMODE_SAMPLEHOLD,
dacConvModeSampleOff = _DAC_CTRL_CONVMODE_SAMPLEOFF
}
Conversion mode.
enum DAC_Output_TypeDef {
dacOutputDisable = _DAC_CTRL_OUTMODE_DISABLE,
dacOutputPin = _DAC_CTRL_OUTMODE_PIN,
dacOutputADC = _DAC_CTRL_OUTMODE_ADC,
dacOutputPinADC = _DAC_CTRL_OUTMODE_PINADC
}
Output mode.