From e4f2740f407266aa274b45111194ec3d7c42282c Mon Sep 17 00:00:00 2001 From: ryang14 Date: Mon, 25 Jan 2021 20:44:49 -0500 Subject: [PATCH] Fix wait source encoding Change the wait instruction encoding to shift the source by 5 bits instead of 4. --- adafruit_pioasm.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/adafruit_pioasm.py b/adafruit_pioasm.py index d10824e..dc7591f 100644 --- a/adafruit_pioasm.py +++ b/adafruit_pioasm.py @@ -96,7 +96,7 @@ def assemble(text_program): if not 0 <= polarity <= 1: raise RuntimeError("Invalid polarity") assembled[-1] |= polarity << 7 - assembled[-1] |= WAIT_SOURCES.index(instruction[2]) << 4 + assembled[-1] |= WAIT_SOURCES.index(instruction[2]) << 5 num = int(instruction[3]) if not 0 <= num <= 31: raise RuntimeError("Wait num out of range")