diff options
Diffstat (limited to 'examples/rp/src/bin/pio_async.rs')
| -rw-r--r-- | examples/rp/src/bin/pio_async.rs | 10 |
1 files changed, 3 insertions, 7 deletions
diff --git a/examples/rp/src/bin/pio_async.rs b/examples/rp/src/bin/pio_async.rs index c001d6440..a6d6144be 100644 --- a/examples/rp/src/bin/pio_async.rs +++ b/examples/rp/src/bin/pio_async.rs | |||
| @@ -8,7 +8,6 @@ use embassy_executor::Spawner; | |||
| 8 | use embassy_rp::bind_interrupts; | 8 | use embassy_rp::bind_interrupts; |
| 9 | use embassy_rp::peripherals::PIO0; | 9 | use embassy_rp::peripherals::PIO0; |
| 10 | 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}; |
| 11 | use embassy_rp::relocate::RelocatedProgram; | ||
| 12 | use fixed::traits::ToFixed; | 11 | use fixed::traits::ToFixed; |
| 13 | use fixed_macro::types::U56F8; | 12 | use fixed_macro::types::U56F8; |
| 14 | use {defmt_rtt as _, panic_probe as _}; | 13 | use {defmt_rtt as _, panic_probe as _}; |
| @@ -29,9 +28,8 @@ fn setup_pio_task_sm0<'a>(pio: &mut Common<'a, PIO0>, sm: &mut StateMachine<'a, | |||
| 29 | ".wrap", | 28 | ".wrap", |
| 30 | ); | 29 | ); |
| 31 | 30 | ||
| 32 | let relocated = RelocatedProgram::new(&prg.program); | ||
| 33 | let mut cfg = Config::default(); | 31 | let mut cfg = Config::default(); |
| 34 | cfg.use_program(&pio.load_program(&relocated), &[]); | 32 | cfg.use_program(&pio.load_program(&prg.program), &[]); |
| 35 | let out_pin = pio.make_pio_pin(pin); | 33 | let out_pin = pio.make_pio_pin(pin); |
| 36 | cfg.set_out_pins(&[&out_pin]); | 34 | cfg.set_out_pins(&[&out_pin]); |
| 37 | cfg.set_set_pins(&[&out_pin]); | 35 | cfg.set_set_pins(&[&out_pin]); |
| @@ -65,9 +63,8 @@ fn setup_pio_task_sm1<'a>(pio: &mut Common<'a, PIO0>, sm: &mut StateMachine<'a, | |||
| 65 | ".wrap", | 63 | ".wrap", |
| 66 | ); | 64 | ); |
| 67 | 65 | ||
| 68 | let relocated = RelocatedProgram::new(&prg.program); | ||
| 69 | let mut cfg = Config::default(); | 66 | let mut cfg = Config::default(); |
| 70 | cfg.use_program(&pio.load_program(&relocated), &[]); | 67 | cfg.use_program(&pio.load_program(&prg.program), &[]); |
| 71 | cfg.clock_divider = (U56F8!(125_000_000) / 2000).to_fixed(); | 68 | cfg.clock_divider = (U56F8!(125_000_000) / 2000).to_fixed(); |
| 72 | cfg.shift_in.auto_fill = true; | 69 | cfg.shift_in.auto_fill = true; |
| 73 | cfg.shift_in.direction = ShiftDirection::Right; | 70 | cfg.shift_in.direction = ShiftDirection::Right; |
| @@ -96,9 +93,8 @@ fn setup_pio_task_sm2<'a>(pio: &mut Common<'a, PIO0>, sm: &mut StateMachine<'a, | |||
| 96 | "irq 3 [15]", | 93 | "irq 3 [15]", |
| 97 | ".wrap", | 94 | ".wrap", |
| 98 | ); | 95 | ); |
| 99 | let relocated = RelocatedProgram::new(&prg.program); | ||
| 100 | let mut cfg = Config::default(); | 96 | let mut cfg = Config::default(); |
| 101 | cfg.use_program(&pio.load_program(&relocated), &[]); | 97 | cfg.use_program(&pio.load_program(&prg.program), &[]); |
| 102 | cfg.clock_divider = (U56F8!(125_000_000) / 2000).to_fixed(); | 98 | cfg.clock_divider = (U56F8!(125_000_000) / 2000).to_fixed(); |
| 103 | sm.set_config(&cfg); | 99 | sm.set_config(&cfg); |
| 104 | } | 100 | } |
