summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorrobert-hh <robert@hammelrath.com>2021-09-16 08:40:01 +0200
committerDamien George <damien@micropython.org>2021-10-25 23:53:51 +1100
commit90b45efa6a7efaef80db9b6bbac48690723fb8b9 (patch)
tree485f420c14c85b2dd77c5b4f41c5476d56e0278c
parent6754213a9d54f7c57005794824dd6aabd71855c8 (diff)
mimxrt/boards/make-pins.py: Allow empty lines and comments in pins.csv.
-rw-r--r--ports/mimxrt/boards/make-pins.py6
1 files changed, 6 insertions, 0 deletions
diff --git a/ports/mimxrt/boards/make-pins.py b/ports/mimxrt/boards/make-pins.py
index aba517127..e13b9c578 100644
--- a/ports/mimxrt/boards/make-pins.py
+++ b/ports/mimxrt/boards/make-pins.py
@@ -180,6 +180,12 @@ class Pins(object):
with open(filename, "r") as csvfile:
rows = csv.reader(csvfile)
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])
if pin and row[0]: # Only add board pins that have a name
self.board_pins.append(NamedPin(row[0], pin.pad, pin.idx))