Commit graph

40 commits

Author SHA1 Message Date
foamyguy
1539f0a96e change to ruff 2025-05-16 18:31:52 +00:00
649526118b Avoid printing True in C program
& test it!

Closes: #74
2025-01-23 16:13:12 -06:00
23bd1b13e7 Add support for .side_set ... pindirs
This also requires a core change to set the respective bit in the
PIO hardware.
2024-12-01 11:11:09 -06:00
b746aec729 Add public_labels, test of labels
Now, a label declared with `public foo:` will be exported in the
`public_labels` property of `Program` objects.

Additionally, a test of this feature as well as the existing
duplicate label detection feature is added.

Change the return type of `assemble` so that it better reflects reality

Add docstrings for the public properties of Program objects
2024-09-19 22:13:14 -05:00
8f52bea49d Rename this file to emphasize it's for generating test cases
.. not part of the testsuite proper.
2024-09-18 15:12:50 -05:00
679feb8e21 Fix assembly of irq & mov rxfifo[] instructions to match sdk pioasm 2024-09-13 16:32:12 -05:00
89fc1a125a Add (failing) test comparing "all" instructions to sdk pioasm
the failing tests will be addressed next. They fall into two simple
classes, both pertaining to the new piov1 instructions.
2024-09-13 16:01:53 -05:00
403da520a6 Adjust condition in which ".out 16" is accepted syntax
this feature is in all PIO versions
2024-09-13 14:49:58 -05:00
8a97f71b0c More piov2 updates
* As an extension, ".fifo auto" may be specified to request CircuitPython's
   auto fifo join behavior
 * bounds check on `.set` directive improved
 * redundant kwargs (e.g., out_count vs out_pin_count) fixed
2024-09-10 14:09:34 -05:00
b379f05b29 Merge mov_status_count & _param into mov_status_n
.. and correct .mov_status irq prev and range handling
2024-09-10 11:20:48 -05:00
86f02e8b83 Add wait jmppin & wait irq prev/next 2024-09-08 08:01:09 -05:00
7acebc63b0 Add mov pindirs 2024-09-07 08:50:25 -05:00
895f8eb056 add mov rxfifo 2024-09-07 08:43:56 -05:00
4f98480aeb Add irq prev/next 2024-09-05 19:54:52 -05:00
e9858c3666 Add .set 2024-09-05 13:50:19 -05:00
ed74947440 Add .out directive 2024-09-05 13:46:47 -05:00
4deafa6c65 Add and test .in directive 2024-09-05 13:18:26 -05:00
ff1f57dfb1 Check directives that must come before an instruction 2024-09-05 13:13:20 -05:00
cfee88e040 Add .mov_status 2024-09-05 09:49:50 -05:00
3da0f6cea2 Add .fifo directive 2024-09-05 09:05:47 -05:00
a8fa218e45 Recognize .pio_version directive (integer arguments only) 2024-09-05 08:37:43 -05:00
be66c02eb3 Better diagnose the incorrect lines like "side 1" or "[5]"
Before this, the exception would be 'IndexError: list index out of range'.
Now it is 'Unknown instruction: side' or similar.

(These need an instruction, even if it's a `nop`: `nop side 1 [5]`)
2024-07-10 08:09:46 -05:00
KB Sriram
3e6a8bc392 Add type annotations for library and tests.
Verified that `mypy --strict adafruit_pioasm.py tests` runs without
errors.

Fixes: https://github.com/adafruit/Adafruit_CircuitPython_PIOASM/issues/24
2024-05-27 12:30:52 -07:00
KB Sriram
d87b4461ae Add tests for "out" and "in".
Also added more descriptive errors for invalid
source/destination values.

Fixes https://github.com/adafruit/Adafruit_CircuitPython_PIOASM/issues/44
2024-04-25 22:50:39 -07:00
Gebhartj
05e0ae9acd
Update test_pseudo.py 2024-01-24 08:19:53 +01:00
3bacee4ad2
support .offset pseudo-op 2023-08-05 15:57:13 -05:00
Tekktrik
66db505fc6 Switch to pytest 2023-05-24 12:57:35 -04:00
5429dc1f59
accept 0x, 0b, 0o literals in most places numbers can be used
Closes: #30 (though I don't know what octal syntax is accepted by
official pioasm, we will accept python-style 0o567 not C-style 0567)
2022-04-24 20:06:24 -05:00
16adbe4464
The core doesn't like sideset_pin_count=0, so don't send it 2022-04-06 08:41:58 -05:00
d16bd7e6a4
Add support for wrap/wrap_target
.. This also needs support in the core for specifying them in the
StateMachine constructor.
2022-02-13 13:22:03 -06:00
Jeff Epler
fde6fccaa0
adding this file lets 'python3 -munittest' in the top directory work 2022-02-13 13:17:34 -06:00
5736f5034b
Update testpioasm.py 2022-02-01 16:50:15 -06:00
2722649975
Fix name of parameter in pio_kwargs 2022-02-01 11:00:45 -06:00
666f4ef2c9
Merge remote-tracking branch 'origin/main' into program-object 2022-01-12 08:38:43 -06:00
Danny Staple
c3fa9b65bd Turns out, this dialect supports taking out spaces and the bang mark. 2022-01-08 15:50:28 +00:00
Danny Staple
df0662297d make my exceptions more consistent, and add tests. 2022-01-02 16:07:07 +00:00
Jeff Epler
9707333567 Add Program class, type information
An instance of the `Program` class has the `.assembled` property
as well as the `pio_kwargs` property. This allows passing information
from the assembler to the StateMachine constructor, in a way that can
be extended in future versions (e.g., for .wrap / .wrap_target)

This re-indents a lot of code so it may be better viewed with whitespace
changes hidden.

Tests are added for the limits of the side-set and delay values. An
off-by-one bug with the sideset_value limit was fixed.
2021-12-26 10:35:41 -06:00
Scott Shawcroft
dd2f65e4d5
Add one more test case 2021-12-23 11:21:30 -08:00
Scott Shawcroft
6fd0518867
Fix tests and add one 2021-12-22 12:35:25 -08:00
9861fd06ac add some tests 2021-03-22 21:09:33 -05:00