Skip to content

Commit 5eaed3d

Browse files
committed
[dfg] Keep remap pins if not duplicate
1 parent c30fc28 commit 5eaed3d

File tree

2 files changed

+6
-3
lines changed

2 files changed

+6
-3
lines changed

modm_devices/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,4 +16,4 @@
1616

1717
__all__ = ['exception', 'device_file', 'device_identifier', 'device', 'parser', 'pkg']
1818

19-
__version__ = "0.2.1"
19+
__version__ = "0.2.2"

tools/generator/dfg/stm32/stm_device_tree.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -182,7 +182,7 @@ def raw_pin_sort(p):
182182
return (port, int(pin[2:]))
183183
pins = sorted(pins, key=raw_pin_sort)
184184
# Remove package remaps from GPIO data (but not from package)
185-
pins = filter(lambda p: "PINREMAP" not in p.get("Variant", ""), pins)
185+
pins.sort(key=lambda p: "PINREMAP" not in p.get("Variant", ""))
186186

187187
gpios = []
188188

@@ -321,6 +321,7 @@ def rv(param, default=[]):
321321
if did.family == "f1":
322322
grouped_f1_signals = gpioFile.compactQuery('//GPIO_Pin/PinSignal/@Name')
323323

324+
_seen_gpio = set()
324325
for pin in pins:
325326
rname = pin.get("Name")
326327
name = pin_name(rname)
@@ -347,7 +348,9 @@ def rv(param, default=[]):
347348
afs.append(naf)
348349

349350
gpio = (name[0], name[1], afs)
350-
gpios.append(gpio)
351+
if name not in _seen_gpio:
352+
gpios.append(gpio)
353+
_seen_gpio.add(name)
351354
# print(gpio[0].upper(), gpio[1], afs)
352355
# LOGGER.debug("{}{}: {} ->".format(gpio[0].upper(), gpio[1]))
353356

0 commit comments

Comments
 (0)