aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorDario Nieuwenhuis <[email protected]>2025-03-27 15:30:40 +0100
committerGitHub <[email protected]>2025-03-27 15:30:40 +0100
commit502c188cf4c08a1acf9d7095e790e0b5d77d3702 (patch)
tree69922949b153f88e2b2513c8cea7c30f2a0508c8 /tests
parentd097ccc68cce25c95ca2594c7c0bcd62c3c40640 (diff)
parentd41eeeae79388f219bf6a84e2f7bde9f6b532516 (diff)
Merge pull request #3999 from embassy-rs/peripehral-v2
Remove Peripheral trait, rename PeripheralRef->Peri.
Diffstat (limited to 'tests')
-rw-r--r--tests/nrf/src/bin/buffered_uart.rs14
-rw-r--r--tests/nrf/src/bin/buffered_uart_halves.rs16
-rw-r--r--tests/nrf/src/bin/buffered_uart_spam.rs6
-rw-r--r--tests/nrf/src/bin/spim.rs8
-rw-r--r--tests/nrf/src/bin/uart_halves.rs14
-rw-r--r--tests/nrf/src/bin/uart_split.rs6
-rw-r--r--tests/rp/src/bin/adc.rs61
-rw-r--r--tests/rp/src/bin/bootsel.rs5
-rw-r--r--tests/rp/src/bin/gpio.rs40
-rw-r--r--tests/rp/src/bin/gpio_async.rs24
-rw-r--r--tests/rp/src/bin/gpio_multicore.rs5
-rw-r--r--tests/rp/src/bin/pwm.rs50
-rw-r--r--tests/rp/src/bin/uart.rs14
-rw-r--r--tests/rp/src/bin/uart_buffered.rs38
-rw-r--r--tests/rp/src/bin/uart_dma.rs38
-rw-r--r--tests/stm32/src/bin/can.rs2
-rw-r--r--tests/stm32/src/bin/cordic.rs4
-rw-r--r--tests/stm32/src/bin/gpio.rs44
-rw-r--r--tests/stm32/src/bin/sdmmc.rs26
-rw-r--r--tests/stm32/src/bin/spi.rs16
-rw-r--r--tests/stm32/src/bin/spi_dma.rs34
-rw-r--r--tests/stm32/src/bin/ucpd.rs10
-rw-r--r--tests/stm32/src/bin/usart.rs6
23 files changed, 274 insertions, 207 deletions
diff --git a/tests/nrf/src/bin/buffered_uart.rs b/tests/nrf/src/bin/buffered_uart.rs
index 04f32832f..2eecafb95 100644
--- a/tests/nrf/src/bin/buffered_uart.rs
+++ b/tests/nrf/src/bin/buffered_uart.rs
@@ -25,14 +25,14 @@ async fn main(_spawner: Spawner) {
25 // test teardown + recreate of the buffereduarte works fine. 25 // test teardown + recreate of the buffereduarte works fine.
26 for _ in 0..2 { 26 for _ in 0..2 {
27 let u = BufferedUarte::new( 27 let u = BufferedUarte::new(
28 &mut peri!(p, UART0), 28 peri!(p, UART0).reborrow(),
29 &mut p.TIMER0, 29 p.TIMER0.reborrow(),
30 &mut p.PPI_CH0, 30 p.PPI_CH0.reborrow(),
31 &mut p.PPI_CH1, 31 p.PPI_CH1.reborrow(),
32 &mut p.PPI_GROUP0, 32 p.PPI_GROUP0.reborrow(),
33 irqs!(UART0_BUFFERED), 33 irqs!(UART0_BUFFERED),
34 &mut peri!(p, PIN_A), 34 peri!(p, PIN_A).reborrow(),
35 &mut peri!(p, PIN_B), 35 peri!(p, PIN_B).reborrow(),
36 config.clone(), 36 config.clone(),
37 &mut rx_buffer, 37 &mut rx_buffer,
38 &mut tx_buffer, 38 &mut tx_buffer,
diff --git a/tests/nrf/src/bin/buffered_uart_halves.rs b/tests/nrf/src/bin/buffered_uart_halves.rs
index bdf5ad726..adfba509d 100644
--- a/tests/nrf/src/bin/buffered_uart_halves.rs
+++ b/tests/nrf/src/bin/buffered_uart_halves.rs
@@ -27,21 +27,21 @@ async fn main(_spawner: Spawner) {
27 const COUNT: usize = 40_000; 27 const COUNT: usize = 40_000;
28 28
29 let mut tx = BufferedUarteTx::new( 29 let mut tx = BufferedUarteTx::new(
30 &mut peri!(p, UART1), 30 peri!(p, UART1).reborrow(),
31 irqs!(UART1_BUFFERED), 31 irqs!(UART1_BUFFERED),
32 &mut peri!(p, PIN_A), 32 peri!(p, PIN_A).reborrow(),
33 config.clone(), 33 config.clone(),
34 &mut tx_buffer, 34 &mut tx_buffer,
35 ); 35 );
36 36
37 let mut rx = BufferedUarteRx::new( 37 let mut rx = BufferedUarteRx::new(
38 &mut peri!(p, UART0), 38 peri!(p, UART0).reborrow(),
39 &mut p.TIMER0, 39 p.TIMER0.reborrow(),
40 &mut p.PPI_CH0, 40 p.PPI_CH0.reborrow(),
41 &mut p.PPI_CH1, 41 p.PPI_CH1.reborrow(),
42 &mut p.PPI_GROUP0, 42 p.PPI_GROUP0.reborrow(),
43 irqs!(UART0_BUFFERED), 43 irqs!(UART0_BUFFERED),
44 &mut peri!(p, PIN_B), 44 peri!(p, PIN_B).reborrow(),
45 config.clone(), 45 config.clone(),
46 &mut rx_buffer, 46 &mut rx_buffer,
47 ); 47 );
diff --git a/tests/nrf/src/bin/buffered_uart_spam.rs b/tests/nrf/src/bin/buffered_uart_spam.rs
index cf9ca50d2..24ddd06f3 100644
--- a/tests/nrf/src/bin/buffered_uart_spam.rs
+++ b/tests/nrf/src/bin/buffered_uart_spam.rs
@@ -27,7 +27,11 @@ async fn main(_spawner: Spawner) {
27 27
28 let mut rx_buffer = [0u8; 1024]; 28 let mut rx_buffer = [0u8; 1024];
29 29
30 mem::forget(Output::new(&mut peri!(p, PIN_A), Level::High, OutputDrive::Standard)); 30 mem::forget(Output::new(
31 peri!(p, PIN_A).reborrow(),
32 Level::High,
33 OutputDrive::Standard,
34 ));
31 35
32 let mut u = BufferedUarteRx::new( 36 let mut u = BufferedUarteRx::new(
33 peri!(p, UART0), 37 peri!(p, UART0),
diff --git a/tests/nrf/src/bin/spim.rs b/tests/nrf/src/bin/spim.rs
index c2ec90b88..2b38f0409 100644
--- a/tests/nrf/src/bin/spim.rs
+++ b/tests/nrf/src/bin/spim.rs
@@ -17,11 +17,11 @@ async fn main(_spawner: Spawner) {
17 let mut config = spim::Config::default(); 17 let mut config = spim::Config::default();
18 config.frequency = spim::Frequency::M1; 18 config.frequency = spim::Frequency::M1;
19 let mut spim = Spim::new( 19 let mut spim = Spim::new(
20 &mut peri!(p, SPIM0), 20 peri!(p, SPIM0).reborrow(),
21 irqs!(SPIM0), 21 irqs!(SPIM0),
22 &mut peri!(p, PIN_X), 22 peri!(p, PIN_X).reborrow(),
23 &mut peri!(p, PIN_A), // MISO 23 peri!(p, PIN_A).reborrow(), // MISO
24 &mut peri!(p, PIN_B), // MOSI 24 peri!(p, PIN_B).reborrow(), // MOSI
25 config.clone(), 25 config.clone(),
26 ); 26 );
27 let data = [ 27 let data = [
diff --git a/tests/nrf/src/bin/uart_halves.rs b/tests/nrf/src/bin/uart_halves.rs
index f48ea43a1..a462f80ce 100644
--- a/tests/nrf/src/bin/uart_halves.rs
+++ b/tests/nrf/src/bin/uart_halves.rs
@@ -19,8 +19,18 @@ async fn main(_spawner: Spawner) {
19 config.parity = uarte::Parity::EXCLUDED; 19 config.parity = uarte::Parity::EXCLUDED;
20 config.baudrate = uarte::Baudrate::BAUD1M; 20 config.baudrate = uarte::Baudrate::BAUD1M;
21 21
22 let mut tx = UarteTx::new(&mut peri!(p, UART0), irqs!(UART0), &mut peri!(p, PIN_A), config.clone()); 22 let mut tx = UarteTx::new(
23 let mut rx = UarteRx::new(&mut peri!(p, UART1), irqs!(UART1), &mut peri!(p, PIN_B), config.clone()); 23 peri!(p, UART0).reborrow(),
24 irqs!(UART0),
25 peri!(p, PIN_A).reborrow(),
26 config.clone(),
27 );
28 let mut rx = UarteRx::new(
29 peri!(p, UART1).reborrow(),
30 irqs!(UART1),
31 peri!(p, PIN_B).reborrow(),
32 config.clone(),
33 );
24 34
25 let data = [ 35 let data = [
26 0x42, 0x43, 0x44, 0x45, 0x66, 0x12, 0x23, 0x34, 0x45, 0x19, 0x91, 0xaa, 0xff, 0xa5, 0x5a, 0x77, 36 0x42, 0x43, 0x44, 0x45, 0x66, 0x12, 0x23, 0x34, 0x45, 0x19, 0x91, 0xaa, 0xff, 0xa5, 0x5a, 0x77,
diff --git a/tests/nrf/src/bin/uart_split.rs b/tests/nrf/src/bin/uart_split.rs
index 70d8b2e33..f24903297 100644
--- a/tests/nrf/src/bin/uart_split.rs
+++ b/tests/nrf/src/bin/uart_split.rs
@@ -21,10 +21,10 @@ async fn main(_spawner: Spawner) {
21 config.baudrate = uarte::Baudrate::BAUD9600; 21 config.baudrate = uarte::Baudrate::BAUD9600;
22 22
23 let uarte = Uarte::new( 23 let uarte = Uarte::new(
24 &mut peri!(p, UART0), 24 peri!(p, UART0).reborrow(),
25 irqs!(UART0), 25 irqs!(UART0),
26 &mut peri!(p, PIN_A), 26 peri!(p, PIN_A).reborrow(),
27 &mut peri!(p, PIN_B), 27 peri!(p, PIN_B).reborrow(),
28 config.clone(), 28 config.clone(),
29 ); 29 );
30 let (mut tx, mut rx) = uarte.split(); 30 let (mut tx, mut rx) = uarte.split();
diff --git a/tests/rp/src/bin/adc.rs b/tests/rp/src/bin/adc.rs
index 87e9709cc..c2175bc03 100644
--- a/tests/rp/src/bin/adc.rs
+++ b/tests/rp/src/bin/adc.rs
@@ -30,12 +30,12 @@ async fn main(_spawner: Spawner) {
30 30
31 { 31 {
32 { 32 {
33 let mut p = Channel::new_pin(&mut a, Pull::Down); 33 let mut p = Channel::new_pin(a.reborrow(), Pull::Down);
34 defmt::assert!(adc.blocking_read(&mut p).unwrap() < 0b01_0000_0000); 34 defmt::assert!(adc.blocking_read(&mut p).unwrap() < 0b01_0000_0000);
35 defmt::assert!(adc.read(&mut p).await.unwrap() < 0b01_0000_0000); 35 defmt::assert!(adc.read(&mut p).await.unwrap() < 0b01_0000_0000);
36 } 36 }
37 { 37 {
38 let mut p = Channel::new_pin(&mut a, Pull::Up); 38 let mut p = Channel::new_pin(a.reborrow(), Pull::Up);
39 defmt::assert!(adc.blocking_read(&mut p).unwrap() > 0b11_0000_0000); 39 defmt::assert!(adc.blocking_read(&mut p).unwrap() > 0b11_0000_0000);
40 defmt::assert!(adc.read(&mut p).await.unwrap() > 0b11_0000_0000); 40 defmt::assert!(adc.read(&mut p).await.unwrap() > 0b11_0000_0000);
41 } 41 }
@@ -43,21 +43,21 @@ async fn main(_spawner: Spawner) {
43 // not bothering with async reads from now on 43 // not bothering with async reads from now on
44 { 44 {
45 { 45 {
46 let mut p = Channel::new_pin(&mut b, Pull::Down); 46 let mut p = Channel::new_pin(b.reborrow(), Pull::Down);
47 defmt::assert!(adc.blocking_read(&mut p).unwrap() < 0b01_0000_0000); 47 defmt::assert!(adc.blocking_read(&mut p).unwrap() < 0b01_0000_0000);
48 } 48 }
49 { 49 {
50 let mut p = Channel::new_pin(&mut b, Pull::Up); 50 let mut p = Channel::new_pin(b.reborrow(), Pull::Up);
51 defmt::assert!(adc.blocking_read(&mut p).unwrap() > 0b11_0000_0000); 51 defmt::assert!(adc.blocking_read(&mut p).unwrap() > 0b11_0000_0000);
52 } 52 }
53 } 53 }
54 { 54 {
55 { 55 {
56 let mut p = Channel::new_pin(&mut c, Pull::Down); 56 let mut p = Channel::new_pin(c.reborrow(), Pull::Down);
57 defmt::assert!(adc.blocking_read(&mut p).unwrap() < 0b01_0000_0000); 57 defmt::assert!(adc.blocking_read(&mut p).unwrap() < 0b01_0000_0000);
58 } 58 }
59 { 59 {
60 let mut p = Channel::new_pin(&mut c, Pull::Up); 60 let mut p = Channel::new_pin(c.reborrow(), Pull::Up);
61 defmt::assert!(adc.blocking_read(&mut p).unwrap() > 0b11_0000_0000); 61 defmt::assert!(adc.blocking_read(&mut p).unwrap() > 0b11_0000_0000);
62 } 62 }
63 } 63 }
@@ -65,15 +65,15 @@ async fn main(_spawner: Spawner) {
65 // gp29 is connected to vsys through a 200k/100k divider, 65 // gp29 is connected to vsys through a 200k/100k divider,
66 // adding pulls should change the value 66 // adding pulls should change the value
67 let low = { 67 let low = {
68 let mut p = Channel::new_pin(&mut d, Pull::Down); 68 let mut p = Channel::new_pin(d.reborrow(), Pull::Down);
69 adc.blocking_read(&mut p).unwrap() 69 adc.blocking_read(&mut p).unwrap()
70 }; 70 };
71 let none = { 71 let none = {
72 let mut p = Channel::new_pin(&mut d, Pull::None); 72 let mut p = Channel::new_pin(d.reborrow(), Pull::None);
73 adc.blocking_read(&mut p).unwrap() 73 adc.blocking_read(&mut p).unwrap()
74 }; 74 };
75 let up = { 75 let up = {
76 let mut p = Channel::new_pin(&mut d, Pull::Up); 76 let mut p = Channel::new_pin(d.reborrow(), Pull::Up);
77 adc.blocking_read(&mut p).unwrap() 77 adc.blocking_read(&mut p).unwrap()
78 }; 78 };
79 defmt::assert!(low < none); 79 defmt::assert!(low < none);
@@ -81,7 +81,7 @@ async fn main(_spawner: Spawner) {
81 } 81 }
82 { 82 {
83 let temp = convert_to_celsius( 83 let temp = convert_to_celsius(
84 adc.read(&mut Channel::new_temp_sensor(&mut p.ADC_TEMP_SENSOR)) 84 adc.read(&mut Channel::new_temp_sensor(p.ADC_TEMP_SENSOR.reborrow()))
85 .await 85 .await
86 .unwrap(), 86 .unwrap(),
87 ); 87 );
@@ -97,14 +97,29 @@ async fn main(_spawner: Spawner) {
97 let mut low = [0u16; 16]; 97 let mut low = [0u16; 16];
98 let mut none = [0u8; 16]; 98 let mut none = [0u8; 16];
99 let mut up = [Sample::default(); 16]; 99 let mut up = [Sample::default(); 16];
100 adc.read_many(&mut Channel::new_pin(&mut d, Pull::Down), &mut low, 1, &mut p.DMA_CH0) 100 adc.read_many(
101 .await 101 &mut Channel::new_pin(d.reborrow(), Pull::Down),
102 .unwrap(); 102 &mut low,
103 adc.read_many(&mut Channel::new_pin(&mut d, Pull::None), &mut none, 1, &mut p.DMA_CH0) 103 1,
104 .await 104 p.DMA_CH0.reborrow(),
105 .unwrap(); 105 )
106 adc.read_many_raw(&mut Channel::new_pin(&mut d, Pull::Up), &mut up, 1, &mut p.DMA_CH0) 106 .await
107 .await; 107 .unwrap();
108 adc.read_many(
109 &mut Channel::new_pin(d.reborrow(), Pull::None),
110 &mut none,
111 1,
112 p.DMA_CH0.reborrow(),
113 )
114 .await
115 .unwrap();
116 adc.read_many_raw(
117 &mut Channel::new_pin(d.reborrow(), Pull::Up),
118 &mut up,
119 1,
120 p.DMA_CH0.reborrow(),
121 )
122 .await;
108 defmt::assert!(low.iter().zip(none.iter()).all(|(l, n)| *l >> 4 < *n as u16)); 123 defmt::assert!(low.iter().zip(none.iter()).all(|(l, n)| *l >> 4 < *n as u16));
109 defmt::assert!(up.iter().all(|s| s.good())); 124 defmt::assert!(up.iter().all(|s| s.good()));
110 defmt::assert!(none.iter().zip(up.iter()).all(|(n, u)| (*n as u16) < u.value())); 125 defmt::assert!(none.iter().zip(up.iter()).all(|(n, u)| (*n as u16) < u.value()));
@@ -112,10 +127,10 @@ async fn main(_spawner: Spawner) {
112 { 127 {
113 let mut temp = [0u16; 16]; 128 let mut temp = [0u16; 16];
114 adc.read_many( 129 adc.read_many(
115 &mut Channel::new_temp_sensor(&mut p.ADC_TEMP_SENSOR), 130 &mut Channel::new_temp_sensor(p.ADC_TEMP_SENSOR.reborrow()),
116 &mut temp, 131 &mut temp,
117 1, 132 1,
118 &mut p.DMA_CH0, 133 p.DMA_CH0.reborrow(),
119 ) 134 )
120 .await 135 .await
121 .unwrap(); 136 .unwrap();
@@ -126,10 +141,10 @@ async fn main(_spawner: Spawner) {
126 { 141 {
127 let mut multi = [0u16; 2]; 142 let mut multi = [0u16; 2];
128 let mut channels = [ 143 let mut channels = [
129 Channel::new_pin(&mut a, Pull::Up), 144 Channel::new_pin(a.reborrow(), Pull::Up),
130 Channel::new_temp_sensor(&mut p.ADC_TEMP_SENSOR), 145 Channel::new_temp_sensor(p.ADC_TEMP_SENSOR.reborrow()),
131 ]; 146 ];
132 adc.read_many_multichannel(&mut channels, &mut multi, 1, &mut p.DMA_CH0) 147 adc.read_many_multichannel(&mut channels, &mut multi, 1, p.DMA_CH0.reborrow())
133 .await 148 .await
134 .unwrap(); 149 .unwrap();
135 defmt::assert!(multi[0] > 3_000); 150 defmt::assert!(multi[0] > 3_000);
diff --git a/tests/rp/src/bin/bootsel.rs b/tests/rp/src/bin/bootsel.rs
index e88d8bf6c..aa123ab03 100644
--- a/tests/rp/src/bin/bootsel.rs
+++ b/tests/rp/src/bin/bootsel.rs
@@ -4,12 +4,13 @@ teleprobe_meta::target!(b"rpi-pico");
4 4
5use defmt::{assert_eq, *}; 5use defmt::{assert_eq, *};
6use embassy_executor::Spawner; 6use embassy_executor::Spawner;
7use embassy_rp::bootsel::is_bootsel_pressed;
7use embassy_time::Timer; 8use embassy_time::Timer;
8use {defmt_rtt as _, panic_probe as _}; 9use {defmt_rtt as _, panic_probe as _};
9 10
10#[embassy_executor::main] 11#[embassy_executor::main]
11async fn main(_spawner: Spawner) { 12async fn main(_spawner: Spawner) {
12 let mut p = embassy_rp::init(Default::default()); 13 let p = embassy_rp::init(Default::default());
13 info!("Hello World!"); 14 info!("Hello World!");
14 15
15 // add some delay to give an attached debug probe time to parse the 16 // add some delay to give an attached debug probe time to parse the
@@ -18,7 +19,7 @@ async fn main(_spawner: Spawner) {
18 // https://github.com/knurling-rs/defmt/pull/683 19 // https://github.com/knurling-rs/defmt/pull/683
19 Timer::after_millis(10).await; 20 Timer::after_millis(10).await;
20 21
21 assert_eq!(p.BOOTSEL.is_pressed(), false); 22 assert_eq!(is_bootsel_pressed(p.BOOTSEL), false);
22 23
23 info!("Test OK"); 24 info!("Test OK");
24 cortex_m::asm::bkpt(); 25 cortex_m::asm::bkpt();
diff --git a/tests/rp/src/bin/gpio.rs b/tests/rp/src/bin/gpio.rs
index 6c37ac5be..614b6317a 100644
--- a/tests/rp/src/bin/gpio.rs
+++ b/tests/rp/src/bin/gpio.rs
@@ -21,10 +21,10 @@ async fn main(_spawner: Spawner) {
21 21
22 // Test initial output 22 // Test initial output
23 { 23 {
24 let b = Input::new(&mut b, Pull::None); 24 let b = Input::new(b.reborrow(), Pull::None);
25 25
26 { 26 {
27 let a = Output::new(&mut a, Level::Low); 27 let a = Output::new(a.reborrow(), Level::Low);
28 delay(); 28 delay();
29 assert!(b.is_low()); 29 assert!(b.is_low());
30 assert!(!b.is_high()); 30 assert!(!b.is_high());
@@ -32,7 +32,7 @@ async fn main(_spawner: Spawner) {
32 assert!(!a.is_set_high()); 32 assert!(!a.is_set_high());
33 } 33 }
34 { 34 {
35 let mut a = Output::new(&mut a, Level::High); 35 let mut a = Output::new(a.reborrow(), Level::High);
36 delay(); 36 delay();
37 assert!(!b.is_low()); 37 assert!(!b.is_low());
38 assert!(b.is_high()); 38 assert!(b.is_high());
@@ -69,10 +69,10 @@ async fn main(_spawner: Spawner) {
69 69
70 // Test input no pull 70 // Test input no pull
71 { 71 {
72 let b = Input::new(&mut b, Pull::None); 72 let b = Input::new(b.reborrow(), Pull::None);
73 // no pull, the status is undefined 73 // no pull, the status is undefined
74 74
75 let mut a = Output::new(&mut a, Level::Low); 75 let mut a = Output::new(a.reborrow(), Level::Low);
76 delay(); 76 delay();
77 assert!(b.is_low()); 77 assert!(b.is_low());
78 a.set_high(); 78 a.set_high();
@@ -83,11 +83,11 @@ async fn main(_spawner: Spawner) {
83 // Test input pulldown 83 // Test input pulldown
84 #[cfg(feature = "rp2040")] 84 #[cfg(feature = "rp2040")]
85 { 85 {
86 let b = Input::new(&mut b, Pull::Down); 86 let b = Input::new(b.reborrow(), Pull::Down);
87 delay(); 87 delay();
88 assert!(b.is_low()); 88 assert!(b.is_low());
89 89
90 let mut a = Output::new(&mut a, Level::Low); 90 let mut a = Output::new(a.reborrow(), Level::Low);
91 delay(); 91 delay();
92 assert!(b.is_low()); 92 assert!(b.is_low());
93 a.set_high(); 93 a.set_high();
@@ -97,11 +97,11 @@ async fn main(_spawner: Spawner) {
97 97
98 // Test input pullup 98 // Test input pullup
99 { 99 {
100 let b = Input::new(&mut b, Pull::Up); 100 let b = Input::new(b.reborrow(), Pull::Up);
101 delay(); 101 delay();
102 assert!(b.is_high()); 102 assert!(b.is_high());
103 103
104 let mut a = Output::new(&mut a, Level::Low); 104 let mut a = Output::new(a.reborrow(), Level::Low);
105 delay(); 105 delay();
106 assert!(b.is_low()); 106 assert!(b.is_low());
107 a.set_high(); 107 a.set_high();
@@ -112,8 +112,8 @@ async fn main(_spawner: Spawner) {
112 // OUTPUT OPEN DRAIN 112 // OUTPUT OPEN DRAIN
113 #[cfg(feature = "rp2040")] 113 #[cfg(feature = "rp2040")]
114 { 114 {
115 let mut b = OutputOpenDrain::new(&mut b, Level::High); 115 let mut b = OutputOpenDrain::new(b.reborrow(), Level::High);
116 let mut a = Flex::new(&mut a); 116 let mut a = Flex::new(a.reborrow());
117 a.set_as_input(); 117 a.set_as_input();
118 118
119 // When an OutputOpenDrain is high, it doesn't drive the pin. 119 // When an OutputOpenDrain is high, it doesn't drive the pin.
@@ -170,12 +170,12 @@ async fn main(_spawner: Spawner) {
170 // Test initial output 170 // Test initial output
171 { 171 {
172 //Flex pin configured as input 172 //Flex pin configured as input
173 let mut b = Flex::new(&mut b); 173 let mut b = Flex::new(b.reborrow());
174 b.set_as_input(); 174 b.set_as_input();
175 175
176 { 176 {
177 //Flex pin configured as output 177 //Flex pin configured as output
178 let mut a = Flex::new(&mut a); //Flex pin configured as output 178 let mut a = Flex::new(a.reborrow()); //Flex pin configured as output
179 a.set_low(); // Pin state must be set before configuring the pin, thus we avoid unknown state 179 a.set_low(); // Pin state must be set before configuring the pin, thus we avoid unknown state
180 a.set_as_output(); 180 a.set_as_output();
181 delay(); 181 delay();
@@ -183,7 +183,7 @@ async fn main(_spawner: Spawner) {
183 } 183 }
184 { 184 {
185 //Flex pin configured as output 185 //Flex pin configured as output
186 let mut a = Flex::new(&mut a); 186 let mut a = Flex::new(a.reborrow());
187 a.set_high(); 187 a.set_high();
188 a.set_as_output(); 188 a.set_as_output();
189 189
@@ -194,10 +194,10 @@ async fn main(_spawner: Spawner) {
194 194
195 // Test input no pull 195 // Test input no pull
196 { 196 {
197 let mut b = Flex::new(&mut b); 197 let mut b = Flex::new(b.reborrow());
198 b.set_as_input(); // no pull by default. 198 b.set_as_input(); // no pull by default.
199 199
200 let mut a = Flex::new(&mut a); 200 let mut a = Flex::new(a.reborrow());
201 a.set_low(); 201 a.set_low();
202 a.set_as_output(); 202 a.set_as_output();
203 203
@@ -211,13 +211,13 @@ async fn main(_spawner: Spawner) {
211 // Test input pulldown 211 // Test input pulldown
212 #[cfg(feature = "rp2040")] 212 #[cfg(feature = "rp2040")]
213 { 213 {
214 let mut b = Flex::new(&mut b); 214 let mut b = Flex::new(b.reborrow());
215 b.set_as_input(); 215 b.set_as_input();
216 b.set_pull(Pull::Down); 216 b.set_pull(Pull::Down);
217 delay(); 217 delay();
218 assert!(b.is_low()); 218 assert!(b.is_low());
219 219
220 let mut a = Flex::new(&mut a); 220 let mut a = Flex::new(a.reborrow());
221 a.set_low(); 221 a.set_low();
222 a.set_as_output(); 222 a.set_as_output();
223 delay(); 223 delay();
@@ -229,13 +229,13 @@ async fn main(_spawner: Spawner) {
229 229
230 // Test input pullup 230 // Test input pullup
231 { 231 {
232 let mut b = Flex::new(&mut b); 232 let mut b = Flex::new(b.reborrow());
233 b.set_as_input(); 233 b.set_as_input();
234 b.set_pull(Pull::Up); 234 b.set_pull(Pull::Up);
235 delay(); 235 delay();
236 assert!(b.is_high()); 236 assert!(b.is_high());
237 237
238 let mut a = Flex::new(&mut a); 238 let mut a = Flex::new(a.reborrow());
239 a.set_high(); 239 a.set_high();
240 a.set_as_output(); 240 a.set_as_output();
241 delay(); 241 delay();
diff --git a/tests/rp/src/bin/gpio_async.rs b/tests/rp/src/bin/gpio_async.rs
index 39e3d6337..72fb0910d 100644
--- a/tests/rp/src/bin/gpio_async.rs
+++ b/tests/rp/src/bin/gpio_async.rs
@@ -22,8 +22,8 @@ async fn main(_spawner: Spawner) {
22 22
23 { 23 {
24 info!("test wait_for_high"); 24 info!("test wait_for_high");
25 let mut output = Output::new(&mut output_pin, Level::Low); 25 let mut output = Output::new(output_pin.reborrow(), Level::Low);
26 let mut input = Input::new(&mut input_pin, Pull::None); 26 let mut input = Input::new(input_pin.reborrow(), Pull::None);
27 27
28 assert!(input.is_low(), "input was expected to be low"); 28 assert!(input.is_low(), "input was expected to be low");
29 29
@@ -43,8 +43,8 @@ async fn main(_spawner: Spawner) {
43 43
44 { 44 {
45 info!("test wait_for_low"); 45 info!("test wait_for_low");
46 let mut output = Output::new(&mut output_pin, Level::High); 46 let mut output = Output::new(output_pin.reborrow(), Level::High);
47 let mut input = Input::new(&mut input_pin, Pull::None); 47 let mut input = Input::new(input_pin.reborrow(), Pull::None);
48 48
49 assert!(input.is_high(), "input was expected to be high"); 49 assert!(input.is_high(), "input was expected to be high");
50 50
@@ -63,8 +63,8 @@ async fn main(_spawner: Spawner) {
63 63
64 { 64 {
65 info!("test wait_for_rising_edge"); 65 info!("test wait_for_rising_edge");
66 let mut output = Output::new(&mut output_pin, Level::Low); 66 let mut output = Output::new(output_pin.reborrow(), Level::Low);
67 let mut input = Input::new(&mut input_pin, Pull::None); 67 let mut input = Input::new(input_pin.reborrow(), Pull::None);
68 68
69 assert!(input.is_low(), "input was expected to be low"); 69 assert!(input.is_low(), "input was expected to be low");
70 70
@@ -83,8 +83,8 @@ async fn main(_spawner: Spawner) {
83 83
84 { 84 {
85 info!("test wait_for_falling_edge"); 85 info!("test wait_for_falling_edge");
86 let mut output = Output::new(&mut output_pin, Level::High); 86 let mut output = Output::new(output_pin.reborrow(), Level::High);
87 let mut input = Input::new(&mut input_pin, Pull::None); 87 let mut input = Input::new(input_pin.reborrow(), Pull::None);
88 88
89 assert!(input.is_high(), "input was expected to be high"); 89 assert!(input.is_high(), "input was expected to be high");
90 90
@@ -103,8 +103,8 @@ async fn main(_spawner: Spawner) {
103 103
104 { 104 {
105 info!("test wait_for_any_edge (falling)"); 105 info!("test wait_for_any_edge (falling)");
106 let mut output = Output::new(&mut output_pin, Level::High); 106 let mut output = Output::new(output_pin.reborrow(), Level::High);
107 let mut input = Input::new(&mut input_pin, Pull::None); 107 let mut input = Input::new(input_pin.reborrow(), Pull::None);
108 108
109 assert!(input.is_high(), "input was expected to be high"); 109 assert!(input.is_high(), "input was expected to be high");
110 110
@@ -123,8 +123,8 @@ async fn main(_spawner: Spawner) {
123 123
124 { 124 {
125 info!("test wait_for_any_edge (rising)"); 125 info!("test wait_for_any_edge (rising)");
126 let mut output = Output::new(&mut output_pin, Level::Low); 126 let mut output = Output::new(output_pin.reborrow(), Level::Low);
127 let mut input = Input::new(&mut input_pin, Pull::None); 127 let mut input = Input::new(input_pin.reborrow(), Pull::None);
128 128
129 assert!(input.is_low(), "input was expected to be low"); 129 assert!(input.is_low(), "input was expected to be low");
130 130
diff --git a/tests/rp/src/bin/gpio_multicore.rs b/tests/rp/src/bin/gpio_multicore.rs
index 3caa8ef35..857f36975 100644
--- a/tests/rp/src/bin/gpio_multicore.rs
+++ b/tests/rp/src/bin/gpio_multicore.rs
@@ -10,6 +10,7 @@ use embassy_executor::Executor;
10use embassy_rp::gpio::{Input, Level, Output, Pull}; 10use embassy_rp::gpio::{Input, Level, Output, Pull};
11use embassy_rp::multicore::{spawn_core1, Stack}; 11use embassy_rp::multicore::{spawn_core1, Stack};
12use embassy_rp::peripherals::{PIN_0, PIN_1}; 12use embassy_rp::peripherals::{PIN_0, PIN_1};
13use embassy_rp::Peri;
13use embassy_sync::blocking_mutex::raw::CriticalSectionRawMutex; 14use embassy_sync::blocking_mutex::raw::CriticalSectionRawMutex;
14use embassy_sync::channel::Channel; 15use embassy_sync::channel::Channel;
15use static_cell::StaticCell; 16use static_cell::StaticCell;
@@ -37,7 +38,7 @@ fn main() -> ! {
37} 38}
38 39
39#[embassy_executor::task] 40#[embassy_executor::task]
40async fn core0_task(p: PIN_0) { 41async fn core0_task(p: Peri<'static, PIN_0>) {
41 info!("CORE0 is running"); 42 info!("CORE0 is running");
42 43
43 let mut pin = Output::new(p, Level::Low); 44 let mut pin = Output::new(p, Level::Low);
@@ -54,7 +55,7 @@ async fn core0_task(p: PIN_0) {
54} 55}
55 56
56#[embassy_executor::task] 57#[embassy_executor::task]
57async fn core1_task(p: PIN_1) { 58async fn core1_task(p: Peri<'static, PIN_1>) {
58 info!("CORE1 is running"); 59 info!("CORE1 is running");
59 60
60 CHANNEL0.receive().await; 61 CHANNEL0.receive().await;
diff --git a/tests/rp/src/bin/pwm.rs b/tests/rp/src/bin/pwm.rs
index d8ee78dcd..5f890cd50 100644
--- a/tests/rp/src/bin/pwm.rs
+++ b/tests/rp/src/bin/pwm.rs
@@ -33,7 +33,7 @@ async fn main(_spawner: Spawner) {
33 33
34 // Test free-running clock 34 // Test free-running clock
35 { 35 {
36 let pwm = Pwm::new_free(&mut p.PWM_SLICE3, cfg.clone()); 36 let pwm = Pwm::new_free(p.PWM_SLICE3.reborrow(), cfg.clone());
37 cortex_m::asm::delay(125); 37 cortex_m::asm::delay(125);
38 let ctr = pwm.counter(); 38 let ctr = pwm.counter();
39 assert!(ctr > 0); 39 assert!(ctr > 0);
@@ -50,8 +50,8 @@ async fn main(_spawner: Spawner) {
50 50
51 // Test output from A 51 // Test output from A
52 { 52 {
53 let pin1 = Input::new(&mut p9, Pull::None); 53 let pin1 = Input::new(p9.reborrow(), Pull::None);
54 let _pwm = Pwm::new_output_a(&mut p.PWM_SLICE3, &mut p6, cfg.clone()); 54 let _pwm = Pwm::new_output_a(p.PWM_SLICE3.reborrow(), p6.reborrow(), cfg.clone());
55 Timer::after_millis(1).await; 55 Timer::after_millis(1).await;
56 assert_eq!(pin1.is_low(), invert_a); 56 assert_eq!(pin1.is_low(), invert_a);
57 Timer::after_millis(5).await; 57 Timer::after_millis(5).await;
@@ -64,8 +64,8 @@ async fn main(_spawner: Spawner) {
64 64
65 // Test output from B 65 // Test output from B
66 { 66 {
67 let pin2 = Input::new(&mut p11, Pull::None); 67 let pin2 = Input::new(p11.reborrow(), Pull::None);
68 let _pwm = Pwm::new_output_b(&mut p.PWM_SLICE3, &mut p7, cfg.clone()); 68 let _pwm = Pwm::new_output_b(p.PWM_SLICE3.reborrow(), p7.reborrow(), cfg.clone());
69 Timer::after_millis(1).await; 69 Timer::after_millis(1).await;
70 assert_ne!(pin2.is_low(), invert_a); 70 assert_ne!(pin2.is_low(), invert_a);
71 Timer::after_millis(5).await; 71 Timer::after_millis(5).await;
@@ -78,9 +78,9 @@ async fn main(_spawner: Spawner) {
78 78
79 // Test output from A+B 79 // Test output from A+B
80 { 80 {
81 let pin1 = Input::new(&mut p9, Pull::None); 81 let pin1 = Input::new(p9.reborrow(), Pull::None);
82 let pin2 = Input::new(&mut p11, Pull::None); 82 let pin2 = Input::new(p11.reborrow(), Pull::None);
83 let _pwm = Pwm::new_output_ab(&mut p.PWM_SLICE3, &mut p6, &mut p7, cfg.clone()); 83 let _pwm = Pwm::new_output_ab(p.PWM_SLICE3.reborrow(), p6.reborrow(), p7.reborrow(), cfg.clone());
84 Timer::after_millis(1).await; 84 Timer::after_millis(1).await;
85 assert_eq!(pin1.is_low(), invert_a); 85 assert_eq!(pin1.is_low(), invert_a);
86 assert_ne!(pin2.is_low(), invert_a); 86 assert_ne!(pin2.is_low(), invert_a);
@@ -99,8 +99,14 @@ async fn main(_spawner: Spawner) {
99 // Test level-gated 99 // Test level-gated
100 #[cfg(feature = "rp2040")] 100 #[cfg(feature = "rp2040")]
101 { 101 {
102 let mut pin2 = Output::new(&mut p11, Level::Low); 102 let mut pin2 = Output::new(p11.reborrow(), Level::Low);
103 let pwm = Pwm::new_input(&mut p.PWM_SLICE3, &mut p7, Pull::None, InputMode::Level, cfg.clone()); 103 let pwm = Pwm::new_input(
104 p.PWM_SLICE3.reborrow(),
105 p7.reborrow(),
106 Pull::None,
107 InputMode::Level,
108 cfg.clone(),
109 );
104 assert_eq!(pwm.counter(), 0); 110 assert_eq!(pwm.counter(), 0);
105 Timer::after_millis(5).await; 111 Timer::after_millis(5).await;
106 assert_eq!(pwm.counter(), 0); 112 assert_eq!(pwm.counter(), 0);
@@ -117,10 +123,10 @@ async fn main(_spawner: Spawner) {
117 // Test rising-gated 123 // Test rising-gated
118 #[cfg(feature = "rp2040")] 124 #[cfg(feature = "rp2040")]
119 { 125 {
120 let mut pin2 = Output::new(&mut p11, Level::Low); 126 let mut pin2 = Output::new(p11.reborrow(), Level::Low);
121 let pwm = Pwm::new_input( 127 let pwm = Pwm::new_input(
122 &mut p.PWM_SLICE3, 128 p.PWM_SLICE3.reborrow(),
123 &mut p7, 129 p7.reborrow(),
124 Pull::None, 130 Pull::None,
125 InputMode::RisingEdge, 131 InputMode::RisingEdge,
126 cfg.clone(), 132 cfg.clone(),
@@ -139,10 +145,10 @@ async fn main(_spawner: Spawner) {
139 // Test falling-gated 145 // Test falling-gated
140 #[cfg(feature = "rp2040")] 146 #[cfg(feature = "rp2040")]
141 { 147 {
142 let mut pin2 = Output::new(&mut p11, Level::High); 148 let mut pin2 = Output::new(p11.reborrow(), Level::High);
143 let pwm = Pwm::new_input( 149 let pwm = Pwm::new_input(
144 &mut p.PWM_SLICE3, 150 p.PWM_SLICE3.reborrow(),
145 &mut p7, 151 p7.reborrow(),
146 Pull::None, 152 Pull::None,
147 InputMode::FallingEdge, 153 InputMode::FallingEdge,
148 cfg.clone(), 154 cfg.clone(),
@@ -160,10 +166,10 @@ async fn main(_spawner: Spawner) {
160 166
161 // pull-down 167 // pull-down
162 { 168 {
163 let pin2 = Input::new(&mut p11, Pull::None); 169 let pin2 = Input::new(p11.reborrow(), Pull::None);
164 Pwm::new_input( 170 Pwm::new_input(
165 &mut p.PWM_SLICE3, 171 p.PWM_SLICE3.reborrow(),
166 &mut p7, 172 p7.reborrow(),
167 Pull::Down, 173 Pull::Down,
168 InputMode::FallingEdge, 174 InputMode::FallingEdge,
169 cfg.clone(), 175 cfg.clone(),
@@ -174,10 +180,10 @@ async fn main(_spawner: Spawner) {
174 180
175 // pull-up 181 // pull-up
176 { 182 {
177 let pin2 = Input::new(&mut p11, Pull::None); 183 let pin2 = Input::new(p11.reborrow(), Pull::None);
178 Pwm::new_input( 184 Pwm::new_input(
179 &mut p.PWM_SLICE3, 185 p.PWM_SLICE3.reborrow(),
180 &mut p7, 186 p7.reborrow(),
181 Pull::Up, 187 Pull::Up,
182 InputMode::FallingEdge, 188 InputMode::FallingEdge,
183 cfg.clone(), 189 cfg.clone(),
diff --git a/tests/rp/src/bin/uart.rs b/tests/rp/src/bin/uart.rs
index 67cfa6bc8..84744ab77 100644
--- a/tests/rp/src/bin/uart.rs
+++ b/tests/rp/src/bin/uart.rs
@@ -56,7 +56,7 @@ async fn main(_spawner: Spawner) {
56 56
57 { 57 {
58 let config = Config::default(); 58 let config = Config::default();
59 let mut uart = Uart::new_blocking(&mut uart, &mut tx, &mut rx, config); 59 let mut uart = Uart::new_blocking(uart.reborrow(), tx.reborrow(), rx.reborrow(), config);
60 60
61 // We can't send too many bytes, they have to fit in the FIFO. 61 // We can't send too many bytes, they have to fit in the FIFO.
62 // This is because we aren't sending+receiving at the same time. 62 // This is because we aren't sending+receiving at the same time.
@@ -69,7 +69,7 @@ async fn main(_spawner: Spawner) {
69 info!("test overflow detection"); 69 info!("test overflow detection");
70 { 70 {
71 let config = Config::default(); 71 let config = Config::default();
72 let mut uart = Uart::new_blocking(&mut uart, &mut tx, &mut rx, config); 72 let mut uart = Uart::new_blocking(uart.reborrow(), tx.reborrow(), rx.reborrow(), config);
73 73
74 let data = [ 74 let data = [
75 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 75 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29,
@@ -93,7 +93,7 @@ async fn main(_spawner: Spawner) {
93 info!("test break detection"); 93 info!("test break detection");
94 { 94 {
95 let config = Config::default(); 95 let config = Config::default();
96 let mut uart = Uart::new_blocking(&mut uart, &mut tx, &mut rx, config); 96 let mut uart = Uart::new_blocking(uart.reborrow(), tx.reborrow(), rx.reborrow(), config);
97 97
98 // break on empty fifo 98 // break on empty fifo
99 uart.send_break(20).await; 99 uart.send_break(20).await;
@@ -113,11 +113,11 @@ async fn main(_spawner: Spawner) {
113 // parity detection. here we bitbang to not require two uarts. 113 // parity detection. here we bitbang to not require two uarts.
114 info!("test parity error detection"); 114 info!("test parity error detection");
115 { 115 {
116 let mut pin = Output::new(&mut tx, Level::High); 116 let mut pin = Output::new(tx.reborrow(), Level::High);
117 let mut config = Config::default(); 117 let mut config = Config::default();
118 config.baudrate = 1000; 118 config.baudrate = 1000;
119 config.parity = Parity::ParityEven; 119 config.parity = Parity::ParityEven;
120 let mut uart = UartRx::new_blocking(&mut uart, &mut rx, config); 120 let mut uart = UartRx::new_blocking(uart.reborrow(), rx.reborrow(), config);
121 121
122 async fn chr(pin: &mut Output<'_>, v: u8, parity: u8) { 122 async fn chr(pin: &mut Output<'_>, v: u8, parity: u8) {
123 send(pin, v, Some(parity != 0)).await; 123 send(pin, v, Some(parity != 0)).await;
@@ -140,10 +140,10 @@ async fn main(_spawner: Spawner) {
140 // framing error detection. here we bitbang because there's no other way. 140 // framing error detection. here we bitbang because there's no other way.
141 info!("test framing error detection"); 141 info!("test framing error detection");
142 { 142 {
143 let mut pin = Output::new(&mut tx, Level::High); 143 let mut pin = Output::new(tx.reborrow(), Level::High);
144 let mut config = Config::default(); 144 let mut config = Config::default();
145 config.baudrate = 1000; 145 config.baudrate = 1000;
146 let mut uart = UartRx::new_blocking(&mut uart, &mut rx, config); 146 let mut uart = UartRx::new_blocking(uart.reborrow(), rx.reborrow(), config);
147 147
148 async fn chr(pin: &mut Output<'_>, v: u8, good: bool) { 148 async fn chr(pin: &mut Output<'_>, v: u8, good: bool) {
149 if good { 149 if good {
diff --git a/tests/rp/src/bin/uart_buffered.rs b/tests/rp/src/bin/uart_buffered.rs
index a543320e0..b270a60ce 100644
--- a/tests/rp/src/bin/uart_buffered.rs
+++ b/tests/rp/src/bin/uart_buffered.rs
@@ -73,7 +73,15 @@ async fn main(_spawner: Spawner) {
73 let config = Config::default(); 73 let config = Config::default();
74 let tx_buf = &mut [0u8; 16]; 74 let tx_buf = &mut [0u8; 16];
75 let rx_buf = &mut [0u8; 16]; 75 let rx_buf = &mut [0u8; 16];
76 let mut uart = BufferedUart::new(&mut uart, Irqs, &mut tx, &mut rx, tx_buf, rx_buf, config); 76 let mut uart = BufferedUart::new(
77 uart.reborrow(),
78 Irqs,
79 tx.reborrow(),
80 rx.reborrow(),
81 tx_buf,
82 rx_buf,
83 config,
84 );
77 85
78 // Make sure we send more bytes than fits in the FIFO, to test the actual 86 // Make sure we send more bytes than fits in the FIFO, to test the actual
79 // bufferedUart. 87 // bufferedUart.
@@ -93,7 +101,15 @@ async fn main(_spawner: Spawner) {
93 let config = Config::default(); 101 let config = Config::default();
94 let tx_buf = &mut [0u8; 16]; 102 let tx_buf = &mut [0u8; 16];
95 let rx_buf = &mut [0u8; 16]; 103 let rx_buf = &mut [0u8; 16];
96 let mut uart = BufferedUart::new(&mut uart, Irqs, &mut tx, &mut rx, tx_buf, rx_buf, config); 104 let mut uart = BufferedUart::new(
105 uart.reborrow(),
106 Irqs,
107 tx.reborrow(),
108 rx.reborrow(),
109 tx_buf,
110 rx_buf,
111 config,
112 );
97 113
98 // Make sure we send more bytes than fits in the FIFO, to test the actual 114 // Make sure we send more bytes than fits in the FIFO, to test the actual
99 // bufferedUart. 115 // bufferedUart.
@@ -128,7 +144,15 @@ async fn main(_spawner: Spawner) {
128 config.baudrate = 1000; 144 config.baudrate = 1000;
129 let tx_buf = &mut [0u8; 16]; 145 let tx_buf = &mut [0u8; 16];
130 let rx_buf = &mut [0u8; 16]; 146 let rx_buf = &mut [0u8; 16];
131 let mut uart = BufferedUart::new(&mut uart, Irqs, &mut tx, &mut rx, tx_buf, rx_buf, config); 147 let mut uart = BufferedUart::new(
148 uart.reborrow(),
149 Irqs,
150 tx.reborrow(),
151 rx.reborrow(),
152 tx_buf,
153 rx_buf,
154 config,
155 );
132 156
133 // break on empty buffer 157 // break on empty buffer
134 uart.send_break(20).await; 158 uart.send_break(20).await;
@@ -156,13 +180,13 @@ async fn main(_spawner: Spawner) {
156 // parity detection. here we bitbang to not require two uarts. 180 // parity detection. here we bitbang to not require two uarts.
157 info!("test parity error detection"); 181 info!("test parity error detection");
158 { 182 {
159 let mut pin = Output::new(&mut tx, Level::High); 183 let mut pin = Output::new(tx.reborrow(), Level::High);
160 // choose a very slow baud rate to make tests reliable even with O0 184 // choose a very slow baud rate to make tests reliable even with O0
161 let mut config = Config::default(); 185 let mut config = Config::default();
162 config.baudrate = 1000; 186 config.baudrate = 1000;
163 config.parity = Parity::ParityEven; 187 config.parity = Parity::ParityEven;
164 let rx_buf = &mut [0u8; 16]; 188 let rx_buf = &mut [0u8; 16];
165 let mut uart = BufferedUartRx::new(&mut uart, Irqs, &mut rx, rx_buf, config); 189 let mut uart = BufferedUartRx::new(uart.reborrow(), Irqs, rx.reborrow(), rx_buf, config);
166 190
167 async fn chr(pin: &mut Output<'_>, v: u8, parity: u32) { 191 async fn chr(pin: &mut Output<'_>, v: u8, parity: u32) {
168 send(pin, v, Some(parity != 0)).await; 192 send(pin, v, Some(parity != 0)).await;
@@ -204,12 +228,12 @@ async fn main(_spawner: Spawner) {
204 // framing error detection. here we bitbang because there's no other way. 228 // framing error detection. here we bitbang because there's no other way.
205 info!("test framing error detection"); 229 info!("test framing error detection");
206 { 230 {
207 let mut pin = Output::new(&mut tx, Level::High); 231 let mut pin = Output::new(tx.reborrow(), Level::High);
208 // choose a very slow baud rate to make tests reliable even with O0 232 // choose a very slow baud rate to make tests reliable even with O0
209 let mut config = Config::default(); 233 let mut config = Config::default();
210 config.baudrate = 1000; 234 config.baudrate = 1000;
211 let rx_buf = &mut [0u8; 16]; 235 let rx_buf = &mut [0u8; 16];
212 let mut uart = BufferedUartRx::new(&mut uart, Irqs, &mut rx, rx_buf, config); 236 let mut uart = BufferedUartRx::new(uart.reborrow(), Irqs, rx.reborrow(), rx_buf, config);
213 237
214 async fn chr(pin: &mut Output<'_>, v: u8, good: bool) { 238 async fn chr(pin: &mut Output<'_>, v: u8, good: bool) {
215 if good { 239 if good {
diff --git a/tests/rp/src/bin/uart_dma.rs b/tests/rp/src/bin/uart_dma.rs
index bdf94e78c..a09101223 100644
--- a/tests/rp/src/bin/uart_dma.rs
+++ b/tests/rp/src/bin/uart_dma.rs
@@ -65,12 +65,12 @@ async fn main(_spawner: Spawner) {
65 { 65 {
66 let config = Config::default(); 66 let config = Config::default();
67 let mut uart = Uart::new( 67 let mut uart = Uart::new(
68 &mut uart, 68 uart.reborrow(),
69 &mut tx, 69 tx.reborrow(),
70 &mut rx, 70 rx.reborrow(),
71 Irqs, 71 Irqs,
72 &mut p.DMA_CH0, 72 p.DMA_CH0.reborrow(),
73 &mut p.DMA_CH1, 73 p.DMA_CH1.reborrow(),
74 config, 74 config,
75 ); 75 );
76 76
@@ -86,12 +86,12 @@ async fn main(_spawner: Spawner) {
86 { 86 {
87 let config = Config::default(); 87 let config = Config::default();
88 let mut uart = Uart::new( 88 let mut uart = Uart::new(
89 &mut uart, 89 uart.reborrow(),
90 &mut tx, 90 tx.reborrow(),
91 &mut rx, 91 rx.reborrow(),
92 Irqs, 92 Irqs,
93 &mut p.DMA_CH0, 93 p.DMA_CH0.reborrow(),
94 &mut p.DMA_CH1, 94 p.DMA_CH1.reborrow(),
95 config, 95 config,
96 ); 96 );
97 97
@@ -115,12 +115,12 @@ async fn main(_spawner: Spawner) {
115 { 115 {
116 let config = Config::default(); 116 let config = Config::default();
117 let (mut tx, mut rx) = Uart::new( 117 let (mut tx, mut rx) = Uart::new(
118 &mut uart, 118 uart.reborrow(),
119 &mut tx, 119 tx.reborrow(),
120 &mut rx, 120 rx.reborrow(),
121 Irqs, 121 Irqs,
122 &mut p.DMA_CH0, 122 p.DMA_CH0.reborrow(),
123 &mut p.DMA_CH1, 123 p.DMA_CH1.reborrow(),
124 config, 124 config,
125 ) 125 )
126 .split(); 126 .split();
@@ -156,12 +156,12 @@ async fn main(_spawner: Spawner) {
156 // parity detection. here we bitbang to not require two uarts. 156 // parity detection. here we bitbang to not require two uarts.
157 info!("test parity error detection"); 157 info!("test parity error detection");
158 { 158 {
159 let mut pin = Output::new(&mut tx, Level::High); 159 let mut pin = Output::new(tx.reborrow(), Level::High);
160 // choose a very slow baud rate to make tests reliable even with O0 160 // choose a very slow baud rate to make tests reliable even with O0
161 let mut config = Config::default(); 161 let mut config = Config::default();
162 config.baudrate = 1000; 162 config.baudrate = 1000;
163 config.parity = Parity::ParityEven; 163 config.parity = Parity::ParityEven;
164 let mut uart = UartRx::new(&mut uart, &mut rx, Irqs, &mut p.DMA_CH0, config); 164 let mut uart = UartRx::new(uart.reborrow(), rx.reborrow(), Irqs, p.DMA_CH0.reborrow(), config);
165 165
166 async fn chr(pin: &mut Output<'_>, v: u8, parity: u32) { 166 async fn chr(pin: &mut Output<'_>, v: u8, parity: u32) {
167 send(pin, v, Some(parity != 0)).await; 167 send(pin, v, Some(parity != 0)).await;
@@ -202,11 +202,11 @@ async fn main(_spawner: Spawner) {
202 // framing error detection. here we bitbang because there's no other way. 202 // framing error detection. here we bitbang because there's no other way.
203 info!("test framing error detection"); 203 info!("test framing error detection");
204 { 204 {
205 let mut pin = Output::new(&mut tx, Level::High); 205 let mut pin = Output::new(tx.reborrow(), Level::High);
206 // choose a very slow baud rate to make tests reliable even with O0 206 // choose a very slow baud rate to make tests reliable even with O0
207 let mut config = Config::default(); 207 let mut config = Config::default();
208 config.baudrate = 1000; 208 config.baudrate = 1000;
209 let mut uart = UartRx::new(&mut uart, &mut rx, Irqs, &mut p.DMA_CH0, config); 209 let mut uart = UartRx::new(uart.reborrow(), rx.reborrow(), Irqs, p.DMA_CH0.reborrow(), config);
210 210
211 async fn chr(pin: &mut Output<'_>, v: u8, good: bool) { 211 async fn chr(pin: &mut Output<'_>, v: u8, good: bool) {
212 if good { 212 if good {
diff --git a/tests/stm32/src/bin/can.rs b/tests/stm32/src/bin/can.rs
index 85a5f8d83..778d88a7b 100644
--- a/tests/stm32/src/bin/can.rs
+++ b/tests/stm32/src/bin/can.rs
@@ -43,7 +43,7 @@ async fn main(_spawner: Spawner) {
43 // To synchronise to the bus the RX input needs to see a high level. 43 // To synchronise to the bus the RX input needs to see a high level.
44 // Use `mem::forget()` to release the borrow on the pin but keep the 44 // Use `mem::forget()` to release the borrow on the pin but keep the
45 // pull-up resistor enabled. 45 // pull-up resistor enabled.
46 let rx_pin = Input::new(&mut rx, Pull::Up); 46 let rx_pin = Input::new(rx.reborrow(), Pull::Up);
47 core::mem::forget(rx_pin); 47 core::mem::forget(rx_pin);
48 48
49 let mut can = embassy_stm32::can::Can::new(can, rx, tx, Irqs); 49 let mut can = embassy_stm32::can::Can::new(can, rx, tx, Irqs);
diff --git a/tests/stm32/src/bin/cordic.rs b/tests/stm32/src/bin/cordic.rs
index 879ad56b6..e86eea58b 100644
--- a/tests/stm32/src/bin/cordic.rs
+++ b/tests/stm32/src/bin/cordic.rs
@@ -82,8 +82,8 @@ async fn main(_spawner: Spawner) {
82 let cnt1 = defmt::unwrap!( 82 let cnt1 = defmt::unwrap!(
83 cordic 83 cordic
84 .async_calc_32bit( 84 .async_calc_32bit(
85 &mut write_dma, 85 write_dma.reborrow(),
86 &mut read_dma, 86 read_dma.reborrow(),
87 &input_q1_31[2..], 87 &input_q1_31[2..],
88 &mut output_q1_31[cnt0..], 88 &mut output_q1_31[cnt0..],
89 true, 89 true,
diff --git a/tests/stm32/src/bin/gpio.rs b/tests/stm32/src/bin/gpio.rs
index 4a2584b4e..40b03201c 100644
--- a/tests/stm32/src/bin/gpio.rs
+++ b/tests/stm32/src/bin/gpio.rs
@@ -20,10 +20,10 @@ async fn main(_spawner: Spawner) {
20 20
21 // Test initial output 21 // Test initial output
22 { 22 {
23 let b = Input::new(&mut b, Pull::None); 23 let b = Input::new(b.reborrow(), Pull::None);
24 24
25 { 25 {
26 let a = Output::new(&mut a, Level::Low, Speed::Low); 26 let a = Output::new(a.reborrow(), Level::Low, Speed::Low);
27 delay(); 27 delay();
28 assert!(b.is_low()); 28 assert!(b.is_low());
29 assert!(!b.is_high()); 29 assert!(!b.is_high());
@@ -31,7 +31,7 @@ async fn main(_spawner: Spawner) {
31 assert!(!a.is_set_high()); 31 assert!(!a.is_set_high());
32 } 32 }
33 { 33 {
34 let mut a = Output::new(&mut a, Level::High, Speed::Low); 34 let mut a = Output::new(a.reborrow(), Level::High, Speed::Low);
35 delay(); 35 delay();
36 assert!(!b.is_low()); 36 assert!(!b.is_low());
37 assert!(b.is_high()); 37 assert!(b.is_high());
@@ -68,10 +68,10 @@ async fn main(_spawner: Spawner) {
68 68
69 // Test input no pull 69 // Test input no pull
70 { 70 {
71 let b = Input::new(&mut b, Pull::None); 71 let b = Input::new(b.reborrow(), Pull::None);
72 // no pull, the status is undefined 72 // no pull, the status is undefined
73 73
74 let mut a = Output::new(&mut a, Level::Low, Speed::Low); 74 let mut a = Output::new(a.reborrow(), Level::Low, Speed::Low);
75 delay(); 75 delay();
76 assert!(b.is_low()); 76 assert!(b.is_low());
77 a.set_high(); 77 a.set_high();
@@ -81,11 +81,11 @@ async fn main(_spawner: Spawner) {
81 81
82 // Test input pulldown 82 // Test input pulldown
83 { 83 {
84 let b = Input::new(&mut b, Pull::Down); 84 let b = Input::new(b.reborrow(), Pull::Down);
85 delay(); 85 delay();
86 assert!(b.is_low()); 86 assert!(b.is_low());
87 87
88 let mut a = Output::new(&mut a, Level::Low, Speed::Low); 88 let mut a = Output::new(a.reborrow(), Level::Low, Speed::Low);
89 delay(); 89 delay();
90 assert!(b.is_low()); 90 assert!(b.is_low());
91 a.set_high(); 91 a.set_high();
@@ -95,11 +95,11 @@ async fn main(_spawner: Spawner) {
95 95
96 // Test input pullup 96 // Test input pullup
97 { 97 {
98 let b = Input::new(&mut b, Pull::Up); 98 let b = Input::new(b.reborrow(), Pull::Up);
99 delay(); 99 delay();
100 assert!(b.is_high()); 100 assert!(b.is_high());
101 101
102 let mut a = Output::new(&mut a, Level::Low, Speed::Low); 102 let mut a = Output::new(a.reborrow(), Level::Low, Speed::Low);
103 delay(); 103 delay();
104 assert!(b.is_low()); 104 assert!(b.is_low());
105 a.set_high(); 105 a.set_high();
@@ -109,10 +109,10 @@ async fn main(_spawner: Spawner) {
109 109
110 // Test output open drain 110 // Test output open drain
111 { 111 {
112 let b = Input::new(&mut b, Pull::Down); 112 let b = Input::new(b.reborrow(), Pull::Down);
113 // no pull, the status is undefined 113 // no pull, the status is undefined
114 114
115 let mut a = OutputOpenDrain::new(&mut a, Level::Low, Speed::Low); 115 let mut a = OutputOpenDrain::new(a.reborrow(), Level::Low, Speed::Low);
116 delay(); 116 delay();
117 assert!(b.is_low()); 117 assert!(b.is_low());
118 a.set_high(); // High-Z output 118 a.set_high(); // High-Z output
@@ -124,12 +124,12 @@ async fn main(_spawner: Spawner) {
124 // Test initial output 124 // Test initial output
125 { 125 {
126 //Flex pin configured as input 126 //Flex pin configured as input
127 let mut b = Flex::new(&mut b); 127 let mut b = Flex::new(b.reborrow());
128 b.set_as_input(Pull::None); 128 b.set_as_input(Pull::None);
129 129
130 { 130 {
131 //Flex pin configured as output 131 //Flex pin configured as output
132 let mut a = Flex::new(&mut a); //Flex pin configured as output 132 let mut a = Flex::new(a.reborrow()); //Flex pin configured as output
133 a.set_low(); // Pin state must be set before configuring the pin, thus we avoid unknown state 133 a.set_low(); // Pin state must be set before configuring the pin, thus we avoid unknown state
134 a.set_as_output(Speed::Low); 134 a.set_as_output(Speed::Low);
135 delay(); 135 delay();
@@ -137,7 +137,7 @@ async fn main(_spawner: Spawner) {
137 } 137 }
138 { 138 {
139 //Flex pin configured as output 139 //Flex pin configured as output
140 let mut a = Flex::new(&mut a); 140 let mut a = Flex::new(a.reborrow());
141 a.set_high(); 141 a.set_high();
142 a.set_as_output(Speed::Low); 142 a.set_as_output(Speed::Low);
143 143
@@ -148,10 +148,10 @@ async fn main(_spawner: Spawner) {
148 148
149 // Test input no pull 149 // Test input no pull
150 { 150 {
151 let mut b = Flex::new(&mut b); 151 let mut b = Flex::new(b.reborrow());
152 b.set_as_input(Pull::None); // no pull, the status is undefined 152 b.set_as_input(Pull::None); // no pull, the status is undefined
153 153
154 let mut a = Flex::new(&mut a); 154 let mut a = Flex::new(a.reborrow());
155 a.set_low(); 155 a.set_low();
156 a.set_as_output(Speed::Low); 156 a.set_as_output(Speed::Low);
157 157
@@ -164,12 +164,12 @@ async fn main(_spawner: Spawner) {
164 164
165 // Test input pulldown 165 // Test input pulldown
166 { 166 {
167 let mut b = Flex::new(&mut b); 167 let mut b = Flex::new(b.reborrow());
168 b.set_as_input(Pull::Down); 168 b.set_as_input(Pull::Down);
169 delay(); 169 delay();
170 assert!(b.is_low()); 170 assert!(b.is_low());
171 171
172 let mut a = Flex::new(&mut a); 172 let mut a = Flex::new(a.reborrow());
173 a.set_low(); 173 a.set_low();
174 a.set_as_output(Speed::Low); 174 a.set_as_output(Speed::Low);
175 delay(); 175 delay();
@@ -181,12 +181,12 @@ async fn main(_spawner: Spawner) {
181 181
182 // Test input pullup 182 // Test input pullup
183 { 183 {
184 let mut b = Flex::new(&mut b); 184 let mut b = Flex::new(b.reborrow());
185 b.set_as_input(Pull::Up); 185 b.set_as_input(Pull::Up);
186 delay(); 186 delay();
187 assert!(b.is_high()); 187 assert!(b.is_high());
188 188
189 let mut a = Flex::new(&mut a); 189 let mut a = Flex::new(a.reborrow());
190 a.set_high(); 190 a.set_high();
191 a.set_as_output(Speed::Low); 191 a.set_as_output(Speed::Low);
192 delay(); 192 delay();
@@ -198,10 +198,10 @@ async fn main(_spawner: Spawner) {
198 198
199 // Test output open drain 199 // Test output open drain
200 { 200 {
201 let mut b = Flex::new(&mut b); 201 let mut b = Flex::new(b.reborrow());
202 b.set_as_input(Pull::Down); 202 b.set_as_input(Pull::Down);
203 203
204 let mut a = Flex::new(&mut a); 204 let mut a = Flex::new(a.reborrow());
205 a.set_low(); 205 a.set_low();
206 a.set_as_input_output(Speed::Low); 206 a.set_as_input_output(Speed::Low);
207 delay(); 207 delay();
diff --git a/tests/stm32/src/bin/sdmmc.rs b/tests/stm32/src/bin/sdmmc.rs
index a6bc117c0..07f17b569 100644
--- a/tests/stm32/src/bin/sdmmc.rs
+++ b/tests/stm32/src/bin/sdmmc.rs
@@ -40,15 +40,15 @@ async fn main(_spawner: Spawner) {
40 // ======== Try 4bit. ============== 40 // ======== Try 4bit. ==============
41 info!("initializing in 4-bit mode..."); 41 info!("initializing in 4-bit mode...");
42 let mut s = Sdmmc::new_4bit( 42 let mut s = Sdmmc::new_4bit(
43 &mut sdmmc, 43 sdmmc.reborrow(),
44 Irqs, 44 Irqs,
45 &mut dma, 45 dma.reborrow(),
46 &mut clk, 46 clk.reborrow(),
47 &mut cmd, 47 cmd.reborrow(),
48 &mut d0, 48 d0.reborrow(),
49 &mut d1, 49 d1.reborrow(),
50 &mut d2, 50 d2.reborrow(),
51 &mut d3, 51 d3.reborrow(),
52 Default::default(), 52 Default::default(),
53 ); 53 );
54 54
@@ -89,12 +89,12 @@ async fn main(_spawner: Spawner) {
89 // ======== Try 1bit. ============== 89 // ======== Try 1bit. ==============
90 info!("initializing in 1-bit mode..."); 90 info!("initializing in 1-bit mode...");
91 let mut s = Sdmmc::new_1bit( 91 let mut s = Sdmmc::new_1bit(
92 &mut sdmmc, 92 sdmmc.reborrow(),
93 Irqs, 93 Irqs,
94 &mut dma, 94 dma.reborrow(),
95 &mut clk, 95 clk.reborrow(),
96 &mut cmd, 96 cmd.reborrow(),
97 &mut d0, 97 d0.reborrow(),
98 Default::default(), 98 Default::default(),
99 ); 99 );
100 100
diff --git a/tests/stm32/src/bin/spi.rs b/tests/stm32/src/bin/spi.rs
index 9712a8c5a..e8310866a 100644
--- a/tests/stm32/src/bin/spi.rs
+++ b/tests/stm32/src/bin/spi.rs
@@ -25,10 +25,10 @@ async fn main(_spawner: Spawner) {
25 spi_config.frequency = Hertz(1_000_000); 25 spi_config.frequency = Hertz(1_000_000);
26 26
27 let mut spi = Spi::new_blocking( 27 let mut spi = Spi::new_blocking(
28 &mut spi_peri, 28 spi_peri.reborrow(),
29 &mut sck, // Arduino D13 29 sck.reborrow(), // Arduino D13
30 &mut mosi, // Arduino D11 30 mosi.reborrow(), // Arduino D11
31 &mut miso, // Arduino D12 31 miso.reborrow(), // Arduino D12
32 spi_config, 32 spi_config,
33 ); 33 );
34 34
@@ -43,20 +43,20 @@ async fn main(_spawner: Spawner) {
43 defmt::assert!(!embassy_stm32::pac::RCC.apb2enr().read().spi1en()); 43 defmt::assert!(!embassy_stm32::pac::RCC.apb2enr().read().spi1en());
44 44
45 // test rx-only configuration 45 // test rx-only configuration
46 let mut spi = Spi::new_blocking_rxonly(&mut spi_peri, &mut sck, &mut miso, spi_config); 46 let mut spi = Spi::new_blocking_rxonly(spi_peri.reborrow(), sck.reborrow(), miso.reborrow(), spi_config);
47 let mut mosi_out = Output::new(&mut mosi, Level::Low, Speed::VeryHigh); 47 let mut mosi_out = Output::new(mosi.reborrow(), Level::Low, Speed::VeryHigh);
48 48
49 test_rx::<u8>(&mut spi, &mut mosi_out); 49 test_rx::<u8>(&mut spi, &mut mosi_out);
50 test_rx::<u16>(&mut spi, &mut mosi_out); 50 test_rx::<u16>(&mut spi, &mut mosi_out);
51 drop(spi); 51 drop(spi);
52 drop(mosi_out); 52 drop(mosi_out);
53 53
54 let mut spi = Spi::new_blocking_txonly(&mut spi_peri, &mut sck, &mut mosi, spi_config); 54 let mut spi = Spi::new_blocking_txonly(spi_peri.reborrow(), sck.reborrow(), mosi.reborrow(), spi_config);
55 test_tx::<u8>(&mut spi); 55 test_tx::<u8>(&mut spi);
56 test_tx::<u16>(&mut spi); 56 test_tx::<u16>(&mut spi);
57 drop(spi); 57 drop(spi);
58 58
59 let mut spi = Spi::new_blocking_txonly_nosck(&mut spi_peri, &mut mosi, spi_config); 59 let mut spi = Spi::new_blocking_txonly_nosck(spi_peri.reborrow(), mosi.reborrow(), spi_config);
60 test_tx::<u8>(&mut spi); 60 test_tx::<u8>(&mut spi);
61 test_tx::<u16>(&mut spi); 61 test_tx::<u16>(&mut spi);
62 drop(spi); 62 drop(spi);
diff --git a/tests/stm32/src/bin/spi_dma.rs b/tests/stm32/src/bin/spi_dma.rs
index 307409a16..b4fdb8faa 100644
--- a/tests/stm32/src/bin/spi_dma.rs
+++ b/tests/stm32/src/bin/spi_dma.rs
@@ -27,12 +27,12 @@ async fn main(_spawner: Spawner) {
27 spi_config.frequency = Hertz(1_000_000); 27 spi_config.frequency = Hertz(1_000_000);
28 28
29 let mut spi = Spi::new( 29 let mut spi = Spi::new(
30 &mut spi_peri, 30 spi_peri.reborrow(),
31 &mut sck, // Arduino D13 31 sck.reborrow(), // Arduino D13
32 &mut mosi, // Arduino D11 32 mosi.reborrow(), // Arduino D11
33 &mut miso, // Arduino D12 33 miso.reborrow(), // Arduino D12
34 &mut tx_dma, 34 tx_dma.reborrow(),
35 &mut rx_dma, 35 rx_dma.reborrow(),
36 spi_config, 36 spi_config,
37 ); 37 );
38 38
@@ -42,28 +42,34 @@ async fn main(_spawner: Spawner) {
42 42
43 // test rx-only configuration 43 // test rx-only configuration
44 let mut spi = Spi::new_rxonly( 44 let mut spi = Spi::new_rxonly(
45 &mut spi_peri, 45 spi_peri.reborrow(),
46 &mut sck, 46 sck.reborrow(),
47 &mut miso, 47 miso.reborrow(),
48 // SPIv1/f1 requires txdma even if rxonly. 48 // SPIv1/f1 requires txdma even if rxonly.
49 #[cfg(not(feature = "spi-v345"))] 49 #[cfg(not(feature = "spi-v345"))]
50 &mut tx_dma, 50 tx_dma.reborrow(),
51 &mut rx_dma, 51 rx_dma.reborrow(),
52 spi_config, 52 spi_config,
53 ); 53 );
54 let mut mosi_out = Output::new(&mut mosi, Level::Low, Speed::VeryHigh); 54 let mut mosi_out = Output::new(mosi.reborrow(), Level::Low, Speed::VeryHigh);
55 55
56 test_rx::<u8>(&mut spi, &mut mosi_out).await; 56 test_rx::<u8>(&mut spi, &mut mosi_out).await;
57 test_rx::<u16>(&mut spi, &mut mosi_out).await; 57 test_rx::<u16>(&mut spi, &mut mosi_out).await;
58 drop(spi); 58 drop(spi);
59 drop(mosi_out); 59 drop(mosi_out);
60 60
61 let mut spi = Spi::new_txonly(&mut spi_peri, &mut sck, &mut mosi, &mut tx_dma, spi_config); 61 let mut spi = Spi::new_txonly(
62 spi_peri.reborrow(),
63 sck.reborrow(),
64 mosi.reborrow(),
65 tx_dma.reborrow(),
66 spi_config,
67 );
62 test_tx::<u8>(&mut spi).await; 68 test_tx::<u8>(&mut spi).await;
63 test_tx::<u16>(&mut spi).await; 69 test_tx::<u16>(&mut spi).await;
64 drop(spi); 70 drop(spi);
65 71
66 let mut spi = Spi::new_txonly_nosck(&mut spi_peri, &mut mosi, &mut tx_dma, spi_config); 72 let mut spi = Spi::new_txonly_nosck(spi_peri.reborrow(), mosi.reborrow(), tx_dma.reborrow(), spi_config);
67 test_tx::<u8>(&mut spi).await; 73 test_tx::<u8>(&mut spi).await;
68 test_tx::<u16>(&mut spi).await; 74 test_tx::<u16>(&mut spi).await;
69 drop(spi); 75 drop(spi);
diff --git a/tests/stm32/src/bin/ucpd.rs b/tests/stm32/src/bin/ucpd.rs
index bd7b35d6b..97aefe1a0 100644
--- a/tests/stm32/src/bin/ucpd.rs
+++ b/tests/stm32/src/bin/ucpd.rs
@@ -9,7 +9,7 @@ use defmt::{assert, assert_eq};
9use embassy_executor::Spawner; 9use embassy_executor::Spawner;
10use embassy_futures::join::join; 10use embassy_futures::join::join;
11use embassy_stm32::ucpd::{self, CcPhy, CcPull, CcSel, CcVState, RxError, Ucpd}; 11use embassy_stm32::ucpd::{self, CcPhy, CcPull, CcSel, CcVState, RxError, Ucpd};
12use embassy_stm32::{bind_interrupts, peripherals}; 12use embassy_stm32::{bind_interrupts, peripherals, Peri};
13use embassy_time::Timer; 13use embassy_time::Timer;
14 14
15bind_interrupts!(struct Irqs { 15bind_interrupts!(struct Irqs {
@@ -28,8 +28,8 @@ async fn wait_for_vstate<T: ucpd::Instance>(cc_phy: &mut CcPhy<'_, T>, vstate: C
28 28
29async fn source( 29async fn source(
30 mut ucpd: Ucpd<'static, peripherals::UCPD1>, 30 mut ucpd: Ucpd<'static, peripherals::UCPD1>,
31 rx_dma: peripherals::DMA1_CH1, 31 rx_dma: Peri<'static, peripherals::DMA1_CH1>,
32 tx_dma: peripherals::DMA1_CH2, 32 tx_dma: Peri<'static, peripherals::DMA1_CH2>,
33) { 33) {
34 debug!("source: setting default current pull-up"); 34 debug!("source: setting default current pull-up");
35 ucpd.cc_phy().set_pull(CcPull::SourceDefaultUsb); 35 ucpd.cc_phy().set_pull(CcPull::SourceDefaultUsb);
@@ -65,8 +65,8 @@ async fn source(
65 65
66async fn sink( 66async fn sink(
67 mut ucpd: Ucpd<'static, peripherals::UCPD2>, 67 mut ucpd: Ucpd<'static, peripherals::UCPD2>,
68 rx_dma: peripherals::DMA1_CH3, 68 rx_dma: Peri<'static, peripherals::DMA1_CH3>,
69 tx_dma: peripherals::DMA1_CH4, 69 tx_dma: Peri<'static, peripherals::DMA1_CH4>,
70) { 70) {
71 debug!("sink: setting pull down"); 71 debug!("sink: setting pull down");
72 ucpd.cc_phy().set_pull(CcPull::Sink); 72 ucpd.cc_phy().set_pull(CcPull::Sink);
diff --git a/tests/stm32/src/bin/usart.rs b/tests/stm32/src/bin/usart.rs
index 2f601ad0e..129c7b692 100644
--- a/tests/stm32/src/bin/usart.rs
+++ b/tests/stm32/src/bin/usart.rs
@@ -22,7 +22,7 @@ async fn main(_spawner: Spawner) {
22 22
23 { 23 {
24 let config = Config::default(); 24 let config = Config::default();
25 let mut usart = Uart::new_blocking(&mut usart, &mut rx, &mut tx, config).unwrap(); 25 let mut usart = Uart::new_blocking(usart.reborrow(), rx.reborrow(), tx.reborrow(), config).unwrap();
26 26
27 // We can't send too many bytes, they have to fit in the FIFO. 27 // We can't send too many bytes, they have to fit in the FIFO.
28 // This is because we aren't sending+receiving at the same time. 28 // This is because we aren't sending+receiving at the same time.
@@ -45,7 +45,7 @@ async fn main(_spawner: Spawner) {
45 // Test error handling with with an overflow error 45 // Test error handling with with an overflow error
46 { 46 {
47 let config = Config::default(); 47 let config = Config::default();
48 let mut usart = Uart::new_blocking(&mut usart, &mut rx, &mut tx, config).unwrap(); 48 let mut usart = Uart::new_blocking(usart.reborrow(), rx.reborrow(), tx.reborrow(), config).unwrap();
49 49
50 // Send enough bytes to fill the RX FIFOs off all USART versions. 50 // Send enough bytes to fill the RX FIFOs off all USART versions.
51 let data = [0; 64]; 51 let data = [0; 64];
@@ -75,7 +75,7 @@ async fn main(_spawner: Spawner) {
75 75
76 let mut config = Config::default(); 76 let mut config = Config::default();
77 config.baudrate = baudrate; 77 config.baudrate = baudrate;
78 let mut usart = match Uart::new_blocking(&mut usart, &mut rx, &mut tx, config) { 78 let mut usart = match Uart::new_blocking(usart.reborrow(), rx.reborrow(), tx.reborrow(), config) {
79 Ok(x) => x, 79 Ok(x) => x,
80 Err(ConfigError::BaudrateTooHigh) => { 80 Err(ConfigError::BaudrateTooHigh) => {
81 info!("baudrate too high"); 81 info!("baudrate too high");