Skip to content
Closed
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
bsp: analog: handle ADC_VER_V5_V90
available with some ST32H7xx

Signed-off-by: Frederic Pillon <[email protected]>
  • Loading branch information
fpistm committed Sep 14, 2021
commit 7fb080309bfbb83aa36ad886217c8caaaf5d2e9b
9 changes: 9 additions & 0 deletions libraries/SrcWrapper/src/stm32/analog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,10 @@ static PinName g_current_pin = NC;
#endif
#endif /* !ADC_SAMPLINGTIME */

#if defined(ADC_VER_V5_V90) && !defined(ADC3_SAMPLINGTIME)
#define ADC3_SAMPLINGTIME ADC3_SAMPLETIME_24CYCLES_5;
#endif

/*
* Minimum ADC sampling time is required when reading
* internal channels so set it to max possible value.
Expand Down Expand Up @@ -770,6 +774,11 @@ uint16_t adc_read_value(PinName pin, uint32_t resolution)
} else {
AdcHandle.Instance = (ADC_TypeDef *)pinmap_peripheral(pin, PinMap_ADC);
channel = get_adc_channel(pin, &bank);
#if defined(ADC_VER_V5_V90)
if (AdcHandle.Instance == ADC3) {
samplingTime = ADC3_SAMPLINGTIME;
}
#endif
}

if (AdcHandle.Instance == NP) {
Expand Down