diff options
| -rw-r--r-- | cyw43-pio/src/lib.rs | 14 | ||||
| -rw-r--r-- | embassy-rp/src/gpio.rs | 125 | ||||
| -rw-r--r-- | examples/rp/src/bin/blinky_two_tasks.rs | 2 | ||||
| -rw-r--r-- | examples/rp/src/bin/ethernet_w5500_multisocket.rs | 8 | ||||
| -rw-r--r-- | examples/rp/src/bin/ethernet_w5500_tcp_client.rs | 8 | ||||
| -rw-r--r-- | examples/rp/src/bin/ethernet_w5500_tcp_server.rs | 8 | ||||
| -rw-r--r-- | examples/rp/src/bin/ethernet_w5500_udp.rs | 8 | ||||
| -rw-r--r-- | examples/rp/src/bin/multicore.rs | 3 | ||||
| -rw-r--r-- | examples/rp/src/bin/wifi_ap_tcp_server.rs | 6 | ||||
| -rw-r--r-- | examples/rp/src/bin/wifi_blinky.rs | 6 | ||||
| -rw-r--r-- | examples/rp/src/bin/wifi_scan.rs | 6 | ||||
| -rw-r--r-- | examples/rp/src/bin/wifi_tcp_server.rs | 6 | ||||
| -rw-r--r-- | tests/rp/src/bin/cyw43-perf.rs | 6 | ||||
| -rw-r--r-- | tests/rp/src/bin/ethernet_w5100s_perf.rs | 8 | ||||
| -rw-r--r-- | tests/rp/src/bin/uart.rs | 6 | ||||
| -rw-r--r-- | tests/rp/src/bin/uart_buffered.rs | 6 | ||||
| -rw-r--r-- | tests/rp/src/bin/uart_dma.rs | 6 |
17 files changed, 109 insertions, 123 deletions
diff --git a/cyw43-pio/src/lib.rs b/cyw43-pio/src/lib.rs index 5efab10e4..8c217b995 100644 --- a/cyw43-pio/src/lib.rs +++ b/cyw43-pio/src/lib.rs | |||
| @@ -7,25 +7,24 @@ use core::slice; | |||
| 7 | 7 | ||
| 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, Pin, Pull, SlewRate}; | 10 | use embassy_rp::gpio::{Drive, Level, Output, Pull, SlewRate}; |
| 11 | use embassy_rp::pio::{instr, Common, Config, Direction, Instance, Irq, PioPin, ShiftDirection, StateMachine}; | 11 | use embassy_rp::pio::{instr, Common, Config, Direction, Instance, Irq, PioPin, ShiftDirection, StateMachine}; |
| 12 | use embassy_rp::{Peripheral, PeripheralRef}; | 12 | use embassy_rp::{Peripheral, PeripheralRef}; |
| 13 | use fixed::FixedU32; | 13 | use fixed::FixedU32; |
| 14 | use pio_proc::pio_asm; | 14 | use pio_proc::pio_asm; |
| 15 | 15 | ||
| 16 | /// SPI comms driven by PIO. | 16 | /// SPI comms driven by PIO. |
| 17 | pub struct PioSpi<'d, CS: Pin, PIO: Instance, const SM: usize, DMA> { | 17 | pub struct PioSpi<'d, PIO: Instance, const SM: usize, DMA> { |
| 18 | cs: Output<'d, CS>, | 18 | cs: Output<'d>, |
| 19 | sm: StateMachine<'d, PIO, SM>, | 19 | sm: StateMachine<'d, PIO, SM>, |
| 20 | irq: Irq<'d, PIO, 0>, | 20 | irq: Irq<'d, PIO, 0>, |
| 21 | dma: PeripheralRef<'d, DMA>, | 21 | dma: PeripheralRef<'d, DMA>, |
| 22 | wrap_target: u8, | 22 | wrap_target: u8, |
| 23 | } | 23 | } |
| 24 | 24 | ||
| 25 | impl<'d, CS, PIO, const SM: usize, DMA> PioSpi<'d, CS, PIO, SM, DMA> | 25 | impl<'d, PIO, const SM: usize, DMA> PioSpi<'d, PIO, SM, DMA> |
| 26 | where | 26 | where |
| 27 | DMA: Channel, | 27 | DMA: Channel, |
| 28 | CS: Pin, | ||
| 29 | PIO: Instance, | 28 | PIO: Instance, |
| 30 | { | 29 | { |
| 31 | /// Create a new instance of PioSpi. | 30 | /// Create a new instance of PioSpi. |
| @@ -33,7 +32,7 @@ where | |||
| 33 | common: &mut Common<'d, PIO>, | 32 | common: &mut Common<'d, PIO>, |
| 34 | mut sm: StateMachine<'d, PIO, SM>, | 33 | mut sm: StateMachine<'d, PIO, SM>, |
| 35 | irq: Irq<'d, PIO, 0>, | 34 | irq: Irq<'d, PIO, 0>, |
| 36 | cs: Output<'d, CS>, | 35 | cs: Output<'d>, |
| 37 | dio: DIO, | 36 | dio: DIO, |
| 38 | clk: CLK, | 37 | clk: CLK, |
| 39 | dma: impl Peripheral<P = DMA> + 'd, | 38 | dma: impl Peripheral<P = DMA> + 'd, |
| @@ -206,9 +205,8 @@ where | |||
| 206 | } | 205 | } |
| 207 | } | 206 | } |
| 208 | 207 | ||
| 209 | impl<'d, CS, PIO, const SM: usize, DMA> SpiBusCyw43 for PioSpi<'d, CS, PIO, SM, DMA> | 208 | impl<'d, PIO, const SM: usize, DMA> SpiBusCyw43 for PioSpi<'d, PIO, SM, DMA> |
| 210 | where | 209 | where |
| 211 | CS: Pin, | ||
| 212 | PIO: Instance, | 210 | PIO: Instance, |
| 213 | DMA: Channel, | 211 | DMA: Channel, |
| 214 | { | 212 | { |
diff --git a/embassy-rp/src/gpio.rs b/embassy-rp/src/gpio.rs index 7eb57bbe6..93b29bbf9 100644 --- a/embassy-rp/src/gpio.rs +++ b/embassy-rp/src/gpio.rs | |||
| @@ -8,6 +8,7 @@ use core::task::{Context, Poll}; | |||
| 8 | use embassy_hal_internal::{impl_peripheral, into_ref, PeripheralRef}; | 8 | use embassy_hal_internal::{impl_peripheral, into_ref, PeripheralRef}; |
| 9 | use embassy_sync::waitqueue::AtomicWaker; | 9 | use embassy_sync::waitqueue::AtomicWaker; |
| 10 | 10 | ||
| 11 | use self::sealed::Pin as _; | ||
| 11 | use crate::interrupt::InterruptExt; | 12 | use crate::interrupt::InterruptExt; |
| 12 | use crate::pac::common::{Reg, RW}; | 13 | use crate::pac::common::{Reg, RW}; |
| 13 | use crate::pac::SIO; | 14 | use crate::pac::SIO; |
| @@ -105,14 +106,14 @@ pub struct DormantWakeConfig { | |||
| 105 | } | 106 | } |
| 106 | 107 | ||
| 107 | /// GPIO input driver. | 108 | /// GPIO input driver. |
| 108 | pub struct Input<'d, T: Pin> { | 109 | pub struct Input<'d> { |
| 109 | pin: Flex<'d, T>, | 110 | pin: Flex<'d>, |
| 110 | } | 111 | } |
| 111 | 112 | ||
| 112 | impl<'d, T: Pin> Input<'d, T> { | 113 | impl<'d> Input<'d> { |
| 113 | /// Create GPIO input driver for a [Pin] with the provided [Pull] configuration. | 114 | /// Create GPIO input driver for a [Pin] with the provided [Pull] configuration. |
| 114 | #[inline] | 115 | #[inline] |
| 115 | pub fn new(pin: impl Peripheral<P = T> + 'd, pull: Pull) -> Self { | 116 | pub fn new(pin: impl Peripheral<P = impl Pin> + 'd, pull: Pull) -> Self { |
| 116 | let mut pin = Flex::new(pin); | 117 | let mut pin = Flex::new(pin); |
| 117 | pin.set_as_input(); | 118 | pin.set_as_input(); |
| 118 | pin.set_pull(pull); | 119 | pin.set_pull(pull); |
| @@ -175,7 +176,7 @@ impl<'d, T: Pin> Input<'d, T> { | |||
| 175 | 176 | ||
| 176 | /// Configure dormant wake. | 177 | /// Configure dormant wake. |
| 177 | #[inline] | 178 | #[inline] |
| 178 | pub fn dormant_wake(&mut self, cfg: DormantWakeConfig) -> DormantWake<T> { | 179 | pub fn dormant_wake(&mut self, cfg: DormantWakeConfig) -> DormantWake<'_> { |
| 179 | self.pin.dormant_wake(cfg) | 180 | self.pin.dormant_wake(cfg) |
| 180 | } | 181 | } |
| 181 | } | 182 | } |
| @@ -255,14 +256,12 @@ fn IO_IRQ_QSPI() { | |||
| 255 | } | 256 | } |
| 256 | 257 | ||
| 257 | #[must_use = "futures do nothing unless you `.await` or poll them"] | 258 | #[must_use = "futures do nothing unless you `.await` or poll them"] |
| 258 | struct InputFuture<'a, T: Pin> { | 259 | struct InputFuture<'d> { |
| 259 | pin: PeripheralRef<'a, T>, | 260 | pin: PeripheralRef<'d, AnyPin>, |
| 260 | } | 261 | } |
| 261 | 262 | ||
| 262 | impl<'d, T: Pin> InputFuture<'d, T> { | 263 | impl<'d> InputFuture<'d> { |
| 263 | /// Create a new future wiating for input trigger. | 264 | fn new(pin: PeripheralRef<'d, AnyPin>, level: InterruptTrigger) -> Self { |
| 264 | pub fn new(pin: impl Peripheral<P = T> + 'd, level: InterruptTrigger) -> Self { | ||
| 265 | into_ref!(pin); | ||
| 266 | let pin_group = (pin.pin() % 8) as usize; | 265 | let pin_group = (pin.pin() % 8) as usize; |
| 267 | // first, clear the INTR register bits. without this INTR will still | 266 | // first, clear the INTR register bits. without this INTR will still |
| 268 | // contain reports of previous edges, causing the IRQ to fire early | 267 | // contain reports of previous edges, causing the IRQ to fire early |
| @@ -305,7 +304,7 @@ impl<'d, T: Pin> InputFuture<'d, T> { | |||
| 305 | } | 304 | } |
| 306 | } | 305 | } |
| 307 | 306 | ||
| 308 | impl<'d, T: Pin> Future for InputFuture<'d, T> { | 307 | impl<'d> Future for InputFuture<'d> { |
| 309 | type Output = (); | 308 | type Output = (); |
| 310 | 309 | ||
| 311 | fn poll(self: FuturePin<&mut Self>, cx: &mut Context<'_>) -> Poll<Self::Output> { | 310 | fn poll(self: FuturePin<&mut Self>, cx: &mut Context<'_>) -> Poll<Self::Output> { |
| @@ -344,14 +343,14 @@ impl<'d, T: Pin> Future for InputFuture<'d, T> { | |||
| 344 | } | 343 | } |
| 345 | 344 | ||
| 346 | /// GPIO output driver. | 345 | /// GPIO output driver. |
| 347 | pub struct Output<'d, T: Pin> { | 346 | pub struct Output<'d> { |
| 348 | pin: Flex<'d, T>, | 347 | pin: Flex<'d>, |
| 349 | } | 348 | } |
| 350 | 349 | ||
| 351 | impl<'d, T: Pin> Output<'d, T> { | 350 | impl<'d> Output<'d> { |
| 352 | /// Create GPIO output driver for a [Pin] with the provided [Level]. | 351 | /// Create GPIO output driver for a [Pin] with the provided [Level]. |
| 353 | #[inline] | 352 | #[inline] |
| 354 | pub fn new(pin: impl Peripheral<P = T> + 'd, initial_output: Level) -> Self { | 353 | pub fn new(pin: impl Peripheral<P = impl Pin> + 'd, initial_output: Level) -> Self { |
| 355 | let mut pin = Flex::new(pin); | 354 | let mut pin = Flex::new(pin); |
| 356 | match initial_output { | 355 | match initial_output { |
| 357 | Level::High => pin.set_high(), | 356 | Level::High => pin.set_high(), |
| @@ -418,14 +417,14 @@ impl<'d, T: Pin> Output<'d, T> { | |||
| 418 | } | 417 | } |
| 419 | 418 | ||
| 420 | /// GPIO output open-drain. | 419 | /// GPIO output open-drain. |
| 421 | pub struct OutputOpenDrain<'d, T: Pin> { | 420 | pub struct OutputOpenDrain<'d> { |
| 422 | pin: Flex<'d, T>, | 421 | pin: Flex<'d>, |
| 423 | } | 422 | } |
| 424 | 423 | ||
| 425 | impl<'d, T: Pin> OutputOpenDrain<'d, T> { | 424 | impl<'d> OutputOpenDrain<'d> { |
| 426 | /// Create GPIO output driver for a [Pin] in open drain mode with the provided [Level]. | 425 | /// Create GPIO output driver for a [Pin] in open drain mode with the provided [Level]. |
| 427 | #[inline] | 426 | #[inline] |
| 428 | pub fn new(pin: impl Peripheral<P = T> + 'd, initial_output: Level) -> Self { | 427 | pub fn new(pin: impl Peripheral<P = impl Pin> + 'd, initial_output: Level) -> Self { |
| 429 | let mut pin = Flex::new(pin); | 428 | let mut pin = Flex::new(pin); |
| 430 | pin.set_low(); | 429 | pin.set_low(); |
| 431 | match initial_output { | 430 | match initial_output { |
| @@ -548,17 +547,17 @@ impl<'d, T: Pin> OutputOpenDrain<'d, T> { | |||
| 548 | /// This pin can be either an input or output pin. The output level register bit will remain | 547 | /// This pin can be either an input or output pin. The output level register bit will remain |
| 549 | /// set while not in output mode, so the pin's level will be 'remembered' when it is not in output | 548 | /// set while not in output mode, so the pin's level will be 'remembered' when it is not in output |
| 550 | /// mode. | 549 | /// mode. |
| 551 | pub struct Flex<'d, T: Pin> { | 550 | pub struct Flex<'d> { |
| 552 | pin: PeripheralRef<'d, T>, | 551 | pin: PeripheralRef<'d, AnyPin>, |
| 553 | } | 552 | } |
| 554 | 553 | ||
| 555 | impl<'d, T: Pin> Flex<'d, T> { | 554 | impl<'d> Flex<'d> { |
| 556 | /// Wrap the pin in a `Flex`. | 555 | /// Wrap the pin in a `Flex`. |
| 557 | /// | 556 | /// |
| 558 | /// The pin remains disconnected. The initial output level is unspecified, but can be changed | 557 | /// The pin remains disconnected. The initial output level is unspecified, but can be changed |
| 559 | /// before the pin is put into output mode. | 558 | /// before the pin is put into output mode. |
| 560 | #[inline] | 559 | #[inline] |
| 561 | pub fn new(pin: impl Peripheral<P = T> + 'd) -> Self { | 560 | pub fn new(pin: impl Peripheral<P = impl Pin> + 'd) -> Self { |
| 562 | into_ref!(pin); | 561 | into_ref!(pin); |
| 563 | 562 | ||
| 564 | pin.pad_ctrl().write(|w| { | 563 | pin.pad_ctrl().write(|w| { |
| @@ -569,7 +568,7 @@ impl<'d, T: Pin> Flex<'d, T> { | |||
| 569 | w.set_funcsel(pac::io::vals::Gpio0ctrlFuncsel::SIO_0 as _); | 568 | w.set_funcsel(pac::io::vals::Gpio0ctrlFuncsel::SIO_0 as _); |
| 570 | }); | 569 | }); |
| 571 | 570 | ||
| 572 | Self { pin } | 571 | Self { pin: pin.map_into() } |
| 573 | } | 572 | } |
| 574 | 573 | ||
| 575 | #[inline] | 574 | #[inline] |
| @@ -716,36 +715,36 @@ impl<'d, T: Pin> Flex<'d, T> { | |||
| 716 | /// Wait until the pin is high. If it is already high, return immediately. | 715 | /// Wait until the pin is high. If it is already high, return immediately. |
| 717 | #[inline] | 716 | #[inline] |
| 718 | pub async fn wait_for_high(&mut self) { | 717 | pub async fn wait_for_high(&mut self) { |
| 719 | InputFuture::new(&mut self.pin, InterruptTrigger::LevelHigh).await; | 718 | InputFuture::new(self.pin.reborrow(), InterruptTrigger::LevelHigh).await; |
| 720 | } | 719 | } |
| 721 | 720 | ||
| 722 | /// Wait until the pin is low. If it is already low, return immediately. | 721 | /// Wait until the pin is low. If it is already low, return immediately. |
| 723 | #[inline] | 722 | #[inline] |
| 724 | pub async fn wait_for_low(&mut self) { | 723 | pub async fn wait_for_low(&mut self) { |
| 725 | InputFuture::new(&mut self.pin, InterruptTrigger::LevelLow).await; | 724 | InputFuture::new(self.pin.reborrow(), InterruptTrigger::LevelLow).await; |
| 726 | } | 725 | } |
| 727 | 726 | ||
| 728 | /// Wait for the pin to undergo a transition from low to high. | 727 | /// Wait for the pin to undergo a transition from low to high. |
| 729 | #[inline] | 728 | #[inline] |
| 730 | pub async fn wait_for_rising_edge(&mut self) { | 729 | pub async fn wait_for_rising_edge(&mut self) { |
| 731 | InputFuture::new(&mut self.pin, InterruptTrigger::EdgeHigh).await; | 730 | InputFuture::new(self.pin.reborrow(), InterruptTrigger::EdgeHigh).await; |
| 732 | } | 731 | } |
| 733 | 732 | ||
| 734 | /// Wait for the pin to undergo a transition from high to low. | 733 | /// Wait for the pin to undergo a transition from high to low. |
| 735 | #[inline] | 734 | #[inline] |
| 736 | pub async fn wait_for_falling_edge(&mut self) { | 735 | pub async fn wait_for_falling_edge(&mut self) { |
| 737 | InputFuture::new(&mut self.pin, InterruptTrigger::EdgeLow).await; | 736 | InputFuture::new(self.pin.reborrow(), InterruptTrigger::EdgeLow).await; |
| 738 | } | 737 | } |
| 739 | 738 | ||
| 740 | /// Wait for the pin to undergo any transition, i.e low to high OR high to low. | 739 | /// Wait for the pin to undergo any transition, i.e low to high OR high to low. |
| 741 | #[inline] | 740 | #[inline] |
| 742 | pub async fn wait_for_any_edge(&mut self) { | 741 | pub async fn wait_for_any_edge(&mut self) { |
| 743 | InputFuture::new(&mut self.pin, InterruptTrigger::AnyEdge).await; | 742 | InputFuture::new(self.pin.reborrow(), InterruptTrigger::AnyEdge).await; |
| 744 | } | 743 | } |
| 745 | 744 | ||
| 746 | /// Configure dormant wake. | 745 | /// Configure dormant wake. |
| 747 | #[inline] | 746 | #[inline] |
| 748 | pub fn dormant_wake(&mut self, cfg: DormantWakeConfig) -> DormantWake<T> { | 747 | pub fn dormant_wake(&mut self, cfg: DormantWakeConfig) -> DormantWake<'_> { |
| 749 | let idx = self.pin._pin() as usize; | 748 | let idx = self.pin._pin() as usize; |
| 750 | self.pin.io().intr(idx / 8).write(|w| { | 749 | self.pin.io().intr(idx / 8).write(|w| { |
| 751 | w.set_edge_high(idx % 8, cfg.edge_high); | 750 | w.set_edge_high(idx % 8, cfg.edge_high); |
| @@ -764,7 +763,7 @@ impl<'d, T: Pin> Flex<'d, T> { | |||
| 764 | } | 763 | } |
| 765 | } | 764 | } |
| 766 | 765 | ||
| 767 | impl<'d, T: Pin> Drop for Flex<'d, T> { | 766 | impl<'d> Drop for Flex<'d> { |
| 768 | #[inline] | 767 | #[inline] |
| 769 | fn drop(&mut self) { | 768 | fn drop(&mut self) { |
| 770 | let idx = self.pin._pin() as usize; | 769 | let idx = self.pin._pin() as usize; |
| @@ -782,12 +781,12 @@ impl<'d, T: Pin> Drop for Flex<'d, T> { | |||
| 782 | } | 781 | } |
| 783 | 782 | ||
| 784 | /// Dormant wake driver. | 783 | /// Dormant wake driver. |
| 785 | pub struct DormantWake<'w, T: Pin> { | 784 | pub struct DormantWake<'w> { |
| 786 | pin: PeripheralRef<'w, T>, | 785 | pin: PeripheralRef<'w, AnyPin>, |
| 787 | cfg: DormantWakeConfig, | 786 | cfg: DormantWakeConfig, |
| 788 | } | 787 | } |
| 789 | 788 | ||
| 790 | impl<'w, T: Pin> Drop for DormantWake<'w, T> { | 789 | impl<'w> Drop for DormantWake<'w> { |
| 791 | fn drop(&mut self) { | 790 | fn drop(&mut self) { |
| 792 | let idx = self.pin._pin() as usize; | 791 | let idx = self.pin._pin() as usize; |
| 793 | self.pin.io().intr(idx / 8).write(|w| { | 792 | self.pin.io().intr(idx / 8).write(|w| { |
| @@ -970,7 +969,7 @@ mod eh02 { | |||
| 970 | 969 | ||
| 971 | use super::*; | 970 | use super::*; |
| 972 | 971 | ||
| 973 | impl<'d, T: Pin> embedded_hal_02::digital::v2::InputPin for Input<'d, T> { | 972 | impl<'d> embedded_hal_02::digital::v2::InputPin for Input<'d> { |
| 974 | type Error = Infallible; | 973 | type Error = Infallible; |
| 975 | 974 | ||
| 976 | fn is_high(&self) -> Result<bool, Self::Error> { | 975 | fn is_high(&self) -> Result<bool, Self::Error> { |
| @@ -982,7 +981,7 @@ mod eh02 { | |||
| 982 | } | 981 | } |
| 983 | } | 982 | } |
| 984 | 983 | ||
| 985 | impl<'d, T: Pin> embedded_hal_02::digital::v2::OutputPin for Output<'d, T> { | 984 | impl<'d> embedded_hal_02::digital::v2::OutputPin for Output<'d> { |
| 986 | type Error = Infallible; | 985 | type Error = Infallible; |
| 987 | 986 | ||
| 988 | fn set_high(&mut self) -> Result<(), Self::Error> { | 987 | fn set_high(&mut self) -> Result<(), Self::Error> { |
| @@ -994,7 +993,7 @@ mod eh02 { | |||
| 994 | } | 993 | } |
| 995 | } | 994 | } |
| 996 | 995 | ||
| 997 | impl<'d, T: Pin> embedded_hal_02::digital::v2::StatefulOutputPin for Output<'d, T> { | 996 | impl<'d> embedded_hal_02::digital::v2::StatefulOutputPin for Output<'d> { |
| 998 | fn is_set_high(&self) -> Result<bool, Self::Error> { | 997 | fn is_set_high(&self) -> Result<bool, Self::Error> { |
| 999 | Ok(self.is_set_high()) | 998 | Ok(self.is_set_high()) |
| 1000 | } | 999 | } |
| @@ -1004,7 +1003,7 @@ mod eh02 { | |||
| 1004 | } | 1003 | } |
| 1005 | } | 1004 | } |
| 1006 | 1005 | ||
| 1007 | impl<'d, T: Pin> embedded_hal_02::digital::v2::ToggleableOutputPin for Output<'d, T> { | 1006 | impl<'d> embedded_hal_02::digital::v2::ToggleableOutputPin for Output<'d> { |
| 1008 | type Error = Infallible; | 1007 | type Error = Infallible; |
| 1009 | #[inline] | 1008 | #[inline] |
| 1010 | fn toggle(&mut self) -> Result<(), Self::Error> { | 1009 | fn toggle(&mut self) -> Result<(), Self::Error> { |
| @@ -1012,7 +1011,7 @@ mod eh02 { | |||
| 1012 | } | 1011 | } |
| 1013 | } | 1012 | } |
| 1014 | 1013 | ||
| 1015 | impl<'d, T: Pin> embedded_hal_02::digital::v2::InputPin for OutputOpenDrain<'d, T> { | 1014 | impl<'d> embedded_hal_02::digital::v2::InputPin for OutputOpenDrain<'d> { |
| 1016 | type Error = Infallible; | 1015 | type Error = Infallible; |
| 1017 | 1016 | ||
| 1018 | fn is_high(&self) -> Result<bool, Self::Error> { | 1017 | fn is_high(&self) -> Result<bool, Self::Error> { |
| @@ -1024,7 +1023,7 @@ mod eh02 { | |||
| 1024 | } | 1023 | } |
| 1025 | } | 1024 | } |
| 1026 | 1025 | ||
| 1027 | impl<'d, T: Pin> embedded_hal_02::digital::v2::OutputPin for OutputOpenDrain<'d, T> { | 1026 | impl<'d> embedded_hal_02::digital::v2::OutputPin for OutputOpenDrain<'d> { |
| 1028 | type Error = Infallible; | 1027 | type Error = Infallible; |
| 1029 | 1028 | ||
| 1030 | #[inline] | 1029 | #[inline] |
| @@ -1038,7 +1037,7 @@ mod eh02 { | |||
| 1038 | } | 1037 | } |
| 1039 | } | 1038 | } |
| 1040 | 1039 | ||
| 1041 | impl<'d, T: Pin> embedded_hal_02::digital::v2::StatefulOutputPin for OutputOpenDrain<'d, T> { | 1040 | impl<'d> embedded_hal_02::digital::v2::StatefulOutputPin for OutputOpenDrain<'d> { |
| 1042 | fn is_set_high(&self) -> Result<bool, Self::Error> { | 1041 | fn is_set_high(&self) -> Result<bool, Self::Error> { |
| 1043 | Ok(self.is_set_high()) | 1042 | Ok(self.is_set_high()) |
| 1044 | } | 1043 | } |
| @@ -1048,7 +1047,7 @@ mod eh02 { | |||
| 1048 | } | 1047 | } |
| 1049 | } | 1048 | } |
| 1050 | 1049 | ||
| 1051 | impl<'d, T: Pin> embedded_hal_02::digital::v2::ToggleableOutputPin for OutputOpenDrain<'d, T> { | 1050 | impl<'d> embedded_hal_02::digital::v2::ToggleableOutputPin for OutputOpenDrain<'d> { |
| 1052 | type Error = Infallible; | 1051 | type Error = Infallible; |
| 1053 | #[inline] | 1052 | #[inline] |
| 1054 | fn toggle(&mut self) -> Result<(), Self::Error> { | 1053 | fn toggle(&mut self) -> Result<(), Self::Error> { |
| @@ -1056,7 +1055,7 @@ mod eh02 { | |||
| 1056 | } | 1055 | } |
| 1057 | } | 1056 | } |
| 1058 | 1057 | ||
| 1059 | impl<'d, T: Pin> embedded_hal_02::digital::v2::InputPin for Flex<'d, T> { | 1058 | impl<'d> embedded_hal_02::digital::v2::InputPin for Flex<'d> { |
| 1060 | type Error = Infallible; | 1059 | type Error = Infallible; |
| 1061 | 1060 | ||
| 1062 | fn is_high(&self) -> Result<bool, Self::Error> { | 1061 | fn is_high(&self) -> Result<bool, Self::Error> { |
| @@ -1068,7 +1067,7 @@ mod eh02 { | |||
| 1068 | } | 1067 | } |
| 1069 | } | 1068 | } |
| 1070 | 1069 | ||
| 1071 | impl<'d, T: Pin> embedded_hal_02::digital::v2::OutputPin for Flex<'d, T> { | 1070 | impl<'d> embedded_hal_02::digital::v2::OutputPin for Flex<'d> { |
| 1072 | type Error = Infallible; | 1071 | type Error = Infallible; |
| 1073 | 1072 | ||
| 1074 | fn set_high(&mut self) -> Result<(), Self::Error> { | 1073 | fn set_high(&mut self) -> Result<(), Self::Error> { |
| @@ -1080,7 +1079,7 @@ mod eh02 { | |||
| 1080 | } | 1079 | } |
| 1081 | } | 1080 | } |
| 1082 | 1081 | ||
| 1083 | impl<'d, T: Pin> embedded_hal_02::digital::v2::StatefulOutputPin for Flex<'d, T> { | 1082 | impl<'d> embedded_hal_02::digital::v2::StatefulOutputPin for Flex<'d> { |
| 1084 | fn is_set_high(&self) -> Result<bool, Self::Error> { | 1083 | fn is_set_high(&self) -> Result<bool, Self::Error> { |
| 1085 | Ok(self.is_set_high()) | 1084 | Ok(self.is_set_high()) |
| 1086 | } | 1085 | } |
| @@ -1090,7 +1089,7 @@ mod eh02 { | |||
| 1090 | } | 1089 | } |
| 1091 | } | 1090 | } |
| 1092 | 1091 | ||
| 1093 | impl<'d, T: Pin> embedded_hal_02::digital::v2::ToggleableOutputPin for Flex<'d, T> { | 1092 | impl<'d> embedded_hal_02::digital::v2::ToggleableOutputPin for Flex<'d> { |
| 1094 | type Error = Infallible; | 1093 | type Error = Infallible; |
| 1095 | #[inline] | 1094 | #[inline] |
| 1096 | fn toggle(&mut self) -> Result<(), Self::Error> { | 1095 | fn toggle(&mut self) -> Result<(), Self::Error> { |
| @@ -1099,11 +1098,11 @@ mod eh02 { | |||
| 1099 | } | 1098 | } |
| 1100 | } | 1099 | } |
| 1101 | 1100 | ||
| 1102 | impl<'d, T: Pin> embedded_hal_1::digital::ErrorType for Input<'d, T> { | 1101 | impl<'d> embedded_hal_1::digital::ErrorType for Input<'d> { |
| 1103 | type Error = Infallible; | 1102 | type Error = Infallible; |
| 1104 | } | 1103 | } |
| 1105 | 1104 | ||
| 1106 | impl<'d, T: Pin> embedded_hal_1::digital::InputPin for Input<'d, T> { | 1105 | impl<'d> embedded_hal_1::digital::InputPin for Input<'d> { |
| 1107 | fn is_high(&mut self) -> Result<bool, Self::Error> { | 1106 | fn is_high(&mut self) -> Result<bool, Self::Error> { |
| 1108 | Ok((*self).is_high()) | 1107 | Ok((*self).is_high()) |
| 1109 | } | 1108 | } |
| @@ -1113,11 +1112,11 @@ impl<'d, T: Pin> embedded_hal_1::digital::InputPin for Input<'d, T> { | |||
| 1113 | } | 1112 | } |
| 1114 | } | 1113 | } |
| 1115 | 1114 | ||
| 1116 | impl<'d, T: Pin> embedded_hal_1::digital::ErrorType for Output<'d, T> { | 1115 | impl<'d> embedded_hal_1::digital::ErrorType for Output<'d> { |
| 1117 | type Error = Infallible; | 1116 | type Error = Infallible; |
| 1118 | } | 1117 | } |
| 1119 | 1118 | ||
| 1120 | impl<'d, T: Pin> embedded_hal_1::digital::OutputPin for Output<'d, T> { | 1119 | impl<'d> embedded_hal_1::digital::OutputPin for Output<'d> { |
| 1121 | fn set_high(&mut self) -> Result<(), Self::Error> { | 1120 | fn set_high(&mut self) -> Result<(), Self::Error> { |
| 1122 | Ok(self.set_high()) | 1121 | Ok(self.set_high()) |
| 1123 | } | 1122 | } |
| @@ -1127,7 +1126,7 @@ impl<'d, T: Pin> embedded_hal_1::digital::OutputPin for Output<'d, T> { | |||
| 1127 | } | 1126 | } |
| 1128 | } | 1127 | } |
| 1129 | 1128 | ||
| 1130 | impl<'d, T: Pin> embedded_hal_1::digital::StatefulOutputPin for Output<'d, T> { | 1129 | impl<'d> embedded_hal_1::digital::StatefulOutputPin for Output<'d> { |
| 1131 | fn is_set_high(&mut self) -> Result<bool, Self::Error> { | 1130 | fn is_set_high(&mut self) -> Result<bool, Self::Error> { |
| 1132 | Ok((*self).is_set_high()) | 1131 | Ok((*self).is_set_high()) |
| 1133 | } | 1132 | } |
| @@ -1137,11 +1136,11 @@ impl<'d, T: Pin> embedded_hal_1::digital::StatefulOutputPin for Output<'d, T> { | |||
| 1137 | } | 1136 | } |
| 1138 | } | 1137 | } |
| 1139 | 1138 | ||
| 1140 | impl<'d, T: Pin> embedded_hal_1::digital::ErrorType for OutputOpenDrain<'d, T> { | 1139 | impl<'d> embedded_hal_1::digital::ErrorType for OutputOpenDrain<'d> { |
| 1141 | type Error = Infallible; | 1140 | type Error = Infallible; |
| 1142 | } | 1141 | } |
| 1143 | 1142 | ||
| 1144 | impl<'d, T: Pin> embedded_hal_1::digital::OutputPin for OutputOpenDrain<'d, T> { | 1143 | impl<'d> embedded_hal_1::digital::OutputPin for OutputOpenDrain<'d> { |
| 1145 | fn set_high(&mut self) -> Result<(), Self::Error> { | 1144 | fn set_high(&mut self) -> Result<(), Self::Error> { |
| 1146 | Ok(self.set_high()) | 1145 | Ok(self.set_high()) |
| 1147 | } | 1146 | } |
| @@ -1151,7 +1150,7 @@ impl<'d, T: Pin> embedded_hal_1::digital::OutputPin for OutputOpenDrain<'d, T> { | |||
| 1151 | } | 1150 | } |
| 1152 | } | 1151 | } |
| 1153 | 1152 | ||
| 1154 | impl<'d, T: Pin> embedded_hal_1::digital::StatefulOutputPin for OutputOpenDrain<'d, T> { | 1153 | impl<'d> embedded_hal_1::digital::StatefulOutputPin for OutputOpenDrain<'d> { |
| 1155 | fn is_set_high(&mut self) -> Result<bool, Self::Error> { | 1154 | fn is_set_high(&mut self) -> Result<bool, Self::Error> { |
| 1156 | Ok((*self).is_set_high()) | 1155 | Ok((*self).is_set_high()) |
| 1157 | } | 1156 | } |
| @@ -1161,7 +1160,7 @@ impl<'d, T: Pin> embedded_hal_1::digital::StatefulOutputPin for OutputOpenDrain< | |||
| 1161 | } | 1160 | } |
| 1162 | } | 1161 | } |
| 1163 | 1162 | ||
| 1164 | impl<'d, T: Pin> embedded_hal_1::digital::InputPin for OutputOpenDrain<'d, T> { | 1163 | impl<'d> embedded_hal_1::digital::InputPin for OutputOpenDrain<'d> { |
| 1165 | fn is_high(&mut self) -> Result<bool, Self::Error> { | 1164 | fn is_high(&mut self) -> Result<bool, Self::Error> { |
| 1166 | Ok((*self).is_high()) | 1165 | Ok((*self).is_high()) |
| 1167 | } | 1166 | } |
| @@ -1171,11 +1170,11 @@ impl<'d, T: Pin> embedded_hal_1::digital::InputPin for OutputOpenDrain<'d, T> { | |||
| 1171 | } | 1170 | } |
| 1172 | } | 1171 | } |
| 1173 | 1172 | ||
| 1174 | impl<'d, T: Pin> embedded_hal_1::digital::ErrorType for Flex<'d, T> { | 1173 | impl<'d> embedded_hal_1::digital::ErrorType for Flex<'d> { |
| 1175 | type Error = Infallible; | 1174 | type Error = Infallible; |
| 1176 | } | 1175 | } |
| 1177 | 1176 | ||
| 1178 | impl<'d, T: Pin> embedded_hal_1::digital::InputPin for Flex<'d, T> { | 1177 | impl<'d> embedded_hal_1::digital::InputPin for Flex<'d> { |
| 1179 | fn is_high(&mut self) -> Result<bool, Self::Error> { | 1178 | fn is_high(&mut self) -> Result<bool, Self::Error> { |
| 1180 | Ok((*self).is_high()) | 1179 | Ok((*self).is_high()) |
| 1181 | } | 1180 | } |
| @@ -1185,7 +1184,7 @@ impl<'d, T: Pin> embedded_hal_1::digital::InputPin for Flex<'d, T> { | |||
| 1185 | } | 1184 | } |
| 1186 | } | 1185 | } |
| 1187 | 1186 | ||
| 1188 | impl<'d, T: Pin> embedded_hal_1::digital::OutputPin for Flex<'d, T> { | 1187 | impl<'d> embedded_hal_1::digital::OutputPin for Flex<'d> { |
| 1189 | fn set_high(&mut self) -> Result<(), Self::Error> { | 1188 | fn set_high(&mut self) -> Result<(), Self::Error> { |
| 1190 | Ok(self.set_high()) | 1189 | Ok(self.set_high()) |
| 1191 | } | 1190 | } |
| @@ -1195,7 +1194,7 @@ impl<'d, T: Pin> embedded_hal_1::digital::OutputPin for Flex<'d, T> { | |||
| 1195 | } | 1194 | } |
| 1196 | } | 1195 | } |
| 1197 | 1196 | ||
| 1198 | impl<'d, T: Pin> embedded_hal_1::digital::StatefulOutputPin for Flex<'d, T> { | 1197 | impl<'d> embedded_hal_1::digital::StatefulOutputPin for Flex<'d> { |
| 1199 | fn is_set_high(&mut self) -> Result<bool, Self::Error> { | 1198 | fn is_set_high(&mut self) -> Result<bool, Self::Error> { |
| 1200 | Ok((*self).is_set_high()) | 1199 | Ok((*self).is_set_high()) |
| 1201 | } | 1200 | } |
| @@ -1205,7 +1204,7 @@ impl<'d, T: Pin> embedded_hal_1::digital::StatefulOutputPin for Flex<'d, T> { | |||
| 1205 | } | 1204 | } |
| 1206 | } | 1205 | } |
| 1207 | 1206 | ||
| 1208 | impl<'d, T: Pin> embedded_hal_async::digital::Wait for Flex<'d, T> { | 1207 | impl<'d> embedded_hal_async::digital::Wait for Flex<'d> { |
| 1209 | async fn wait_for_high(&mut self) -> Result<(), Self::Error> { | 1208 | async fn wait_for_high(&mut self) -> Result<(), Self::Error> { |
| 1210 | self.wait_for_high().await; | 1209 | self.wait_for_high().await; |
| 1211 | Ok(()) | 1210 | Ok(()) |
| @@ -1232,7 +1231,7 @@ impl<'d, T: Pin> embedded_hal_async::digital::Wait for Flex<'d, T> { | |||
| 1232 | } | 1231 | } |
| 1233 | } | 1232 | } |
| 1234 | 1233 | ||
| 1235 | impl<'d, T: Pin> embedded_hal_async::digital::Wait for Input<'d, T> { | 1234 | impl<'d> embedded_hal_async::digital::Wait for Input<'d> { |
| 1236 | async fn wait_for_high(&mut self) -> Result<(), Self::Error> { | 1235 | async fn wait_for_high(&mut self) -> Result<(), Self::Error> { |
| 1237 | self.wait_for_high().await; | 1236 | self.wait_for_high().await; |
| 1238 | Ok(()) | 1237 | Ok(()) |
| @@ -1259,7 +1258,7 @@ impl<'d, T: Pin> embedded_hal_async::digital::Wait for Input<'d, T> { | |||
| 1259 | } | 1258 | } |
| 1260 | } | 1259 | } |
| 1261 | 1260 | ||
| 1262 | impl<'d, T: Pin> embedded_hal_async::digital::Wait for OutputOpenDrain<'d, T> { | 1261 | impl<'d> embedded_hal_async::digital::Wait for OutputOpenDrain<'d> { |
| 1263 | async fn wait_for_high(&mut self) -> Result<(), Self::Error> { | 1262 | async fn wait_for_high(&mut self) -> Result<(), Self::Error> { |
| 1264 | self.wait_for_high().await; | 1263 | self.wait_for_high().await; |
| 1265 | Ok(()) | 1264 | Ok(()) |
diff --git a/examples/rp/src/bin/blinky_two_tasks.rs b/examples/rp/src/bin/blinky_two_tasks.rs index a03f3a592..a57b513d6 100644 --- a/examples/rp/src/bin/blinky_two_tasks.rs +++ b/examples/rp/src/bin/blinky_two_tasks.rs | |||
| @@ -14,7 +14,7 @@ use embassy_time::{Duration, Ticker}; | |||
| 14 | use gpio::{AnyPin, Level, Output}; | 14 | use gpio::{AnyPin, Level, Output}; |
| 15 | use {defmt_rtt as _, panic_probe as _}; | 15 | use {defmt_rtt as _, panic_probe as _}; |
| 16 | 16 | ||
| 17 | type LedType = Mutex<ThreadModeRawMutex, Option<Output<'static, AnyPin>>>; | 17 | type LedType = Mutex<ThreadModeRawMutex, Option<Output<'static>>>; |
| 18 | static LED: LedType = Mutex::new(None); | 18 | static LED: LedType = Mutex::new(None); |
| 19 | 19 | ||
| 20 | #[embassy_executor::main] | 20 | #[embassy_executor::main] |
diff --git a/examples/rp/src/bin/ethernet_w5500_multisocket.rs b/examples/rp/src/bin/ethernet_w5500_multisocket.rs index a16ea0007..bd52cadca 100644 --- a/examples/rp/src/bin/ethernet_w5500_multisocket.rs +++ b/examples/rp/src/bin/ethernet_w5500_multisocket.rs | |||
| @@ -13,7 +13,7 @@ use embassy_net_wiznet::chip::W5500; | |||
| 13 | use embassy_net_wiznet::*; | 13 | use embassy_net_wiznet::*; |
| 14 | use embassy_rp::clocks::RoscRng; | 14 | use embassy_rp::clocks::RoscRng; |
| 15 | use embassy_rp::gpio::{Input, Level, Output, Pull}; | 15 | use embassy_rp::gpio::{Input, Level, Output, Pull}; |
| 16 | use embassy_rp::peripherals::{PIN_17, PIN_20, PIN_21, SPI0}; | 16 | use embassy_rp::peripherals::SPI0; |
| 17 | use embassy_rp::spi::{Async, Config as SpiConfig, Spi}; | 17 | use embassy_rp::spi::{Async, Config as SpiConfig, Spi}; |
| 18 | use embassy_time::{Delay, Duration}; | 18 | use embassy_time::{Delay, Duration}; |
| 19 | use embedded_hal_bus::spi::ExclusiveDevice; | 19 | use embedded_hal_bus::spi::ExclusiveDevice; |
| @@ -27,9 +27,9 @@ async fn ethernet_task( | |||
| 27 | runner: Runner< | 27 | runner: Runner< |
| 28 | 'static, | 28 | 'static, |
| 29 | W5500, | 29 | W5500, |
| 30 | ExclusiveDevice<Spi<'static, SPI0, Async>, Output<'static, PIN_17>, Delay>, | 30 | ExclusiveDevice<Spi<'static, SPI0, Async>, Output<'static>, Delay>, |
| 31 | Input<'static, PIN_21>, | 31 | Input<'static>, |
| 32 | Output<'static, PIN_20>, | 32 | Output<'static>, |
| 33 | >, | 33 | >, |
| 34 | ) -> ! { | 34 | ) -> ! { |
| 35 | runner.run().await | 35 | runner.run().await |
diff --git a/examples/rp/src/bin/ethernet_w5500_tcp_client.rs b/examples/rp/src/bin/ethernet_w5500_tcp_client.rs index 975b3d385..3e4fbd2e6 100644 --- a/examples/rp/src/bin/ethernet_w5500_tcp_client.rs +++ b/examples/rp/src/bin/ethernet_w5500_tcp_client.rs | |||
| @@ -15,7 +15,7 @@ use embassy_net_wiznet::chip::W5500; | |||
| 15 | use embassy_net_wiznet::*; | 15 | use embassy_net_wiznet::*; |
| 16 | use embassy_rp::clocks::RoscRng; | 16 | use embassy_rp::clocks::RoscRng; |
| 17 | use embassy_rp::gpio::{Input, Level, Output, Pull}; | 17 | use embassy_rp::gpio::{Input, Level, Output, Pull}; |
| 18 | use embassy_rp::peripherals::{PIN_17, PIN_20, PIN_21, SPI0}; | 18 | use embassy_rp::peripherals::SPI0; |
| 19 | use embassy_rp::spi::{Async, Config as SpiConfig, Spi}; | 19 | use embassy_rp::spi::{Async, Config as SpiConfig, Spi}; |
| 20 | use embassy_time::{Delay, Duration, Timer}; | 20 | use embassy_time::{Delay, Duration, Timer}; |
| 21 | use embedded_hal_bus::spi::ExclusiveDevice; | 21 | use embedded_hal_bus::spi::ExclusiveDevice; |
| @@ -29,9 +29,9 @@ async fn ethernet_task( | |||
| 29 | runner: Runner< | 29 | runner: Runner< |
| 30 | 'static, | 30 | 'static, |
| 31 | W5500, | 31 | W5500, |
| 32 | ExclusiveDevice<Spi<'static, SPI0, Async>, Output<'static, PIN_17>, Delay>, | 32 | ExclusiveDevice<Spi<'static, SPI0, Async>, Output<'static>, Delay>, |
| 33 | Input<'static, PIN_21>, | 33 | Input<'static>, |
| 34 | Output<'static, PIN_20>, | 34 | Output<'static>, |
| 35 | >, | 35 | >, |
| 36 | ) -> ! { | 36 | ) -> ! { |
| 37 | runner.run().await | 37 | runner.run().await |
diff --git a/examples/rp/src/bin/ethernet_w5500_tcp_server.rs b/examples/rp/src/bin/ethernet_w5500_tcp_server.rs index 489af2c76..5532851f3 100644 --- a/examples/rp/src/bin/ethernet_w5500_tcp_server.rs +++ b/examples/rp/src/bin/ethernet_w5500_tcp_server.rs | |||
| @@ -14,7 +14,7 @@ use embassy_net_wiznet::chip::W5500; | |||
| 14 | use embassy_net_wiznet::*; | 14 | use embassy_net_wiznet::*; |
| 15 | use embassy_rp::clocks::RoscRng; | 15 | use embassy_rp::clocks::RoscRng; |
| 16 | use embassy_rp::gpio::{Input, Level, Output, Pull}; | 16 | use embassy_rp::gpio::{Input, Level, Output, Pull}; |
| 17 | use embassy_rp::peripherals::{PIN_17, PIN_20, PIN_21, SPI0}; | 17 | use embassy_rp::peripherals::SPI0; |
| 18 | use embassy_rp::spi::{Async, Config as SpiConfig, Spi}; | 18 | use embassy_rp::spi::{Async, Config as SpiConfig, Spi}; |
| 19 | use embassy_time::{Delay, Duration}; | 19 | use embassy_time::{Delay, Duration}; |
| 20 | use embedded_hal_bus::spi::ExclusiveDevice; | 20 | use embedded_hal_bus::spi::ExclusiveDevice; |
| @@ -28,9 +28,9 @@ async fn ethernet_task( | |||
| 28 | runner: Runner< | 28 | runner: Runner< |
| 29 | 'static, | 29 | 'static, |
| 30 | W5500, | 30 | W5500, |
| 31 | ExclusiveDevice<Spi<'static, SPI0, Async>, Output<'static, PIN_17>, Delay>, | 31 | ExclusiveDevice<Spi<'static, SPI0, Async>, Output<'static>, Delay>, |
| 32 | Input<'static, PIN_21>, | 32 | Input<'static>, |
| 33 | Output<'static, PIN_20>, | 33 | Output<'static>, |
| 34 | >, | 34 | >, |
| 35 | ) -> ! { | 35 | ) -> ! { |
| 36 | runner.run().await | 36 | runner.run().await |
diff --git a/examples/rp/src/bin/ethernet_w5500_udp.rs b/examples/rp/src/bin/ethernet_w5500_udp.rs index 41bd7d077..adb1d8941 100644 --- a/examples/rp/src/bin/ethernet_w5500_udp.rs +++ b/examples/rp/src/bin/ethernet_w5500_udp.rs | |||
| @@ -14,7 +14,7 @@ use embassy_net_wiznet::chip::W5500; | |||
| 14 | use embassy_net_wiznet::*; | 14 | use embassy_net_wiznet::*; |
| 15 | use embassy_rp::clocks::RoscRng; | 15 | use embassy_rp::clocks::RoscRng; |
| 16 | use embassy_rp::gpio::{Input, Level, Output, Pull}; | 16 | use embassy_rp::gpio::{Input, Level, Output, Pull}; |
| 17 | use embassy_rp::peripherals::{PIN_17, PIN_20, PIN_21, SPI0}; | 17 | use embassy_rp::peripherals::SPI0; |
| 18 | use embassy_rp::spi::{Async, Config as SpiConfig, Spi}; | 18 | use embassy_rp::spi::{Async, Config as SpiConfig, Spi}; |
| 19 | use embassy_time::Delay; | 19 | use embassy_time::Delay; |
| 20 | use embedded_hal_bus::spi::ExclusiveDevice; | 20 | use embedded_hal_bus::spi::ExclusiveDevice; |
| @@ -27,9 +27,9 @@ async fn ethernet_task( | |||
| 27 | runner: Runner< | 27 | runner: Runner< |
| 28 | 'static, | 28 | 'static, |
| 29 | W5500, | 29 | W5500, |
| 30 | ExclusiveDevice<Spi<'static, SPI0, Async>, Output<'static, PIN_17>, Delay>, | 30 | ExclusiveDevice<Spi<'static, SPI0, Async>, Output<'static>, Delay>, |
| 31 | Input<'static, PIN_21>, | 31 | Input<'static>, |
| 32 | Output<'static, PIN_20>, | 32 | Output<'static>, |
| 33 | >, | 33 | >, |
| 34 | ) -> ! { | 34 | ) -> ! { |
| 35 | runner.run().await | 35 | runner.run().await |
diff --git a/examples/rp/src/bin/multicore.rs b/examples/rp/src/bin/multicore.rs index a1678d99a..c7b087476 100644 --- a/examples/rp/src/bin/multicore.rs +++ b/examples/rp/src/bin/multicore.rs | |||
| @@ -9,7 +9,6 @@ use defmt::*; | |||
| 9 | use embassy_executor::Executor; | 9 | use embassy_executor::Executor; |
| 10 | use embassy_rp::gpio::{Level, Output}; | 10 | use embassy_rp::gpio::{Level, Output}; |
| 11 | use embassy_rp::multicore::{spawn_core1, Stack}; | 11 | use embassy_rp::multicore::{spawn_core1, Stack}; |
| 12 | use embassy_rp::peripherals::PIN_25; | ||
| 13 | use embassy_sync::blocking_mutex::raw::CriticalSectionRawMutex; | 12 | use embassy_sync::blocking_mutex::raw::CriticalSectionRawMutex; |
| 14 | use embassy_sync::channel::Channel; | 13 | use embassy_sync::channel::Channel; |
| 15 | use embassy_time::Timer; | 14 | use embassy_time::Timer; |
| @@ -52,7 +51,7 @@ async fn core0_task() { | |||
| 52 | } | 51 | } |
| 53 | 52 | ||
| 54 | #[embassy_executor::task] | 53 | #[embassy_executor::task] |
| 55 | async fn core1_task(mut led: Output<'static, PIN_25>) { | 54 | async fn core1_task(mut led: Output<'static>) { |
| 56 | info!("Hello from core 1"); | 55 | info!("Hello from core 1"); |
| 57 | loop { | 56 | loop { |
| 58 | match CHANNEL.receive().await { | 57 | match CHANNEL.receive().await { |
diff --git a/examples/rp/src/bin/wifi_ap_tcp_server.rs b/examples/rp/src/bin/wifi_ap_tcp_server.rs index 1bd75607e..b60852359 100644 --- a/examples/rp/src/bin/wifi_ap_tcp_server.rs +++ b/examples/rp/src/bin/wifi_ap_tcp_server.rs | |||
| @@ -14,7 +14,7 @@ use embassy_net::tcp::TcpSocket; | |||
| 14 | use embassy_net::{Config, Stack, StackResources}; | 14 | use embassy_net::{Config, Stack, StackResources}; |
| 15 | use embassy_rp::bind_interrupts; | 15 | use embassy_rp::bind_interrupts; |
| 16 | use embassy_rp::gpio::{Level, Output}; | 16 | use embassy_rp::gpio::{Level, Output}; |
| 17 | use embassy_rp::peripherals::{DMA_CH0, PIN_23, PIN_25, PIO0}; | 17 | use embassy_rp::peripherals::{DMA_CH0, PIO0}; |
| 18 | use embassy_rp::pio::{InterruptHandler, Pio}; | 18 | use embassy_rp::pio::{InterruptHandler, Pio}; |
| 19 | use embassy_time::Duration; | 19 | use embassy_time::Duration; |
| 20 | use embedded_io_async::Write; | 20 | use embedded_io_async::Write; |
| @@ -26,9 +26,7 @@ bind_interrupts!(struct Irqs { | |||
| 26 | }); | 26 | }); |
| 27 | 27 | ||
| 28 | #[embassy_executor::task] | 28 | #[embassy_executor::task] |
| 29 | async fn wifi_task( | 29 | async fn wifi_task(runner: cyw43::Runner<'static, Output<'static>, PioSpi<'static, PIO0, 0, DMA_CH0>>) -> ! { |
| 30 | runner: cyw43::Runner<'static, Output<'static, PIN_23>, PioSpi<'static, PIN_25, PIO0, 0, DMA_CH0>>, | ||
| 31 | ) -> ! { | ||
| 32 | runner.run().await | 30 | runner.run().await |
| 33 | } | 31 | } |
| 34 | 32 | ||
diff --git a/examples/rp/src/bin/wifi_blinky.rs b/examples/rp/src/bin/wifi_blinky.rs index 1ed74993c..18eefe41f 100644 --- a/examples/rp/src/bin/wifi_blinky.rs +++ b/examples/rp/src/bin/wifi_blinky.rs | |||
| @@ -10,7 +10,7 @@ use defmt::*; | |||
| 10 | use embassy_executor::Spawner; | 10 | use embassy_executor::Spawner; |
| 11 | use embassy_rp::bind_interrupts; | 11 | use embassy_rp::bind_interrupts; |
| 12 | use embassy_rp::gpio::{Level, Output}; | 12 | use embassy_rp::gpio::{Level, Output}; |
| 13 | use embassy_rp::peripherals::{DMA_CH0, PIN_23, PIN_25, PIO0}; | 13 | use embassy_rp::peripherals::{DMA_CH0, PIO0}; |
| 14 | use embassy_rp::pio::{InterruptHandler, Pio}; | 14 | use embassy_rp::pio::{InterruptHandler, Pio}; |
| 15 | use embassy_time::{Duration, Timer}; | 15 | use embassy_time::{Duration, Timer}; |
| 16 | use static_cell::StaticCell; | 16 | use static_cell::StaticCell; |
| @@ -21,9 +21,7 @@ bind_interrupts!(struct Irqs { | |||
| 21 | }); | 21 | }); |
| 22 | 22 | ||
| 23 | #[embassy_executor::task] | 23 | #[embassy_executor::task] |
| 24 | async fn wifi_task( | 24 | async fn wifi_task(runner: cyw43::Runner<'static, Output<'static>, PioSpi<'static, PIO0, 0, DMA_CH0>>) -> ! { |
| 25 | runner: cyw43::Runner<'static, Output<'static, PIN_23>, PioSpi<'static, PIN_25, PIO0, 0, DMA_CH0>>, | ||
| 26 | ) -> ! { | ||
| 27 | runner.run().await | 25 | runner.run().await |
| 28 | } | 26 | } |
| 29 | 27 | ||
diff --git a/examples/rp/src/bin/wifi_scan.rs b/examples/rp/src/bin/wifi_scan.rs index e678209dd..e0f85a6b0 100644 --- a/examples/rp/src/bin/wifi_scan.rs +++ b/examples/rp/src/bin/wifi_scan.rs | |||
| @@ -13,7 +13,7 @@ use embassy_executor::Spawner; | |||
| 13 | use embassy_net::Stack; | 13 | use embassy_net::Stack; |
| 14 | use embassy_rp::bind_interrupts; | 14 | use embassy_rp::bind_interrupts; |
| 15 | use embassy_rp::gpio::{Level, Output}; | 15 | use embassy_rp::gpio::{Level, Output}; |
| 16 | use embassy_rp::peripherals::{DMA_CH0, PIN_23, PIN_25, PIO0}; | 16 | use embassy_rp::peripherals::{DMA_CH0, PIO0}; |
| 17 | use embassy_rp::pio::{InterruptHandler, Pio}; | 17 | use embassy_rp::pio::{InterruptHandler, Pio}; |
| 18 | use static_cell::StaticCell; | 18 | use static_cell::StaticCell; |
| 19 | use {defmt_rtt as _, panic_probe as _}; | 19 | use {defmt_rtt as _, panic_probe as _}; |
| @@ -23,9 +23,7 @@ bind_interrupts!(struct Irqs { | |||
| 23 | }); | 23 | }); |
| 24 | 24 | ||
| 25 | #[embassy_executor::task] | 25 | #[embassy_executor::task] |
| 26 | async fn wifi_task( | 26 | async fn wifi_task(runner: cyw43::Runner<'static, Output<'static>, PioSpi<'static, PIO0, 0, DMA_CH0>>) -> ! { |
| 27 | runner: cyw43::Runner<'static, Output<'static, PIN_23>, PioSpi<'static, PIN_25, PIO0, 0, DMA_CH0>>, | ||
| 28 | ) -> ! { | ||
| 29 | runner.run().await | 27 | runner.run().await |
| 30 | } | 28 | } |
| 31 | 29 | ||
diff --git a/examples/rp/src/bin/wifi_tcp_server.rs b/examples/rp/src/bin/wifi_tcp_server.rs index c346f1ded..f1afc4a00 100644 --- a/examples/rp/src/bin/wifi_tcp_server.rs +++ b/examples/rp/src/bin/wifi_tcp_server.rs | |||
| @@ -14,7 +14,7 @@ use embassy_net::tcp::TcpSocket; | |||
| 14 | use embassy_net::{Config, Stack, StackResources}; | 14 | use embassy_net::{Config, Stack, StackResources}; |
| 15 | use embassy_rp::bind_interrupts; | 15 | use embassy_rp::bind_interrupts; |
| 16 | use embassy_rp::gpio::{Level, Output}; | 16 | use embassy_rp::gpio::{Level, Output}; |
| 17 | use embassy_rp::peripherals::{DMA_CH0, PIN_23, PIN_25, PIO0}; | 17 | use embassy_rp::peripherals::{DMA_CH0, PIO0}; |
| 18 | use embassy_rp::pio::{InterruptHandler, Pio}; | 18 | use embassy_rp::pio::{InterruptHandler, Pio}; |
| 19 | use embassy_time::{Duration, Timer}; | 19 | use embassy_time::{Duration, Timer}; |
| 20 | use embedded_io_async::Write; | 20 | use embedded_io_async::Write; |
| @@ -29,9 +29,7 @@ const WIFI_NETWORK: &str = "EmbassyTest"; | |||
| 29 | const WIFI_PASSWORD: &str = "V8YxhKt5CdIAJFud"; | 29 | const WIFI_PASSWORD: &str = "V8YxhKt5CdIAJFud"; |
| 30 | 30 | ||
| 31 | #[embassy_executor::task] | 31 | #[embassy_executor::task] |
| 32 | async fn wifi_task( | 32 | async fn wifi_task(runner: cyw43::Runner<'static, Output<'static>, PioSpi<'static, PIO0, 0, DMA_CH0>>) -> ! { |
| 33 | runner: cyw43::Runner<'static, Output<'static, PIN_23>, PioSpi<'static, PIN_25, PIO0, 0, DMA_CH0>>, | ||
| 34 | ) -> ! { | ||
| 35 | runner.run().await | 33 | runner.run().await |
| 36 | } | 34 | } |
| 37 | 35 | ||
diff --git a/tests/rp/src/bin/cyw43-perf.rs b/tests/rp/src/bin/cyw43-perf.rs index a1b2946e6..b46ae670a 100644 --- a/tests/rp/src/bin/cyw43-perf.rs +++ b/tests/rp/src/bin/cyw43-perf.rs | |||
| @@ -7,7 +7,7 @@ use defmt::{panic, *}; | |||
| 7 | use embassy_executor::Spawner; | 7 | use embassy_executor::Spawner; |
| 8 | use embassy_net::{Config, Stack, StackResources}; | 8 | use embassy_net::{Config, Stack, StackResources}; |
| 9 | use embassy_rp::gpio::{Level, Output}; | 9 | use embassy_rp::gpio::{Level, Output}; |
| 10 | use embassy_rp::peripherals::{DMA_CH0, PIN_23, PIN_25, PIO0}; | 10 | use embassy_rp::peripherals::{DMA_CH0, PIO0}; |
| 11 | use embassy_rp::pio::{InterruptHandler, Pio}; | 11 | use embassy_rp::pio::{InterruptHandler, Pio}; |
| 12 | use embassy_rp::{bind_interrupts, rom_data}; | 12 | use embassy_rp::{bind_interrupts, rom_data}; |
| 13 | use static_cell::StaticCell; | 13 | use static_cell::StaticCell; |
| @@ -24,9 +24,7 @@ const WIFI_NETWORK: &str = "EmbassyTest"; | |||
| 24 | const WIFI_PASSWORD: &str = "V8YxhKt5CdIAJFud"; | 24 | const WIFI_PASSWORD: &str = "V8YxhKt5CdIAJFud"; |
| 25 | 25 | ||
| 26 | #[embassy_executor::task] | 26 | #[embassy_executor::task] |
| 27 | async fn wifi_task( | 27 | async fn wifi_task(runner: cyw43::Runner<'static, Output<'static>, PioSpi<'static, PIO0, 0, DMA_CH0>>) -> ! { |
| 28 | runner: cyw43::Runner<'static, Output<'static, PIN_23>, PioSpi<'static, PIN_25, PIO0, 0, DMA_CH0>>, | ||
| 29 | ) -> ! { | ||
| 30 | runner.run().await | 28 | runner.run().await |
| 31 | } | 29 | } |
| 32 | 30 | ||
diff --git a/tests/rp/src/bin/ethernet_w5100s_perf.rs b/tests/rp/src/bin/ethernet_w5100s_perf.rs index 8c9089d0e..5d5547773 100644 --- a/tests/rp/src/bin/ethernet_w5100s_perf.rs +++ b/tests/rp/src/bin/ethernet_w5100s_perf.rs | |||
| @@ -10,7 +10,7 @@ use embassy_net_wiznet::chip::W5100S; | |||
| 10 | use embassy_net_wiznet::*; | 10 | use embassy_net_wiznet::*; |
| 11 | use embassy_rp::clocks::RoscRng; | 11 | use embassy_rp::clocks::RoscRng; |
| 12 | use embassy_rp::gpio::{Input, Level, Output, Pull}; | 12 | use embassy_rp::gpio::{Input, Level, Output, Pull}; |
| 13 | use embassy_rp::peripherals::{PIN_17, PIN_20, PIN_21, SPI0}; | 13 | use embassy_rp::peripherals::SPI0; |
| 14 | use embassy_rp::spi::{Async, Config as SpiConfig, Spi}; | 14 | use embassy_rp::spi::{Async, Config as SpiConfig, Spi}; |
| 15 | use embassy_time::Delay; | 15 | use embassy_time::Delay; |
| 16 | use embedded_hal_bus::spi::ExclusiveDevice; | 16 | use embedded_hal_bus::spi::ExclusiveDevice; |
| @@ -23,9 +23,9 @@ async fn ethernet_task( | |||
| 23 | runner: Runner< | 23 | runner: Runner< |
| 24 | 'static, | 24 | 'static, |
| 25 | W5100S, | 25 | W5100S, |
| 26 | ExclusiveDevice<Spi<'static, SPI0, Async>, Output<'static, PIN_17>, Delay>, | 26 | ExclusiveDevice<Spi<'static, SPI0, Async>, Output<'static>, Delay>, |
| 27 | Input<'static, PIN_21>, | 27 | Input<'static>, |
| 28 | Output<'static, PIN_20>, | 28 | Output<'static>, |
| 29 | >, | 29 | >, |
| 30 | ) -> ! { | 30 | ) -> ! { |
| 31 | runner.run().await | 31 | runner.run().await |
diff --git a/tests/rp/src/bin/uart.rs b/tests/rp/src/bin/uart.rs index f4d641175..6e6e5517b 100644 --- a/tests/rp/src/bin/uart.rs +++ b/tests/rp/src/bin/uart.rs | |||
| @@ -21,7 +21,7 @@ fn read1<const N: usize>(uart: &mut UartRx<'_, impl Instance, Blocking>) -> Resu | |||
| 21 | Ok(buf) | 21 | Ok(buf) |
| 22 | } | 22 | } |
| 23 | 23 | ||
| 24 | async fn send(pin: &mut Output<'_, impl embassy_rp::gpio::Pin>, v: u8, parity: Option<bool>) { | 24 | async fn send(pin: &mut Output<'_>, v: u8, parity: Option<bool>) { |
| 25 | pin.set_low(); | 25 | pin.set_low(); |
| 26 | Timer::after_millis(1).await; | 26 | Timer::after_millis(1).await; |
| 27 | for i in 0..8 { | 27 | for i in 0..8 { |
| @@ -116,7 +116,7 @@ async fn main(_spawner: Spawner) { | |||
| 116 | config.parity = Parity::ParityEven; | 116 | config.parity = Parity::ParityEven; |
| 117 | let mut uart = UartRx::new_blocking(&mut uart, &mut rx, config); | 117 | let mut uart = UartRx::new_blocking(&mut uart, &mut rx, config); |
| 118 | 118 | ||
| 119 | async fn chr(pin: &mut Output<'_, impl embassy_rp::gpio::Pin>, v: u8, parity: u8) { | 119 | async fn chr(pin: &mut Output<'_>, v: u8, parity: u8) { |
| 120 | send(pin, v, Some(parity != 0)).await; | 120 | send(pin, v, Some(parity != 0)).await; |
| 121 | } | 121 | } |
| 122 | 122 | ||
| @@ -142,7 +142,7 @@ async fn main(_spawner: Spawner) { | |||
| 142 | config.baudrate = 1000; | 142 | config.baudrate = 1000; |
| 143 | let mut uart = UartRx::new_blocking(&mut uart, &mut rx, config); | 143 | let mut uart = UartRx::new_blocking(&mut uart, &mut rx, config); |
| 144 | 144 | ||
| 145 | async fn chr(pin: &mut Output<'_, impl embassy_rp::gpio::Pin>, v: u8, good: bool) { | 145 | async fn chr(pin: &mut Output<'_>, v: u8, good: bool) { |
| 146 | if good { | 146 | if good { |
| 147 | send(pin, v, None).await; | 147 | send(pin, v, None).await; |
| 148 | } else { | 148 | } else { |
diff --git a/tests/rp/src/bin/uart_buffered.rs b/tests/rp/src/bin/uart_buffered.rs index 14647e44a..d68c23cbd 100644 --- a/tests/rp/src/bin/uart_buffered.rs +++ b/tests/rp/src/bin/uart_buffered.rs | |||
| @@ -36,7 +36,7 @@ async fn read1<const N: usize>(uart: &mut BufferedUartRx<'_, impl Instance>) -> | |||
| 36 | } | 36 | } |
| 37 | } | 37 | } |
| 38 | 38 | ||
| 39 | async fn send(pin: &mut Output<'_, impl embassy_rp::gpio::Pin>, v: u8, parity: Option<bool>) { | 39 | async fn send(pin: &mut Output<'_>, v: u8, parity: Option<bool>) { |
| 40 | pin.set_low(); | 40 | pin.set_low(); |
| 41 | Timer::after_millis(1).await; | 41 | Timer::after_millis(1).await; |
| 42 | for i in 0..8 { | 42 | for i in 0..8 { |
| @@ -161,7 +161,7 @@ async fn main(_spawner: Spawner) { | |||
| 161 | let rx_buf = &mut [0u8; 16]; | 161 | let rx_buf = &mut [0u8; 16]; |
| 162 | let mut uart = BufferedUartRx::new(&mut uart, Irqs, &mut rx, rx_buf, config); | 162 | let mut uart = BufferedUartRx::new(&mut uart, Irqs, &mut rx, rx_buf, config); |
| 163 | 163 | ||
| 164 | async fn chr(pin: &mut Output<'_, impl embassy_rp::gpio::Pin>, v: u8, parity: u32) { | 164 | async fn chr(pin: &mut Output<'_>, v: u8, parity: u32) { |
| 165 | send(pin, v, Some(parity != 0)).await; | 165 | send(pin, v, Some(parity != 0)).await; |
| 166 | } | 166 | } |
| 167 | 167 | ||
| @@ -208,7 +208,7 @@ async fn main(_spawner: Spawner) { | |||
| 208 | let rx_buf = &mut [0u8; 16]; | 208 | let rx_buf = &mut [0u8; 16]; |
| 209 | let mut uart = BufferedUartRx::new(&mut uart, Irqs, &mut rx, rx_buf, config); | 209 | let mut uart = BufferedUartRx::new(&mut uart, Irqs, &mut rx, rx_buf, config); |
| 210 | 210 | ||
| 211 | async fn chr(pin: &mut Output<'_, impl embassy_rp::gpio::Pin>, v: u8, good: bool) { | 211 | async fn chr(pin: &mut Output<'_>, v: u8, good: bool) { |
| 212 | if good { | 212 | if good { |
| 213 | send(pin, v, None).await; | 213 | send(pin, v, None).await; |
| 214 | } else { | 214 | } else { |
diff --git a/tests/rp/src/bin/uart_dma.rs b/tests/rp/src/bin/uart_dma.rs index 130d8599e..edc87175a 100644 --- a/tests/rp/src/bin/uart_dma.rs +++ b/tests/rp/src/bin/uart_dma.rs | |||
| @@ -27,7 +27,7 @@ async fn read1<const N: usize>(uart: &mut UartRx<'_, impl Instance, Async>) -> R | |||
| 27 | Ok(buf) | 27 | Ok(buf) |
| 28 | } | 28 | } |
| 29 | 29 | ||
| 30 | async fn send(pin: &mut Output<'_, impl embassy_rp::gpio::Pin>, v: u8, parity: Option<bool>) { | 30 | async fn send(pin: &mut Output<'_>, v: u8, parity: Option<bool>) { |
| 31 | pin.set_low(); | 31 | pin.set_low(); |
| 32 | Timer::after_millis(1).await; | 32 | Timer::after_millis(1).await; |
| 33 | for i in 0..8 { | 33 | for i in 0..8 { |
| @@ -160,7 +160,7 @@ async fn main(_spawner: Spawner) { | |||
| 160 | config.parity = Parity::ParityEven; | 160 | config.parity = Parity::ParityEven; |
| 161 | let mut uart = UartRx::new(&mut uart, &mut rx, Irqs, &mut p.DMA_CH0, config); | 161 | let mut uart = UartRx::new(&mut uart, &mut rx, Irqs, &mut p.DMA_CH0, config); |
| 162 | 162 | ||
| 163 | async fn chr(pin: &mut Output<'_, impl embassy_rp::gpio::Pin>, v: u8, parity: u32) { | 163 | async fn chr(pin: &mut Output<'_>, v: u8, parity: u32) { |
| 164 | send(pin, v, Some(parity != 0)).await; | 164 | send(pin, v, Some(parity != 0)).await; |
| 165 | } | 165 | } |
| 166 | 166 | ||
| @@ -205,7 +205,7 @@ async fn main(_spawner: Spawner) { | |||
| 205 | config.baudrate = 1000; | 205 | config.baudrate = 1000; |
| 206 | let mut uart = UartRx::new(&mut uart, &mut rx, Irqs, &mut p.DMA_CH0, config); | 206 | let mut uart = UartRx::new(&mut uart, &mut rx, Irqs, &mut p.DMA_CH0, config); |
| 207 | 207 | ||
| 208 | async fn chr(pin: &mut Output<'_, impl embassy_rp::gpio::Pin>, v: u8, good: bool) { | 208 | async fn chr(pin: &mut Output<'_>, v: u8, good: bool) { |
| 209 | if good { | 209 | if good { |
| 210 | send(pin, v, None).await; | 210 | send(pin, v, None).await; |
| 211 | } else { | 211 | } else { |
