8000 [genpinmap] Manage Dual Pad pins (_C) · stm32duino/Arduino_Tools@1f17c9c · GitHub
[go: up one dir, main page]

Skip to content

Commit 1f17c9c

Browse files
committed
[genpinmap] Manage Dual Pad pins (_C)
Signed-off-by: Frederic Pillon <frederic.pillon@st.com>
1 parent e5a1a0b commit 1f17c9c

File tree

1 file changed

+23
-7
lines changed

1 file changed

+23
-7
lines changed

src/genpinmap/genpinmap_arduino.py

Lines changed: 23 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
mcu_list = [] # 'name'
1414
io_list = [] # 'PIN','name'
1515
alt_list = [] # 'PIN','name'
16+
dualpad_list = [] # 'PIN','name'
1617
remap_list = [] # 'PIN','name'
1718
adclist = [] # 'PIN','name','ADCSignal'
1819
daclist = [] # 'PIN','name','DACSignal'
@@ -392,6 +393,7 @@ def print_all_lists():
392393
if print_list_header("SD", "SD", "SD", sd_list):
393394
print_sd()
394395
# Print specific PinNames in header file
396+
print_dualpad_h()
395397
print_alt_h()
396398
print_syswkup_h()
397399
print_usb_h()
@@ -461,7 +463,7 @@ def print_adc():
461463
else:
462464
prev_p = p[0]
463465
alt_index = 0
464-
s1 = "%-15s" % (" {" + p[0] + ",")
466+
s1 = "%-16s" % (" {" + p[0] + ",")
465467
a = p[2].split("_")
466468
inst = a[0].replace("ADC", "")
467469
if len(inst) == 0:
@@ -523,7 +525,7 @@ def print_i2c(lst):
523525
else:
524526
prev_p = p[0]
525527
alt_index = 0
526-
s1 = "%-15s" % (" {" + p[0] + ",")
528+
s1 = "%-16s" % (" {" + p[0] + ",")
527529
# 2nd element is the I2C XXX signal
528530
b = p[2].split("_")[0]
529531
s1 += (
@@ -555,7 +557,7 @@ def print_pwm():
555557
else:
556558
prev_p = p[0]
557559
alt_index = 0
558-
s1 = "%-15s" % (" {" + p[0] + ",")
560+
s1 = "%-16s" % (" {" + p[0] + ",")
559561
# 2nd element is the PWM signal
560562
a = p[2].split("_")
561563
inst = a[0]
@@ -593,7 +595,7 @@ def print_uart(lst):
593595
else:
594596
prev_p = p[0]
595597
alt_index = 0
596-
s1 = "%-15s" % (" {" + p[0] + ",")
598+
s1 = "%-16s" % (" {" + p[0] + ",")
597599
# 2nd element is the UART_XX signal
598600
b = p[2].split("_")[0]
599601
s1 += "%-9s" % (b[: len(b) - 1] + b[len(b) - 1 :] + ",")
@@ -799,6 +801,15 @@ def print_usb(lst):
799801
)
800802

801803

804+
def print_dualpad_h():
805+
if len(dualpad_list) != 0:
806+
out_h_file.write("/* Dual pad pin name */\n")
807+
for p in dualpad_list:
808+
s1 = " %-12s = %-5s | %s,\n" % (p[0], p[0].split("_C")[0], "ALTC",)
809+
out_h_file.write(s1)
810+
out_h_file.write("\n")
811+
812+
802813
def print_alt_h():
803814
if len(alt_list) == 0:
804815
out_h_file.write("/* No alternate */\n")
@@ -877,6 +888,7 @@ def natural_sortkey2(list_2_elem):
877888
def sort_my_lists():
878889
io_list.sort(key=natural_sortkey)
879890
alt_list.sort(key=natural_sortkey)
891+
dualpad_list.sort(key=natural_sortkey)
880892
remap_list.sort(key=natural_sortkey)
881893
adclist.sort(key=natural_sortkey)
882894
daclist.sort(key=natural_sortkey)
@@ -911,6 +923,7 @@ def sort_my_lists():
911923
def clean_all_lists():
912924
del io_list[:]
913925
del alt_list[:]
926+
del dualpad_list[:]
914927
del remap_list[:]
915928
del adclist[:]
916929
del daclist[:]
@@ -943,7 +956,7 @@ def clean_all_lists():
943956

944957
def parse_pins():
945958
print(" * Getting pins per Ips...")
946-
pinregex = r"^(P[A-Z][0-9][0-5]?)|^(ANA[0-9])"
959+
pinregex = r"^(P[A-Z][0-9][0-5]?[_]?[C]?)|^(ANA[0-9])"
947960
itemlist = xml_mcu.getElementsByTagName("Pin")
948961
for s in itemlist:
949962
m = re.match(pinregex, s.attributes["Name"].value)
@@ -956,7 +969,9 @@ def parse_pins():
956969
pin = m.group(0)[:3] + "_" + m.group(0)[3:]
957970
name = s.attributes["Name"].value.strip() # full name: "PF0 / OSC_IN"
958971
if s.attributes["Type"].value in ["I/O", "MonoIO"]:
959-
if (
972+
if pin.endswith("_C"):
973+
store_pin(pin, name, dualpad_list)
974+
elif (
960975
"Variant" in s.attributes
961976
and "REMAP" in s.attributes["Variant"].value
962977
):
@@ -1140,7 +1155,8 @@ def parse_pins():
11401155
)
11411156
)
11421157
print(" - {} I/O pins".format(len(io_list)))
1143-
1158+
if len(dualpad_list):
1159+
print(" - {} dual pad".format(len(dualpad_list)))
11441160
if len(remap_list):
11451161
print(" - {} remap pins".format(len(remap_list)))
11461162
print(" - {} ALT I/O pins".format(len(alt_list)))

0 commit comments

Comments
 (0)
0