[dac] add get resolution method

This commit is contained in:
Meco Man
2022-04-23 23:03:59 +08:00
committed by guo
parent 778be73cac
commit 175ca2ee09
4 changed files with 29 additions and 8 deletions
+13
View File
@@ -105,6 +105,18 @@ static rt_err_t stm32_dac_disabled(struct rt_dac_device *device, rt_uint32_t cha
return RT_EOK;
}
static rt_uint8_t stm32_dac_get_resolution(struct rt_dac_device *device)
{
DAC_HandleTypeDef *stm32_dac_handler;
RT_ASSERT(device != RT_NULL);
stm32_dac_handler = device->parent.user_data;
(void)stm32_dac_handler;
return 12; /* TODO */
}
static rt_err_t stm32_set_dac_value(struct rt_dac_device *device, rt_uint32_t channel, rt_uint32_t *value)
{
uint32_t dac_channel;
@@ -162,6 +174,7 @@ static const struct rt_dac_ops stm_dac_ops =
.disabled = stm32_dac_disabled,
.enabled = stm32_dac_enabled,
.convert = stm32_set_dac_value,
.get_resolution = stm32_dac_get_resolution,
};
static int stm32_dac_init(void)