diff options
| author | Dario Nieuwenhuis <[email protected]> | 2025-02-10 00:03:49 +0100 |
|---|---|---|
| committer | Dario Nieuwenhuis <[email protected]> | 2025-02-18 18:14:57 +0100 |
| commit | 52dfefb63242ad49fd126470042411f464fe624d (patch) | |
| tree | 69c559a4b4ecbab92e8b2963d8331546862d7de4 /embassy-rp/src/pio_programs/rotary_encoder.rs | |
| parent | dcf0868dd017c6df0c82e504864956374019f484 (diff) | |
rp/pio: update pio-rs crate, reexport it so users don't get version mismatches.
Diffstat (limited to 'embassy-rp/src/pio_programs/rotary_encoder.rs')
| -rw-r--r-- | embassy-rp/src/pio_programs/rotary_encoder.rs | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/embassy-rp/src/pio_programs/rotary_encoder.rs b/embassy-rp/src/pio_programs/rotary_encoder.rs index 86423fd31..f2fb02aca 100644 --- a/embassy-rp/src/pio_programs/rotary_encoder.rs +++ b/embassy-rp/src/pio_programs/rotary_encoder.rs | |||
| @@ -3,7 +3,9 @@ | |||
| 3 | use fixed::traits::ToFixed; | 3 | use fixed::traits::ToFixed; |
| 4 | 4 | ||
| 5 | use crate::gpio::Pull; | 5 | use crate::gpio::Pull; |
| 6 | use crate::pio::{self, Common, Config, FifoJoin, Instance, LoadedProgram, PioPin, ShiftDirection, StateMachine}; | 6 | use crate::pio::{ |
| 7 | Common, Config, Direction as PioDirection, FifoJoin, Instance, LoadedProgram, PioPin, ShiftDirection, StateMachine, | ||
| 8 | }; | ||
| 7 | 9 | ||
| 8 | /// This struct represents an Encoder program loaded into pio instruction memory. | 10 | /// This struct represents an Encoder program loaded into pio instruction memory. |
| 9 | pub struct PioEncoderProgram<'a, PIO: Instance> { | 11 | pub struct PioEncoderProgram<'a, PIO: Instance> { |
| @@ -13,7 +15,7 @@ pub struct PioEncoderProgram<'a, PIO: Instance> { | |||
| 13 | impl<'a, PIO: Instance> PioEncoderProgram<'a, PIO> { | 15 | impl<'a, PIO: Instance> PioEncoderProgram<'a, PIO> { |
| 14 | /// Load the program into the given pio | 16 | /// Load the program into the given pio |
| 15 | pub fn new(common: &mut Common<'a, PIO>) -> Self { | 17 | pub fn new(common: &mut Common<'a, PIO>) -> Self { |
| 16 | let prg = pio_proc::pio_asm!("wait 1 pin 1", "wait 0 pin 1", "in pins, 2", "push",); | 18 | let prg = pio::pio_asm!("wait 1 pin 1", "wait 0 pin 1", "in pins, 2", "push",); |
| 17 | 19 | ||
| 18 | let prg = common.load_program(&prg.program); | 20 | let prg = common.load_program(&prg.program); |
| 19 | 21 | ||
| @@ -39,7 +41,7 @@ impl<'d, T: Instance, const SM: usize> PioEncoder<'d, T, SM> { | |||
| 39 | let mut pin_b = pio.make_pio_pin(pin_b); | 41 | let mut pin_b = pio.make_pio_pin(pin_b); |
| 40 | pin_a.set_pull(Pull::Up); | 42 | pin_a.set_pull(Pull::Up); |
| 41 | pin_b.set_pull(Pull::Up); | 43 | pin_b.set_pull(Pull::Up); |
| 42 | sm.set_pin_dirs(pio::Direction::In, &[&pin_a, &pin_b]); | 44 | sm.set_pin_dirs(PioDirection::In, &[&pin_a, &pin_b]); |
| 43 | 45 | ||
| 44 | let mut cfg = Config::default(); | 46 | let mut cfg = Config::default(); |
| 45 | cfg.set_in_pins(&[&pin_a, &pin_b]); | 47 | cfg.set_in_pins(&[&pin_a, &pin_b]); |
