Zephyr API Documentation  3.6.99
A Scalable Open Source RTOS
Loading...
Searching...
No Matches
DAC driver APIs

DAC driver APIs. More...

Data Structures

struct  dac_channel_cfg
 Structure for specifying the configuration of a DAC channel. More...
 

Functions

int dac_channel_setup (const struct device *dev, const struct dac_channel_cfg *channel_cfg)
 Configure a DAC channel.
 
int dac_write_value (const struct device *dev, uint8_t channel, uint32_t value)
 Write a single value to a DAC channel.
 

Detailed Description

DAC driver APIs.

Since
2.3
Version
0.8.0

Function Documentation

◆ dac_channel_setup()

int dac_channel_setup ( const struct device dev,
const struct dac_channel_cfg channel_cfg 
)

#include <zephyr/drivers/dac.h>

Configure a DAC channel.

It is required to call this function and configure each channel before it is selected for a write request.

Parameters
devPointer to the device structure for the driver instance.
channel_cfgChannel configuration.
Return values
0On success.
-EINVALIf a parameter with an invalid value has been provided.
-ENOTSUPIf the requested resolution is not supported.

◆ dac_write_value()

int dac_write_value ( const struct device dev,
uint8_t  channel,
uint32_t  value 
)

#include <zephyr/drivers/dac.h>

Write a single value to a DAC channel.

Parameters
devPointer to the device structure for the driver instance.
channelNumber of the channel to be used.
valueData to be written to DAC output registers.
Return values
0On success.
-EINVALIf a parameter with an invalid value has been provided.