diff --git a/components/drivers/include/drivers/dac.h b/components/drivers/include/drivers/dac.h index 36ab2b4ced..dcda0ef68f 100644 --- a/components/drivers/include/drivers/dac.h +++ b/components/drivers/include/drivers/dac.h @@ -35,7 +35,7 @@ typedef enum rt_err_t rt_hw_dac_register(rt_dac_device_t dac,const char *name, const struct rt_dac_ops *ops, const void *user_data); -rt_uint32_t rt_dac_write(rt_dac_device_t dev, rt_uint32_t channel, rt_uint32_t value); +rt_err_t rt_dac_write(rt_dac_device_t dev, rt_uint32_t channel, rt_uint32_t value); rt_err_t rt_dac_enable(rt_dac_device_t dev, rt_uint32_t channel); rt_err_t rt_dac_disable(rt_dac_device_t dev, rt_uint32_t channel); diff --git a/components/drivers/misc/dac.c b/components/drivers/misc/dac.c index a17c54d841..548a7bde99 100644 --- a/components/drivers/misc/dac.c +++ b/components/drivers/misc/dac.c @@ -98,13 +98,11 @@ rt_err_t rt_hw_dac_register(rt_dac_device_t device, const char *name, const stru return result; } -rt_uint32_t rt_dac_write(rt_dac_device_t dev, rt_uint32_t channel, rt_uint32_t value) +rt_err_t rt_dac_write(rt_dac_device_t dev, rt_uint32_t channel, rt_uint32_t value) { RT_ASSERT(dev); - dev->ops->convert(dev, channel, &value); - - return RT_EOK; + return dev->ops->convert(dev, channel, &value); } rt_err_t rt_dac_enable(rt_dac_device_t dev, rt_uint32_t channel)