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 | |
| parent | dcf0868dd017c6df0c82e504864956374019f484 (diff) | |
rp/pio: update pio-rs crate, reexport it so users don't get version mismatches.
| -rw-r--r-- | cyw43-pio/Cargo.toml | 2 | ||||
| -rw-r--r-- | cyw43-pio/src/lib.rs | 2 | ||||
| -rw-r--r-- | embassy-rp/Cargo.toml | 3 | ||||
| -rw-r--r-- | embassy-rp/src/pio/mod.rs | 3 | ||||
| -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 | ||||
| -rw-r--r-- | examples/rp/Cargo.toml | 2 | ||||
| -rw-r--r-- | examples/rp/src/bin/pio_async.rs | 7 | ||||
| -rw-r--r-- | examples/rp/src/bin/pio_dma.rs | 3 | ||||
| -rw-r--r-- | examples/rp23/Cargo.toml | 2 | ||||
| -rw-r--r-- | examples/rp23/src/bin/pio_async.rs | 7 | ||||
| -rw-r--r-- | examples/rp23/src/bin/pio_dma.rs | 3 | ||||
| -rw-r--r-- | examples/rp23/src/bin/pio_rotary_encoder_rxf.rs | 3 | ||||
| -rw-r--r-- | tests/rp/Cargo.toml | 2 | ||||
| -rw-r--r-- | tests/rp/src/bin/pio_irq.rs | 3 | ||||
| -rw-r--r-- | tests/rp/src/bin/pio_multi_load.rs | 16 |
21 files changed, 45 insertions, 43 deletions
diff --git a/cyw43-pio/Cargo.toml b/cyw43-pio/Cargo.toml index f52788ba3..2397c76d3 100644 --- a/cyw43-pio/Cargo.toml +++ b/cyw43-pio/Cargo.toml | |||
| @@ -12,8 +12,6 @@ documentation = "https://docs.embassy.dev/cyw43-pio" | |||
| 12 | [dependencies] | 12 | [dependencies] |
| 13 | cyw43 = { version = "0.3.0", path = "../cyw43" } | 13 | cyw43 = { version = "0.3.0", path = "../cyw43" } |
| 14 | embassy-rp = { version = "0.3.0", path = "../embassy-rp" } | 14 | embassy-rp = { version = "0.3.0", path = "../embassy-rp" } |
| 15 | pio-proc = { git = "https://github.com/rp-rs/pio-rs", rev = "fa586448b0b223217eec8c92c19fe6823dd04cc4" } | ||
| 16 | pio = { git = "https://github.com/rp-rs/pio-rs", rev = "fa586448b0b223217eec8c92c19fe6823dd04cc4" } | ||
| 17 | fixed = "1.23.1" | 15 | fixed = "1.23.1" |
| 18 | defmt = { version = "0.3", optional = true } | 16 | defmt = { version = "0.3", optional = true } |
| 19 | 17 | ||
diff --git a/cyw43-pio/src/lib.rs b/cyw43-pio/src/lib.rs index b08e68307..d0d504395 100644 --- a/cyw43-pio/src/lib.rs +++ b/cyw43-pio/src/lib.rs | |||
| @@ -8,11 +8,11 @@ use core::slice; | |||
| 8 | use cyw43::SpiBusCyw43; | 8 | use cyw43::SpiBusCyw43; |
| 9 | use embassy_rp::dma::Channel; | 9 | use embassy_rp::dma::Channel; |
| 10 | use embassy_rp::gpio::{Drive, Level, Output, Pull, SlewRate}; | 10 | use embassy_rp::gpio::{Drive, Level, Output, Pull, SlewRate}; |
| 11 | use embassy_rp::pio::program::pio_asm; | ||
| 11 | use embassy_rp::pio::{Common, Config, Direction, Instance, Irq, PioPin, ShiftDirection, StateMachine}; | 12 | use embassy_rp::pio::{Common, Config, Direction, Instance, Irq, PioPin, ShiftDirection, StateMachine}; |
| 12 | use embassy_rp::{Peripheral, PeripheralRef}; | 13 | use embassy_rp::{Peripheral, PeripheralRef}; |
| 13 | use fixed::types::extra::U8; | 14 | use fixed::types::extra::U8; |
| 14 | use fixed::FixedU32; | 15 | use fixed::FixedU32; |
| 15 | use pio_proc::pio_asm; | ||
| 16 | 16 | ||
| 17 | /// SPI comms driven by PIO. | 17 | /// SPI comms driven by PIO. |
| 18 | pub struct PioSpi<'d, PIO: Instance, const SM: usize, DMA> { | 18 | pub struct PioSpi<'d, PIO: Instance, const SM: usize, DMA> { |
diff --git a/embassy-rp/Cargo.toml b/embassy-rp/Cargo.toml index 5d4c4e9b5..539c579a3 100644 --- a/embassy-rp/Cargo.toml +++ b/embassy-rp/Cargo.toml | |||
| @@ -164,8 +164,7 @@ embedded-hal-1 = { package = "embedded-hal", version = "1.0" } | |||
| 164 | embedded-hal-async = { version = "1.0" } | 164 | embedded-hal-async = { version = "1.0" } |
| 165 | embedded-hal-nb = { version = "1.0" } | 165 | embedded-hal-nb = { version = "1.0" } |
| 166 | 166 | ||
| 167 | pio-proc = { git = "https://github.com/rp-rs/pio-rs", rev = "fa586448b0b223217eec8c92c19fe6823dd04cc4" } | 167 | pio = { git = "https://github.com/rp-rs/pio-rs", rev = "506a51b9bc135845e8544a0debd75847b73754dc" } |
| 168 | pio = { git = "https://github.com/rp-rs/pio-rs", rev = "fa586448b0b223217eec8c92c19fe6823dd04cc4" } | ||
| 169 | rp2040-boot2 = "0.3" | 168 | rp2040-boot2 = "0.3" |
| 170 | document-features = "0.2.10" | 169 | document-features = "0.2.10" |
| 171 | sha2-const-stable = "0.1" | 170 | sha2-const-stable = "0.1" |
diff --git a/embassy-rp/src/pio/mod.rs b/embassy-rp/src/pio/mod.rs index d4c0af55e..880d6effd 100644 --- a/embassy-rp/src/pio/mod.rs +++ b/embassy-rp/src/pio/mod.rs | |||
| @@ -20,6 +20,9 @@ use crate::{pac, peripherals, RegExt}; | |||
| 20 | 20 | ||
| 21 | mod instr; | 21 | mod instr; |
| 22 | 22 | ||
| 23 | #[doc(inline)] | ||
| 24 | pub use pio as program; | ||
| 25 | |||
| 23 | /// Wakers for interrupts and FIFOs. | 26 | /// Wakers for interrupts and FIFOs. |
| 24 | pub struct Wakers([AtomicWaker; 12]); | 27 | pub struct Wakers([AtomicWaker; 12]); |
| 25 | 28 | ||
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. |
diff --git a/examples/rp/Cargo.toml b/examples/rp/Cargo.toml index e05c88a9a..a81166067 100644 --- a/examples/rp/Cargo.toml +++ b/examples/rp/Cargo.toml | |||
| @@ -55,8 +55,6 @@ embedded-storage = { version = "0.3" } | |||
| 55 | static_cell = "2.1" | 55 | static_cell = "2.1" |
| 56 | portable-atomic = { version = "1.5", features = ["critical-section"] } | 56 | portable-atomic = { version = "1.5", features = ["critical-section"] } |
| 57 | log = "0.4" | 57 | log = "0.4" |
| 58 | pio-proc = { git = "https://github.com/rp-rs/pio-rs", rev = "fa586448b0b223217eec8c92c19fe6823dd04cc4" } | ||
| 59 | pio = { git = "https://github.com/rp-rs/pio-rs", rev = "fa586448b0b223217eec8c92c19fe6823dd04cc4" } | ||
| 60 | rand = { version = "0.8.5", default-features = false } | 58 | rand = { version = "0.8.5", default-features = false } |
| 61 | embedded-sdmmc = "0.7.0" | 59 | embedded-sdmmc = "0.7.0" |
| 62 | 60 | ||
diff --git a/examples/rp/src/bin/pio_async.rs b/examples/rp/src/bin/pio_async.rs index ee248591b..08c702347 100644 --- a/examples/rp/src/bin/pio_async.rs +++ b/examples/rp/src/bin/pio_async.rs | |||
| @@ -6,6 +6,7 @@ use defmt::info; | |||
| 6 | use embassy_executor::Spawner; | 6 | use embassy_executor::Spawner; |
| 7 | use embassy_rp::bind_interrupts; | 7 | use embassy_rp::bind_interrupts; |
| 8 | use embassy_rp::peripherals::PIO0; | 8 | use embassy_rp::peripherals::PIO0; |
| 9 | use embassy_rp::pio::program::pio_asm; | ||
| 9 | 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}; |
| 10 | use fixed::traits::ToFixed; | 11 | use fixed::traits::ToFixed; |
| 11 | use fixed_macro::types::U56F8; | 12 | use 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/rp/src/bin/pio_dma.rs b/examples/rp/src/bin/pio_dma.rs index 02700269c..d00ed2142 100644 --- a/examples/rp/src/bin/pio_dma.rs +++ b/examples/rp/src/bin/pio_dma.rs | |||
| @@ -6,6 +6,7 @@ use defmt::info; | |||
| 6 | use embassy_executor::Spawner; | 6 | use embassy_executor::Spawner; |
| 7 | use embassy_futures::join::join; | 7 | use embassy_futures::join::join; |
| 8 | use embassy_rp::peripherals::PIO0; | 8 | use embassy_rp::peripherals::PIO0; |
| 9 | use embassy_rp::pio::program::pio_asm; | ||
| 9 | use embassy_rp::pio::{Config, InterruptHandler, Pio, ShiftConfig, ShiftDirection}; | 10 | use embassy_rp::pio::{Config, InterruptHandler, Pio, ShiftConfig, ShiftDirection}; |
| 10 | use embassy_rp::{bind_interrupts, Peripheral}; | 11 | use embassy_rp::{bind_interrupts, Peripheral}; |
| 11 | use fixed::traits::ToFixed; | 12 | use 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/Cargo.toml b/examples/rp23/Cargo.toml index b7e7dd69a..f4dfae773 100644 --- a/examples/rp23/Cargo.toml +++ b/examples/rp23/Cargo.toml | |||
| @@ -55,8 +55,6 @@ embedded-storage = { version = "0.3" } | |||
| 55 | static_cell = "2.1" | 55 | static_cell = "2.1" |
| 56 | portable-atomic = { version = "1.5", features = ["critical-section"] } | 56 | portable-atomic = { version = "1.5", features = ["critical-section"] } |
| 57 | log = "0.4" | 57 | log = "0.4" |
| 58 | pio-proc = { git = "https://github.com/rp-rs/pio-rs", rev = "fa586448b0b223217eec8c92c19fe6823dd04cc4" } | ||
| 59 | pio = { git = "https://github.com/rp-rs/pio-rs", rev = "fa586448b0b223217eec8c92c19fe6823dd04cc4" } | ||
| 60 | rand = { version = "0.8.5", default-features = false } | 58 | rand = { version = "0.8.5", default-features = false } |
| 61 | embedded-sdmmc = "0.7.0" | 59 | embedded-sdmmc = "0.7.0" |
| 62 | 60 | ||
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; | |||
| 6 | use embassy_executor::Spawner; | 6 | use embassy_executor::Spawner; |
| 7 | use embassy_rp::bind_interrupts; | 7 | use embassy_rp::bind_interrupts; |
| 8 | use embassy_rp::peripherals::PIO0; | 8 | use embassy_rp::peripherals::PIO0; |
| 9 | use embassy_rp::pio::program::pio_asm; | ||
| 9 | 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}; |
| 10 | use fixed::traits::ToFixed; | 11 | use fixed::traits::ToFixed; |
| 11 | use fixed_macro::types::U56F8; | 12 | use 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; | |||
| 6 | use embassy_executor::Spawner; | 6 | use embassy_executor::Spawner; |
| 7 | use embassy_futures::join::join; | 7 | use embassy_futures::join::join; |
| 8 | use embassy_rp::peripherals::PIO0; | 8 | use embassy_rp::peripherals::PIO0; |
| 9 | use embassy_rp::pio::program::pio_asm; | ||
| 9 | use embassy_rp::pio::{Config, InterruptHandler, Pio, ShiftConfig, ShiftDirection}; | 10 | use embassy_rp::pio::{Config, InterruptHandler, Pio, ShiftConfig, ShiftDirection}; |
| 10 | use embassy_rp::{bind_interrupts, Peripheral}; | 11 | use embassy_rp::{bind_interrupts, Peripheral}; |
| 11 | use fixed::traits::ToFixed; | 12 | use 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; | |||
| 8 | use embassy_executor::Spawner; | 8 | use embassy_executor::Spawner; |
| 9 | use embassy_rp::gpio::Pull; | 9 | use embassy_rp::gpio::Pull; |
| 10 | use embassy_rp::peripherals::PIO0; | 10 | use embassy_rp::peripherals::PIO0; |
| 11 | use embassy_rp::pio::program::pio_asm; | ||
| 11 | use embassy_rp::{bind_interrupts, pio}; | 12 | use embassy_rp::{bind_interrupts, pio}; |
| 12 | use embassy_time::Timer; | 13 | use embassy_time::Timer; |
| 13 | use fixed::traits::ToFixed; | 14 | use 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" |
diff --git a/tests/rp/Cargo.toml b/tests/rp/Cargo.toml index 5a6a6c75a..3d6cd6ab8 100644 --- a/tests/rp/Cargo.toml +++ b/tests/rp/Cargo.toml | |||
| @@ -33,8 +33,6 @@ embedded-io-async = { version = "0.6.1" } | |||
| 33 | embedded-storage = { version = "0.3" } | 33 | embedded-storage = { version = "0.3" } |
| 34 | static_cell = "2" | 34 | static_cell = "2" |
| 35 | portable-atomic = { version = "1.5", features = ["critical-section"] } | 35 | portable-atomic = { version = "1.5", features = ["critical-section"] } |
| 36 | pio-proc = { git = "https://github.com/rp-rs/pio-rs", rev = "fa586448b0b223217eec8c92c19fe6823dd04cc4" } | ||
| 37 | pio = { git = "https://github.com/rp-rs/pio-rs", rev = "fa586448b0b223217eec8c92c19fe6823dd04cc4" } | ||
| 38 | rand = { version = "0.8.5", default-features = false } | 36 | rand = { version = "0.8.5", default-features = false } |
| 39 | 37 | ||
| 40 | [profile.dev] | 38 | [profile.dev] |
diff --git a/tests/rp/src/bin/pio_irq.rs b/tests/rp/src/bin/pio_irq.rs index 33cdaaac9..1fee6dc2f 100644 --- a/tests/rp/src/bin/pio_irq.rs +++ b/tests/rp/src/bin/pio_irq.rs | |||
| @@ -6,6 +6,7 @@ use defmt::info; | |||
| 6 | use embassy_executor::Spawner; | 6 | use embassy_executor::Spawner; |
| 7 | use embassy_rp::bind_interrupts; | 7 | use embassy_rp::bind_interrupts; |
| 8 | use embassy_rp::peripherals::PIO0; | 8 | use embassy_rp::peripherals::PIO0; |
| 9 | use embassy_rp::pio::program::pio_asm; | ||
| 9 | use embassy_rp::pio::{Config, InterruptHandler, Pio}; | 10 | use embassy_rp::pio::{Config, InterruptHandler, Pio}; |
| 10 | use {defmt_rtt as _, panic_probe as _}; | 11 | use {defmt_rtt as _, panic_probe as _}; |
| 11 | 12 | ||
| @@ -24,7 +25,7 @@ async fn main(_spawner: Spawner) { | |||
| 24 | .. | 25 | .. |
| 25 | } = Pio::new(pio, Irqs); | 26 | } = Pio::new(pio, Irqs); |
| 26 | 27 | ||
| 27 | let prg = pio_proc::pio_asm!( | 28 | let prg = pio_asm!( |
| 28 | "irq set 0", | 29 | "irq set 0", |
| 29 | "irq wait 0", | 30 | "irq wait 0", |
| 30 | "irq set 1", | 31 | "irq set 1", |
diff --git a/tests/rp/src/bin/pio_multi_load.rs b/tests/rp/src/bin/pio_multi_load.rs index cd28f99b6..71321015b 100644 --- a/tests/rp/src/bin/pio_multi_load.rs +++ b/tests/rp/src/bin/pio_multi_load.rs | |||
| @@ -6,6 +6,7 @@ use defmt::info; | |||
| 6 | use embassy_executor::Spawner; | 6 | use embassy_executor::Spawner; |
| 7 | use embassy_rp::bind_interrupts; | 7 | use embassy_rp::bind_interrupts; |
| 8 | use embassy_rp::peripherals::PIO0; | 8 | use embassy_rp::peripherals::PIO0; |
| 9 | use embassy_rp::pio::program::pio_asm; | ||
| 9 | use embassy_rp::pio::{Config, InterruptHandler, LoadError, Pio}; | 10 | use embassy_rp::pio::{Config, InterruptHandler, LoadError, Pio}; |
| 10 | use {defmt_rtt as _, panic_probe as _}; | 11 | use {defmt_rtt as _, panic_probe as _}; |
| 11 | 12 | ||
| @@ -27,7 +28,7 @@ async fn main(_spawner: Spawner) { | |||
| 27 | } = Pio::new(pio, Irqs); | 28 | } = Pio::new(pio, Irqs); |
| 28 | 29 | ||
| 29 | // load with explicit origin works | 30 | // load with explicit origin works |
| 30 | let prg1 = pio_proc::pio_asm!( | 31 | let prg1 = pio_asm!( |
| 31 | ".origin 4" | 32 | ".origin 4" |
| 32 | "nop", | 33 | "nop", |
| 33 | "nop", | 34 | "nop", |
| @@ -46,15 +47,14 @@ async fn main(_spawner: Spawner) { | |||
| 46 | assert_eq!(loaded1.wrap.target, 4); | 47 | assert_eq!(loaded1.wrap.target, 4); |
| 47 | 48 | ||
| 48 | // load without origin chooses a free space | 49 | // load without origin chooses a free space |
| 49 | let prg2 = pio_proc::pio_asm!("nop", "nop", "nop", "nop", "nop", "nop", "nop", "irq 1", "nop", "nop",); | 50 | let prg2 = pio_asm!("nop", "nop", "nop", "nop", "nop", "nop", "nop", "irq 1", "nop", "nop",); |
| 50 | let loaded2 = common.load_program(&prg2.program); | 51 | let loaded2 = common.load_program(&prg2.program); |
| 51 | assert_eq!(loaded2.origin, 14); | 52 | assert_eq!(loaded2.origin, 14); |
| 52 | assert_eq!(loaded2.wrap.source, 23); | 53 | assert_eq!(loaded2.wrap.source, 23); |
| 53 | assert_eq!(loaded2.wrap.target, 14); | 54 | assert_eq!(loaded2.wrap.target, 14); |
| 54 | 55 | ||
| 55 | // wrapping around the end of program space automatically works | 56 | // wrapping around the end of program space automatically works |
| 56 | let prg3 = | 57 | let prg3 = pio_asm!("nop", "nop", "nop", "nop", "nop", "nop", "nop", "nop", "nop", "nop", "nop", "irq 2",); |
| 57 | pio_proc::pio_asm!("nop", "nop", "nop", "nop", "nop", "nop", "nop", "nop", "nop", "nop", "nop", "irq 2",); | ||
| 58 | let loaded3 = common.load_program(&prg3.program); | 58 | let loaded3 = common.load_program(&prg3.program); |
| 59 | assert_eq!(loaded3.origin, 24); | 59 | assert_eq!(loaded3.origin, 24); |
| 60 | assert_eq!(loaded3.wrap.source, 3); | 60 | assert_eq!(loaded3.wrap.source, 3); |
| @@ -88,13 +88,13 @@ async fn main(_spawner: Spawner) { | |||
| 88 | 88 | ||
| 89 | // instruction memory is full now. all loads should fail. | 89 | // instruction memory is full now. all loads should fail. |
| 90 | { | 90 | { |
| 91 | let prg = pio_proc::pio_asm!(".origin 0", "nop"); | 91 | let prg = pio_asm!(".origin 0", "nop"); |
| 92 | match common.try_load_program(&prg.program) { | 92 | match common.try_load_program(&prg.program) { |
| 93 | Err(LoadError::AddressInUse(0)) => (), | 93 | Err(LoadError::AddressInUse(0)) => (), |
| 94 | _ => panic!("program loaded when it shouldn't"), | 94 | _ => panic!("program loaded when it shouldn't"), |
| 95 | }; | 95 | }; |
| 96 | 96 | ||
| 97 | let prg = pio_proc::pio_asm!("nop"); | 97 | let prg = pio_asm!("nop"); |
| 98 | match common.try_load_program(&prg.program) { | 98 | match common.try_load_program(&prg.program) { |
| 99 | Err(LoadError::InsufficientSpace) => (), | 99 | Err(LoadError::InsufficientSpace) => (), |
| 100 | _ => panic!("program loaded when it shouldn't"), | 100 | _ => panic!("program loaded when it shouldn't"), |
| @@ -106,13 +106,13 @@ async fn main(_spawner: Spawner) { | |||
| 106 | common.free_instr(loaded3.used_memory); | 106 | common.free_instr(loaded3.used_memory); |
| 107 | } | 107 | } |
| 108 | { | 108 | { |
| 109 | let prg = pio_proc::pio_asm!(".origin 0", "nop"); | 109 | let prg = pio_asm!(".origin 0", "nop"); |
| 110 | match common.try_load_program(&prg.program) { | 110 | match common.try_load_program(&prg.program) { |
| 111 | Ok(_) => (), | 111 | Ok(_) => (), |
| 112 | _ => panic!("program didn't loaded when it shouldn"), | 112 | _ => panic!("program didn't loaded when it shouldn"), |
| 113 | }; | 113 | }; |
| 114 | 114 | ||
| 115 | let prg = pio_proc::pio_asm!("nop"); | 115 | let prg = pio_asm!("nop"); |
| 116 | match common.try_load_program(&prg.program) { | 116 | match common.try_load_program(&prg.program) { |
| 117 | Ok(_) => (), | 117 | Ok(_) => (), |
| 118 | _ => panic!("program didn't loaded when it shouldn"), | 118 | _ => panic!("program didn't loaded when it shouldn"), |
