diff options
Diffstat (limited to 'os/hal/ports/STM32/LLD/ADCv4')
-rw-r--r-- | os/hal/ports/STM32/LLD/ADCv4/hal_adc_lld.c | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/os/hal/ports/STM32/LLD/ADCv4/hal_adc_lld.c b/os/hal/ports/STM32/LLD/ADCv4/hal_adc_lld.c index b45aef900..6762ec8e6 100644 --- a/os/hal/ports/STM32/LLD/ADCv4/hal_adc_lld.c +++ b/os/hal/ports/STM32/LLD/ADCv4/hal_adc_lld.c @@ -153,16 +153,18 @@ static void adc_lld_calibrate(ADCDriver *adcp) { osalDbgAssert(adcp->adcm->CR == ADC_CR_ADVREGEN, "invalid register state");
- adcp->adcm->CR = adcp->config->calibration & (ADC_CR_ADCALDIF |
- ADC_CR_ADCALLIN);
+ adcp->adcm->CR &= ~(ADC_CR_ADCALDIF | ADC_CR_ADCALLIN);
+ adcp->adcm->CR |= adcp->config->calibration & (ADC_CR_ADCALDIF |
+ ADC_CR_ADCALLIN);
adcp->adcm->CR |= ADC_CR_ADCAL;
while ((adcp->adcm->CR & ADC_CR_ADCAL) != 0U)
;
#if STM32_ADC_DUAL_MODE
osalDbgAssert(adcp->adcs->CR == ADC_CR_ADVREGEN, "invalid register state");
- adcp->adcs->CR = adcp->config->calibration & (ADC_CR_ADCALDIF |
- ADC_CR_ADCALLIN);
+ adcp->adcs->CR &= ~(ADC_CR_ADCALDIF | ADC_CR_ADCALLIN);
+ adcp->adcs->CR |= adcp->config->calibration & (ADC_CR_ADCALDIF |
+ ADC_CR_ADCALLIN);
adcp->adcs->CR |= ADC_CR_ADCAL;
while ((adcp->adcs->CR & ADC_CR_ADCAL) != 0U)
;
|