13#ifndef ZEPHYR_INCLUDE_DRIVERS_DAC_H_
14#define ZEPHYR_INCLUDE_DRIVERS_DAC_H_
35#define DAC_CHANNEL_BROADCAST 0xFF
67typedef int (*dac_api_channel_setup)(
const struct device *dev,
74typedef int (*dac_api_write_value)(
const struct device *dev,
82__subsystem
struct dac_driver_api {
83 dac_api_channel_setup channel_setup;
84 dac_api_write_value write_value;
107static inline int z_impl_dac_channel_setup(
const struct device *dev,
110 const struct dac_driver_api *api =
111 (
const struct dac_driver_api *)dev->
api;
113 return api->channel_setup(dev, channel_cfg);
129static inline int z_impl_dac_write_value(
const struct device *dev,
132 const struct dac_driver_api *api =
133 (
const struct dac_driver_api *)dev->
api;
135 return api->write_value(dev, channel, value);
146#include <zephyr/syscalls/dac.h>
int dac_write_value(const struct device *dev, uint8_t channel, uint32_t value)
Write a single value to a DAC channel.
int dac_channel_setup(const struct device *dev, const struct dac_channel_cfg *channel_cfg)
Configure a DAC channel.
__UINT32_TYPE__ uint32_t
Definition stdint.h:90
__UINT8_TYPE__ uint8_t
Definition stdint.h:88
Structure for specifying the configuration of a DAC channel.
Definition dac.h:40
bool buffered
Enable output buffer for this channel.
Definition dac.h:49
uint8_t channel_id
Channel identifier of the DAC that should be configured.
Definition dac.h:42
uint8_t resolution
Desired resolution of the DAC (depends on device capabilities).
Definition dac.h:44
Runtime device structure (in ROM) per driver instance.
Definition device.h:510
const void * api
Address of the API structure exposed by the device instance.
Definition device.h:516