Skip to content

Commit 234febd

Browse files
committed
docs: additional info about how to install and use this package
Signed-off-by: deadprogram <[email protected]>
1 parent 1938e9a commit 234febd

File tree

1 file changed

+35
-0
lines changed

1 file changed

+35
-0
lines changed

README.md

+35
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
11
# pio
2+
3+
[![Build](https://github.com/tinygo-org/pio/actions/workflows/build.yml/badge.svg)](https://github.com/tinygo-org/pio/actions/workflows/build.yml)
4+
25
Provides clean API to interact with RP2040's on-board Programable Input/Output (PIO) block.
36
See chapter 3 of the [RP2040 datasheet](https://datasheets.raspberrypi.com/rp2040/rp2040-datasheet.pdf#page=310) for more information.
47

@@ -32,3 +35,35 @@ again:
3235
set pins, 0 ; Drive pin low
3336
jmp again ; Set PC to label `again`
3437
```
38+
39+
### How to install pioasm
40+
41+
To develop new code using PIO with this package, you must build and install the `pioasm` tool. It can be be built from the pico-sdk:
42+
43+
```shell
44+
git clone [email protected]:raspberrypi/pico-sdk.git
45+
cd pico-sdk/tools/pioasm
46+
cmake .
47+
make
48+
sudo make install
49+
```
50+
51+
### How to develop a PIO program
52+
53+
To develop a PIO program you first start out with the .pio file. Let's look at the Pulsar example first.
54+
55+
1. `pulsar.pio` specifies a binary PIO program that can be loaded to the PIO program memory.
56+
2. `all_generate.go`: holds the code generation command on the line with `//go:generate pioasm -o go pulsar.pio pulsar_pio.go` which by itself generates the raw binary code that can be loaded onto the PIO along with helper code to load it correctly inside `pulsar_pio.go`.
57+
3. `pulsar_pio.go`: contains the generated code by the `pioasm` tool.
58+
4. `pulsar.go`: contains the User facing code that allows using the PIO as intended by the author.
59+
60+
### Regenerating piolib
61+
62+
```shell
63+
cd rp2-pio/piolib
64+
go generate .
65+
```
66+
67+
### Other notes
68+
69+
Keep in mind PIO programs are very finnicky, especially differentiating between SetOutPins and SetSetPins. The difference is subtle but it can be the difference between spending days debugging a silly conceptual mistake. Have fun!

0 commit comments

Comments
 (0)