diff options
| author | Dario Nieuwenhuis <[email protected]> | 2025-03-26 16:01:37 +0100 |
|---|---|---|
| committer | Dario Nieuwenhuis <[email protected]> | 2025-03-27 15:18:06 +0100 |
| commit | d41eeeae79388f219bf6a84e2f7bde9f6b532516 (patch) | |
| tree | 678b6fc732216e529dc38e6f65b72a309917ac32 /examples/rp/src/bin/zerocopy.rs | |
| parent | 9edf5b7f049f95742b60b041e4443967d8a6b708 (diff) | |
Remove Peripheral trait, rename PeripheralRef->Peri.
Diffstat (limited to 'examples/rp/src/bin/zerocopy.rs')
| -rw-r--r-- | examples/rp/src/bin/zerocopy.rs | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/examples/rp/src/bin/zerocopy.rs b/examples/rp/src/bin/zerocopy.rs index 39f03c8e4..d1fb0eb00 100644 --- a/examples/rp/src/bin/zerocopy.rs +++ b/examples/rp/src/bin/zerocopy.rs | |||
| @@ -9,9 +9,9 @@ use core::sync::atomic::{AtomicU16, Ordering}; | |||
| 9 | use defmt::*; | 9 | use defmt::*; |
| 10 | use embassy_executor::Spawner; | 10 | use embassy_executor::Spawner; |
| 11 | use embassy_rp::adc::{self, Adc, Async, Config, InterruptHandler}; | 11 | use embassy_rp::adc::{self, Adc, Async, Config, InterruptHandler}; |
| 12 | use embassy_rp::bind_interrupts; | ||
| 13 | use embassy_rp::gpio::Pull; | 12 | use embassy_rp::gpio::Pull; |
| 14 | use embassy_rp::peripherals::DMA_CH0; | 13 | use embassy_rp::peripherals::DMA_CH0; |
| 14 | use embassy_rp::{bind_interrupts, Peri}; | ||
| 15 | use embassy_sync::blocking_mutex::raw::NoopRawMutex; | 15 | use embassy_sync::blocking_mutex::raw::NoopRawMutex; |
| 16 | use embassy_sync::zerocopy_channel::{Channel, Receiver, Sender}; | 16 | use embassy_sync::zerocopy_channel::{Channel, Receiver, Sender}; |
| 17 | use embassy_time::{Duration, Ticker, Timer}; | 17 | use embassy_time::{Duration, Ticker, Timer}; |
| @@ -31,7 +31,7 @@ static MAX: AtomicU16 = AtomicU16::new(0); | |||
| 31 | struct AdcParts { | 31 | struct AdcParts { |
| 32 | adc: Adc<'static, Async>, | 32 | adc: Adc<'static, Async>, |
| 33 | pin: adc::Channel<'static>, | 33 | pin: adc::Channel<'static>, |
| 34 | dma: DMA_CH0, | 34 | dma: Peri<'static, DMA_CH0>, |
| 35 | } | 35 | } |
| 36 | 36 | ||
| 37 | #[embassy_executor::main] | 37 | #[embassy_executor::main] |
| @@ -70,7 +70,10 @@ async fn producer(mut sender: Sender<'static, NoopRawMutex, SampleBuffer>, mut a | |||
| 70 | let buf = sender.send().await; | 70 | let buf = sender.send().await; |
| 71 | 71 | ||
| 72 | // Fill it with data | 72 | // Fill it with data |
| 73 | adc.adc.read_many(&mut adc.pin, buf, 1, &mut adc.dma).await.unwrap(); | 73 | adc.adc |
| 74 | .read_many(&mut adc.pin, buf, 1, adc.dma.reborrow()) | ||
| 75 | .await | ||
| 76 | .unwrap(); | ||
| 74 | 77 | ||
| 75 | // Notify the channel that the buffer is now ready to be received | 78 | // Notify the channel that the buffer is now ready to be received |
| 76 | sender.send_done(); | 79 | sender.send_done(); |
