The friendly Operating System for the Internet of Things

DAC peripheral driver interface. More...

Detailed Description

Similar to the ADC driver interface (ADC), the DAC interface uses the concept of lines, corresponds to a tuple of a DAC device and a DAC output channel.

The DAC interface expects data to be served as a 16-bit unsigned integer, independent of the actual resolution of the hardware device. It is up to the DAC driver, to scale the given value to the maximal width that can be handled. The device driver should, on the other hand, implement the DAC in a way, that it will use the bit width, that comes closest to 16-bit.

This kind of 'auto-scaling' is quite sufficient for this interface, as standard DAC peripherals use a fixed conversion resolution internally anyway, so that any particular bit-width configuration on this driver level would not have much effect...


file  dac.h
 DAC peripheral driver interface definition.


int8_t dac_init (dac_t line)
 Initialize the given DAC line. More...
void dac_set (dac_t line, uint16_t value)
 Write a value onto DAC Device on a given Channel. More...
void dac_poweron (dac_t line)
 Enable the given DAC line. More...
void dac_poweroff (dac_t line)
 Disable the given DAC line. More...
typedef unsigned int dac_t
 Define default DAC type identifier.
#define DAC_UNDEF   (UINT_MAX)
 Default DAC undefined value.
#define DAC_LINE(x)   (x)
 Default DAC access macro.

Function Documentation

int8_t dac_init ( dac_t  line)
[in]lineDAC line to initialize
0 on success
-1 on invalid DAC line
void dac_poweroff ( dac_t  line)
[in]lineDAC line to power off
void dac_poweron ( dac_t  line)
[in]lineDAC line to power on
void dac_set ( dac_t  line,
uint16_t  value 
[in]lineDAC line to set
[in]valuevalue to set line to