Skip to content

Commit

Permalink
bsp: analog: handle ADC_VER_V5_V90
Browse files Browse the repository at this point in the history
available with some ST32H7xx

Signed-off-by: Frederic Pillon <[email protected]>
  • Loading branch information
fpistm committed Sep 14, 2021
1 parent 91ee6c5 commit 7fb0803
Showing 1 changed file with 9 additions and 0 deletions.
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

0 comments on commit 7fb0803

Please sign in to comment.