File tree Expand file tree Collapse file tree 1 file changed +8
-0
lines changed Expand file tree Collapse file tree 1 file changed +8
-0
lines changed Original file line number Diff line number Diff line change @@ -797,7 +797,11 @@ uint16_t adc_read_value(PinName pin)
797797#ifdef ADC_DATAALIGN_RIGHT
798798 AdcHandle.Init .DataAlign = ADC_DATAALIGN_RIGHT; /* Right-alignment for converted data */
799799#endif
800+ #ifdef ADC_SCAN_SEQ_FIXED
801+ AdcHandle.Init .ScanConvMode = ADC_SCAN_SEQ_FIXED; /* Sequencer disabled (ADC conversion on only 1 channel: channel set on rank 1) */
802+ #else
800803 AdcHandle.Init .ScanConvMode = DISABLE; /* Sequencer disabled (ADC conversion on only 1 channel: channel set on rank 1) */
804+ #endif
801805#ifdef ADC_EOC_SINGLE_CONV
802806 AdcHandle.Init .EOCSelection = ADC_EOC_SINGLE_CONV; /* EOC flag picked-up to indicate conversion end */
803807#endif
@@ -886,7 +890,11 @@ uint16_t adc_read_value(PinName pin)
886890#endif /* STM32L4xx || STM32WBxx */
887891 return 0 ;
888892 }
893+ #ifdef ADC_SCAN_SEQ_FIXED
894+ AdcChannelConf.Rank = ADC_RANK_CHANNEL_NUMBER; /* Enable the rank of the selected channels when not fully configurable */
895+ #else
889896 AdcChannelConf.Rank = ADC_REGULAR_RANK_1; /* Specifies the rank in the regular group sequencer */
897+ #endif
890898#if !defined(STM32L0xx)
891899#if !defined(STM32G0xx)
892900 AdcChannelConf.SamplingTime = samplingTime; /* Sampling time value to be set for the selected channel */
You can’t perform that action at this time.
0 commit comments