Skip to content

Commit 29d0660

Browse files
FRASTMcarlescufi
authored andcommitted
drivers: adc: stm32 adc API has a valid internal reference
extend the stm32 adc api to set the ref_internal of 3.3V Signed-off-by: Francois Ramu <[email protected]>
1 parent a5ad4e8 commit 29d0660

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

drivers/adc/adc_stm32.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,9 @@ LOG_MODULE_REGISTER(adc_stm32);
4040
#endif
4141
#endif
4242

43+
/* reference voltage for the ADC */
44+
#define STM32_ADC_VREF_MV DT_INST_PROP(0, vref_mv)
45+
4346
#if !defined(CONFIG_SOC_SERIES_STM32F0X) && \
4447
!defined(CONFIG_SOC_SERIES_STM32G0X) && \
4548
!defined(CONFIG_SOC_SERIES_STM32L0X) && \
@@ -1079,6 +1082,7 @@ static const struct adc_driver_api api_stm32_driver_api = {
10791082
#ifdef CONFIG_ADC_ASYNC
10801083
.read_async = adc_stm32_read_async,
10811084
#endif
1085+
.ref_internal = STM32_ADC_VREF_MV, /* VREF is usually connected to VDD */
10821086
};
10831087

10841088
#ifdef CONFIG_ADC_STM32_SHARED_IRQS

0 commit comments

Comments
 (0)