Skip to content

Commit 65c78df

Browse files
authored
Merge pull request #15 from fprwi6labs/add_qspi_pins
Add qspi pins
2 parents cc20fc2 + d6ea7e2 commit 65c78df

File tree

3 files changed

+40
-1
lines changed

3 files changed

+40
-1
lines changed

src/genpinmap/genpinmap_arduino.bat

+1
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ python genpinmap_arduino.py DISCO_F407G "STM32F407V(E-G)Tx.xml"
1515
python genpinmap_arduino.py DISCO_F746NG "STM32F746N(E-G)Hx.xml"
1616
python genpinmap_arduino.py NUCLEO_L053R8 "STM32L053R(6-8)Tx.xml"
1717
python genpinmap_arduino.py NUCLEO_L432KC "STM32L432K(B-C)Ux.xml"
18+
python genpinmap_arduino.py DISCO_L475VG "STM32L475V(C-E-G)Tx.xml"
1819
python genpinmap_arduino.py NUCLEO_L476RG "STM32L475R(C-E-G)Tx.xml"
1920

2021
pause

src/genpinmap/genpinmap_arduino.py

+38-1
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
cantd_list = [] #'PIN','name','CANTD'
2121
canrd_list = [] #'PIN','name','CANRD'
2222
eth_list = [] #'PIN','name','ETH'
23+
qspi_list = [] #'PIN','name','QUADSPI'
2324

2425

2526
def find_gpio_file(xmldoc):
@@ -131,6 +132,10 @@ def store_can(pin, name, signal):
131132
def store_eth (pin, name, signal):
132133
eth_list.append([pin,name,signal])
133134

135+
#function to store QSPI pins
136+
def store_qspi (pin, name, signal):
137+
qspi_list.append([pin,name,signal])
138+
134139
def print_header():
135140
s = ("""/*
136141
*******************************************************************************
@@ -205,6 +210,8 @@ def print_all_lists():
205210
print_can(xml, cantd_list)
206211
if print_list_header("ETHERNET", "Ethernet", eth_list, "ETH"):
207212
print_eth(xml, eth_list)
213+
if print_list_header("QUADSPI", "QUADSPI", qspi_list, "QSPI"):
214+
print_qspi(xml, qspi_list)
208215

209216
def print_list_header(comment, name, l, switch):
210217
if len(l)>0:
@@ -412,6 +419,33 @@ def print_eth(xml, l):
412419
#endif
413420
""")
414421

422+
def print_qspi(xml, l):
423+
i=0
424+
if len(l)>0:
425+
prev_s = ''
426+
while i < len(l):
427+
p=l[i]
428+
result = get_gpio_af_num(xml, p[1], p[2])
429+
if result != 'NOTFOUND':
430+
s1 = "%-12s" % (" {" + p[0] + ',')
431+
#2nd element is the QUADSPI_XXXX signal
432+
s1 += 'QUADSPI, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, ' + result +')},'
433+
#check duplicated lines, only signal differs
434+
if (prev_s == s1):
435+
s1 = '|' + p[2]
436+
else:
437+
if len(prev_s)>0:
438+
out_file.write('\n')
439+
prev_s = s1
440+
s1 += ' // ' + p[2]
441+
out_file.write(s1)
442+
i += 1
443+
444+
out_file.write( """\n {NC, NP, 0}
445+
};
446+
#endif
447+
""")
448+
415449
tokenize = re.compile(r'(\d+)|(\D+)').findall
416450
def natural_sortkey(list_2_elem):
417451

@@ -434,6 +468,7 @@ def sort_my_lists():
434468
cantd_list.sort(key=natural_sortkey)
435469
canrd_list.sort(key=natural_sortkey)
436470
eth_list.sort(key=natural_sortkey)
471+
qspi_list.sort(key=natural_sortkey)
437472

438473
return
439474

@@ -554,7 +589,9 @@ def sort_my_lists():
554589
if "CAN" in sig:
555590
store_can( pin, name, sig)
556591
if "ETH" in sig:
557-
store_eth( pin, name, sig)
592+
store_eth( pin, name, sig)
593+
if "QUADSPI" in sig:
594+
store_qspi( pin, name, sig)
558595

559596
print (" * * * Sorting lists...")
560597
sort_my_lists()

src/genpinmap/genpinmap_arduino.sh

+1
Original file line numberDiff line numberDiff line change
@@ -35,4 +35,5 @@ python genpinmap_arduino.py DISCO_F407G "STM32F407V(E-G)Tx.xml"
3535
python genpinmap_arduino.py DISCO_F746NG "STM32F746N(E-G)Hx.xml"
3636
python genpinmap_arduino.py NUCLEO_L053R8 "STM32L053R(6-8)Tx.xml"
3737
python genpinmap_arduino.py NUCLEO_L432KC "STM32L432K(B-C)Ux.xml"
38+
python genpinmap_arduino.py DISCO_L475VG "STM32L475V(C-E-G)Tx.xml"
3839
python genpinmap_arduino.py NUCLEO_L476RG "STM32L475R(C-E-G)Tx.xml"

0 commit comments

Comments
 (0)