diff options
| author | pennae <[email protected]> | 2023-05-03 09:42:42 +0200 |
|---|---|---|
| committer | pennae <[email protected]> | 2023-05-03 11:25:58 +0200 |
| commit | 906d2b2db78d287ad818ab2a7abb1fec572ac6f6 (patch) | |
| tree | 2e920e24d99bc1d8fab1da080376c74f4ceeed9f /examples | |
| parent | 79985f003646d379f2aea2738dc0291770e701c5 (diff) | |
rp/pio: PioStateMachine{Instance, => ,Instance}
next step: get rid of the insance trait entirely
Diffstat (limited to 'examples')
| -rw-r--r-- | examples/rp/src/bin/pio_async.rs | 12 | ||||
| -rw-r--r-- | examples/rp/src/bin/pio_dma.rs | 2 | ||||
| -rw-r--r-- | examples/rp/src/bin/pio_hd44780.rs | 2 | ||||
| -rw-r--r-- | examples/rp/src/bin/ws2812-pio.rs | 4 |
4 files changed, 10 insertions, 10 deletions
diff --git a/examples/rp/src/bin/pio_async.rs b/examples/rp/src/bin/pio_async.rs index 154cc6b65..8c02f9f16 100644 --- a/examples/rp/src/bin/pio_async.rs +++ b/examples/rp/src/bin/pio_async.rs | |||
| @@ -9,7 +9,7 @@ use embassy_rp::pio_instr_util; | |||
| 9 | use embassy_rp::relocate::RelocatedProgram; | 9 | use embassy_rp::relocate::RelocatedProgram; |
| 10 | use {defmt_rtt as _, panic_probe as _}; | 10 | use {defmt_rtt as _, panic_probe as _}; |
| 11 | 11 | ||
| 12 | fn setup_pio_task_sm0(pio: &mut PioCommon<PIO0>, sm: &mut PioStateMachineInstance<PIO0, 0>, pin: impl PioPin) { | 12 | fn setup_pio_task_sm0(pio: &mut PioCommon<PIO0>, sm: &mut PioStateMachine<PIO0, 0>, pin: impl PioPin) { |
| 13 | // Setup sm0 | 13 | // Setup sm0 |
| 14 | 14 | ||
| 15 | // Send data serially to pin | 15 | // Send data serially to pin |
| @@ -37,7 +37,7 @@ fn setup_pio_task_sm0(pio: &mut PioCommon<PIO0>, sm: &mut PioStateMachineInstanc | |||
| 37 | } | 37 | } |
| 38 | 38 | ||
| 39 | #[embassy_executor::task] | 39 | #[embassy_executor::task] |
| 40 | async fn pio_task_sm0(mut sm: PioStateMachineInstance<'static, PIO0, 0>) { | 40 | async fn pio_task_sm0(mut sm: PioStateMachine<'static, PIO0, 0>) { |
| 41 | sm.set_enable(true); | 41 | sm.set_enable(true); |
| 42 | 42 | ||
| 43 | let mut v = 0x0f0caffa; | 43 | let mut v = 0x0f0caffa; |
| @@ -48,7 +48,7 @@ async fn pio_task_sm0(mut sm: PioStateMachineInstance<'static, PIO0, 0>) { | |||
| 48 | } | 48 | } |
| 49 | } | 49 | } |
| 50 | 50 | ||
| 51 | fn setup_pio_task_sm1(pio: &mut PioCommon<PIO0>, sm: &mut PioStateMachineInstance<PIO0, 1>) { | 51 | fn setup_pio_task_sm1(pio: &mut PioCommon<PIO0>, sm: &mut PioStateMachine<PIO0, 1>) { |
| 52 | // Setupm sm1 | 52 | // Setupm sm1 |
| 53 | 53 | ||
| 54 | // Read 0b10101 repeatedly until ISR is full | 54 | // Read 0b10101 repeatedly until ISR is full |
| @@ -67,7 +67,7 @@ fn setup_pio_task_sm1(pio: &mut PioCommon<PIO0>, sm: &mut PioStateMachineInstanc | |||
| 67 | } | 67 | } |
| 68 | 68 | ||
| 69 | #[embassy_executor::task] | 69 | #[embassy_executor::task] |
| 70 | async fn pio_task_sm1(mut sm: PioStateMachineInstance<'static, PIO0, 1>) { | 70 | async fn pio_task_sm1(mut sm: PioStateMachine<'static, PIO0, 1>) { |
| 71 | sm.set_enable(true); | 71 | sm.set_enable(true); |
| 72 | loop { | 72 | loop { |
| 73 | let rx = sm.wait_pull().await; | 73 | let rx = sm.wait_pull().await; |
| @@ -75,7 +75,7 @@ async fn pio_task_sm1(mut sm: PioStateMachineInstance<'static, PIO0, 1>) { | |||
| 75 | } | 75 | } |
| 76 | } | 76 | } |
| 77 | 77 | ||
| 78 | fn setup_pio_task_sm2(pio: &mut PioCommon<PIO0>, sm: &mut PioStateMachineInstance<PIO0, 2>) { | 78 | fn setup_pio_task_sm2(pio: &mut PioCommon<PIO0>, sm: &mut PioStateMachine<PIO0, 2>) { |
| 79 | // Setup sm2 | 79 | // Setup sm2 |
| 80 | 80 | ||
| 81 | // Repeatedly trigger IRQ 3 | 81 | // Repeatedly trigger IRQ 3 |
| @@ -99,7 +99,7 @@ fn setup_pio_task_sm2(pio: &mut PioCommon<PIO0>, sm: &mut PioStateMachineInstanc | |||
| 99 | } | 99 | } |
| 100 | 100 | ||
| 101 | #[embassy_executor::task] | 101 | #[embassy_executor::task] |
| 102 | async fn pio_task_sm2(mut sm: PioStateMachineInstance<'static, PIO0, 2>) { | 102 | async fn pio_task_sm2(mut sm: PioStateMachine<'static, PIO0, 2>) { |
| 103 | sm.set_enable(true); | 103 | sm.set_enable(true); |
| 104 | loop { | 104 | loop { |
| 105 | sm.wait_irq(3).await; | 105 | sm.wait_irq(3).await; |
diff --git a/examples/rp/src/bin/pio_dma.rs b/examples/rp/src/bin/pio_dma.rs index 0f1f6df12..a351e2c7c 100644 --- a/examples/rp/src/bin/pio_dma.rs +++ b/examples/rp/src/bin/pio_dma.rs | |||
| @@ -4,7 +4,7 @@ | |||
| 4 | use defmt::info; | 4 | use defmt::info; |
| 5 | use embassy_executor::Spawner; | 5 | use embassy_executor::Spawner; |
| 6 | use embassy_futures::join::join; | 6 | use embassy_futures::join::join; |
| 7 | use embassy_rp::pio::{Pio, PioStateMachine, ShiftDirection}; | 7 | use embassy_rp::pio::{Pio, PioStateMachineInstance, ShiftDirection}; |
| 8 | use embassy_rp::relocate::RelocatedProgram; | 8 | use embassy_rp::relocate::RelocatedProgram; |
| 9 | use embassy_rp::{pio_instr_util, Peripheral}; | 9 | use embassy_rp::{pio_instr_util, Peripheral}; |
| 10 | use {defmt_rtt as _, panic_probe as _}; | 10 | use {defmt_rtt as _, panic_probe as _}; |
diff --git a/examples/rp/src/bin/pio_hd44780.rs b/examples/rp/src/bin/pio_hd44780.rs index 6d56bc233..249711a32 100644 --- a/examples/rp/src/bin/pio_hd44780.rs +++ b/examples/rp/src/bin/pio_hd44780.rs | |||
| @@ -64,7 +64,7 @@ async fn main(_spawner: Spawner) { | |||
| 64 | 64 | ||
| 65 | pub struct HD44780<'l> { | 65 | pub struct HD44780<'l> { |
| 66 | dma: PeripheralRef<'l, AnyChannel>, | 66 | dma: PeripheralRef<'l, AnyChannel>, |
| 67 | sm: PioStateMachineInstance<'l, PIO0, 0>, | 67 | sm: PioStateMachine<'l, PIO0, 0>, |
| 68 | 68 | ||
| 69 | buf: [u8; 40], | 69 | buf: [u8; 40], |
| 70 | } | 70 | } |
diff --git a/examples/rp/src/bin/ws2812-pio.rs b/examples/rp/src/bin/ws2812-pio.rs index 8276fad64..c141560e5 100644 --- a/examples/rp/src/bin/ws2812-pio.rs +++ b/examples/rp/src/bin/ws2812-pio.rs | |||
| @@ -13,11 +13,11 @@ use embassy_time::{Duration, Timer}; | |||
| 13 | use smart_leds::RGB8; | 13 | use smart_leds::RGB8; |
| 14 | use {defmt_rtt as _, panic_probe as _}; | 14 | use {defmt_rtt as _, panic_probe as _}; |
| 15 | pub struct Ws2812<'d, P: PioInstance, const S: usize> { | 15 | pub struct Ws2812<'d, P: PioInstance, const S: usize> { |
| 16 | sm: PioStateMachineInstance<'d, P, S>, | 16 | sm: PioStateMachine<'d, P, S>, |
| 17 | } | 17 | } |
| 18 | 18 | ||
| 19 | impl<'d, P: PioInstance, const S: usize> Ws2812<'d, P, S> { | 19 | impl<'d, P: PioInstance, const S: usize> Ws2812<'d, P, S> { |
| 20 | pub fn new(mut pio: PioCommon<'d, P>, mut sm: PioStateMachineInstance<'d, P, S>, pin: impl PioPin) -> Self { | 20 | pub fn new(mut pio: PioCommon<'d, P>, mut sm: PioStateMachine<'d, P, S>, pin: impl PioPin) -> Self { |
| 21 | // Setup sm0 | 21 | // Setup sm0 |
| 22 | 22 | ||
| 23 | // prepare the PIO program | 23 | // prepare the PIO program |
