mirror of https://github.com/ARMmbed/mbed-os.git
STM32L4 ADC correct internal channel management
parent
53cb6e06f9
commit
ef006931f8
|
@ -2312,7 +2312,6 @@ HAL_StatusTypeDef HAL_ADC_ConfigChannel(ADC_HandleTypeDef* hadc, ADC_ChannelConf
|
||||||
/* Parameters update conditioned to ADC state: */
|
/* Parameters update conditioned to ADC state: */
|
||||||
/* Parameters that can be updated only when ADC is disabled: */
|
/* Parameters that can be updated only when ADC is disabled: */
|
||||||
/* - Single or differential mode */
|
/* - Single or differential mode */
|
||||||
/* - Internal measurement channels: Vbat/VrefInt/TempSensor */
|
|
||||||
if (ADC_IS_ENABLE(hadc) == RESET)
|
if (ADC_IS_ENABLE(hadc) == RESET)
|
||||||
{
|
{
|
||||||
/* Set mode single-ended or differential input of the selected ADC channel */
|
/* Set mode single-ended or differential input of the selected ADC channel */
|
||||||
|
@ -2325,6 +2324,8 @@ HAL_StatusTypeDef HAL_ADC_ConfigChannel(ADC_HandleTypeDef* hadc, ADC_ChannelConf
|
||||||
LL_ADC_SetChannelSamplingTime(hadc->Instance, __LL_ADC_DECIMAL_NB_TO_CHANNEL(__LL_ADC_CHANNEL_TO_DECIMAL_NB(sConfig->Channel) + 1), sConfig->SamplingTime);
|
LL_ADC_SetChannelSamplingTime(hadc->Instance, __LL_ADC_DECIMAL_NB_TO_CHANNEL(__LL_ADC_CHANNEL_TO_DECIMAL_NB(sConfig->Channel) + 1), sConfig->SamplingTime);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
/* Management of internal measurement channels: Vbat/VrefInt/TempSensor. */
|
/* Management of internal measurement channels: Vbat/VrefInt/TempSensor. */
|
||||||
/* If internal channel selected, enable dedicated internal buffers and */
|
/* If internal channel selected, enable dedicated internal buffers and */
|
||||||
/* paths. */
|
/* paths. */
|
||||||
|
@ -2344,11 +2345,6 @@ HAL_StatusTypeDef HAL_ADC_ConfigChannel(ADC_HandleTypeDef* hadc, ADC_ChannelConf
|
||||||
{
|
{
|
||||||
/* Configuration of common ADC parameters (continuation) */
|
/* Configuration of common ADC parameters (continuation) */
|
||||||
|
|
||||||
/* Software is allowed to change common parameters only when all ADCs */
|
|
||||||
/* of the common group are disabled. */
|
|
||||||
if ((ADC_IS_ENABLE(hadc) == RESET) &&
|
|
||||||
(ADC_ANY_OTHER_ENABLED(hadc) == RESET) )
|
|
||||||
{
|
|
||||||
if (sConfig->Channel == ADC_CHANNEL_TEMPSENSOR)
|
if (sConfig->Channel == ADC_CHANNEL_TEMPSENSOR)
|
||||||
{
|
{
|
||||||
if (ADC_TEMPERATURE_SENSOR_INSTANCE(hadc))
|
if (ADC_TEMPERATURE_SENSOR_INSTANCE(hadc))
|
||||||
|
@ -2381,18 +2377,6 @@ HAL_StatusTypeDef HAL_ADC_ConfigChannel(ADC_HandleTypeDef* hadc, ADC_ChannelConf
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
/* If the requested internal measurement path has already been */
|
|
||||||
/* enabled and other ADC of the common group are enabled, internal */
|
|
||||||
/* measurement paths cannot be enabled. */
|
|
||||||
else
|
|
||||||
{
|
|
||||||
/* Update ADC state machine to error */
|
|
||||||
SET_BIT(hadc->State, HAL_ADC_STATE_ERROR_CONFIG);
|
|
||||||
|
|
||||||
tmp_hal_status = HAL_ERROR;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* If a conversion is on going on regular group, no update on regular */
|
/* If a conversion is on going on regular group, no update on regular */
|
||||||
|
|
Loading…
Reference in New Issue