diff options
Diffstat (limited to 'examples')
| -rw-r--r-- | examples/rp/src/bin/pio_rotary_encoder.rs | 14 |
1 files changed, 2 insertions, 12 deletions
diff --git a/examples/rp/src/bin/pio_rotary_encoder.rs b/examples/rp/src/bin/pio_rotary_encoder.rs index 589f38a7b..6d9d59df6 100644 --- a/examples/rp/src/bin/pio_rotary_encoder.rs +++ b/examples/rp/src/bin/pio_rotary_encoder.rs | |||
| @@ -34,24 +34,14 @@ impl<'d, T: Instance, const SM: usize> PioEncoder<'d, T, SM> { | |||
| 34 | pin_b.set_pull(Pull::Up); | 34 | pin_b.set_pull(Pull::Up); |
| 35 | sm.set_pin_dirs(pio::Direction::In, &[&pin_a, &pin_b]); | 35 | sm.set_pin_dirs(pio::Direction::In, &[&pin_a, &pin_b]); |
| 36 | 36 | ||
| 37 | let prg = pio_proc::pio_asm!( | 37 | let prg = pio_proc::pio_asm!("wait 1 pin 1", "wait 0 pin 1", "in pins, 2", "push",); |
| 38 | r#" | ||
| 39 | wait 1 pin 1 | ||
| 40 | .wrap_target | ||
| 41 | wait 0 pin 1 | ||
| 42 | in pins, 2 | ||
| 43 | push | ||
| 44 | wait 1 pin 1 | ||
| 45 | .wrap | ||
| 46 | "# | ||
| 47 | ); | ||
| 48 | 38 | ||
| 49 | let mut cfg = Config::default(); | 39 | let mut cfg = Config::default(); |
| 50 | cfg.set_in_pins(&[&pin_a, &pin_b]); | 40 | cfg.set_in_pins(&[&pin_a, &pin_b]); |
| 51 | cfg.fifo_join = FifoJoin::RxOnly; | 41 | cfg.fifo_join = FifoJoin::RxOnly; |
| 52 | cfg.use_program(&pio.load_program(&prg.program), &[]); | ||
| 53 | cfg.shift_in.direction = ShiftDirection::Left; | 42 | cfg.shift_in.direction = ShiftDirection::Left; |
| 54 | cfg.clock_divider = 10_000.to_fixed(); | 43 | cfg.clock_divider = 10_000.to_fixed(); |
| 44 | cfg.use_program(&pio.load_program(&prg.program), &[]); | ||
| 55 | sm.set_config(&cfg); | 45 | sm.set_config(&cfg); |
| 56 | sm.set_enable(true); | 46 | sm.set_enable(true); |
| 57 | Self { sm } | 47 | Self { sm } |
