drivers: adc: stm32h5x: Set option register for adc1/channel 0
The STM32H5x adc has a special option register that needs to be set when using channel 0 on adc1. fixes: #77618 Signed-off-by: Lars Jeppesen <lje@foss.dk>
This commit is contained in:
parent
a0411ad2e1
commit
8c3790d9b7
1 changed files with 13 additions and 0 deletions
|
@ -1308,6 +1308,11 @@ static int adc_stm32_sampling_time_setup(const struct device *dev, uint8_t id,
|
|||
static int adc_stm32_channel_setup(const struct device *dev,
|
||||
const struct adc_channel_cfg *channel_cfg)
|
||||
{
|
||||
#ifdef CONFIG_SOC_SERIES_STM32H5X
|
||||
const struct adc_stm32_cfg *config = (const struct adc_stm32_cfg *)dev->config;
|
||||
ADC_TypeDef *adc = config->base;
|
||||
#endif
|
||||
|
||||
if (channel_cfg->differential) {
|
||||
LOG_ERR("Differential channels are not supported");
|
||||
return -EINVAL;
|
||||
|
@ -1329,6 +1334,14 @@ static int adc_stm32_channel_setup(const struct device *dev,
|
|||
return -EINVAL;
|
||||
}
|
||||
|
||||
#ifdef CONFIG_SOC_SERIES_STM32H5X
|
||||
if (adc == ADC1) {
|
||||
if (channel_cfg->channel_id == 0) {
|
||||
LL_ADC_EnableChannel0_GPIO(adc);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
LOG_DBG("Channel setup succeeded!");
|
||||
|
||||
return 0;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue