Skip to content

Commit 7fb0803

Browse files
committed
bsp: analog: handle ADC_VER_V5_V90
available with some ST32H7xx Signed-off-by: Frederic Pillon <[email protected]>
1 parent 91ee6c5 commit 7fb0803

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

Diff for: libraries/SrcWrapper/src/stm32/analog.cpp

+9
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,10 @@ static PinName g_current_pin = NC;
4646
#endif
4747
#endif /* !ADC_SAMPLINGTIME */
4848

49+
#if defined(ADC_VER_V5_V90) && !defined(ADC3_SAMPLINGTIME)
50+
#define ADC3_SAMPLINGTIME ADC3_SAMPLETIME_24CYCLES_5;
51+
#endif
52+
4953
/*
5054
* Minimum ADC sampling time is required when reading
5155
* internal channels so set it to max possible value.
@@ -770,6 +774,11 @@ uint16_t adc_read_value(PinName pin, uint32_t resolution)
770774
} else {
771775
AdcHandle.Instance = (ADC_TypeDef *)pinmap_peripheral(pin, PinMap_ADC);
772776
channel = get_adc_channel(pin, &bank);
777+
#if defined(ADC_VER_V5_V90)
778+
if (AdcHandle.Instance == ADC3) {
779+
samplingTime = ADC3_SAMPLINGTIME;
780+
}
781+
#endif
773782
}
774783

775784
if (AdcHandle.Instance == NP) {

0 commit comments

Comments
 (0)