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 | |
| 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')
| -rw-r--r-- | embassy-rp/src/pio_programs/hd44780.rs | 4 | ||||
| -rw-r--r-- | embassy-rp/src/pio_programs/i2s.rs | 2 | ||||
| -rw-r--r-- | embassy-rp/src/pio_programs/onewire.rs | 8 | ||||
| -rw-r--r-- | embassy-rp/src/pio_programs/pwm.rs | 2 | ||||
| -rw-r--r-- | embassy-rp/src/pio_programs/rotary_encoder.rs | 8 | ||||
| -rw-r--r-- | embassy-rp/src/pio_programs/stepper.rs | 2 | ||||
| -rw-r--r-- | embassy-rp/src/pio_programs/uart.rs | 4 |
7 files changed, 16 insertions, 14 deletions
diff --git a/embassy-rp/src/pio_programs/hd44780.rs b/embassy-rp/src/pio_programs/hd44780.rs index 9bbf44fc4..70129318b 100644 --- a/embassy-rp/src/pio_programs/hd44780.rs +++ b/embassy-rp/src/pio_programs/hd44780.rs | |||
| @@ -15,7 +15,7 @@ pub struct PioHD44780CommandWordProgram<'a, PIO: Instance> { | |||
| 15 | impl<'a, PIO: Instance> PioHD44780CommandWordProgram<'a, PIO> { | 15 | impl<'a, PIO: Instance> PioHD44780CommandWordProgram<'a, PIO> { |
| 16 | /// Load the program into the given pio | 16 | /// Load the program into the given pio |
| 17 | pub fn new(common: &mut Common<'a, PIO>) -> Self { | 17 | pub fn new(common: &mut Common<'a, PIO>) -> Self { |
| 18 | let prg = pio_proc::pio_asm!( | 18 | let prg = pio::pio_asm!( |
| 19 | r#" | 19 | r#" |
| 20 | .side_set 1 opt | 20 | .side_set 1 opt |
| 21 | .origin 20 | 21 | .origin 20 |
| @@ -46,7 +46,7 @@ impl<'a, PIO: Instance> PioHD44780CommandSequenceProgram<'a, PIO> { | |||
| 46 | /// Load the program into the given pio | 46 | /// Load the program into the given pio |
| 47 | pub fn new(common: &mut Common<'a, PIO>) -> Self { | 47 | pub fn new(common: &mut Common<'a, PIO>) -> Self { |
| 48 | // many side sets are only there to free up a delay bit! | 48 | // many side sets are only there to free up a delay bit! |
| 49 | let prg = pio_proc::pio_asm!( | 49 | let prg = pio::pio_asm!( |
| 50 | r#" | 50 | r#" |
| 51 | .origin 27 | 51 | .origin 27 |
| 52 | .side_set 1 | 52 | .side_set 1 |
diff --git a/embassy-rp/src/pio_programs/i2s.rs b/embassy-rp/src/pio_programs/i2s.rs index 87fb2e19f..a7b4f46a6 100644 --- a/embassy-rp/src/pio_programs/i2s.rs +++ b/embassy-rp/src/pio_programs/i2s.rs | |||
| @@ -16,7 +16,7 @@ pub struct PioI2sOutProgram<'a, PIO: Instance> { | |||
| 16 | impl<'a, PIO: Instance> PioI2sOutProgram<'a, PIO> { | 16 | impl<'a, PIO: Instance> PioI2sOutProgram<'a, PIO> { |
| 17 | /// Load the program into the given pio | 17 | /// Load the program into the given pio |
| 18 | pub fn new(common: &mut Common<'a, PIO>) -> Self { | 18 | pub fn new(common: &mut Common<'a, PIO>) -> Self { |
| 19 | let prg = pio_proc::pio_asm!( | 19 | let prg = pio::pio_asm!( |
| 20 | ".side_set 2", | 20 | ".side_set 2", |
| 21 | " set x, 14 side 0b01", // side 0bWB - W = Word Clock, B = Bit Clock | 21 | " set x, 14 side 0b01", // side 0bWB - W = Word Clock, B = Bit Clock |
| 22 | "left_data:", | 22 | "left_data:", |
diff --git a/embassy-rp/src/pio_programs/onewire.rs b/embassy-rp/src/pio_programs/onewire.rs index f3bc5fcd7..040333e76 100644 --- a/embassy-rp/src/pio_programs/onewire.rs +++ b/embassy-rp/src/pio_programs/onewire.rs | |||
| @@ -1,6 +1,6 @@ | |||
| 1 | //! OneWire pio driver | 1 | //! OneWire pio driver |
| 2 | 2 | ||
| 3 | use crate::pio::{self, Common, Config, Instance, LoadedProgram, PioPin, ShiftConfig, ShiftDirection, StateMachine}; | 3 | use crate::pio::{Common, Config, Instance, LoadedProgram, PioPin, ShiftConfig, ShiftDirection, StateMachine}; |
| 4 | 4 | ||
| 5 | /// This struct represents an onewire driver program | 5 | /// This struct represents an onewire driver program |
| 6 | pub struct PioOneWireProgram<'a, PIO: Instance> { | 6 | pub struct PioOneWireProgram<'a, PIO: Instance> { |
| @@ -10,7 +10,7 @@ pub struct PioOneWireProgram<'a, PIO: Instance> { | |||
| 10 | impl<'a, PIO: Instance> PioOneWireProgram<'a, PIO> { | 10 | impl<'a, PIO: Instance> PioOneWireProgram<'a, PIO> { |
| 11 | /// Load the program into the given pio | 11 | /// Load the program into the given pio |
| 12 | pub fn new(common: &mut Common<'a, PIO>) -> Self { | 12 | pub fn new(common: &mut Common<'a, PIO>) -> Self { |
| 13 | let prg = pio_proc::pio_asm!( | 13 | let prg = pio::pio_asm!( |
| 14 | r#" | 14 | r#" |
| 15 | .wrap_target | 15 | .wrap_target |
| 16 | again: | 16 | again: |
| @@ -60,11 +60,11 @@ impl<'a, PIO: Instance> PioOneWireProgram<'a, PIO> { | |||
| 60 | } | 60 | } |
| 61 | 61 | ||
| 62 | /// Pio backed OneWire driver | 62 | /// Pio backed OneWire driver |
| 63 | pub struct PioOneWire<'d, PIO: pio::Instance, const SM: usize> { | 63 | pub struct PioOneWire<'d, PIO: Instance, const SM: usize> { |
| 64 | sm: StateMachine<'d, PIO, SM>, | 64 | sm: StateMachine<'d, PIO, SM>, |
| 65 | } | 65 | } |
| 66 | 66 | ||
| 67 | impl<'d, PIO: pio::Instance, const SM: usize> PioOneWire<'d, PIO, SM> { | 67 | impl<'d, PIO: Instance, const SM: usize> PioOneWire<'d, PIO, SM> { |
| 68 | /// Create a new instance the driver | 68 | /// Create a new instance the driver |
| 69 | pub fn new( | 69 | pub fn new( |
| 70 | common: &mut Common<'d, PIO>, | 70 | common: &mut Common<'d, PIO>, |
diff --git a/embassy-rp/src/pio_programs/pwm.rs b/embassy-rp/src/pio_programs/pwm.rs index c6502387a..01ffe012a 100644 --- a/embassy-rp/src/pio_programs/pwm.rs +++ b/embassy-rp/src/pio_programs/pwm.rs | |||
| @@ -21,7 +21,7 @@ pub struct PioPwmProgram<'a, PIO: Instance> { | |||
| 21 | impl<'a, PIO: Instance> PioPwmProgram<'a, PIO> { | 21 | impl<'a, PIO: Instance> PioPwmProgram<'a, PIO> { |
| 22 | /// Load the program into the given pio | 22 | /// Load the program into the given pio |
| 23 | pub fn new(common: &mut Common<'a, PIO>) -> Self { | 23 | pub fn new(common: &mut Common<'a, PIO>) -> Self { |
| 24 | let prg = pio_proc::pio_asm!( | 24 | let prg = pio::pio_asm!( |
| 25 | ".side_set 1 opt" | 25 | ".side_set 1 opt" |
| 26 | "pull noblock side 0" | 26 | "pull noblock side 0" |
| 27 | "mov x, osr" | 27 | "mov x, osr" |
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]); |
diff --git a/embassy-rp/src/pio_programs/stepper.rs b/embassy-rp/src/pio_programs/stepper.rs index 0d58c754c..c8f74167d 100644 --- a/embassy-rp/src/pio_programs/stepper.rs +++ b/embassy-rp/src/pio_programs/stepper.rs | |||
| @@ -16,7 +16,7 @@ pub struct PioStepperProgram<'a, PIO: Instance> { | |||
| 16 | impl<'a, PIO: Instance> PioStepperProgram<'a, PIO> { | 16 | impl<'a, PIO: Instance> PioStepperProgram<'a, PIO> { |
| 17 | /// Load the program into the given pio | 17 | /// Load the program into the given pio |
| 18 | pub fn new(common: &mut Common<'a, PIO>) -> Self { | 18 | pub fn new(common: &mut Common<'a, PIO>) -> Self { |
| 19 | let prg = pio_proc::pio_asm!( | 19 | let prg = pio::pio_asm!( |
| 20 | "pull block", | 20 | "pull block", |
| 21 | "mov x, osr", | 21 | "mov x, osr", |
| 22 | "pull block", | 22 | "pull block", |
diff --git a/embassy-rp/src/pio_programs/uart.rs b/embassy-rp/src/pio_programs/uart.rs index c643f1063..641daca61 100644 --- a/embassy-rp/src/pio_programs/uart.rs +++ b/embassy-rp/src/pio_programs/uart.rs | |||
| @@ -19,7 +19,7 @@ pub struct PioUartTxProgram<'a, PIO: Instance> { | |||
| 19 | impl<'a, PIO: Instance> PioUartTxProgram<'a, PIO> { | 19 | impl<'a, PIO: Instance> PioUartTxProgram<'a, PIO> { |
| 20 | /// Load the uart tx program into the given pio | 20 | /// Load the uart tx program into the given pio |
| 21 | pub fn new(common: &mut Common<'a, PIO>) -> Self { | 21 | pub fn new(common: &mut Common<'a, PIO>) -> Self { |
| 22 | let prg = pio_proc::pio_asm!( | 22 | let prg = pio::pio_asm!( |
| 23 | r#" | 23 | r#" |
| 24 | .side_set 1 opt | 24 | .side_set 1 opt |
| 25 | 25 | ||
| @@ -99,7 +99,7 @@ pub struct PioUartRxProgram<'a, PIO: Instance> { | |||
| 99 | impl<'a, PIO: Instance> PioUartRxProgram<'a, PIO> { | 99 | impl<'a, PIO: Instance> PioUartRxProgram<'a, PIO> { |
| 100 | /// Load the uart rx program into the given pio | 100 | /// Load the uart rx program into the given pio |
| 101 | pub fn new(common: &mut Common<'a, PIO>) -> Self { | 101 | pub fn new(common: &mut Common<'a, PIO>) -> Self { |
| 102 | let prg = pio_proc::pio_asm!( | 102 | let prg = pio::pio_asm!( |
| 103 | r#" | 103 | r#" |
| 104 | ; Slightly more fleshed-out 8n1 UART receiver which handles framing errors and | 104 | ; Slightly more fleshed-out 8n1 UART receiver which handles framing errors and |
| 105 | ; break conditions more gracefully. | 105 | ; break conditions more gracefully. |
