From dbee9a2066912f6c212cd8e7efec6cbf7935a9c6 Mon Sep 17 00:00:00 2001 From: jeromecoutant Date: Wed, 9 Aug 2017 10:21:51 +0200 Subject: [PATCH] STM32L0 : internal ADC channels --- targets/TARGET_STM/TARGET_STM32L0/analogin_api.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/targets/TARGET_STM/TARGET_STM32L0/analogin_api.c b/targets/TARGET_STM/TARGET_STM32L0/analogin_api.c index c53447efa3..e6d68e29cf 100644 --- a/targets/TARGET_STM/TARGET_STM32L0/analogin_api.c +++ b/targets/TARGET_STM/TARGET_STM32L0/analogin_api.c @@ -45,8 +45,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->handle.Instance = (ADC_TypeDef *)pinmap_peripheral(pin, PinMap_ADC);