rp-rs / ws2812-pio-rs

https://crates.io/crates/ws2812-pio/
Apache License 2.0
18 stars 26 forks source link

`nop` with delay `T2 - 2` instead of `T2 - 1`? #8

Closed luiswirth closed 2 years ago

luiswirth commented 2 years ago

Why does the nop have a delay of T2 - 2 instead of T2 - 1?

https://github.com/ithinuel/ws2812-pio-rs/blob/37ade6dd937c62c2b9c0b0fe212c291fe5f33317/src/lib.rs#L107

Usually it's T - 1 because the instruction itself uses a cycle and then you want to wait T - 1 more cycles.

The offical raspberry pi pio ws2812 example also uses T2 - 1.

https://github.com/raspberrypi/pico-examples/blob/afd1d2008f3fb3fa7a837dd1bdf17a6fecbc57fe/pio/ws2812/ws2812.pio#L25

ithinuel commented 2 years ago

It is likely a typo. You're welcome to open a PR to fix that :)