From 70c5407697ecdf48a8da60df90a9d1246cdae0dd Mon Sep 17 00:00:00 2001 From: jeromecoutant Date: Mon, 17 Jul 2017 13:33:50 +0200 Subject: [PATCH] STM32L4 AnalogIn init issue with _ALT pins --- targets/TARGET_STM/TARGET_STM32L4/analogin_api.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/targets/TARGET_STM/TARGET_STM32L4/analogin_api.c b/targets/TARGET_STM/TARGET_STM32L4/analogin_api.c index 081241aec3..94ccdb0f06 100644 --- a/targets/TARGET_STM/TARGET_STM32L4/analogin_api.c +++ b/targets/TARGET_STM/TARGET_STM32L4/analogin_api.c @@ -47,8 +47,8 @@ void analogin_init(analogin_t *obj, PinName pin) // ADC Internal Channels "pins" (Temperature, Vref, Vbat, ...) // are described in PinNames.h and PeripheralPins.c - // Pin value must be >= 0xF0 - if (pin < 0xF0) { + // Pin value must be between 0xF0 and 0xFF + if ((pin < 0xF0) || (pin >= 0x100)) { // Normal channels // Get the peripheral name from the pin and assign it to the object obj->adc = (ADCName)pinmap_peripheral(pin, PinMap_ADC);