8000 stm32/boards/make-pins.py: Allow empty lines and comments in pins.csv. · theidealist/micropython@c51cc46 · GitHub
[go: up one dir, main page]

Skip to content

Commit c51cc46

Browse files
committed
stm32/boards/make-pins.py: Allow empty lines and comments in pins.csv.
Signed-off-by: Damien George <damien@micropython.org>
1 parent a6907c7 commit c51cc46

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

ports/stm32/boards/make-pins.py

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,8 @@
44
Generates pin source files based on an MCU alternate-function definition (eg
55
stm32f405_af.csv) and a board-specific pin definition file, pins.csv.
66
7-
The pins.csv file must contain lines of the form:
7+
The pins.csv file can contain empty lines, comments (a line beginning with "#")
8+
or pin definition lines. Pin definition lines must be of the form:
89
910
board,cpu
1011
@@ -362,6 +363,12 @@ def parse_board_file(self, filename):
362363
with open(filename, "r") as csvfile:
363364
rows = csv.reader(csvfile)
364365
for row in rows:
366+
if len(row) == 0 or row[0].startswith("#"):
367+
# Skip empty lines, and lines starting with "#"
368+
continue
369+
if len(row) != 2:
370+
raise ValueError("Expecting two entries in a row")
371+
365372
cpu_pin_name = row[1]
366373
cpu_pin_hidden = False
367374
if cpu_pin_name.startswith("-"):

0 commit comments

Comments
 (0)
0