aboutsummaryrefslogtreecommitdiff
path: root/examples
diff options
context:
space:
mode:
authorpennae <[email protected]>2023-05-03 17:16:35 +0200
committerpennae <[email protected]>2023-05-05 19:08:16 +0200
commit8ebe6e5f2029026594c703820c11d703da2c0334 (patch)
tree567ee3174b2f140c6a0ce99d40c0d599279ef799 /examples
parent4439031d4323a5d1e11af22887a32bb76cb953fb (diff)
rp/pio: drop Pio prefix from almost all names
it's only any good for PioPin because there it follows a pattern of gpio pin alternate functions being named like that, everything else can just as well be referred to as `pio::Thing`
Diffstat (limited to 'examples')
-rw-r--r--examples/rp/src/bin/pio_async.rs14
-rw-r--r--examples/rp/src/bin/pio_hd44780.rs4
-rw-r--r--examples/rp/src/bin/ws2812-pio.rs10
3 files changed, 14 insertions, 14 deletions
diff --git a/examples/rp/src/bin/pio_async.rs b/examples/rp/src/bin/pio_async.rs
index 4e0ab5e3c..461ea3ff9 100644
--- a/examples/rp/src/bin/pio_async.rs
+++ b/examples/rp/src/bin/pio_async.rs
@@ -4,12 +4,12 @@
4use defmt::info; 4use defmt::info;
5use embassy_executor::Spawner; 5use embassy_executor::Spawner;
6use embassy_rp::peripherals::PIO0; 6use embassy_rp::peripherals::PIO0;
7use embassy_rp::pio::{Pio, PioCommon, PioIrq, PioPin, PioStateMachine, ShiftDirection}; 7use embassy_rp::pio::{Common, Irq, Pio, PioPin, ShiftDirection, StateMachine};
8use embassy_rp::pio_instr_util; 8use embassy_rp::pio_instr_util;
9use embassy_rp::relocate::RelocatedProgram; 9use embassy_rp::relocate::RelocatedProgram;
10use {defmt_rtt as _, panic_probe as _}; 10use {defmt_rtt as _, panic_probe as _};
11 11
12fn setup_pio_task_sm0(pio: &mut PioCommon<PIO0>, sm: &mut PioStateMachine<PIO0, 0>, pin: impl PioPin) { 12fn setup_pio_task_sm0(pio: &mut Common<PIO0>, sm: &mut StateMachine<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 PioStateMachine<PIO0,
37} 37}
38 38
39#[embassy_executor::task] 39#[embassy_executor::task]
40async fn pio_task_sm0(mut sm: PioStateMachine<'static, PIO0, 0>) { 40async fn pio_task_sm0(mut sm: StateMachine<'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: PioStateMachine<'static, PIO0, 0>) {
48 } 48 }
49} 49}
50 50
51fn setup_pio_task_sm1(pio: &mut PioCommon<PIO0>, sm: &mut PioStateMachine<PIO0, 1>) { 51fn setup_pio_task_sm1(pio: &mut Common<PIO0>, sm: &mut StateMachine<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 PioStateMachine<PIO0,
67} 67}
68 68
69#[embassy_executor::task] 69#[embassy_executor::task]
70async fn pio_task_sm1(mut sm: PioStateMachine<'static, PIO0, 1>) { 70async fn pio_task_sm1(mut sm: StateMachine<'static, PIO0, 1>) {
71 sm.set_enable(true); 71 sm.set_enable(true);
72 loop { 72 loop {
73 let rx = sm.rx().wait_pull().await; 73 let rx = sm.rx().wait_pull().await;
@@ -75,7 +75,7 @@ async fn pio_task_sm1(mut sm: PioStateMachine<'static, PIO0, 1>) {
75 } 75 }
76} 76}
77 77
78fn setup_pio_task_sm2(pio: &mut PioCommon<PIO0>, sm: &mut PioStateMachine<PIO0, 2>) { 78fn setup_pio_task_sm2(pio: &mut Common<PIO0>, sm: &mut StateMachine<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 PioStateMachine<PIO0,
99} 99}
100 100
101#[embassy_executor::task] 101#[embassy_executor::task]
102async fn pio_task_sm2(mut irq: PioIrq<'static, PIO0, 3>, mut sm: PioStateMachine<'static, PIO0, 2>) { 102async fn pio_task_sm2(mut irq: Irq<'static, PIO0, 3>, mut sm: StateMachine<'static, PIO0, 2>) {
103 sm.set_enable(true); 103 sm.set_enable(true);
104 loop { 104 loop {
105 irq.wait().await; 105 irq.wait().await;
diff --git a/examples/rp/src/bin/pio_hd44780.rs b/examples/rp/src/bin/pio_hd44780.rs
index f76d334e7..17b2440cf 100644
--- a/examples/rp/src/bin/pio_hd44780.rs
+++ b/examples/rp/src/bin/pio_hd44780.rs
@@ -7,7 +7,7 @@ use core::fmt::Write;
7use embassy_executor::Spawner; 7use embassy_executor::Spawner;
8use embassy_rp::dma::{AnyChannel, Channel}; 8use embassy_rp::dma::{AnyChannel, Channel};
9use embassy_rp::peripherals::PIO0; 9use embassy_rp::peripherals::PIO0;
10use embassy_rp::pio::{FifoJoin, Pio, PioPin, PioStateMachine, ShiftDirection}; 10use embassy_rp::pio::{FifoJoin, Pio, PioPin, ShiftDirection, StateMachine};
11use embassy_rp::pwm::{Config, Pwm}; 11use embassy_rp::pwm::{Config, Pwm};
12use embassy_rp::relocate::RelocatedProgram; 12use embassy_rp::relocate::RelocatedProgram;
13use embassy_rp::{into_ref, Peripheral, PeripheralRef}; 13use embassy_rp::{into_ref, Peripheral, PeripheralRef};
@@ -64,7 +64,7 @@ async fn main(_spawner: Spawner) {
64 64
65pub struct HD44780<'l> { 65pub struct HD44780<'l> {
66 dma: PeripheralRef<'l, AnyChannel>, 66 dma: PeripheralRef<'l, AnyChannel>,
67 sm: PioStateMachine<'l, PIO0, 0>, 67 sm: StateMachine<'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 c9c701a70..2e6860d8b 100644
--- a/examples/rp/src/bin/ws2812-pio.rs
+++ b/examples/rp/src/bin/ws2812-pio.rs
@@ -4,18 +4,18 @@
4 4
5use defmt::*; 5use defmt::*;
6use embassy_executor::Spawner; 6use embassy_executor::Spawner;
7use embassy_rp::pio::{FifoJoin, Pio, PioCommon, PioInstance, PioPin, PioStateMachine, ShiftDirection}; 7use embassy_rp::pio::{Common, FifoJoin, Instance, Pio, PioPin, ShiftDirection, StateMachine};
8use embassy_rp::pio_instr_util; 8use embassy_rp::pio_instr_util;
9use embassy_rp::relocate::RelocatedProgram; 9use embassy_rp::relocate::RelocatedProgram;
10use embassy_time::{Duration, Timer}; 10use embassy_time::{Duration, Timer};
11use smart_leds::RGB8; 11use smart_leds::RGB8;
12use {defmt_rtt as _, panic_probe as _}; 12use {defmt_rtt as _, panic_probe as _};
13pub struct Ws2812<'d, P: PioInstance, const S: usize> { 13pub struct Ws2812<'d, P: Instance, const S: usize> {
14 sm: PioStateMachine<'d, P, S>, 14 sm: StateMachine<'d, P, S>,
15} 15}
16 16
17impl<'d, P: PioInstance, const S: usize> Ws2812<'d, P, S> { 17impl<'d, P: Instance, const S: usize> Ws2812<'d, P, S> {
18 pub fn new(mut pio: PioCommon<'d, P>, mut sm: PioStateMachine<'d, P, S>, pin: impl PioPin) -> Self { 18 pub fn new(mut pio: Common<'d, P>, mut sm: StateMachine<'d, P, S>, pin: impl PioPin) -> Self {
19 // Setup sm0 19 // Setup sm0
20 20
21 // prepare the PIO program 21 // prepare the PIO program