diff options
| author | Dario Nieuwenhuis <[email protected]> | 2025-02-18 22:02:20 +0100 |
|---|---|---|
| committer | GitHub <[email protected]> | 2025-02-18 22:02:20 +0100 |
| commit | f3b98a8748ad5ef7761dccb2e935cecea9e1e707 (patch) | |
| tree | 69c559a4b4ecbab92e8b2963d8331546862d7de4 /examples | |
| parent | 1780f8479e8c8b5145e56861eb3cb4d57dd80185 (diff) | |
| parent | 52dfefb63242ad49fd126470042411f464fe624d (diff) | |
Merge pull request #3865 from embassy-rs/pio2
rp/pio: update pio-rs, reexport, move instr methods to SM.
Diffstat (limited to 'examples')
| -rw-r--r-- | examples/rp/Cargo.toml | 2 | ||||
| -rw-r--r-- | examples/rp/src/bin/pio_async.rs | 7 | ||||
| -rw-r--r-- | examples/rp/src/bin/pio_dma.rs | 3 | ||||
| -rw-r--r-- | examples/rp23/Cargo.toml | 2 | ||||
| -rw-r--r-- | examples/rp23/src/bin/pio_async.rs | 7 | ||||
| -rw-r--r-- | examples/rp23/src/bin/pio_dma.rs | 3 | ||||
| -rw-r--r-- | examples/rp23/src/bin/pio_rotary_encoder_rxf.rs | 3 |
7 files changed, 14 insertions, 13 deletions
diff --git a/examples/rp/Cargo.toml b/examples/rp/Cargo.toml index e05c88a9a..a81166067 100644 --- a/examples/rp/Cargo.toml +++ b/examples/rp/Cargo.toml | |||
| @@ -55,8 +55,6 @@ embedded-storage = { version = "0.3" } | |||
| 55 | static_cell = "2.1" | 55 | static_cell = "2.1" |
| 56 | portable-atomic = { version = "1.5", features = ["critical-section"] } | 56 | portable-atomic = { version = "1.5", features = ["critical-section"] } |
| 57 | log = "0.4" | 57 | log = "0.4" |
| 58 | pio-proc = { git = "https://github.com/rp-rs/pio-rs", rev = "fa586448b0b223217eec8c92c19fe6823dd04cc4" } | ||
| 59 | pio = { git = "https://github.com/rp-rs/pio-rs", rev = "fa586448b0b223217eec8c92c19fe6823dd04cc4" } | ||
| 60 | rand = { version = "0.8.5", default-features = false } | 58 | rand = { version = "0.8.5", default-features = false } |
| 61 | embedded-sdmmc = "0.7.0" | 59 | embedded-sdmmc = "0.7.0" |
| 62 | 60 | ||
diff --git a/examples/rp/src/bin/pio_async.rs b/examples/rp/src/bin/pio_async.rs index ee248591b..08c702347 100644 --- a/examples/rp/src/bin/pio_async.rs +++ b/examples/rp/src/bin/pio_async.rs | |||
| @@ -6,6 +6,7 @@ use defmt::info; | |||
| 6 | use embassy_executor::Spawner; | 6 | use embassy_executor::Spawner; |
| 7 | use embassy_rp::bind_interrupts; | 7 | use embassy_rp::bind_interrupts; |
| 8 | use embassy_rp::peripherals::PIO0; | 8 | use embassy_rp::peripherals::PIO0; |
| 9 | use embassy_rp::pio::program::pio_asm; | ||
| 9 | use embassy_rp::pio::{Common, Config, InterruptHandler, Irq, Pio, PioPin, ShiftDirection, StateMachine}; | 10 | use embassy_rp::pio::{Common, Config, InterruptHandler, Irq, Pio, PioPin, ShiftDirection, StateMachine}; |
| 10 | use fixed::traits::ToFixed; | 11 | use fixed::traits::ToFixed; |
| 11 | use fixed_macro::types::U56F8; | 12 | use fixed_macro::types::U56F8; |
| @@ -19,7 +20,7 @@ fn setup_pio_task_sm0<'a>(pio: &mut Common<'a, PIO0>, sm: &mut StateMachine<'a, | |||
| 19 | // Setup sm0 | 20 | // Setup sm0 |
| 20 | 21 | ||
| 21 | // Send data serially to pin | 22 | // Send data serially to pin |
| 22 | let prg = pio_proc::pio_asm!( | 23 | let prg = pio_asm!( |
| 23 | ".origin 16", | 24 | ".origin 16", |
| 24 | "set pindirs, 1", | 25 | "set pindirs, 1", |
| 25 | ".wrap_target", | 26 | ".wrap_target", |
| @@ -53,7 +54,7 @@ fn setup_pio_task_sm1<'a>(pio: &mut Common<'a, PIO0>, sm: &mut StateMachine<'a, | |||
| 53 | // Setupm sm1 | 54 | // Setupm sm1 |
| 54 | 55 | ||
| 55 | // Read 0b10101 repeatedly until ISR is full | 56 | // Read 0b10101 repeatedly until ISR is full |
| 56 | let prg = pio_proc::pio_asm!( | 57 | let prg = pio_asm!( |
| 57 | // | 58 | // |
| 58 | ".origin 8", | 59 | ".origin 8", |
| 59 | "set x, 0x15", | 60 | "set x, 0x15", |
| @@ -83,7 +84,7 @@ fn setup_pio_task_sm2<'a>(pio: &mut Common<'a, PIO0>, sm: &mut StateMachine<'a, | |||
| 83 | // Setup sm2 | 84 | // Setup sm2 |
| 84 | 85 | ||
| 85 | // Repeatedly trigger IRQ 3 | 86 | // Repeatedly trigger IRQ 3 |
| 86 | let prg = pio_proc::pio_asm!( | 87 | let prg = pio_asm!( |
| 87 | ".origin 0", | 88 | ".origin 0", |
| 88 | ".wrap_target", | 89 | ".wrap_target", |
| 89 | "set x,10", | 90 | "set x,10", |
diff --git a/examples/rp/src/bin/pio_dma.rs b/examples/rp/src/bin/pio_dma.rs index 02700269c..d00ed2142 100644 --- a/examples/rp/src/bin/pio_dma.rs +++ b/examples/rp/src/bin/pio_dma.rs | |||
| @@ -6,6 +6,7 @@ use defmt::info; | |||
| 6 | use embassy_executor::Spawner; | 6 | use embassy_executor::Spawner; |
| 7 | use embassy_futures::join::join; | 7 | use embassy_futures::join::join; |
| 8 | use embassy_rp::peripherals::PIO0; | 8 | use embassy_rp::peripherals::PIO0; |
| 9 | use embassy_rp::pio::program::pio_asm; | ||
| 9 | use embassy_rp::pio::{Config, InterruptHandler, Pio, ShiftConfig, ShiftDirection}; | 10 | use embassy_rp::pio::{Config, InterruptHandler, Pio, ShiftConfig, ShiftDirection}; |
| 10 | use embassy_rp::{bind_interrupts, Peripheral}; | 11 | use embassy_rp::{bind_interrupts, Peripheral}; |
| 11 | use fixed::traits::ToFixed; | 12 | use fixed::traits::ToFixed; |
| @@ -32,7 +33,7 @@ async fn main(_spawner: Spawner) { | |||
| 32 | .. | 33 | .. |
| 33 | } = Pio::new(pio, Irqs); | 34 | } = Pio::new(pio, Irqs); |
| 34 | 35 | ||
| 35 | let prg = pio_proc::pio_asm!( | 36 | let prg = pio_asm!( |
| 36 | ".origin 0", | 37 | ".origin 0", |
| 37 | "set pindirs,1", | 38 | "set pindirs,1", |
| 38 | ".wrap_target", | 39 | ".wrap_target", |
diff --git a/examples/rp23/Cargo.toml b/examples/rp23/Cargo.toml index b7e7dd69a..f4dfae773 100644 --- a/examples/rp23/Cargo.toml +++ b/examples/rp23/Cargo.toml | |||
| @@ -55,8 +55,6 @@ embedded-storage = { version = "0.3" } | |||
| 55 | static_cell = "2.1" | 55 | static_cell = "2.1" |
| 56 | portable-atomic = { version = "1.5", features = ["critical-section"] } | 56 | portable-atomic = { version = "1.5", features = ["critical-section"] } |
| 57 | log = "0.4" | 57 | log = "0.4" |
| 58 | pio-proc = { git = "https://github.com/rp-rs/pio-rs", rev = "fa586448b0b223217eec8c92c19fe6823dd04cc4" } | ||
| 59 | pio = { git = "https://github.com/rp-rs/pio-rs", rev = "fa586448b0b223217eec8c92c19fe6823dd04cc4" } | ||
| 60 | rand = { version = "0.8.5", default-features = false } | 58 | rand = { version = "0.8.5", default-features = false } |
| 61 | embedded-sdmmc = "0.7.0" | 59 | embedded-sdmmc = "0.7.0" |
| 62 | 60 | ||
diff --git a/examples/rp23/src/bin/pio_async.rs b/examples/rp23/src/bin/pio_async.rs index ee248591b..08c702347 100644 --- a/examples/rp23/src/bin/pio_async.rs +++ b/examples/rp23/src/bin/pio_async.rs | |||
| @@ -6,6 +6,7 @@ use defmt::info; | |||
| 6 | use embassy_executor::Spawner; | 6 | use embassy_executor::Spawner; |
| 7 | use embassy_rp::bind_interrupts; | 7 | use embassy_rp::bind_interrupts; |
| 8 | use embassy_rp::peripherals::PIO0; | 8 | use embassy_rp::peripherals::PIO0; |
| 9 | use embassy_rp::pio::program::pio_asm; | ||
| 9 | use embassy_rp::pio::{Common, Config, InterruptHandler, Irq, Pio, PioPin, ShiftDirection, StateMachine}; | 10 | use embassy_rp::pio::{Common, Config, InterruptHandler, Irq, Pio, PioPin, ShiftDirection, StateMachine}; |
| 10 | use fixed::traits::ToFixed; | 11 | use fixed::traits::ToFixed; |
| 11 | use fixed_macro::types::U56F8; | 12 | use fixed_macro::types::U56F8; |
| @@ -19,7 +20,7 @@ fn setup_pio_task_sm0<'a>(pio: &mut Common<'a, PIO0>, sm: &mut StateMachine<'a, | |||
| 19 | // Setup sm0 | 20 | // Setup sm0 |
| 20 | 21 | ||
| 21 | // Send data serially to pin | 22 | // Send data serially to pin |
| 22 | let prg = pio_proc::pio_asm!( | 23 | let prg = pio_asm!( |
| 23 | ".origin 16", | 24 | ".origin 16", |
| 24 | "set pindirs, 1", | 25 | "set pindirs, 1", |
| 25 | ".wrap_target", | 26 | ".wrap_target", |
| @@ -53,7 +54,7 @@ fn setup_pio_task_sm1<'a>(pio: &mut Common<'a, PIO0>, sm: &mut StateMachine<'a, | |||
| 53 | // Setupm sm1 | 54 | // Setupm sm1 |
| 54 | 55 | ||
| 55 | // Read 0b10101 repeatedly until ISR is full | 56 | // Read 0b10101 repeatedly until ISR is full |
| 56 | let prg = pio_proc::pio_asm!( | 57 | let prg = pio_asm!( |
| 57 | // | 58 | // |
| 58 | ".origin 8", | 59 | ".origin 8", |
| 59 | "set x, 0x15", | 60 | "set x, 0x15", |
| @@ -83,7 +84,7 @@ fn setup_pio_task_sm2<'a>(pio: &mut Common<'a, PIO0>, sm: &mut StateMachine<'a, | |||
| 83 | // Setup sm2 | 84 | // Setup sm2 |
| 84 | 85 | ||
| 85 | // Repeatedly trigger IRQ 3 | 86 | // Repeatedly trigger IRQ 3 |
| 86 | let prg = pio_proc::pio_asm!( | 87 | let prg = pio_asm!( |
| 87 | ".origin 0", | 88 | ".origin 0", |
| 88 | ".wrap_target", | 89 | ".wrap_target", |
| 89 | "set x,10", | 90 | "set x,10", |
diff --git a/examples/rp23/src/bin/pio_dma.rs b/examples/rp23/src/bin/pio_dma.rs index 02700269c..d00ed2142 100644 --- a/examples/rp23/src/bin/pio_dma.rs +++ b/examples/rp23/src/bin/pio_dma.rs | |||
| @@ -6,6 +6,7 @@ use defmt::info; | |||
| 6 | use embassy_executor::Spawner; | 6 | use embassy_executor::Spawner; |
| 7 | use embassy_futures::join::join; | 7 | use embassy_futures::join::join; |
| 8 | use embassy_rp::peripherals::PIO0; | 8 | use embassy_rp::peripherals::PIO0; |
| 9 | use embassy_rp::pio::program::pio_asm; | ||
| 9 | use embassy_rp::pio::{Config, InterruptHandler, Pio, ShiftConfig, ShiftDirection}; | 10 | use embassy_rp::pio::{Config, InterruptHandler, Pio, ShiftConfig, ShiftDirection}; |
| 10 | use embassy_rp::{bind_interrupts, Peripheral}; | 11 | use embassy_rp::{bind_interrupts, Peripheral}; |
| 11 | use fixed::traits::ToFixed; | 12 | use fixed::traits::ToFixed; |
| @@ -32,7 +33,7 @@ async fn main(_spawner: Spawner) { | |||
| 32 | .. | 33 | .. |
| 33 | } = Pio::new(pio, Irqs); | 34 | } = Pio::new(pio, Irqs); |
| 34 | 35 | ||
| 35 | let prg = pio_proc::pio_asm!( | 36 | let prg = pio_asm!( |
| 36 | ".origin 0", | 37 | ".origin 0", |
| 37 | "set pindirs,1", | 38 | "set pindirs,1", |
| 38 | ".wrap_target", | 39 | ".wrap_target", |
diff --git a/examples/rp23/src/bin/pio_rotary_encoder_rxf.rs b/examples/rp23/src/bin/pio_rotary_encoder_rxf.rs index ca6b5222b..0216c131b 100644 --- a/examples/rp23/src/bin/pio_rotary_encoder_rxf.rs +++ b/examples/rp23/src/bin/pio_rotary_encoder_rxf.rs | |||
| @@ -8,6 +8,7 @@ use defmt::info; | |||
| 8 | use embassy_executor::Spawner; | 8 | use embassy_executor::Spawner; |
| 9 | use embassy_rp::gpio::Pull; | 9 | use embassy_rp::gpio::Pull; |
| 10 | use embassy_rp::peripherals::PIO0; | 10 | use embassy_rp::peripherals::PIO0; |
| 11 | use embassy_rp::pio::program::pio_asm; | ||
| 11 | use embassy_rp::{bind_interrupts, pio}; | 12 | use embassy_rp::{bind_interrupts, pio}; |
| 12 | use embassy_time::Timer; | 13 | use embassy_time::Timer; |
| 13 | use fixed::traits::ToFixed; | 14 | use fixed::traits::ToFixed; |
| @@ -46,7 +47,7 @@ impl<'d, T: Instance, const SM: usize> PioEncoder<'d, T, SM> { | |||
| 46 | 47 | ||
| 47 | sm.set_pin_dirs(pio::Direction::In, &[&pin_a, &pin_b]); | 48 | sm.set_pin_dirs(pio::Direction::In, &[&pin_a, &pin_b]); |
| 48 | 49 | ||
| 49 | let prg = pio_proc::pio_asm!( | 50 | let prg = pio_asm!( |
| 50 | "start:" | 51 | "start:" |
| 51 | // encoder count is stored in X | 52 | // encoder count is stored in X |
| 52 | "mov isr, x" | 53 | "mov isr, x" |
