summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTobias Badertscher <tobias.badertscher.ext@siemens.com>2018-11-16 19:37:31 +0100
committerDamien George <damien.p.george@gmail.com>2018-11-26 16:16:29 +1100
commit9acc32b40f9346f17ed75746b7f9380e4805cef4 (patch)
treec816926d9217bca05edb411f1adb3f3777333f6b
parent7c85c7c210e3ad417f59038de95b71618783d76c (diff)
stm32/adc: Add ADC auto-calibration for L4 MCUs.
This increases the precision of the ADC.
-rw-r--r--ports/stm32/adc.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/ports/stm32/adc.c b/ports/stm32/adc.c
index f16159bef..5e8a1a152 100644
--- a/ports/stm32/adc.c
+++ b/ports/stm32/adc.c
@@ -263,6 +263,9 @@ STATIC void adcx_init_periph(ADC_HandleTypeDef *adch, uint32_t resolution) {
#if defined(STM32H7)
HAL_ADCEx_Calibration_Start(adch, ADC_CALIB_OFFSET, ADC_SINGLE_ENDED);
#endif
+ #if defined(STM32L4)
+ HAL_ADCEx_Calibration_Start(adch, ADC_SINGLE_ENDED);
+ #endif
}
STATIC void adc_init_single(pyb_obj_adc_t *adc_obj) {