diff options
Diffstat (limited to 'examples')
| -rw-r--r-- | examples/rp/src/bin/pio_async.rs | 4 | ||||
| -rw-r--r-- | examples/rp/src/bin/pio_dma.rs | 5 | ||||
| -rw-r--r-- | examples/rp/src/bin/pio_hd44780.rs | 16 | ||||
| -rw-r--r-- | examples/rp/src/bin/ws2812-pio.rs | 2 |
4 files changed, 14 insertions, 13 deletions
diff --git a/examples/rp/src/bin/pio_async.rs b/examples/rp/src/bin/pio_async.rs index 3d76a7d7b..4e0ab5e3c 100644 --- a/examples/rp/src/bin/pio_async.rs +++ b/examples/rp/src/bin/pio_async.rs | |||
| @@ -42,7 +42,7 @@ async fn pio_task_sm0(mut sm: PioStateMachine<'static, PIO0, 0>) { | |||
| 42 | 42 | ||
| 43 | let mut v = 0x0f0caffa; | 43 | let mut v = 0x0f0caffa; |
| 44 | loop { | 44 | loop { |
| 45 | sm.wait_push(v).await; | 45 | sm.tx().wait_push(v).await; |
| 46 | v ^= 0xffff; | 46 | v ^= 0xffff; |
| 47 | info!("Pushed {:032b} to FIFO", v); | 47 | info!("Pushed {:032b} to FIFO", v); |
| 48 | } | 48 | } |
| @@ -70,7 +70,7 @@ fn setup_pio_task_sm1(pio: &mut PioCommon<PIO0>, sm: &mut PioStateMachine<PIO0, | |||
| 70 | async fn pio_task_sm1(mut sm: PioStateMachine<'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.rx().wait_pull().await; |
| 74 | info!("Pulled {:032b} from FIFO", rx); | 74 | info!("Pulled {:032b} from FIFO", rx); |
| 75 | } | 75 | } |
| 76 | } | 76 | } |
diff --git a/examples/rp/src/bin/pio_dma.rs b/examples/rp/src/bin/pio_dma.rs index a2a2ee39a..c664482e5 100644 --- a/examples/rp/src/bin/pio_dma.rs +++ b/examples/rp/src/bin/pio_dma.rs | |||
| @@ -60,9 +60,10 @@ async fn main(_spawner: Spawner) { | |||
| 60 | } | 60 | } |
| 61 | let mut din = [0u32; 29]; | 61 | let mut din = [0u32; 29]; |
| 62 | loop { | 62 | loop { |
| 63 | let (rx, tx) = sm.rx_tx(); | ||
| 63 | join( | 64 | join( |
| 64 | sm.dma_push(dma_out_ref.reborrow(), &dout), | 65 | tx.dma_push(dma_out_ref.reborrow(), &dout), |
| 65 | sm.dma_pull(dma_in_ref.reborrow(), &mut din), | 66 | rx.dma_pull(dma_in_ref.reborrow(), &mut din), |
| 66 | ) | 67 | ) |
| 67 | .await; | 68 | .await; |
| 68 | for i in 0..din.len() { | 69 | for i in 0..din.len() { |
diff --git a/examples/rp/src/bin/pio_hd44780.rs b/examples/rp/src/bin/pio_hd44780.rs index 7c1d7acfe..f76d334e7 100644 --- a/examples/rp/src/bin/pio_hd44780.rs +++ b/examples/rp/src/bin/pio_hd44780.rs | |||
| @@ -139,14 +139,14 @@ impl<'l> HD44780<'l> { | |||
| 139 | 139 | ||
| 140 | sm0.set_enable(true); | 140 | sm0.set_enable(true); |
| 141 | // init to 8 bit thrice | 141 | // init to 8 bit thrice |
| 142 | sm0.push_tx((50000 << 8) | 0x30); | 142 | sm0.tx().push((50000 << 8) | 0x30); |
| 143 | sm0.push_tx((5000 << 8) | 0x30); | 143 | sm0.tx().push((5000 << 8) | 0x30); |
| 144 | sm0.push_tx((200 << 8) | 0x30); | 144 | sm0.tx().push((200 << 8) | 0x30); |
| 145 | // init 4 bit | 145 | // init 4 bit |
| 146 | sm0.push_tx((200 << 8) | 0x20); | 146 | sm0.tx().push((200 << 8) | 0x20); |
| 147 | // set font and lines | 147 | // set font and lines |
| 148 | sm0.push_tx((50 << 8) | 0x20); | 148 | sm0.tx().push((50 << 8) | 0x20); |
| 149 | sm0.push_tx(0b1100_0000); | 149 | sm0.tx().push(0b1100_0000); |
| 150 | 150 | ||
| 151 | irq0.wait().await; | 151 | irq0.wait().await; |
| 152 | sm0.set_enable(false); | 152 | sm0.set_enable(false); |
| @@ -216,7 +216,7 @@ impl<'l> HD44780<'l> { | |||
| 216 | sm0.set_enable(true); | 216 | sm0.set_enable(true); |
| 217 | 217 | ||
| 218 | // display on and cursor on and blinking, reset display | 218 | // display on and cursor on and blinking, reset display |
| 219 | sm0.dma_push(dma.reborrow(), &[0x81u8, 0x0f, 1]).await; | 219 | sm0.tx().dma_push(dma.reborrow(), &[0x81u8, 0x0f, 1]).await; |
| 220 | 220 | ||
| 221 | Self { | 221 | Self { |
| 222 | dma: dma.map_into(), | 222 | dma: dma.map_into(), |
| @@ -240,6 +240,6 @@ impl<'l> HD44780<'l> { | |||
| 240 | // set cursor to 1:15 | 240 | // set cursor to 1:15 |
| 241 | self.buf[38..].copy_from_slice(&[0x80, 0xcf]); | 241 | self.buf[38..].copy_from_slice(&[0x80, 0xcf]); |
| 242 | 242 | ||
| 243 | self.sm.dma_push(self.dma.reborrow(), &self.buf).await; | 243 | self.sm.tx().dma_push(self.dma.reborrow(), &self.buf).await; |
| 244 | } | 244 | } |
| 245 | } | 245 | } |
diff --git a/examples/rp/src/bin/ws2812-pio.rs b/examples/rp/src/bin/ws2812-pio.rs index 713e01b44..c9c701a70 100644 --- a/examples/rp/src/bin/ws2812-pio.rs +++ b/examples/rp/src/bin/ws2812-pio.rs | |||
| @@ -87,7 +87,7 @@ impl<'d, P: PioInstance, const S: usize> Ws2812<'d, P, S> { | |||
| 87 | pub async fn write(&mut self, colors: &[RGB8]) { | 87 | pub async fn write(&mut self, colors: &[RGB8]) { |
| 88 | for color in colors { | 88 | for color in colors { |
| 89 | let word = (u32::from(color.g) << 24) | (u32::from(color.r) << 16) | (u32::from(color.b) << 8); | 89 | let word = (u32::from(color.g) << 24) | (u32::from(color.r) << 16) | (u32::from(color.b) << 8); |
| 90 | self.sm.wait_push(word).await; | 90 | self.sm.tx().wait_push(word).await; |
| 91 | } | 91 | } |
| 92 | } | 92 | } |
| 93 | } | 93 | } |
