Digital-to-Analog Converter (DAC)¶
Overview¶
The DAC API provides access to Digital-to-Analog Converter (DAC) devices.
Configuration Options¶
Related configuration options:
API Reference¶
- group dac_interface
DAC driver APIs.
Functions
-
int dac_channel_setup(const struct device *dev, const struct dac_channel_cfg *channel_cfg)¶
Configure a DAC channel.
It is required to call this function and configure each channel before it is selected for a write request.
- Parameters:
dev – Pointer to the device structure for the driver instance.
channel_cfg – Channel configuration.
- Return values:
0 – On success.
-EINVAL – If a parameter with an invalid value has been provided.
-ENOTSUP – If the requested resolution is not supported.
-
int dac_write_value(const struct device *dev, uint8_t channel, uint32_t value)¶
Write a single value to a DAC channel.
- Parameters:
dev – Pointer to the device structure for the driver instance.
channel – Number of the channel to be used.
value – Data to be written to DAC output registers.
- Return values:
0 – On success.
-EINVAL – If a parameter with an invalid value has been provided.
-
struct dac_channel_cfg¶
- #include <dac.h>
Structure for specifying the configuration of a DAC channel.
- Param channel_id:
Channel identifier of the DAC that should be configured.
- Param resolution:
Desired resolution of the DAC (depends on device capabilities).
- Param buffered:
Enable output buffer for this channel. This is relevant for instance if the output is directly connected to the load, without an amplifier in between. The actual details on this are hardware dependent.
-
int dac_channel_setup(const struct device *dev, const struct dac_channel_cfg *channel_cfg)¶