dac.h

DAC peripheral driver interface definition.

DAC_UNDEF

Default DAC undefined value.

1
(UINT_MAX)
DAC_LINE( x)

Default DAC access macro.

1
(x)
enum @144
DAC_OK = 0
DAC_NOLINE = -1
unsigned int dac_t

Define default DAC type identifier.

int8_t dac_init(dac.h::dac_t line)

Initialize the given DAC line.

After initialization, the corresponding DAC line is active and its output is set to 0.

Parameters

line:DAC line to initialize

Return values

  • DAC_OK on success
  • DAC_NOLINE on invalid DAC line
void dac_set(dac.h::dac_t line, uint16_t value)

Write a value onto DAC Device on a given Channel.

The value is always given as 16-bit value and is internally scaled to the actual resolution that the DAC unit provides (e.g. 12-bit). So to get the maximum output voltage, this function has to be called with value set to 65535 (UINT16_MAX).

Parameters

line:DAC line to set
value:value to set line to

void dac_poweron(dac.h::dac_t line)

Enable the given DAC line.

Parameters

line:DAC line to power on

void dac_poweroff(dac.h::dac_t line)

Disable the given DAC line.

Parameters

line:DAC line to power off