Skip to content

Commit 726f207

Browse files
committed
STM32L0 : internal ADC channels
1 parent 27bf7d2 commit 726f207

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

targets/TARGET_STM/TARGET_STM32L0/analogin_api.c

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

4646
// ADC Internal Channels "pins" (Temperature, Vref, Vbat, ...)
4747
// are described in PinNames.h and PeripheralPins.c
48-
// Pin value must be >= 0xF0
49-
if (pin < 0xF0) {
48+
// Pin value must be between 0xF0 and 0xFF
49+
if ((pin < 0xF0) || (pin >= 0x100)) {
5050
// Normal channels
5151
// Get the peripheral name from the pin and assign it to the object
5252
obj->handle.Instance = (ADC_TypeDef *)pinmap_peripheral(pin, PinMap_ADC);

0 commit comments

Comments
 (0)