Skip to content

Commit 7fd4203

Browse files
committed
STM32L4 ADC internal channels update
1 parent 881a8e3 commit 7fd4203

File tree

1 file changed

+1
-4
lines changed

1 file changed

+1
-4
lines changed

targets/TARGET_STM/TARGET_STM32L4/analogin_device.c

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -35,11 +35,9 @@
3535
#include "pinmap.h"
3636
#include "mbed_error.h"
3737
#include "PeripheralPins.h"
38-
#include <stdbool.h>
3938

4039
void analogin_init(analogin_t *obj, PinName pin)
4140
{
42-
static bool adc_calibrated = false;
4341
uint32_t function = (uint32_t)NC;
4442

4543
// ADC Internal Channels "pins" (Temperature, Vref, Vbat, ...)
@@ -94,8 +92,7 @@ void analogin_init(analogin_t *obj, PinName pin)
9492
}
9593

9694
// ADC calibration is done only once
97-
if (!adc_calibrated) {
98-
adc_calibrated = true;
95+
if (!HAL_ADCEx_Calibration_GetValue(&obj->handle, ADC_SINGLE_ENDED)) {
9996
HAL_ADCEx_Calibration_Start(&obj->handle, ADC_SINGLE_ENDED);
10097
}
10198
}

0 commit comments

Comments
 (0)