Skip to content

Commit f735a44

Browse files
committed
[genpinmap] Add support for STM32MP1
STM32MP1 has additional pin definitions such as ANA1 for ADC Signed-off-by: Frederic Pillon <frederic.pillon@st.com>
1 parent b1dcb39 commit f735a44

File tree

1 file changed

+9
-6
lines changed

1 file changed

+9
-6
lines changed

src/genpinmap/genpinmap_arduino.py

+9-6
Original file line numberDiff line numberDiff line change
@@ -850,16 +850,19 @@ def clean_all_lists():
850850

851851
def parse_pins():
852852
print(" * Getting pins per Ips...")
853-
pinregex = r"^(P[A-Z][0-9][0-5]?)"
853+
pinregex = r"^(P[A-Z][0-9][0-5]?)|^(ANA[0-9])"
854854
itemlist = xml_mcu.getElementsByTagName("Pin")
855855
for s in itemlist:
856856
m = re.match(pinregex, s.attributes["Name"].value)
857857
if m:
858-
pin = (
859-
m.group(0)[:2] + "_" + m.group(0)[2:]
860-
) # pin formatted P<port>_<number>: PF_O
858+
if m.group(1) is not None:
859+
# pin formatted P<port>_<number>: PF_O
860+
pin = m.group(0)[:2] + "_" + m.group(0)[2:]
861+
else:
862+
# pin formatted ANA_<number>: ANA_1
863+
pin = m.group(0)[:3] + "_" + m.group(0)[3:]
861864
name = s.attributes["Name"].value.strip() # full name: "PF0 / OSC_IN"
862-
if s.attributes["Type"].value == "I/O":
865+
if s.attributes["Type"].value in ["I/O", "MonoIO"]:
863866
store_pin(pin, name)
864867
else:
865868
continue
@@ -986,7 +989,7 @@ def parse_pins():
986989
quit()
987990
mcu_list.append(args.mcu)
988991
else:
989-
mcu_list = fnmatch.filter(os.listdir(cubemxdir), "STM32[!M][!P]*.xml")
992+
mcu_list = fnmatch.filter(os.listdir(cubemxdir), "STM32*.xml")
990993

991994
if args.list:
992995
print("Available xml files description: %i" % len(mcu_list))

0 commit comments

Comments
 (0)