Closed
Description
The SPI example has this code:
out pins, 1 side 0 [1] ; Stall here on empty (sideset proceeds even if
in pins, 1 side 1 [1] ; instruction stalls, so we stall with SCK low)
It fails to parse, because it searches for "pins,"
in IN_SOURCES and OUT_DESTINATIONS (note the trailing ,
).
I put a hacky fix in and it did assemble, though there are remaining limitations in the core before it can be used:
diff --git a/adafruit_pioasm.py b/adafruit_pioasm.py
index 96891f9..c847298 100644
--- a/adafruit_pioasm.py
+++ b/adafruit_pioasm.py
@@ -106,7 +106,8 @@ def assemble(text_program):
elif instruction[0] == "in":
# instr delay src count
assembled.append(0b010_00000_000_00000)
- assembled[-1] |= IN_SOURCES.index(instruction[1]) << 5
+ source = instruction[1].rstrip(",")
+ assembled[-1] |= IN_SOURCES.index(source) << 5
count = int(instruction[-1])
if not 1 <= count <= 32:
raise RuntimeError("Count out of range")
@@ -114,7 +115,8 @@ def assemble(text_program):
elif instruction[0] == "out":
# instr delay dst count
assembled.append(0b011_00000_000_00000)
- assembled[-1] |= OUT_DESTINATIONS.index(instruction[1]) << 5
+ destination = instruction[1].rstrip(",")
+ assembled[-1] |= OUT_DESTINATIONS.index(destination) << 5
count = int(instruction[-1])
if not 1 <= count <= 32:
raise RuntimeError("Count out of range")
I'm totally sure this is not the right fix so I'm entering this as an issue instead of as a PR.
Metadata
Metadata
Assignees
Labels
No labels