File tree 1 file changed +11
-7
lines changed
libraries/SrcWrapper/src/stm32 1 file changed +11
-7
lines changed Original file line number Diff line number Diff line change @@ -929,17 +929,21 @@ uint16_t adc_read_value(PinName pin, uint32_t resolution)
929
929
930
930
if (!LL_ADC_IsEnabled (AdcHandle.Instance )) {
931
931
AdcHandle.State = HAL_ADC_STATE_RESET;
932
- AdcHandle.DMA_Handle = NULL ;
933
- AdcHandle.Lock = HAL_UNLOCKED;
934
- /* Some other ADC_HandleTypeDef fields exists but not required */
932
+ } else {
933
+ AdcHandle.State = HAL_ADC_STATE_READY;
934
+ }
935
+
936
+ AdcHandle.DMA_Handle = NULL ;
937
+ AdcHandle.Lock = HAL_UNLOCKED;
938
+ /* Some other ADC_HandleTypeDef fields exists but not required */
935
939
936
- g_current_pin = pin; /* Needed for HAL_ADC_MspInit*/
940
+ g_current_pin = pin; /* Needed for HAL_ADC_MspInit*/
937
941
938
- if (HAL_ADC_Init (&AdcHandle) != HAL_OK) {
939
- return 0 ;
940
- }
942
+ if (HAL_ADC_Init (&AdcHandle) != HAL_OK) {
943
+ return 0 ;
941
944
}
942
945
946
+
943
947
AdcChannelConf.Channel = channel; /* Specifies the channel to configure into ADC */
944
948
945
949
#if defined(STM32G4xx) || defined(STM32H5xx) || defined(STM32L4xx) || \
You can’t perform that action at this time.
0 commit comments