aboutsummaryrefslogtreecommitdiff
path: root/examples/rp23/src/bin
diff options
context:
space:
mode:
authorDario Nieuwenhuis <[email protected]>2025-02-18 22:02:20 +0100
committerGitHub <[email protected]>2025-02-18 22:02:20 +0100
commitf3b98a8748ad5ef7761dccb2e935cecea9e1e707 (patch)
tree69c559a4b4ecbab92e8b2963d8331546862d7de4 /examples/rp23/src/bin
parent1780f8479e8c8b5145e56861eb3cb4d57dd80185 (diff)
parent52dfefb63242ad49fd126470042411f464fe624d (diff)
Merge pull request #3865 from embassy-rs/pio2
rp/pio: update pio-rs, reexport, move instr methods to SM.
Diffstat (limited to 'examples/rp23/src/bin')
-rw-r--r--examples/rp23/src/bin/pio_async.rs7
-rw-r--r--examples/rp23/src/bin/pio_dma.rs3
-rw-r--r--examples/rp23/src/bin/pio_rotary_encoder_rxf.rs3
3 files changed, 8 insertions, 5 deletions
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;
6use embassy_executor::Spawner; 6use embassy_executor::Spawner;
7use embassy_rp::bind_interrupts; 7use embassy_rp::bind_interrupts;
8use embassy_rp::peripherals::PIO0; 8use embassy_rp::peripherals::PIO0;
9use embassy_rp::pio::program::pio_asm;
9use embassy_rp::pio::{Common, Config, InterruptHandler, Irq, Pio, PioPin, ShiftDirection, StateMachine}; 10use embassy_rp::pio::{Common, Config, InterruptHandler, Irq, Pio, PioPin, ShiftDirection, StateMachine};
10use fixed::traits::ToFixed; 11use fixed::traits::ToFixed;
11use fixed_macro::types::U56F8; 12use 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;
6use embassy_executor::Spawner; 6use embassy_executor::Spawner;
7use embassy_futures::join::join; 7use embassy_futures::join::join;
8use embassy_rp::peripherals::PIO0; 8use embassy_rp::peripherals::PIO0;
9use embassy_rp::pio::program::pio_asm;
9use embassy_rp::pio::{Config, InterruptHandler, Pio, ShiftConfig, ShiftDirection}; 10use embassy_rp::pio::{Config, InterruptHandler, Pio, ShiftConfig, ShiftDirection};
10use embassy_rp::{bind_interrupts, Peripheral}; 11use embassy_rp::{bind_interrupts, Peripheral};
11use fixed::traits::ToFixed; 12use 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;
8use embassy_executor::Spawner; 8use embassy_executor::Spawner;
9use embassy_rp::gpio::Pull; 9use embassy_rp::gpio::Pull;
10use embassy_rp::peripherals::PIO0; 10use embassy_rp::peripherals::PIO0;
11use embassy_rp::pio::program::pio_asm;
11use embassy_rp::{bind_interrupts, pio}; 12use embassy_rp::{bind_interrupts, pio};
12use embassy_time::Timer; 13use embassy_time::Timer;
13use fixed::traits::ToFixed; 14use 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"