Skip to content

Commit e0e332f

Browse files
committed
STM32L4 AnalogIn init issue with _ALT pins
1 parent 692d905 commit e0e332f

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

targets/TARGET_STM/TARGET_STM32L4/analogin_api.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,8 +47,8 @@ void analogin_init(analogin_t *obj, PinName pin)
4747

4848
// ADC Internal Channels "pins" (Temperature, Vref, Vbat, ...)
4949
// are described in PinNames.h and PeripheralPins.c
50-
// Pin value must be >= 0xF0
51-
if (pin < 0xF0) {
50+
// Pin value must be between 0xF0 and 0xFF
51+
if ((pin < 0xF0) || (pin >= 0x100)) {
5252
// Normal channels
5353
// Get the peripheral name from the pin and assign it to the object
5454
obj->adc = (ADCName)pinmap_peripheral(pin, PinMap_ADC);

0 commit comments

Comments
 (0)