Skip to content

Commit e9858c3

Browse files
committed
Add .set
1 parent ed74947 commit e9858c3

File tree

2 files changed

+18
-0
lines changed

2 files changed

+18
-0
lines changed

Diff for: adafruit_pioasm.py

+10
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,7 @@ def __init__(self, text_program: str, *, build_debuginfo: bool = False) -> None:
7272
out_shift_right = None
7373
auto_pull = None
7474
pull_threshold = None
75+
set_count = None
7576

7677
def require_before_instruction():
7778
if len(instructions) != 0:
@@ -190,6 +191,12 @@ def int_in_range(arg, low, high, what, radix=0):
190191
push_threshold = int_in_range(words[idx], 1, 33, ".in threshold")
191192
idx += 1
192193

194+
elif words[0] == ".set":
195+
require_before_instruction()
196+
set_count = int_in_range(
197+
words[1], 32 if pio_version == 0 else 1, 33, ".set count"
198+
)
199+
193200
elif line.endswith(":"):
194201
label = line[:-1]
195202
if label in labels:
@@ -377,6 +384,9 @@ def int_in_range(arg, low, high, what, radix=0):
377384
self.pio_kwargs["mov_status_count"] = mov_status_count
378385
self.pio_kwargs["mov_status_param"] = mov_status_param
379386

387+
if set_count not in (None, 32):
388+
self.pio_kwargs["set_count"] = set_count
389+
380390
if out_count not in (None, 32):
381391
self.pio_kwargs["out_count"] = out_count
382392

Diff for: tests/test_version.py

+8
Original file line numberDiff line numberDiff line change
@@ -99,3 +99,11 @@ def test_dot_out() -> None:
9999
auto_pull=False,
100100
out_shift_right=True,
101101
)
102+
103+
104+
def test_dot_set() -> None:
105+
assert_pio_kwargs(".set 32", sideset_enable=0)
106+
assert_assembly_fails(".set 16")
107+
assert_pio_kwargs(
108+
".pio_version 1\n.set 16 right", pio_version=1, sideset_enable=0, set_count=16
109+
)

0 commit comments

Comments
 (0)