mimxrt/boards/make-pins.py: Allow empty lines and comments in pins.csv.

This commit is contained in:
robert-hh 2021-09-16 08:40:01 +02:00 committed by Damien George
parent 6754213a9d
commit 90b45efa6a

View File

@ -180,6 +180,12 @@ class Pins(object):
with open(filename, "r") as csvfile: with open(filename, "r") as csvfile:
rows = csv.reader(csvfile) rows = csv.reader(csvfile)
for row in rows: for row in rows:
if len(row) == 0 or row[0].startswith("#"):
# Skip empty lines, and lines starting with "#"
continue
if len(row) != 2:
raise ValueError("Expecting two entries in a row")
pin = self.find_pin_by_name(row[1]) pin = self.find_pin_by_name(row[1])
if pin and row[0]: # Only add board pins that have a name if pin and row[0]: # Only add board pins that have a name
self.board_pins.append(NamedPin(row[0], pin.pad, pin.idx)) self.board_pins.append(NamedPin(row[0], pin.pad, pin.idx))