Skip to content

Commit dea5b13

Browse files
committed
[genpinmap] Skip Negative input analog channels (INN)
Differential is currently not managed Signed-off-by: Frederic Pillon <frederic.pillon@st.com>
1 parent 38df634 commit dea5b13

File tree

1 file changed

+12
-4
lines changed

1 file changed

+12
-4
lines changed

src/genpinmap/genpinmap_arduino.py

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -212,7 +212,9 @@ def store_pin(pin, name, dest_list):
212212

213213
# Store ADC list
214214
def store_adc(pin, name, signal):
215-
if "IN" in signal:
215+
# Skip Negative input analog channels (INN)
216+
# Differential is currently not managed
217+
if "IN" in signal and "INN" not in signal:
216218
adclist.append([pin, name, signal])
217219

218220

@@ -330,9 +332,15 @@ def adc_pinmap():
330332
inst += "1" # single ADC for this product
331333
winst.append(len(inst))
332334
wpin.append(len(p[0]))
335+
if "INN" in a[1]:
336+
# Negative input analog channels
337+
inv = "1"
338+
else:
339+
# Positive input analog channels
340+
inv = "0"
333341
# chan
334-
chan = re.sub("^IN[N|P]?|\D*$", "", a[1])
335-
if a[1].endswith('b'):
342+
chan = re.sub(r"^IN[N|P]?|\D*$", "", a[1])
343+
if a[1].endswith("b"):
336344
mode = "STM_MODE_ANALOG_ADC_CHANNEL_BANK_B"
337345
else:
338346
mode = default_mode
@@ -344,7 +352,7 @@ def adc_pinmap():
344352
"pull": "GPIO_NOPULL",
345353
"af": "0",
346354
"chan": chan,
347-
"inv": "0",
355+
"inv": inv,
348356
"cmt": p[2],
349357
}
350358
)

0 commit comments

Comments
 (0)