Lines Matching +full:dac +full:- +full:channel +full:- +full:id
4 * SPDX-License-Identifier: Apache-2.0
11 #include <zephyr/drivers/dac.h>
16 #include "driver/dac.h"
28 uint8_t channel, uint32_t value) in dac_esp32_write_value() argument
32 dac_output_voltage(channel, value); in dac_esp32_write_value()
42 if (channel_cfg->channel_id > SOC_DAC_CHAN_NUM) { in dac_esp32_channel_setup()
43 LOG_ERR("Channel %d is not valid", channel_cfg->channel_id); in dac_esp32_channel_setup()
44 return -EINVAL; in dac_esp32_channel_setup()
47 if (channel_cfg->internal) { in dac_esp32_channel_setup()
49 return -ENOTSUP; in dac_esp32_channel_setup()
52 dac_output_enable(channel_cfg->channel_id); in dac_esp32_channel_setup()
59 const struct dac_esp32_config *cfg = dev->config; in dac_esp32_init()
61 if (!cfg->clock_dev) { in dac_esp32_init()
63 return -EINVAL; in dac_esp32_init()
66 if (!device_is_ready(cfg->clock_dev)) { in dac_esp32_init()
68 return -ENODEV; in dac_esp32_init()
71 if (clock_control_on(cfg->clock_dev, (clock_control_subsys_t)cfg->clock_subsys) != 0) { in dac_esp32_init()
72 LOG_ERR("DAC clock setup failed (%d)", -EIO); in dac_esp32_init()
73 return -EIO; in dac_esp32_init()
79 static DEVICE_API(dac, dac_esp32_driver_api) = {
84 #define ESP32_DAC_INIT(id) \ argument
86 static const struct dac_esp32_config dac_esp32_config_##id = { \
87 .irq_source = DT_INST_IRQN(id), \
88 .clock_dev = DEVICE_DT_GET(DT_INST_CLOCKS_CTLR(id)), \
89 .clock_subsys = (clock_control_subsys_t) DT_INST_CLOCKS_CELL(id, offset), \
92 DEVICE_DT_INST_DEFINE(id, \
96 &dac_esp32_config_##id, \