drivers: adc: Refactor code to remove warning
Refactor code so that an unused variable 'adc' warning is not generated when building for CONFIG_SOC_SERIES_STM32G4X and not using adc1 or adc5. Signed-off-by: Sam Hurst <sbh1187@gmail.com>
This commit is contained in:
parent
0aa0913ca5
commit
3122a2c8b8
1 changed files with 2 additions and 4 deletions
|
@ -805,18 +805,16 @@ static void adc_stm32_setup_channels(const struct device *dev, uint8_t channel_i
|
||||||
{
|
{
|
||||||
const struct adc_stm32_cfg *config = dev->config;
|
const struct adc_stm32_cfg *config = dev->config;
|
||||||
#ifdef CONFIG_SOC_SERIES_STM32G4X
|
#ifdef CONFIG_SOC_SERIES_STM32G4X
|
||||||
ADC_TypeDef *adc = config->base;
|
|
||||||
|
|
||||||
if (config->has_temp_channel) {
|
if (config->has_temp_channel) {
|
||||||
#if DT_NODE_HAS_STATUS(DT_NODELABEL(adc1), okay)
|
#if DT_NODE_HAS_STATUS(DT_NODELABEL(adc1), okay)
|
||||||
if ((__LL_ADC_CHANNEL_TO_DECIMAL_NB(LL_ADC_CHANNEL_TEMPSENSOR_ADC1) == channel_id)
|
if ((__LL_ADC_CHANNEL_TO_DECIMAL_NB(LL_ADC_CHANNEL_TEMPSENSOR_ADC1) == channel_id)
|
||||||
&& (adc == ADC1)) {
|
&& (config->base == ADC1)) {
|
||||||
adc_stm32_set_common_path(dev, LL_ADC_PATH_INTERNAL_TEMPSENSOR);
|
adc_stm32_set_common_path(dev, LL_ADC_PATH_INTERNAL_TEMPSENSOR);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
#if DT_NODE_HAS_STATUS(DT_NODELABEL(adc5), okay)
|
#if DT_NODE_HAS_STATUS(DT_NODELABEL(adc5), okay)
|
||||||
if ((__LL_ADC_CHANNEL_TO_DECIMAL_NB(LL_ADC_CHANNEL_TEMPSENSOR_ADC5) == channel_id)
|
if ((__LL_ADC_CHANNEL_TO_DECIMAL_NB(LL_ADC_CHANNEL_TEMPSENSOR_ADC5) == channel_id)
|
||||||
&& (adc == ADC5)) {
|
&& (config->base == ADC5)) {
|
||||||
adc_stm32_set_common_path(dev, LL_ADC_PATH_INTERNAL_TEMPSENSOR);
|
adc_stm32_set_common_path(dev, LL_ADC_PATH_INTERNAL_TEMPSENSOR);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue