Skip to content

Commit 181362e

Browse files
committed
chore(u3): ADC support
Signed-off-by: Frederic Pillon <frederic.pillon@st.com>
1 parent c6d9fe2 commit 181362e

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

libraries/SrcWrapper/src/stm32/analog.cpp

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,8 @@ static PinName g_current_pin = NC;
3333
#ifndef ADC_SAMPLINGTIME
3434
#if defined(ADC_SAMPLETIME_8CYCLES_5)
3535
#define ADC_SAMPLINGTIME ADC_SAMPLETIME_8CYCLES_5;
36+
#elif defined(ADC_SAMPLETIME_11CYCLES_5)
37+
#define ADC_SAMPLINGTIME ADC_SAMPLETIME_11CYCLES_5;
3638
#elif defined(ADC_SAMPLETIME_12CYCLES)
3739
#define ADC_SAMPLINGTIME ADC_SAMPLETIME_12CYCLES;
3840
#elif defined(ADC_SAMPLETIME_12CYCLES_5)
@@ -84,6 +86,8 @@ static PinName g_current_pin = NC;
8486
#define ADC_SAMPLINGTIME_INTERNAL ADC_SAMPLETIME_160CYCLES_5
8587
#elif defined(ADC_SAMPLETIME_814CYCLES_5)
8688
#define ADC_SAMPLINGTIME_INTERNAL ADC_SAMPLETIME_814CYCLES_5
89+
#elif defined(ADC_SAMPLETIME_1499CYCLES_5)
90+
#define ADC_SAMPLINGTIME_INTERNAL ADC_SAMPLETIME_1499CYCLES_5
8791
#else
8892
#error "ADC sampling time could not be defined for internal channels!"
8993
#endif
@@ -894,8 +898,8 @@ uint16_t adc_read_value(PinName pin, uint32_t resolution)
894898
#if !defined(STM32F1xx) && !defined(STM32F2xx) && !defined(STM32F3xx) && \
895899
!defined(STM32F4xx) && !defined(STM32F7xx) && !defined(STM32G4xx) && \
896900
!defined(STM32H5xx) && !defined(STM32H7xx) && !defined(STM32L4xx) && \
897-
!defined(STM32L5xx) && !defined(STM32MP1xx) && !defined(STM32WBxx) || \
898-
defined(ADC_SUPPORT_2_5_MSPS)
901+
!defined(STM32L5xx) && !defined(STM32MP1xx) && !defined(STM32U3xx) && \
902+
!defined(STM32WBxx) || defined(ADC_SUPPORT_2_5_MSPS)
899903
AdcHandle.Init.LowPowerAutoPowerOff = DISABLE; /* ADC automatically powers-off after a conversion and automatically wakes-up when a new conversion is triggered */
900904
#endif
901905
#ifdef ADC_CHANNELS_BANK_B
@@ -918,7 +922,7 @@ uint16_t adc_read_value(PinName pin, uint32_t resolution)
918922
AdcHandle.Init.ExternalTrigConvEdge = ADC_EXTERNALTRIGCONVEDGE_NONE; /* Parameter discarded because software trigger chosen */
919923
#endif
920924
#if !defined(STM32F1xx) && !defined(STM32H7xx) && !defined(STM32MP1xx) && \
921-
!defined(ADC1_V2_5)
925+
!defined(STM32U3xx) && !defined(ADC1_V2_5)
922926
AdcHandle.Init.DMAContinuousRequests = DISABLE; /* DMA one-shot mode selected (not applied to this example) */
923927
#endif
924928
#ifdef ADC_CONVERSIONDATA_DR
@@ -974,7 +978,7 @@ uint16_t adc_read_value(PinName pin, uint32_t resolution)
974978
AdcChannelConf.Channel = channel; /* Specifies the channel to configure into ADC */
975979

976980
#if defined(STM32G4xx) || defined(STM32H5xx) || defined(STM32L4xx) || \
977-
defined(STM32L5xx) || defined(STM32WBxx)
981+
defined(STM32L5xx) || defined(STM32U3xx) || defined(STM32WBxx)
978982
if (!IS_ADC_CHANNEL(&AdcHandle, AdcChannelConf.Channel)) {
979983
#else
980984
if (!IS_ADC_CHANNEL(AdcChannelConf.Channel)) {

0 commit comments

Comments
 (0)