aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--cyw43/Cargo.toml2
-rw-r--r--embassy-embedded-hal/Cargo.toml7
-rw-r--r--embassy-embedded-hal/src/adapter/blocking_async.rs43
-rw-r--r--embassy-embedded-hal/src/adapter/yielding_async.rs39
-rw-r--r--embassy-embedded-hal/src/shared_bus/asynch/spi.rs126
-rw-r--r--embassy-embedded-hal/src/shared_bus/blocking/spi.rs120
-rw-r--r--embassy-embedded-hal/src/shared_bus/mod.rs4
-rw-r--r--embassy-lora/Cargo.toml7
-rw-r--r--embassy-net-esp-hosted/Cargo.toml4
-rw-r--r--embassy-net-w5500/Cargo.toml4
-rw-r--r--embassy-net-w5500/src/spi.rs8
-rw-r--r--embassy-nrf/Cargo.toml4
-rw-r--r--embassy-nrf/src/spim.rs20
-rw-r--r--embassy-rp/Cargo.toml6
-rw-r--r--embassy-rp/src/spi.rs20
-rw-r--r--embassy-stm32/Cargo.toml6
-rw-r--r--embassy-stm32/src/spi/mod.rs23
-rw-r--r--embassy-time/Cargo.toml4
-rw-r--r--examples/nrf52840/Cargo.toml5
-rw-r--r--examples/nrf52840/src/bin/wifi_esp_hosted.rs5
-rw-r--r--examples/rp/Cargo.toml7
-rw-r--r--examples/rp/src/bin/ethernet_w5500_multisocket.rs14
-rw-r--r--examples/rp/src/bin/ethernet_w5500_tcp_client.rs14
-rw-r--r--examples/rp/src/bin/ethernet_w5500_tcp_server.rs14
-rw-r--r--examples/rp/src/bin/ethernet_w5500_udp.rs13
-rw-r--r--examples/rp/src/bin/spi_display.rs8
-rw-r--r--examples/stm32h5/Cargo.toml4
-rw-r--r--examples/stm32h7/Cargo.toml4
-rw-r--r--examples/stm32l0/Cargo.toml3
-rw-r--r--examples/stm32l4/Cargo.toml4
-rw-r--r--examples/stm32wl/Cargo.toml3
-rw-r--r--tests/nrf/Cargo.toml4
-rw-r--r--tests/nrf/src/bin/wifi_esp_hosted_perf.rs6
-rw-r--r--tests/rp/Cargo.toml4
-rw-r--r--tests/stm32/Cargo.toml4
35 files changed, 177 insertions, 386 deletions
diff --git a/cyw43/Cargo.toml b/cyw43/Cargo.toml
index 61caa0272..7d2f9dfd0 100644
--- a/cyw43/Cargo.toml
+++ b/cyw43/Cargo.toml
@@ -24,7 +24,7 @@ cortex-m = "0.7.6"
24cortex-m-rt = "0.7.0" 24cortex-m-rt = "0.7.0"
25futures = { version = "0.3.17", default-features = false, features = ["async-await", "cfg-target-has-atomic", "unstable"] } 25futures = { version = "0.3.17", default-features = false, features = ["async-await", "cfg-target-has-atomic", "unstable"] }
26 26
27embedded-hal-1 = { package = "embedded-hal", version = "1.0.0-alpha.10" } 27embedded-hal-1 = { package = "embedded-hal", version = "1.0.0-alpha.11" }
28num_enum = { version = "0.5.7", default-features = false } 28num_enum = { version = "0.5.7", default-features = false }
29 29
30[package.metadata.embassy_docs] 30[package.metadata.embassy_docs]
diff --git a/embassy-embedded-hal/Cargo.toml b/embassy-embedded-hal/Cargo.toml
index 35c70bb63..2d11dc3c7 100644
--- a/embassy-embedded-hal/Cargo.toml
+++ b/embassy-embedded-hal/Cargo.toml
@@ -15,15 +15,18 @@ target = "x86_64-unknown-linux-gnu"
15std = [] 15std = []
16# Enable nightly-only features 16# Enable nightly-only features
17nightly = ["embassy-futures", "embedded-hal-async", "embedded-storage-async"] 17nightly = ["embassy-futures", "embedded-hal-async", "embedded-storage-async"]
18time = ["dep:embassy-time"]
19default = ["time"]
18 20
19[dependencies] 21[dependencies]
20embassy-futures = { version = "0.1.0", path = "../embassy-futures", optional = true } 22embassy-futures = { version = "0.1.0", path = "../embassy-futures", optional = true }
21embassy-sync = { version = "0.2.0", path = "../embassy-sync" } 23embassy-sync = { version = "0.2.0", path = "../embassy-sync" }
24embassy-time = { version = "0.1.0", path = "../embassy-time", optional = true }
22embedded-hal-02 = { package = "embedded-hal", version = "0.2.6", features = [ 25embedded-hal-02 = { package = "embedded-hal", version = "0.2.6", features = [
23 "unproven", 26 "unproven",
24] } 27] }
25embedded-hal-1 = { package = "embedded-hal", version = "=1.0.0-alpha.10" } 28embedded-hal-1 = { package = "embedded-hal", version = "=1.0.0-alpha.11" }
26embedded-hal-async = { version = "=0.2.0-alpha.1", optional = true } 29embedded-hal-async = { version = "=0.2.0-alpha.2", optional = true }
27embedded-storage = "0.3.0" 30embedded-storage = "0.3.0"
28embedded-storage-async = { version = "0.4.0", optional = true } 31embedded-storage-async = { version = "0.4.0", optional = true }
29nb = "1.0.0" 32nb = "1.0.0"
diff --git a/embassy-embedded-hal/src/adapter/blocking_async.rs b/embassy-embedded-hal/src/adapter/blocking_async.rs
index b996d6a75..98ae2b02c 100644
--- a/embassy-embedded-hal/src/adapter/blocking_async.rs
+++ b/embassy-embedded-hal/src/adapter/blocking_async.rs
@@ -74,47 +74,30 @@ where
74 E: embedded_hal_1::spi::Error + 'static, 74 E: embedded_hal_1::spi::Error + 'static,
75 T: blocking::spi::Transfer<u8, Error = E> + blocking::spi::Write<u8, Error = E>, 75 T: blocking::spi::Transfer<u8, Error = E> + blocking::spi::Write<u8, Error = E>,
76{ 76{
77 async fn transfer<'a>(&'a mut self, read: &'a mut [u8], write: &'a [u8]) -> Result<(), Self::Error> { 77 async fn flush(&mut self) -> Result<(), Self::Error> {
78 // Ensure we write the expected bytes
79 for i in 0..core::cmp::min(read.len(), write.len()) {
80 read[i] = write[i].clone();
81 }
82 self.wrapped.transfer(read)?;
83 Ok(()) 78 Ok(())
84 } 79 }
85 80
86 async fn transfer_in_place<'a>(&'a mut self, _: &'a mut [u8]) -> Result<(), Self::Error> { 81 async fn write(&mut self, data: &[u8]) -> Result<(), Self::Error> {
87 todo!() 82 self.wrapped.write(data)?;
83 Ok(())
88 } 84 }
89}
90 85
91impl<T, E> embedded_hal_async::spi::SpiBusFlush for BlockingAsync<T> 86 async fn read(&mut self, data: &mut [u8]) -> Result<(), Self::Error> {
92where 87 self.wrapped.transfer(data)?;
93 E: embedded_hal_1::spi::Error + 'static,
94 T: blocking::spi::Transfer<u8, Error = E> + blocking::spi::Write<u8, Error = E>,
95{
96 async fn flush(&mut self) -> Result<(), Self::Error> {
97 Ok(()) 88 Ok(())
98 } 89 }
99}
100 90
101impl<T, E> embedded_hal_async::spi::SpiBusWrite<u8> for BlockingAsync<T> 91 async fn transfer(&mut self, read: &mut [u8], write: &[u8]) -> Result<(), Self::Error> {
102where 92 // Ensure we write the expected bytes
103 E: embedded_hal_1::spi::Error + 'static, 93 for i in 0..core::cmp::min(read.len(), write.len()) {
104 T: blocking::spi::Transfer<u8, Error = E> + blocking::spi::Write<u8, Error = E>, 94 read[i] = write[i].clone();
105{ 95 }
106 async fn write(&mut self, data: &[u8]) -> Result<(), Self::Error> { 96 self.wrapped.transfer(read)?;
107 self.wrapped.write(data)?;
108 Ok(()) 97 Ok(())
109 } 98 }
110}
111 99
112impl<T, E> embedded_hal_async::spi::SpiBusRead<u8> for BlockingAsync<T> 100 async fn transfer_in_place(&mut self, data: &mut [u8]) -> Result<(), Self::Error> {
113where
114 E: embedded_hal_1::spi::Error + 'static,
115 T: blocking::spi::Transfer<u8, Error = E> + blocking::spi::Write<u8, Error = E>,
116{
117 async fn read(&mut self, data: &mut [u8]) -> Result<(), Self::Error> {
118 self.wrapped.transfer(data)?; 101 self.wrapped.transfer(data)?;
119 Ok(()) 102 Ok(())
120 } 103 }
diff --git a/embassy-embedded-hal/src/adapter/yielding_async.rs b/embassy-embedded-hal/src/adapter/yielding_async.rs
index f51e4076f..fe9c9c341 100644
--- a/embassy-embedded-hal/src/adapter/yielding_async.rs
+++ b/embassy-embedded-hal/src/adapter/yielding_async.rs
@@ -69,51 +69,36 @@ where
69 type Error = T::Error; 69 type Error = T::Error;
70} 70}
71 71
72impl<T> embedded_hal_async::spi::SpiBus<u8> for YieldingAsync<T> 72impl<T, Word: 'static + Copy> embedded_hal_async::spi::SpiBus<Word> for YieldingAsync<T>
73where 73where
74 T: embedded_hal_async::spi::SpiBus, 74 T: embedded_hal_async::spi::SpiBus<Word>,
75{ 75{
76 async fn transfer<'a>(&'a mut self, read: &'a mut [u8], write: &'a [u8]) -> Result<(), Self::Error> { 76 async fn flush(&mut self) -> Result<(), Self::Error> {
77 self.wrapped.transfer(read, write).await?; 77 self.wrapped.flush().await?;
78 yield_now().await; 78 yield_now().await;
79 Ok(()) 79 Ok(())
80 } 80 }
81 81
82 async fn transfer_in_place<'a>(&'a mut self, words: &'a mut [u8]) -> Result<(), Self::Error> { 82 async fn write(&mut self, data: &[Word]) -> Result<(), Self::Error> {
83 self.wrapped.transfer_in_place(words).await?; 83 self.wrapped.write(data).await?;
84 yield_now().await; 84 yield_now().await;
85 Ok(()) 85 Ok(())
86 } 86 }
87}
88 87
89impl<T> embedded_hal_async::spi::SpiBusFlush for YieldingAsync<T> 88 async fn read(&mut self, data: &mut [Word]) -> Result<(), Self::Error> {
90where 89 self.wrapped.read(data).await?;
91 T: embedded_hal_async::spi::SpiBusFlush,
92{
93 async fn flush(&mut self) -> Result<(), Self::Error> {
94 self.wrapped.flush().await?;
95 yield_now().await; 90 yield_now().await;
96 Ok(()) 91 Ok(())
97 } 92 }
98}
99 93
100impl<T> embedded_hal_async::spi::SpiBusWrite<u8> for YieldingAsync<T> 94 async fn transfer(&mut self, read: &mut [Word], write: &[Word]) -> Result<(), Self::Error> {
101where 95 self.wrapped.transfer(read, write).await?;
102 T: embedded_hal_async::spi::SpiBusWrite<u8>,
103{
104 async fn write(&mut self, data: &[u8]) -> Result<(), Self::Error> {
105 self.wrapped.write(data).await?;
106 yield_now().await; 96 yield_now().await;
107 Ok(()) 97 Ok(())
108 } 98 }
109}
110 99
111impl<T> embedded_hal_async::spi::SpiBusRead<u8> for YieldingAsync<T> 100 async fn transfer_in_place(&mut self, words: &mut [Word]) -> Result<(), Self::Error> {
112where 101 self.wrapped.transfer_in_place(words).await?;
113 T: embedded_hal_async::spi::SpiBusRead<u8>,
114{
115 async fn read(&mut self, data: &mut [u8]) -> Result<(), Self::Error> {
116 self.wrapped.read(data).await?;
117 yield_now().await; 102 yield_now().await;
118 Ok(()) 103 Ok(())
119 } 104 }
diff --git a/embassy-embedded-hal/src/shared_bus/asynch/spi.rs b/embassy-embedded-hal/src/shared_bus/asynch/spi.rs
index b5549a6cd..030392183 100644
--- a/embassy-embedded-hal/src/shared_bus/asynch/spi.rs
+++ b/embassy-embedded-hal/src/shared_bus/asynch/spi.rs
@@ -56,62 +56,6 @@ where
56 type Error = SpiDeviceError<BUS::Error, CS::Error>; 56 type Error = SpiDeviceError<BUS::Error, CS::Error>;
57} 57}
58 58
59impl<M, BUS, CS> spi::SpiDeviceRead for SpiDevice<'_, M, BUS, CS>
60where
61 M: RawMutex,
62 BUS: spi::SpiBusRead,
63 CS: OutputPin,
64{
65 async fn read_transaction(&mut self, operations: &mut [&mut [u8]]) -> Result<(), Self::Error> {
66 let mut bus = self.bus.lock().await;
67 self.cs.set_low().map_err(SpiDeviceError::Cs)?;
68
69 let op_res: Result<(), BUS::Error> = try {
70 for buf in operations {
71 bus.read(buf).await?;
72 }
73 };
74
75 // On failure, it's important to still flush and deassert CS.
76 let flush_res = bus.flush().await;
77 let cs_res = self.cs.set_high();
78
79 let op_res = op_res.map_err(SpiDeviceError::Spi)?;
80 flush_res.map_err(SpiDeviceError::Spi)?;
81 cs_res.map_err(SpiDeviceError::Cs)?;
82
83 Ok(op_res)
84 }
85}
86
87impl<M, BUS, CS> spi::SpiDeviceWrite for SpiDevice<'_, M, BUS, CS>
88where
89 M: RawMutex,
90 BUS: spi::SpiBusWrite,
91 CS: OutputPin,
92{
93 async fn write_transaction(&mut self, operations: &[&[u8]]) -> Result<(), Self::Error> {
94 let mut bus = self.bus.lock().await;
95 self.cs.set_low().map_err(SpiDeviceError::Cs)?;
96
97 let op_res: Result<(), BUS::Error> = try {
98 for buf in operations {
99 bus.write(buf).await?;
100 }
101 };
102
103 // On failure, it's important to still flush and deassert CS.
104 let flush_res = bus.flush().await;
105 let cs_res = self.cs.set_high();
106
107 let op_res = op_res.map_err(SpiDeviceError::Spi)?;
108 flush_res.map_err(SpiDeviceError::Spi)?;
109 cs_res.map_err(SpiDeviceError::Cs)?;
110
111 Ok(op_res)
112 }
113}
114
115impl<M, BUS, CS> spi::SpiDevice for SpiDevice<'_, M, BUS, CS> 59impl<M, BUS, CS> spi::SpiDevice for SpiDevice<'_, M, BUS, CS>
116where 60where
117 M: RawMutex, 61 M: RawMutex,
@@ -129,6 +73,12 @@ where
129 Operation::Write(buf) => bus.write(buf).await?, 73 Operation::Write(buf) => bus.write(buf).await?,
130 Operation::Transfer(read, write) => bus.transfer(read, write).await?, 74 Operation::Transfer(read, write) => bus.transfer(read, write).await?,
131 Operation::TransferInPlace(buf) => bus.transfer_in_place(buf).await?, 75 Operation::TransferInPlace(buf) => bus.transfer_in_place(buf).await?,
76 #[cfg(not(feature = "time"))]
77 Operation::DelayUs(_) => return Err(SpiDeviceError::DelayUsNotSupported),
78 #[cfg(feature = "time")]
79 Operation::DelayUs(us) => {
80 embassy_time::Timer::after(embassy_time::Duration::from_micros(*us as _)).await
81 }
132 } 82 }
133 } 83 }
134 }; 84 };
@@ -172,64 +122,6 @@ where
172 type Error = SpiDeviceError<BUS::Error, CS::Error>; 122 type Error = SpiDeviceError<BUS::Error, CS::Error>;
173} 123}
174 124
175impl<M, BUS, CS> spi::SpiDeviceWrite for SpiDeviceWithConfig<'_, M, BUS, CS>
176where
177 M: RawMutex,
178 BUS: spi::SpiBusWrite + SetConfig,
179 CS: OutputPin,
180{
181 async fn write_transaction(&mut self, operations: &[&[u8]]) -> Result<(), Self::Error> {
182 let mut bus = self.bus.lock().await;
183 bus.set_config(&self.config);
184 self.cs.set_low().map_err(SpiDeviceError::Cs)?;
185
186 let op_res: Result<(), BUS::Error> = try {
187 for buf in operations {
188 bus.write(buf).await?;
189 }
190 };
191
192 // On failure, it's important to still flush and deassert CS.
193 let flush_res = bus.flush().await;
194 let cs_res = self.cs.set_high();
195
196 let op_res = op_res.map_err(SpiDeviceError::Spi)?;
197 flush_res.map_err(SpiDeviceError::Spi)?;
198 cs_res.map_err(SpiDeviceError::Cs)?;
199
200 Ok(op_res)
201 }
202}
203
204impl<M, BUS, CS> spi::SpiDeviceRead for SpiDeviceWithConfig<'_, M, BUS, CS>
205where
206 M: RawMutex,
207 BUS: spi::SpiBusRead + SetConfig,
208 CS: OutputPin,
209{
210 async fn read_transaction(&mut self, operations: &mut [&mut [u8]]) -> Result<(), Self::Error> {
211 let mut bus = self.bus.lock().await;
212 bus.set_config(&self.config);
213 self.cs.set_low().map_err(SpiDeviceError::Cs)?;
214
215 let op_res: Result<(), BUS::Error> = try {
216 for buf in operations {
217 bus.read(buf).await?;
218 }
219 };
220
221 // On failure, it's important to still flush and deassert CS.
222 let flush_res = bus.flush().await;
223 let cs_res = self.cs.set_high();
224
225 let op_res = op_res.map_err(SpiDeviceError::Spi)?;
226 flush_res.map_err(SpiDeviceError::Spi)?;
227 cs_res.map_err(SpiDeviceError::Cs)?;
228
229 Ok(op_res)
230 }
231}
232
233impl<M, BUS, CS> spi::SpiDevice for SpiDeviceWithConfig<'_, M, BUS, CS> 125impl<M, BUS, CS> spi::SpiDevice for SpiDeviceWithConfig<'_, M, BUS, CS>
234where 126where
235 M: RawMutex, 127 M: RawMutex,
@@ -248,6 +140,12 @@ where
248 Operation::Write(buf) => bus.write(buf).await?, 140 Operation::Write(buf) => bus.write(buf).await?,
249 Operation::Transfer(read, write) => bus.transfer(read, write).await?, 141 Operation::Transfer(read, write) => bus.transfer(read, write).await?,
250 Operation::TransferInPlace(buf) => bus.transfer_in_place(buf).await?, 142 Operation::TransferInPlace(buf) => bus.transfer_in_place(buf).await?,
143 #[cfg(not(feature = "time"))]
144 Operation::DelayUs(_) => return Err(SpiDeviceError::DelayUsNotSupported),
145 #[cfg(feature = "time")]
146 Operation::DelayUs(us) => {
147 embassy_time::Timer::after(embassy_time::Duration::from_micros(*us as _)).await
148 }
251 } 149 }
252 } 150 }
253 }; 151 };
diff --git a/embassy-embedded-hal/src/shared_bus/blocking/spi.rs b/embassy-embedded-hal/src/shared_bus/blocking/spi.rs
index 22e013be9..6d03d6263 100644
--- a/embassy-embedded-hal/src/shared_bus/blocking/spi.rs
+++ b/embassy-embedded-hal/src/shared_bus/blocking/spi.rs
@@ -22,7 +22,7 @@ use core::cell::RefCell;
22use embassy_sync::blocking_mutex::raw::RawMutex; 22use embassy_sync::blocking_mutex::raw::RawMutex;
23use embassy_sync::blocking_mutex::Mutex; 23use embassy_sync::blocking_mutex::Mutex;
24use embedded_hal_1::digital::OutputPin; 24use embedded_hal_1::digital::OutputPin;
25use embedded_hal_1::spi::{self, Operation, SpiBus, SpiBusRead, SpiBusWrite}; 25use embedded_hal_1::spi::{self, Operation, SpiBus};
26 26
27use crate::shared_bus::SpiDeviceError; 27use crate::shared_bus::SpiDeviceError;
28use crate::SetConfig; 28use crate::SetConfig;
@@ -48,58 +48,6 @@ where
48 type Error = SpiDeviceError<BUS::Error, CS::Error>; 48 type Error = SpiDeviceError<BUS::Error, CS::Error>;
49} 49}
50 50
51impl<BUS, M, CS> embedded_hal_1::spi::SpiDeviceRead for SpiDevice<'_, M, BUS, CS>
52where
53 M: RawMutex,
54 BUS: SpiBusRead,
55 CS: OutputPin,
56{
57 fn read_transaction(&mut self, operations: &mut [&mut [u8]]) -> Result<(), Self::Error> {
58 self.bus.lock(|bus| {
59 let mut bus = bus.borrow_mut();
60 self.cs.set_low().map_err(SpiDeviceError::Cs)?;
61
62 let op_res = operations.iter_mut().try_for_each(|buf| bus.read(buf));
63
64 // On failure, it's important to still flush and deassert CS.
65 let flush_res = bus.flush();
66 let cs_res = self.cs.set_high();
67
68 let op_res = op_res.map_err(SpiDeviceError::Spi)?;
69 flush_res.map_err(SpiDeviceError::Spi)?;
70 cs_res.map_err(SpiDeviceError::Cs)?;
71
72 Ok(op_res)
73 })
74 }
75}
76
77impl<BUS, M, CS> embedded_hal_1::spi::SpiDeviceWrite for SpiDevice<'_, M, BUS, CS>
78where
79 M: RawMutex,
80 BUS: SpiBusWrite,
81 CS: OutputPin,
82{
83 fn write_transaction(&mut self, operations: &[&[u8]]) -> Result<(), Self::Error> {
84 self.bus.lock(|bus| {
85 let mut bus = bus.borrow_mut();
86 self.cs.set_low().map_err(SpiDeviceError::Cs)?;
87
88 let op_res = operations.iter().try_for_each(|buf| bus.write(buf));
89
90 // On failure, it's important to still flush and deassert CS.
91 let flush_res = bus.flush();
92 let cs_res = self.cs.set_high();
93
94 let op_res = op_res.map_err(SpiDeviceError::Spi)?;
95 flush_res.map_err(SpiDeviceError::Spi)?;
96 cs_res.map_err(SpiDeviceError::Cs)?;
97
98 Ok(op_res)
99 })
100 }
101}
102
103impl<BUS, M, CS> embedded_hal_1::spi::SpiDevice for SpiDevice<'_, M, BUS, CS> 51impl<BUS, M, CS> embedded_hal_1::spi::SpiDevice for SpiDevice<'_, M, BUS, CS>
104where 52where
105 M: RawMutex, 53 M: RawMutex,
@@ -116,6 +64,13 @@ where
116 Operation::Write(buf) => bus.write(buf), 64 Operation::Write(buf) => bus.write(buf),
117 Operation::Transfer(read, write) => bus.transfer(read, write), 65 Operation::Transfer(read, write) => bus.transfer(read, write),
118 Operation::TransferInPlace(buf) => bus.transfer_in_place(buf), 66 Operation::TransferInPlace(buf) => bus.transfer_in_place(buf),
67 #[cfg(not(feature = "time"))]
68 Operation::DelayUs(_) => Err(SpiDeviceError::DelayUsNotSupported),
69 #[cfg(feature = "time")]
70 Operation::DelayUs(us) => {
71 embassy_time::block_for(embassy_time::Duration::from_micros(*us as _));
72 Ok(())
73 }
119 }); 74 });
120 75
121 // On failure, it's important to still flush and deassert CS. 76 // On failure, it's important to still flush and deassert CS.
@@ -199,58 +154,6 @@ where
199 type Error = SpiDeviceError<BUS::Error, CS::Error>; 154 type Error = SpiDeviceError<BUS::Error, CS::Error>;
200} 155}
201 156
202impl<BUS, M, CS> embedded_hal_1::spi::SpiDeviceRead for SpiDeviceWithConfig<'_, M, BUS, CS>
203where
204 M: RawMutex,
205 BUS: SpiBusRead + SetConfig,
206 CS: OutputPin,
207{
208 fn read_transaction(&mut self, operations: &mut [&mut [u8]]) -> Result<(), Self::Error> {
209 self.bus.lock(|bus| {
210 let mut bus = bus.borrow_mut();
211 bus.set_config(&self.config);
212 self.cs.set_low().map_err(SpiDeviceError::Cs)?;
213
214 let op_res = operations.iter_mut().try_for_each(|buf| bus.read(buf));
215
216 // On failure, it's important to still flush and deassert CS.
217 let flush_res = bus.flush();
218 let cs_res = self.cs.set_high();
219
220 let op_res = op_res.map_err(SpiDeviceError::Spi)?;
221 flush_res.map_err(SpiDeviceError::Spi)?;
222 cs_res.map_err(SpiDeviceError::Cs)?;
223 Ok(op_res)
224 })
225 }
226}
227
228impl<BUS, M, CS> embedded_hal_1::spi::SpiDeviceWrite for SpiDeviceWithConfig<'_, M, BUS, CS>
229where
230 M: RawMutex,
231 BUS: SpiBusWrite + SetConfig,
232 CS: OutputPin,
233{
234 fn write_transaction(&mut self, operations: &[&[u8]]) -> Result<(), Self::Error> {
235 self.bus.lock(|bus| {
236 let mut bus = bus.borrow_mut();
237 bus.set_config(&self.config);
238 self.cs.set_low().map_err(SpiDeviceError::Cs)?;
239
240 let op_res = operations.iter().try_for_each(|buf| bus.write(buf));
241
242 // On failure, it's important to still flush and deassert CS.
243 let flush_res = bus.flush();
244 let cs_res = self.cs.set_high();
245
246 let op_res = op_res.map_err(SpiDeviceError::Spi)?;
247 flush_res.map_err(SpiDeviceError::Spi)?;
248 cs_res.map_err(SpiDeviceError::Cs)?;
249 Ok(op_res)
250 })
251 }
252}
253
254impl<BUS, M, CS> embedded_hal_1::spi::SpiDevice for SpiDeviceWithConfig<'_, M, BUS, CS> 157impl<BUS, M, CS> embedded_hal_1::spi::SpiDevice for SpiDeviceWithConfig<'_, M, BUS, CS>
255where 158where
256 M: RawMutex, 159 M: RawMutex,
@@ -268,6 +171,13 @@ where
268 Operation::Write(buf) => bus.write(buf), 171 Operation::Write(buf) => bus.write(buf),
269 Operation::Transfer(read, write) => bus.transfer(read, write), 172 Operation::Transfer(read, write) => bus.transfer(read, write),
270 Operation::TransferInPlace(buf) => bus.transfer_in_place(buf), 173 Operation::TransferInPlace(buf) => bus.transfer_in_place(buf),
174 #[cfg(not(feature = "time"))]
175 Operation::DelayUs(_) => Err(SpiDeviceError::DelayUsNotSupported),
176 #[cfg(feature = "time")]
177 Operation::DelayUs(us) => {
178 embassy_time::block_for(embassy_time::Duration::from_micros(*us as _));
179 Ok(())
180 }
271 }); 181 });
272 182
273 // On failure, it's important to still flush and deassert CS. 183 // On failure, it's important to still flush and deassert CS.
diff --git a/embassy-embedded-hal/src/shared_bus/mod.rs b/embassy-embedded-hal/src/shared_bus/mod.rs
index 617d921e9..79a90bd52 100644
--- a/embassy-embedded-hal/src/shared_bus/mod.rs
+++ b/embassy-embedded-hal/src/shared_bus/mod.rs
@@ -30,11 +30,14 @@ where
30/// Error returned by SPI device implementations in this crate. 30/// Error returned by SPI device implementations in this crate.
31#[derive(Copy, Clone, Eq, PartialEq, Debug)] 31#[derive(Copy, Clone, Eq, PartialEq, Debug)]
32#[cfg_attr(feature = "defmt", derive(defmt::Format))] 32#[cfg_attr(feature = "defmt", derive(defmt::Format))]
33#[non_exhaustive]
33pub enum SpiDeviceError<BUS, CS> { 34pub enum SpiDeviceError<BUS, CS> {
34 /// An operation on the inner SPI bus failed. 35 /// An operation on the inner SPI bus failed.
35 Spi(BUS), 36 Spi(BUS),
36 /// Setting the value of the Chip Select (CS) pin failed. 37 /// Setting the value of the Chip Select (CS) pin failed.
37 Cs(CS), 38 Cs(CS),
39 /// DelayUs operations are not supported when the `time` Cargo feature is not enabled.
40 DelayUsNotSupported,
38} 41}
39 42
40impl<BUS, CS> spi::Error for SpiDeviceError<BUS, CS> 43impl<BUS, CS> spi::Error for SpiDeviceError<BUS, CS>
@@ -46,6 +49,7 @@ where
46 match self { 49 match self {
47 Self::Spi(e) => e.kind(), 50 Self::Spi(e) => e.kind(),
48 Self::Cs(_) => spi::ErrorKind::Other, 51 Self::Cs(_) => spi::ErrorKind::Other,
52 Self::DelayUsNotSupported => spi::ErrorKind::Other,
49 } 53 }
50 } 54 }
51} 55}
diff --git a/embassy-lora/Cargo.toml b/embassy-lora/Cargo.toml
index 05b6fa2d0..dc44f96db 100644
--- a/embassy-lora/Cargo.toml
+++ b/embassy-lora/Cargo.toml
@@ -23,8 +23,8 @@ log = { version = "0.4.14", optional = true }
23embassy-time = { version = "0.1.0", path = "../embassy-time" } 23embassy-time = { version = "0.1.0", path = "../embassy-time" }
24embassy-sync = { version = "0.2.0", path = "../embassy-sync" } 24embassy-sync = { version = "0.2.0", path = "../embassy-sync" }
25embassy-stm32 = { version = "0.1.0", path = "../embassy-stm32", default-features = false, optional = true } 25embassy-stm32 = { version = "0.1.0", path = "../embassy-stm32", default-features = false, optional = true }
26embedded-hal-1 = { package = "embedded-hal", version = "=1.0.0-alpha.10" } 26embedded-hal-1 = { package = "embedded-hal", version = "=1.0.0-alpha.11" }
27embedded-hal-async = { version = "=0.2.0-alpha.1" } 27embedded-hal-async = { version = "=0.2.0-alpha.2" }
28embassy-hal-common = { version = "0.1.0", path = "../embassy-hal-common", default-features = false } 28embassy-hal-common = { version = "0.1.0", path = "../embassy-hal-common", default-features = false }
29futures = { version = "0.3.17", default-features = false, features = [ "async-await" ] } 29futures = { version = "0.3.17", default-features = false, features = [ "async-await" ] }
30embedded-hal = { version = "0.2", features = ["unproven"] } 30embedded-hal = { version = "0.2", features = ["unproven"] }
@@ -32,3 +32,6 @@ bit_field = { version = "0.10" }
32 32
33lora-phy = { version = "1" } 33lora-phy = { version = "1" }
34lorawan-device = { version = "0.10.0", default-features = false, features = ["async"] } 34lorawan-device = { version = "0.10.0", default-features = false, features = ["async"] }
35
36[patch.crates-io]
37lora-phy = { git = "https://github.com/embassy-rs/lora-phy", rev = "ad289428fd44b02788e2fa2116445cc8f640a265" }
diff --git a/embassy-net-esp-hosted/Cargo.toml b/embassy-net-esp-hosted/Cargo.toml
index a7e18ee09..a52570f5d 100644
--- a/embassy-net-esp-hosted/Cargo.toml
+++ b/embassy-net-esp-hosted/Cargo.toml
@@ -12,8 +12,8 @@ embassy-sync = { version = "0.2.0", path = "../embassy-sync"}
12embassy-futures = { version = "0.1.0", path = "../embassy-futures"} 12embassy-futures = { version = "0.1.0", path = "../embassy-futures"}
13embassy-net-driver-channel = { version = "0.1.0", path = "../embassy-net-driver-channel"} 13embassy-net-driver-channel = { version = "0.1.0", path = "../embassy-net-driver-channel"}
14 14
15embedded-hal = { version = "1.0.0-alpha.10" } 15embedded-hal = { version = "1.0.0-alpha.11" }
16embedded-hal-async = { version = "=0.2.0-alpha.1" } 16embedded-hal-async = { version = "=0.2.0-alpha.2" }
17 17
18noproto = { git="https://github.com/embassy-rs/noproto", default-features = false, features = ["derive"] } 18noproto = { git="https://github.com/embassy-rs/noproto", default-features = false, features = ["derive"] }
19#noproto = { version = "0.1", path = "/home/dirbaio/noproto", default-features = false, features = ["derive"] } 19#noproto = { version = "0.1", path = "/home/dirbaio/noproto", default-features = false, features = ["derive"] }
diff --git a/embassy-net-w5500/Cargo.toml b/embassy-net-w5500/Cargo.toml
index 37d15c7ac..41d411117 100644
--- a/embassy-net-w5500/Cargo.toml
+++ b/embassy-net-w5500/Cargo.toml
@@ -8,8 +8,8 @@ license = "MIT OR Apache-2.0"
8edition = "2021" 8edition = "2021"
9 9
10[dependencies] 10[dependencies]
11embedded-hal = { version = "1.0.0-alpha.10" } 11embedded-hal = { version = "1.0.0-alpha.11" }
12embedded-hal-async = { version = "=0.2.0-alpha.1" } 12embedded-hal-async = { version = "=0.2.0-alpha.2" }
13embassy-net-driver-channel = { version = "0.1.0", path = "../embassy-net-driver-channel"} 13embassy-net-driver-channel = { version = "0.1.0", path = "../embassy-net-driver-channel"}
14embassy-time = { version = "0.1.0" } 14embassy-time = { version = "0.1.0" }
15embassy-futures = { version = "0.1.0" } 15embassy-futures = { version = "0.1.0" }
diff --git a/embassy-net-w5500/src/spi.rs b/embassy-net-w5500/src/spi.rs
index 6cd52c44d..07749d6be 100644
--- a/embassy-net-w5500/src/spi.rs
+++ b/embassy-net-w5500/src/spi.rs
@@ -22,7 +22,11 @@ impl<SPI: SpiDevice> SpiInterface<SPI> {
22 let address_phase = address.to_be_bytes(); 22 let address_phase = address.to_be_bytes();
23 let control_phase = [(block as u8) << 3 | 0b0000_0100]; 23 let control_phase = [(block as u8) << 3 | 0b0000_0100];
24 let data_phase = data; 24 let data_phase = data;
25 let operations = &[&address_phase[..], &control_phase, &data_phase]; 25 let operations = &mut [
26 self.0.write_transaction(operations).await 26 Operation::Write(&address_phase[..]),
27 Operation::Write(&control_phase),
28 Operation::Write(&data_phase),
29 ];
30 self.0.transaction(operations).await
27 } 31 }
28} 32}
diff --git a/embassy-nrf/Cargo.toml b/embassy-nrf/Cargo.toml
index 3e858f854..d33740cc8 100644
--- a/embassy-nrf/Cargo.toml
+++ b/embassy-nrf/Cargo.toml
@@ -98,8 +98,8 @@ embassy-embedded-hal = {version = "0.1.0", path = "../embassy-embedded-hal" }
98embassy-usb-driver = {version = "0.1.0", path = "../embassy-usb-driver", optional=true } 98embassy-usb-driver = {version = "0.1.0", path = "../embassy-usb-driver", optional=true }
99 99
100embedded-hal-02 = { package = "embedded-hal", version = "0.2.6", features = ["unproven"] } 100embedded-hal-02 = { package = "embedded-hal", version = "0.2.6", features = ["unproven"] }
101embedded-hal-1 = { package = "embedded-hal", version = "=1.0.0-alpha.10", optional = true} 101embedded-hal-1 = { package = "embedded-hal", version = "=1.0.0-alpha.11", optional = true}
102embedded-hal-async = { version = "=0.2.0-alpha.1", optional = true} 102embedded-hal-async = { version = "=0.2.0-alpha.2", optional = true}
103embedded-io = { version = "0.4.0", features = ["async"], optional = true } 103embedded-io = { version = "0.4.0", features = ["async"], optional = true }
104 104
105defmt = { version = "0.3", optional = true } 105defmt = { version = "0.3", optional = true }
diff --git a/embassy-nrf/src/spim.rs b/embassy-nrf/src/spim.rs
index 166947936..b7dc332e9 100644
--- a/embassy-nrf/src/spim.rs
+++ b/embassy-nrf/src/spim.rs
@@ -468,25 +468,19 @@ mod eh1 {
468 type Error = Error; 468 type Error = Error;
469 } 469 }
470 470
471 impl<'d, T: Instance> embedded_hal_1::spi::SpiBusFlush for Spim<'d, T> { 471 impl<'d, T: Instance> embedded_hal_1::spi::SpiBus<u8> for Spim<'d, T> {
472 fn flush(&mut self) -> Result<(), Self::Error> { 472 fn flush(&mut self) -> Result<(), Self::Error> {
473 Ok(()) 473 Ok(())
474 } 474 }
475 }
476 475
477 impl<'d, T: Instance> embedded_hal_1::spi::SpiBusRead<u8> for Spim<'d, T> {
478 fn read(&mut self, words: &mut [u8]) -> Result<(), Self::Error> { 476 fn read(&mut self, words: &mut [u8]) -> Result<(), Self::Error> {
479 self.blocking_transfer(words, &[]) 477 self.blocking_transfer(words, &[])
480 } 478 }
481 }
482 479
483 impl<'d, T: Instance> embedded_hal_1::spi::SpiBusWrite<u8> for Spim<'d, T> {
484 fn write(&mut self, words: &[u8]) -> Result<(), Self::Error> { 480 fn write(&mut self, words: &[u8]) -> Result<(), Self::Error> {
485 self.blocking_write(words) 481 self.blocking_write(words)
486 } 482 }
487 }
488 483
489 impl<'d, T: Instance> embedded_hal_1::spi::SpiBus<u8> for Spim<'d, T> {
490 fn transfer(&mut self, read: &mut [u8], write: &[u8]) -> Result<(), Self::Error> { 484 fn transfer(&mut self, read: &mut [u8], write: &[u8]) -> Result<(), Self::Error> {
491 self.blocking_transfer(read, write) 485 self.blocking_transfer(read, write)
492 } 486 }
@@ -502,30 +496,24 @@ mod eha {
502 496
503 use super::*; 497 use super::*;
504 498
505 impl<'d, T: Instance> embedded_hal_async::spi::SpiBusFlush for Spim<'d, T> { 499 impl<'d, T: Instance> embedded_hal_async::spi::SpiBus<u8> for Spim<'d, T> {
506 async fn flush(&mut self) -> Result<(), Error> { 500 async fn flush(&mut self) -> Result<(), Error> {
507 Ok(()) 501 Ok(())
508 } 502 }
509 }
510 503
511 impl<'d, T: Instance> embedded_hal_async::spi::SpiBusRead<u8> for Spim<'d, T> {
512 async fn read(&mut self, words: &mut [u8]) -> Result<(), Error> { 504 async fn read(&mut self, words: &mut [u8]) -> Result<(), Error> {
513 self.read(words).await 505 self.read(words).await
514 } 506 }
515 }
516 507
517 impl<'d, T: Instance> embedded_hal_async::spi::SpiBusWrite<u8> for Spim<'d, T> {
518 async fn write(&mut self, data: &[u8]) -> Result<(), Error> { 508 async fn write(&mut self, data: &[u8]) -> Result<(), Error> {
519 self.write(data).await 509 self.write(data).await
520 } 510 }
521 }
522 511
523 impl<'d, T: Instance> embedded_hal_async::spi::SpiBus<u8> for Spim<'d, T> { 512 async fn transfer(&mut self, rx: &mut [u8], tx: &[u8]) -> Result<(), Error> {
524 async fn transfer<'a>(&'a mut self, rx: &'a mut [u8], tx: &'a [u8]) -> Result<(), Error> {
525 self.transfer(rx, tx).await 513 self.transfer(rx, tx).await
526 } 514 }
527 515
528 async fn transfer_in_place<'a>(&'a mut self, words: &'a mut [u8]) -> Result<(), Error> { 516 async fn transfer_in_place(&mut self, words: &mut [u8]) -> Result<(), Error> {
529 self.transfer_in_place(words).await 517 self.transfer_in_place(words).await
530 } 518 }
531 } 519 }
diff --git a/embassy-rp/Cargo.toml b/embassy-rp/Cargo.toml
index 66823771a..a06831a9a 100644
--- a/embassy-rp/Cargo.toml
+++ b/embassy-rp/Cargo.toml
@@ -79,9 +79,9 @@ fixed = "1.23.1"
79rp-pac = { version = "6" } 79rp-pac = { version = "6" }
80 80
81embedded-hal-02 = { package = "embedded-hal", version = "0.2.6", features = ["unproven"] } 81embedded-hal-02 = { package = "embedded-hal", version = "0.2.6", features = ["unproven"] }
82embedded-hal-1 = { package = "embedded-hal", version = "=1.0.0-alpha.10", optional = true} 82embedded-hal-1 = { package = "embedded-hal", version = "=1.0.0-alpha.11", optional = true}
83embedded-hal-async = { version = "=0.2.0-alpha.1", optional = true} 83embedded-hal-async = { version = "=0.2.0-alpha.2", optional = true}
84embedded-hal-nb = { version = "=1.0.0-alpha.2", optional = true} 84embedded-hal-nb = { version = "=1.0.0-alpha.3", optional = true}
85 85
86paste = "1.0" 86paste = "1.0"
87pio-proc = {version= "0.2" } 87pio-proc = {version= "0.2" }
diff --git a/embassy-rp/src/spi.rs b/embassy-rp/src/spi.rs
index e817d074e..af101cf4a 100644
--- a/embassy-rp/src/spi.rs
+++ b/embassy-rp/src/spi.rs
@@ -545,25 +545,19 @@ mod eh1 {
545 type Error = Error; 545 type Error = Error;
546 } 546 }
547 547
548 impl<'d, T: Instance, M: Mode> embedded_hal_1::spi::SpiBusFlush for Spi<'d, T, M> { 548 impl<'d, T: Instance, M: Mode> embedded_hal_1::spi::SpiBus<u8> for Spi<'d, T, M> {
549 fn flush(&mut self) -> Result<(), Self::Error> { 549 fn flush(&mut self) -> Result<(), Self::Error> {
550 Ok(()) 550 Ok(())
551 } 551 }
552 }
553 552
554 impl<'d, T: Instance, M: Mode> embedded_hal_1::spi::SpiBusRead<u8> for Spi<'d, T, M> {
555 fn read(&mut self, words: &mut [u8]) -> Result<(), Self::Error> { 553 fn read(&mut self, words: &mut [u8]) -> Result<(), Self::Error> {
556 self.blocking_transfer(words, &[]) 554 self.blocking_transfer(words, &[])
557 } 555 }
558 }
559 556
560 impl<'d, T: Instance, M: Mode> embedded_hal_1::spi::SpiBusWrite<u8> for Spi<'d, T, M> {
561 fn write(&mut self, words: &[u8]) -> Result<(), Self::Error> { 557 fn write(&mut self, words: &[u8]) -> Result<(), Self::Error> {
562 self.blocking_write(words) 558 self.blocking_write(words)
563 } 559 }
564 }
565 560
566 impl<'d, T: Instance, M: Mode> embedded_hal_1::spi::SpiBus<u8> for Spi<'d, T, M> {
567 fn transfer(&mut self, read: &mut [u8], write: &[u8]) -> Result<(), Self::Error> { 561 fn transfer(&mut self, read: &mut [u8], write: &[u8]) -> Result<(), Self::Error> {
568 self.blocking_transfer(read, write) 562 self.blocking_transfer(read, write)
569 } 563 }
@@ -578,30 +572,24 @@ mod eh1 {
578mod eha { 572mod eha {
579 use super::*; 573 use super::*;
580 574
581 impl<'d, T: Instance> embedded_hal_async::spi::SpiBusFlush for Spi<'d, T, Async> { 575 impl<'d, T: Instance> embedded_hal_async::spi::SpiBus<u8> for Spi<'d, T, Async> {
582 async fn flush(&mut self) -> Result<(), Self::Error> { 576 async fn flush(&mut self) -> Result<(), Self::Error> {
583 Ok(()) 577 Ok(())
584 } 578 }
585 }
586 579
587 impl<'d, T: Instance> embedded_hal_async::spi::SpiBusWrite<u8> for Spi<'d, T, Async> {
588 async fn write(&mut self, words: &[u8]) -> Result<(), Self::Error> { 580 async fn write(&mut self, words: &[u8]) -> Result<(), Self::Error> {
589 self.write(words).await 581 self.write(words).await
590 } 582 }
591 }
592 583
593 impl<'d, T: Instance> embedded_hal_async::spi::SpiBusRead<u8> for Spi<'d, T, Async> {
594 async fn read(&mut self, words: &mut [u8]) -> Result<(), Self::Error> { 584 async fn read(&mut self, words: &mut [u8]) -> Result<(), Self::Error> {
595 self.read(words).await 585 self.read(words).await
596 } 586 }
597 }
598 587
599 impl<'d, T: Instance> embedded_hal_async::spi::SpiBus<u8> for Spi<'d, T, Async> { 588 async fn transfer(&mut self, read: &mut [u8], write: &[u8]) -> Result<(), Self::Error> {
600 async fn transfer<'a>(&'a mut self, read: &'a mut [u8], write: &'a [u8]) -> Result<(), Self::Error> {
601 self.transfer(read, write).await 589 self.transfer(read, write).await
602 } 590 }
603 591
604 async fn transfer_in_place<'a>(&'a mut self, words: &'a mut [u8]) -> Result<(), Self::Error> { 592 async fn transfer_in_place(&mut self, words: &mut [u8]) -> Result<(), Self::Error> {
605 self.transfer_in_place(words).await 593 self.transfer_in_place(words).await
606 } 594 }
607 } 595 }
diff --git a/embassy-stm32/Cargo.toml b/embassy-stm32/Cargo.toml
index b3fe9c1f5..045149636 100644
--- a/embassy-stm32/Cargo.toml
+++ b/embassy-stm32/Cargo.toml
@@ -40,9 +40,9 @@ embassy-net-driver = { version = "0.1.0", path = "../embassy-net-driver" }
40embassy-usb-driver = {version = "0.1.0", path = "../embassy-usb-driver", optional = true } 40embassy-usb-driver = {version = "0.1.0", path = "../embassy-usb-driver", optional = true }
41 41
42embedded-hal-02 = { package = "embedded-hal", version = "0.2.6", features = ["unproven"] } 42embedded-hal-02 = { package = "embedded-hal", version = "0.2.6", features = ["unproven"] }
43embedded-hal-1 = { package = "embedded-hal", version = "=1.0.0-alpha.10", optional = true} 43embedded-hal-1 = { package = "embedded-hal", version = "=1.0.0-alpha.11", optional = true}
44embedded-hal-async = { version = "=0.2.0-alpha.1", optional = true} 44embedded-hal-async = { version = "=0.2.0-alpha.2", optional = true}
45embedded-hal-nb = { version = "=1.0.0-alpha.2", optional = true} 45embedded-hal-nb = { version = "=1.0.0-alpha.3", optional = true}
46 46
47embedded-storage = "0.3.0" 47embedded-storage = "0.3.0"
48embedded-storage-async = { version = "0.4.0", optional = true } 48embedded-storage-async = { version = "0.4.0", optional = true }
diff --git a/embassy-stm32/src/spi/mod.rs b/embassy-stm32/src/spi/mod.rs
index c3224073d..d5f63f84e 100644
--- a/embassy-stm32/src/spi/mod.rs
+++ b/embassy-stm32/src/spi/mod.rs
@@ -852,25 +852,19 @@ mod eh1 {
852 type Error = Error; 852 type Error = Error;
853 } 853 }
854 854
855 impl<'d, T: Instance, Tx, Rx> embedded_hal_1::spi::SpiBusFlush for Spi<'d, T, Tx, Rx> { 855 impl<'d, T: Instance, W: Word, Tx, Rx> embedded_hal_1::spi::SpiBus<W> for Spi<'d, T, Tx, Rx> {
856 fn flush(&mut self) -> Result<(), Self::Error> { 856 fn flush(&mut self) -> Result<(), Self::Error> {
857 Ok(()) 857 Ok(())
858 } 858 }
859 }
860 859
861 impl<'d, T: Instance, W: Word, Tx, Rx> embedded_hal_1::spi::SpiBusRead<W> for Spi<'d, T, Tx, Rx> {
862 fn read(&mut self, words: &mut [W]) -> Result<(), Self::Error> { 860 fn read(&mut self, words: &mut [W]) -> Result<(), Self::Error> {
863 self.blocking_read(words) 861 self.blocking_read(words)
864 } 862 }
865 }
866 863
867 impl<'d, T: Instance, W: Word, Tx, Rx> embedded_hal_1::spi::SpiBusWrite<W> for Spi<'d, T, Tx, Rx> {
868 fn write(&mut self, words: &[W]) -> Result<(), Self::Error> { 864 fn write(&mut self, words: &[W]) -> Result<(), Self::Error> {
869 self.blocking_write(words) 865 self.blocking_write(words)
870 } 866 }
871 }
872 867
873 impl<'d, T: Instance, W: Word, Tx, Rx> embedded_hal_1::spi::SpiBus<W> for Spi<'d, T, Tx, Rx> {
874 fn transfer(&mut self, read: &mut [W], write: &[W]) -> Result<(), Self::Error> { 868 fn transfer(&mut self, read: &mut [W], write: &[W]) -> Result<(), Self::Error> {
875 self.blocking_transfer(read, write) 869 self.blocking_transfer(read, write)
876 } 870 }
@@ -895,32 +889,25 @@ mod eh1 {
895#[cfg(all(feature = "unstable-traits", feature = "nightly"))] 889#[cfg(all(feature = "unstable-traits", feature = "nightly"))]
896mod eha { 890mod eha {
897 use super::*; 891 use super::*;
898 impl<'d, T: Instance, Tx, Rx> embedded_hal_async::spi::SpiBusFlush for Spi<'d, T, Tx, Rx> { 892
893 impl<'d, T: Instance, Tx: TxDma<T>, Rx: RxDma<T>, W: Word> embedded_hal_async::spi::SpiBus<W> for Spi<'d, T, Tx, Rx> {
899 async fn flush(&mut self) -> Result<(), Self::Error> { 894 async fn flush(&mut self) -> Result<(), Self::Error> {
900 Ok(()) 895 Ok(())
901 } 896 }
902 }
903 897
904 impl<'d, T: Instance, Tx: TxDma<T>, Rx, W: Word> embedded_hal_async::spi::SpiBusWrite<W> for Spi<'d, T, Tx, Rx> {
905 async fn write(&mut self, words: &[W]) -> Result<(), Self::Error> { 898 async fn write(&mut self, words: &[W]) -> Result<(), Self::Error> {
906 self.write(words).await 899 self.write(words).await
907 } 900 }
908 }
909 901
910 impl<'d, T: Instance, Tx: TxDma<T>, Rx: RxDma<T>, W: Word> embedded_hal_async::spi::SpiBusRead<W>
911 for Spi<'d, T, Tx, Rx>
912 {
913 async fn read(&mut self, words: &mut [W]) -> Result<(), Self::Error> { 902 async fn read(&mut self, words: &mut [W]) -> Result<(), Self::Error> {
914 self.read(words).await 903 self.read(words).await
915 } 904 }
916 }
917 905
918 impl<'d, T: Instance, Tx: TxDma<T>, Rx: RxDma<T>, W: Word> embedded_hal_async::spi::SpiBus<W> for Spi<'d, T, Tx, Rx> { 906 async fn transfer(&mut self, read: &mut [W], write: &[W]) -> Result<(), Self::Error> {
919 async fn transfer<'a>(&'a mut self, read: &'a mut [W], write: &'a [W]) -> Result<(), Self::Error> {
920 self.transfer(read, write).await 907 self.transfer(read, write).await
921 } 908 }
922 909
923 async fn transfer_in_place<'a>(&'a mut self, words: &'a mut [W]) -> Result<(), Self::Error> { 910 async fn transfer_in_place(&mut self, words: &mut [W]) -> Result<(), Self::Error> {
924 self.transfer_in_place(words).await 911 self.transfer_in_place(words).await
925 } 912 }
926 } 913 }
diff --git a/embassy-time/Cargo.toml b/embassy-time/Cargo.toml
index 857da5467..0213eef03 100644
--- a/embassy-time/Cargo.toml
+++ b/embassy-time/Cargo.toml
@@ -152,8 +152,8 @@ defmt = { version = "0.3", optional = true }
152log = { version = "0.4.14", optional = true } 152log = { version = "0.4.14", optional = true }
153 153
154embedded-hal-02 = { package = "embedded-hal", version = "0.2.6" } 154embedded-hal-02 = { package = "embedded-hal", version = "0.2.6" }
155embedded-hal-1 = { package = "embedded-hal", version = "=1.0.0-alpha.10", optional = true} 155embedded-hal-1 = { package = "embedded-hal", version = "=1.0.0-alpha.11", optional = true}
156embedded-hal-async = { version = "=0.2.0-alpha.1", optional = true} 156embedded-hal-async = { version = "=0.2.0-alpha.2", optional = true}
157 157
158futures-util = { version = "0.3.17", default-features = false } 158futures-util = { version = "0.3.17", default-features = false }
159atomic-polyfill = "1.0.1" 159atomic-polyfill = "1.0.1"
diff --git a/examples/nrf52840/Cargo.toml b/examples/nrf52840/Cargo.toml
index 8c4175966..2ccd5045f 100644
--- a/examples/nrf52840/Cargo.toml
+++ b/examples/nrf52840/Cargo.toml
@@ -52,4 +52,7 @@ rand = { version = "0.8.4", default-features = false }
52embedded-storage = "0.3.0" 52embedded-storage = "0.3.0"
53usbd-hid = "0.6.0" 53usbd-hid = "0.6.0"
54serde = { version = "1.0.136", default-features = false } 54serde = { version = "1.0.136", default-features = false }
55embedded-hal-async = { version = "0.2.0-alpha.1", optional = true } 55embedded-hal-async = { version = "0.2.0-alpha.2", optional = true }
56
57[patch.crates-io]
58lora-phy = { git = "https://github.com/embassy-rs/lora-phy", rev = "ad289428fd44b02788e2fa2116445cc8f640a265" }
diff --git a/examples/nrf52840/src/bin/wifi_esp_hosted.rs b/examples/nrf52840/src/bin/wifi_esp_hosted.rs
index 4eb31b105..f7496703c 100644
--- a/examples/nrf52840/src/bin/wifi_esp_hosted.rs
+++ b/examples/nrf52840/src/bin/wifi_esp_hosted.rs
@@ -10,6 +10,7 @@ use embassy_nrf::gpio::{AnyPin, Input, Level, Output, OutputDrive, Pin, Pull};
10use embassy_nrf::rng::Rng; 10use embassy_nrf::rng::Rng;
11use embassy_nrf::spim::{self, Spim}; 11use embassy_nrf::spim::{self, Spim};
12use embassy_nrf::{bind_interrupts, peripherals}; 12use embassy_nrf::{bind_interrupts, peripherals};
13use embassy_time::Delay;
13use embedded_hal_async::spi::ExclusiveDevice; 14use embedded_hal_async::spi::ExclusiveDevice;
14use embedded_io::asynch::Write; 15use embedded_io::asynch::Write;
15use static_cell::make_static; 16use static_cell::make_static;
@@ -24,7 +25,7 @@ bind_interrupts!(struct Irqs {
24async fn wifi_task( 25async fn wifi_task(
25 runner: hosted::Runner< 26 runner: hosted::Runner<
26 'static, 27 'static,
27 ExclusiveDevice<Spim<'static, peripherals::SPI3>, Output<'static, peripherals::P0_31>>, 28 ExclusiveDevice<Spim<'static, peripherals::SPI3>, Output<'static, peripherals::P0_31>, Delay>,
28 Input<'static, AnyPin>, 29 Input<'static, AnyPin>,
29 Output<'static, peripherals::P1_05>, 30 Output<'static, peripherals::P1_05>,
30 >, 31 >,
@@ -55,7 +56,7 @@ async fn main(spawner: Spawner) {
55 config.frequency = spim::Frequency::M32; 56 config.frequency = spim::Frequency::M32;
56 config.mode = spim::MODE_2; // !!! 57 config.mode = spim::MODE_2; // !!!
57 let spi = spim::Spim::new(p.SPI3, Irqs, sck, miso, mosi, config); 58 let spi = spim::Spim::new(p.SPI3, Irqs, sck, miso, mosi, config);
58 let spi = ExclusiveDevice::new(spi, cs); 59 let spi = ExclusiveDevice::new(spi, cs, Delay);
59 60
60 let (device, mut control, runner) = embassy_net_esp_hosted::new( 61 let (device, mut control, runner) = embassy_net_esp_hosted::new(
61 make_static!(embassy_net_esp_hosted::State::new()), 62 make_static!(embassy_net_esp_hosted::State::new()),
diff --git a/examples/rp/Cargo.toml b/examples/rp/Cargo.toml
index 48f3a26bb..17ebea86f 100644
--- a/examples/rp/Cargo.toml
+++ b/examples/rp/Cargo.toml
@@ -41,8 +41,8 @@ byte-slice-cast = { version = "1.2.0", default-features = false }
41smart-leds = "0.3.0" 41smart-leds = "0.3.0"
42heapless = "0.7.15" 42heapless = "0.7.15"
43 43
44embedded-hal-1 = { package = "embedded-hal", version = "=1.0.0-alpha.10" } 44embedded-hal-1 = { package = "embedded-hal", version = "=1.0.0-alpha.11" }
45embedded-hal-async = "0.2.0-alpha.1" 45embedded-hal-async = "0.2.0-alpha.2"
46embedded-io = { version = "0.4.0", features = ["async", "defmt"] } 46embedded-io = { version = "0.4.0", features = ["async", "defmt"] }
47embedded-storage = { version = "0.3" } 47embedded-storage = { version = "0.3" }
48static_cell = { version = "1.1", features = ["nightly"]} 48static_cell = { version = "1.1", features = ["nightly"]}
@@ -53,3 +53,6 @@ rand = { version = "0.8.5", default-features = false }
53 53
54[profile.release] 54[profile.release]
55debug = true 55debug = true
56
57[patch.crates-io]
58lora-phy = { git = "https://github.com/embassy-rs/lora-phy", rev = "ad289428fd44b02788e2fa2116445cc8f640a265" }
diff --git a/examples/rp/src/bin/ethernet_w5500_multisocket.rs b/examples/rp/src/bin/ethernet_w5500_multisocket.rs
index 82568254a..e81da177b 100644
--- a/examples/rp/src/bin/ethernet_w5500_multisocket.rs
+++ b/examples/rp/src/bin/ethernet_w5500_multisocket.rs
@@ -15,7 +15,7 @@ use embassy_rp::clocks::RoscRng;
15use embassy_rp::gpio::{Input, Level, Output, Pull}; 15use embassy_rp::gpio::{Input, Level, Output, Pull};
16use embassy_rp::peripherals::{PIN_17, PIN_20, PIN_21, SPI0}; 16use embassy_rp::peripherals::{PIN_17, PIN_20, PIN_21, SPI0};
17use embassy_rp::spi::{Async, Config as SpiConfig, Spi}; 17use embassy_rp::spi::{Async, Config as SpiConfig, Spi};
18use embassy_time::Duration; 18use embassy_time::{Delay, Duration};
19use embedded_hal_async::spi::ExclusiveDevice; 19use embedded_hal_async::spi::ExclusiveDevice;
20use embedded_io::asynch::Write; 20use embedded_io::asynch::Write;
21use rand::RngCore; 21use rand::RngCore;
@@ -26,7 +26,7 @@ use {defmt_rtt as _, panic_probe as _};
26async fn ethernet_task( 26async fn ethernet_task(
27 runner: Runner< 27 runner: Runner<
28 'static, 28 'static,
29 ExclusiveDevice<Spi<'static, SPI0, Async>, Output<'static, PIN_17>>, 29 ExclusiveDevice<Spi<'static, SPI0, Async>, Output<'static, PIN_17>, Delay>,
30 Input<'static, PIN_21>, 30 Input<'static, PIN_21>,
31 Output<'static, PIN_20>, 31 Output<'static, PIN_20>,
32 >, 32 >,
@@ -54,8 +54,14 @@ async fn main(spawner: Spawner) {
54 54
55 let mac_addr = [0x02, 0x00, 0x00, 0x00, 0x00, 0x00]; 55 let mac_addr = [0x02, 0x00, 0x00, 0x00, 0x00, 0x00];
56 let state = make_static!(State::<8, 8>::new()); 56 let state = make_static!(State::<8, 8>::new());
57 let (device, runner) = 57 let (device, runner) = embassy_net_w5500::new(
58 embassy_net_w5500::new(mac_addr, state, ExclusiveDevice::new(spi, cs), w5500_int, w5500_reset).await; 58 mac_addr,
59 state,
60 ExclusiveDevice::new(spi, cs, Delay),
61 w5500_int,
62 w5500_reset,
63 )
64 .await;
59 unwrap!(spawner.spawn(ethernet_task(runner))); 65 unwrap!(spawner.spawn(ethernet_task(runner)));
60 66
61 // Generate random seed 67 // Generate random seed
diff --git a/examples/rp/src/bin/ethernet_w5500_tcp_client.rs b/examples/rp/src/bin/ethernet_w5500_tcp_client.rs
index d562defad..9dd7ae973 100644
--- a/examples/rp/src/bin/ethernet_w5500_tcp_client.rs
+++ b/examples/rp/src/bin/ethernet_w5500_tcp_client.rs
@@ -17,7 +17,7 @@ use embassy_rp::clocks::RoscRng;
17use embassy_rp::gpio::{Input, Level, Output, Pull}; 17use embassy_rp::gpio::{Input, Level, Output, Pull};
18use embassy_rp::peripherals::{PIN_17, PIN_20, PIN_21, SPI0}; 18use embassy_rp::peripherals::{PIN_17, PIN_20, PIN_21, SPI0};
19use embassy_rp::spi::{Async, Config as SpiConfig, Spi}; 19use embassy_rp::spi::{Async, Config as SpiConfig, Spi};
20use embassy_time::{Duration, Timer}; 20use embassy_time::{Delay, Duration, Timer};
21use embedded_hal_async::spi::ExclusiveDevice; 21use embedded_hal_async::spi::ExclusiveDevice;
22use embedded_io::asynch::Write; 22use embedded_io::asynch::Write;
23use rand::RngCore; 23use rand::RngCore;
@@ -28,7 +28,7 @@ use {defmt_rtt as _, panic_probe as _};
28async fn ethernet_task( 28async fn ethernet_task(
29 runner: Runner< 29 runner: Runner<
30 'static, 30 'static,
31 ExclusiveDevice<Spi<'static, SPI0, Async>, Output<'static, PIN_17>>, 31 ExclusiveDevice<Spi<'static, SPI0, Async>, Output<'static, PIN_17>, Delay>,
32 Input<'static, PIN_21>, 32 Input<'static, PIN_21>,
33 Output<'static, PIN_20>, 33 Output<'static, PIN_20>,
34 >, 34 >,
@@ -57,8 +57,14 @@ async fn main(spawner: Spawner) {
57 57
58 let mac_addr = [0x02, 0x00, 0x00, 0x00, 0x00, 0x00]; 58 let mac_addr = [0x02, 0x00, 0x00, 0x00, 0x00, 0x00];
59 let state = make_static!(State::<8, 8>::new()); 59 let state = make_static!(State::<8, 8>::new());
60 let (device, runner) = 60 let (device, runner) = embassy_net_w5500::new(
61 embassy_net_w5500::new(mac_addr, state, ExclusiveDevice::new(spi, cs), w5500_int, w5500_reset).await; 61 mac_addr,
62 state,
63 ExclusiveDevice::new(spi, cs, Delay),
64 w5500_int,
65 w5500_reset,
66 )
67 .await;
62 unwrap!(spawner.spawn(ethernet_task(runner))); 68 unwrap!(spawner.spawn(ethernet_task(runner)));
63 69
64 // Generate random seed 70 // Generate random seed
diff --git a/examples/rp/src/bin/ethernet_w5500_tcp_server.rs b/examples/rp/src/bin/ethernet_w5500_tcp_server.rs
index 7f521cdb4..db21c2b6f 100644
--- a/examples/rp/src/bin/ethernet_w5500_tcp_server.rs
+++ b/examples/rp/src/bin/ethernet_w5500_tcp_server.rs
@@ -16,7 +16,7 @@ use embassy_rp::clocks::RoscRng;
16use embassy_rp::gpio::{Input, Level, Output, Pull}; 16use embassy_rp::gpio::{Input, Level, Output, Pull};
17use embassy_rp::peripherals::{PIN_17, PIN_20, PIN_21, SPI0}; 17use embassy_rp::peripherals::{PIN_17, PIN_20, PIN_21, SPI0};
18use embassy_rp::spi::{Async, Config as SpiConfig, Spi}; 18use embassy_rp::spi::{Async, Config as SpiConfig, Spi};
19use embassy_time::Duration; 19use embassy_time::{Delay, Duration};
20use embedded_hal_async::spi::ExclusiveDevice; 20use embedded_hal_async::spi::ExclusiveDevice;
21use embedded_io::asynch::Write; 21use embedded_io::asynch::Write;
22use rand::RngCore; 22use rand::RngCore;
@@ -26,7 +26,7 @@ use {defmt_rtt as _, panic_probe as _};
26async fn ethernet_task( 26async fn ethernet_task(
27 runner: Runner< 27 runner: Runner<
28 'static, 28 'static,
29 ExclusiveDevice<Spi<'static, SPI0, Async>, Output<'static, PIN_17>>, 29 ExclusiveDevice<Spi<'static, SPI0, Async>, Output<'static, PIN_17>, Delay>,
30 Input<'static, PIN_21>, 30 Input<'static, PIN_21>,
31 Output<'static, PIN_20>, 31 Output<'static, PIN_20>,
32 >, 32 >,
@@ -55,8 +55,14 @@ async fn main(spawner: Spawner) {
55 55
56 let mac_addr = [0x02, 0x00, 0x00, 0x00, 0x00, 0x00]; 56 let mac_addr = [0x02, 0x00, 0x00, 0x00, 0x00, 0x00];
57 let state = make_static!(State::<8, 8>::new()); 57 let state = make_static!(State::<8, 8>::new());
58 let (device, runner) = 58 let (device, runner) = embassy_net_w5500::new(
59 embassy_net_w5500::new(mac_addr, state, ExclusiveDevice::new(spi, cs), w5500_int, w5500_reset).await; 59 mac_addr,
60 state,
61 ExclusiveDevice::new(spi, cs, Delay),
62 w5500_int,
63 w5500_reset,
64 )
65 .await;
60 unwrap!(spawner.spawn(ethernet_task(runner))); 66 unwrap!(spawner.spawn(ethernet_task(runner)));
61 67
62 // Generate random seed 68 // Generate random seed
diff --git a/examples/rp/src/bin/ethernet_w5500_udp.rs b/examples/rp/src/bin/ethernet_w5500_udp.rs
index ada86ae55..038432b17 100644
--- a/examples/rp/src/bin/ethernet_w5500_udp.rs
+++ b/examples/rp/src/bin/ethernet_w5500_udp.rs
@@ -16,6 +16,7 @@ use embassy_rp::clocks::RoscRng;
16use embassy_rp::gpio::{Input, Level, Output, Pull}; 16use embassy_rp::gpio::{Input, Level, Output, Pull};
17use embassy_rp::peripherals::{PIN_17, PIN_20, PIN_21, SPI0}; 17use embassy_rp::peripherals::{PIN_17, PIN_20, PIN_21, SPI0};
18use embassy_rp::spi::{Async, Config as SpiConfig, Spi}; 18use embassy_rp::spi::{Async, Config as SpiConfig, Spi};
19use embassy_time::Delay;
19use embedded_hal_async::spi::ExclusiveDevice; 20use embedded_hal_async::spi::ExclusiveDevice;
20use rand::RngCore; 21use rand::RngCore;
21use static_cell::make_static; 22use static_cell::make_static;
@@ -24,7 +25,7 @@ use {defmt_rtt as _, panic_probe as _};
24async fn ethernet_task( 25async fn ethernet_task(
25 runner: Runner< 26 runner: Runner<
26 'static, 27 'static,
27 ExclusiveDevice<Spi<'static, SPI0, Async>, Output<'static, PIN_17>>, 28 ExclusiveDevice<Spi<'static, SPI0, Async>, Output<'static, PIN_17>, Delay>,
28 Input<'static, PIN_21>, 29 Input<'static, PIN_21>,
29 Output<'static, PIN_20>, 30 Output<'static, PIN_20>,
30 >, 31 >,
@@ -52,8 +53,14 @@ async fn main(spawner: Spawner) {
52 53
53 let mac_addr = [0x02, 0x00, 0x00, 0x00, 0x00, 0x00]; 54 let mac_addr = [0x02, 0x00, 0x00, 0x00, 0x00, 0x00];
54 let state = make_static!(State::<8, 8>::new()); 55 let state = make_static!(State::<8, 8>::new());
55 let (device, runner) = 56 let (device, runner) = embassy_net_w5500::new(
56 embassy_net_w5500::new(mac_addr, state, ExclusiveDevice::new(spi, cs), w5500_int, w5500_reset).await; 57 mac_addr,
58 state,
59 ExclusiveDevice::new(spi, cs, Delay),
60 w5500_int,
61 w5500_reset,
62 )
63 .await;
57 unwrap!(spawner.spawn(ethernet_task(runner))); 64 unwrap!(spawner.spawn(ethernet_task(runner)));
58 65
59 // Generate random seed 66 // Generate random seed
diff --git a/examples/rp/src/bin/spi_display.rs b/examples/rp/src/bin/spi_display.rs
index 85a19ce07..2fd201595 100644
--- a/examples/rp/src/bin/spi_display.rs
+++ b/examples/rp/src/bin/spi_display.rs
@@ -175,7 +175,7 @@ mod touch {
175mod my_display_interface { 175mod my_display_interface {
176 use display_interface::{DataFormat, DisplayError, WriteOnlyDataCommand}; 176 use display_interface::{DataFormat, DisplayError, WriteOnlyDataCommand};
177 use embedded_hal_1::digital::OutputPin; 177 use embedded_hal_1::digital::OutputPin;
178 use embedded_hal_1::spi::SpiDeviceWrite; 178 use embedded_hal_1::spi::SpiDevice;
179 179
180 /// SPI display interface. 180 /// SPI display interface.
181 /// 181 ///
@@ -187,7 +187,7 @@ mod my_display_interface {
187 187
188 impl<SPI, DC> SPIDeviceInterface<SPI, DC> 188 impl<SPI, DC> SPIDeviceInterface<SPI, DC>
189 where 189 where
190 SPI: SpiDeviceWrite, 190 SPI: SpiDevice,
191 DC: OutputPin, 191 DC: OutputPin,
192 { 192 {
193 /// Create new SPI interface for communciation with a display driver 193 /// Create new SPI interface for communciation with a display driver
@@ -198,7 +198,7 @@ mod my_display_interface {
198 198
199 impl<SPI, DC> WriteOnlyDataCommand for SPIDeviceInterface<SPI, DC> 199 impl<SPI, DC> WriteOnlyDataCommand for SPIDeviceInterface<SPI, DC>
200 where 200 where
201 SPI: SpiDeviceWrite, 201 SPI: SpiDevice,
202 DC: OutputPin, 202 DC: OutputPin,
203 { 203 {
204 fn send_commands(&mut self, cmds: DataFormat<'_>) -> Result<(), DisplayError> { 204 fn send_commands(&mut self, cmds: DataFormat<'_>) -> Result<(), DisplayError> {
@@ -218,7 +218,7 @@ mod my_display_interface {
218 } 218 }
219 } 219 }
220 220
221 fn send_u8<T: SpiDeviceWrite>(spi: &mut T, words: DataFormat<'_>) -> Result<(), T::Error> { 221 fn send_u8<T: SpiDevice>(spi: &mut T, words: DataFormat<'_>) -> Result<(), T::Error> {
222 match words { 222 match words {
223 DataFormat::U8(slice) => spi.write(slice), 223 DataFormat::U8(slice) => spi.write(slice),
224 DataFormat::U16(slice) => { 224 DataFormat::U16(slice) => {
diff --git a/examples/stm32h5/Cargo.toml b/examples/stm32h5/Cargo.toml
index ebe511347..789ef59cc 100644
--- a/examples/stm32h5/Cargo.toml
+++ b/examples/stm32h5/Cargo.toml
@@ -19,8 +19,8 @@ defmt-rtt = "0.4"
19cortex-m = { version = "0.7.6", features = ["inline-asm", "critical-section-single-core"] } 19cortex-m = { version = "0.7.6", features = ["inline-asm", "critical-section-single-core"] }
20cortex-m-rt = "0.7.0" 20cortex-m-rt = "0.7.0"
21embedded-hal = "0.2.6" 21embedded-hal = "0.2.6"
22embedded-hal-1 = { package = "embedded-hal", version = "=1.0.0-alpha.10" } 22embedded-hal-1 = { package = "embedded-hal", version = "=1.0.0-alpha.11" }
23embedded-hal-async = { version = "=0.2.0-alpha.1" } 23embedded-hal-async = { version = "=0.2.0-alpha.2" }
24embedded-nal-async = "0.4.0" 24embedded-nal-async = "0.4.0"
25panic-probe = { version = "0.3", features = ["print-defmt"] } 25panic-probe = { version = "0.3", features = ["print-defmt"] }
26futures = { version = "0.3.17", default-features = false, features = ["async-await"] } 26futures = { version = "0.3.17", default-features = false, features = ["async-await"] }
diff --git a/examples/stm32h7/Cargo.toml b/examples/stm32h7/Cargo.toml
index 62ef5e9e4..04a2baab7 100644
--- a/examples/stm32h7/Cargo.toml
+++ b/examples/stm32h7/Cargo.toml
@@ -19,8 +19,8 @@ defmt-rtt = "0.4"
19cortex-m = { version = "0.7.6", features = ["inline-asm", "critical-section-single-core"] } 19cortex-m = { version = "0.7.6", features = ["inline-asm", "critical-section-single-core"] }
20cortex-m-rt = "0.7.0" 20cortex-m-rt = "0.7.0"
21embedded-hal = "0.2.6" 21embedded-hal = "0.2.6"
22embedded-hal-1 = { package = "embedded-hal", version = "=1.0.0-alpha.10" } 22embedded-hal-1 = { package = "embedded-hal", version = "=1.0.0-alpha.11" }
23embedded-hal-async = { version = "=0.2.0-alpha.1" } 23embedded-hal-async = { version = "=0.2.0-alpha.2" }
24embedded-nal-async = "0.4.0" 24embedded-nal-async = "0.4.0"
25panic-probe = { version = "0.3", features = ["print-defmt"] } 25panic-probe = { version = "0.3", features = ["print-defmt"] }
26futures = { version = "0.3.17", default-features = false, features = ["async-await"] } 26futures = { version = "0.3.17", default-features = false, features = ["async-await"] }
diff --git a/examples/stm32l0/Cargo.toml b/examples/stm32l0/Cargo.toml
index 2ead714e4..988fd3a79 100644
--- a/examples/stm32l0/Cargo.toml
+++ b/examples/stm32l0/Cargo.toml
@@ -32,3 +32,6 @@ futures = { version = "0.3.17", default-features = false, features = ["async-awa
32heapless = { version = "0.7.5", default-features = false } 32heapless = { version = "0.7.5", default-features = false }
33embedded-hal = "0.2.6" 33embedded-hal = "0.2.6"
34static_cell = "1.1" 34static_cell = "1.1"
35
36[patch.crates-io]
37lora-phy = { git = "https://github.com/embassy-rs/lora-phy", rev = "ad289428fd44b02788e2fa2116445cc8f640a265" }
diff --git a/examples/stm32l4/Cargo.toml b/examples/stm32l4/Cargo.toml
index 3bb473ef5..7d066bb82 100644
--- a/examples/stm32l4/Cargo.toml
+++ b/examples/stm32l4/Cargo.toml
@@ -18,8 +18,8 @@ defmt-rtt = "0.4"
18cortex-m = { version = "0.7.6", features = ["critical-section-single-core"] } 18cortex-m = { version = "0.7.6", features = ["critical-section-single-core"] }
19cortex-m-rt = "0.7.0" 19cortex-m-rt = "0.7.0"
20embedded-hal = "0.2.6" 20embedded-hal = "0.2.6"
21embedded-hal-1 = { package = "embedded-hal", version = "=1.0.0-alpha.10" } 21embedded-hal-1 = { package = "embedded-hal", version = "=1.0.0-alpha.11" }
22embedded-hal-async = { version = "=0.2.0-alpha.1" } 22embedded-hal-async = { version = "=0.2.0-alpha.2" }
23panic-probe = { version = "0.3", features = ["print-defmt"] } 23panic-probe = { version = "0.3", features = ["print-defmt"] }
24futures = { version = "0.3.17", default-features = false, features = ["async-await"] } 24futures = { version = "0.3.17", default-features = false, features = ["async-await"] }
25heapless = { version = "0.7.5", default-features = false } 25heapless = { version = "0.7.5", default-features = false }
diff --git a/examples/stm32wl/Cargo.toml b/examples/stm32wl/Cargo.toml
index 260f9afa1..75a5f1c41 100644
--- a/examples/stm32wl/Cargo.toml
+++ b/examples/stm32wl/Cargo.toml
@@ -25,3 +25,6 @@ embedded-storage = "0.3.0"
25panic-probe = { version = "0.3", features = ["print-defmt"] } 25panic-probe = { version = "0.3", features = ["print-defmt"] }
26futures = { version = "0.3.17", default-features = false, features = ["async-await"] } 26futures = { version = "0.3.17", default-features = false, features = ["async-await"] }
27heapless = { version = "0.7.5", default-features = false } 27heapless = { version = "0.7.5", default-features = false }
28
29[patch.crates-io]
30lora-phy = { git = "https://github.com/embassy-rs/lora-phy", rev = "ad289428fd44b02788e2fa2116445cc8f640a265" }
diff --git a/tests/nrf/Cargo.toml b/tests/nrf/Cargo.toml
index 4f9ecc47a..247287e46 100644
--- a/tests/nrf/Cargo.toml
+++ b/tests/nrf/Cargo.toml
@@ -10,12 +10,12 @@ teleprobe-meta = "1"
10embassy-futures = { version = "0.1.0", path = "../../embassy-futures" } 10embassy-futures = { version = "0.1.0", path = "../../embassy-futures" }
11embassy-sync = { version = "0.2.0", path = "../../embassy-sync", features = ["defmt", "nightly"] } 11embassy-sync = { version = "0.2.0", path = "../../embassy-sync", features = ["defmt", "nightly"] }
12embassy-executor = { version = "0.2.0", path = "../../embassy-executor", features = ["arch-cortex-m", "executor-thread", "defmt", "nightly", "integrated-timers"] } 12embassy-executor = { version = "0.2.0", path = "../../embassy-executor", features = ["arch-cortex-m", "executor-thread", "defmt", "nightly", "integrated-timers"] }
13embassy-time = { version = "0.1.0", path = "../../embassy-time", features = ["defmt", "nightly", "defmt-timestamp-uptime"] } 13embassy-time = { version = "0.1.0", path = "../../embassy-time", features = ["defmt", "nightly", "unstable-traits", "defmt-timestamp-uptime"] }
14embassy-nrf = { version = "0.1.0", path = "../../embassy-nrf", features = ["defmt", "nightly", "unstable-traits", "nrf52840", "time-driver-rtc1", "gpiote", "unstable-pac"] } 14embassy-nrf = { version = "0.1.0", path = "../../embassy-nrf", features = ["defmt", "nightly", "unstable-traits", "nrf52840", "time-driver-rtc1", "gpiote", "unstable-pac"] }
15embedded-io = { version = "0.4.0", features = ["async"] } 15embedded-io = { version = "0.4.0", features = ["async"] }
16embassy-net = { version = "0.1.0", path = "../../embassy-net", features = ["defmt", "tcp", "dhcpv4", "medium-ethernet", "nightly"] } 16embassy-net = { version = "0.1.0", path = "../../embassy-net", features = ["defmt", "tcp", "dhcpv4", "medium-ethernet", "nightly"] }
17embassy-net-esp-hosted = { version = "0.1.0", path = "../../embassy-net-esp-hosted", features = ["defmt"] } 17embassy-net-esp-hosted = { version = "0.1.0", path = "../../embassy-net-esp-hosted", features = ["defmt"] }
18embedded-hal-async = { version = "0.2.0-alpha.1" } 18embedded-hal-async = { version = "0.2.0-alpha.2" }
19static_cell = { version = "1.1", features = [ "nightly" ] } 19static_cell = { version = "1.1", features = [ "nightly" ] }
20 20
21defmt = "0.3" 21defmt = "0.3"
diff --git a/tests/nrf/src/bin/wifi_esp_hosted_perf.rs b/tests/nrf/src/bin/wifi_esp_hosted_perf.rs
index 277b985c5..398ab9d27 100644
--- a/tests/nrf/src/bin/wifi_esp_hosted_perf.rs
+++ b/tests/nrf/src/bin/wifi_esp_hosted_perf.rs
@@ -14,7 +14,7 @@ use embassy_nrf::gpio::{AnyPin, Input, Level, Output, OutputDrive, Pin, Pull};
14use embassy_nrf::rng::Rng; 14use embassy_nrf::rng::Rng;
15use embassy_nrf::spim::{self, Spim}; 15use embassy_nrf::spim::{self, Spim};
16use embassy_nrf::{bind_interrupts, peripherals}; 16use embassy_nrf::{bind_interrupts, peripherals};
17use embassy_time::{with_timeout, Duration, Timer}; 17use embassy_time::{with_timeout, Delay, Duration, Timer};
18use embedded_hal_async::spi::ExclusiveDevice; 18use embedded_hal_async::spi::ExclusiveDevice;
19use static_cell::make_static; 19use static_cell::make_static;
20use {defmt_rtt as _, embassy_net_esp_hosted as hosted, panic_probe as _}; 20use {defmt_rtt as _, embassy_net_esp_hosted as hosted, panic_probe as _};
@@ -30,7 +30,7 @@ bind_interrupts!(struct Irqs {
30async fn wifi_task( 30async fn wifi_task(
31 runner: hosted::Runner< 31 runner: hosted::Runner<
32 'static, 32 'static,
33 ExclusiveDevice<Spim<'static, peripherals::SPI3>, Output<'static, peripherals::P0_31>>, 33 ExclusiveDevice<Spim<'static, peripherals::SPI3>, Output<'static, peripherals::P0_31>, Delay>,
34 Input<'static, AnyPin>, 34 Input<'static, AnyPin>,
35 Output<'static, peripherals::P1_05>, 35 Output<'static, peripherals::P1_05>,
36 >, 36 >,
@@ -63,7 +63,7 @@ async fn main(spawner: Spawner) {
63 config.frequency = spim::Frequency::M32; 63 config.frequency = spim::Frequency::M32;
64 config.mode = spim::MODE_2; // !!! 64 config.mode = spim::MODE_2; // !!!
65 let spi = spim::Spim::new(p.SPI3, Irqs, sck, miso, mosi, config); 65 let spi = spim::Spim::new(p.SPI3, Irqs, sck, miso, mosi, config);
66 let spi = ExclusiveDevice::new(spi, cs); 66 let spi = ExclusiveDevice::new(spi, cs, Delay);
67 67
68 let (device, mut control, runner) = embassy_net_esp_hosted::new( 68 let (device, mut control, runner) = embassy_net_esp_hosted::new(
69 make_static!(embassy_net_esp_hosted::State::new()), 69 make_static!(embassy_net_esp_hosted::State::new()),
diff --git a/tests/rp/Cargo.toml b/tests/rp/Cargo.toml
index 180d0ebbe..f1b48e747 100644
--- a/tests/rp/Cargo.toml
+++ b/tests/rp/Cargo.toml
@@ -22,8 +22,8 @@ defmt-rtt = "0.4"
22cortex-m = { version = "0.7.6" } 22cortex-m = { version = "0.7.6" }
23cortex-m-rt = "0.7.0" 23cortex-m-rt = "0.7.0"
24embedded-hal = "0.2.6" 24embedded-hal = "0.2.6"
25embedded-hal-1 = { package = "embedded-hal", version = "=1.0.0-alpha.10" } 25embedded-hal-1 = { package = "embedded-hal", version = "=1.0.0-alpha.11" }
26embedded-hal-async = { version = "=0.2.0-alpha.1" } 26embedded-hal-async = { version = "=0.2.0-alpha.2" }
27panic-probe = { version = "0.3.0", features = ["print-defmt"] } 27panic-probe = { version = "0.3.0", features = ["print-defmt"] }
28futures = { version = "0.3.17", default-features = false, features = ["async-await"] } 28futures = { version = "0.3.17", default-features = false, features = ["async-await"] }
29embedded-io = { version = "0.4.0", features = ["async"] } 29embedded-io = { version = "0.4.0", features = ["async"] }
diff --git a/tests/stm32/Cargo.toml b/tests/stm32/Cargo.toml
index c2422f7bc..c69af6d5a 100644
--- a/tests/stm32/Cargo.toml
+++ b/tests/stm32/Cargo.toml
@@ -38,8 +38,8 @@ defmt-rtt = "0.4"
38cortex-m = { version = "0.7.6", features = ["critical-section-single-core"] } 38cortex-m = { version = "0.7.6", features = ["critical-section-single-core"] }
39cortex-m-rt = "0.7.0" 39cortex-m-rt = "0.7.0"
40embedded-hal = "0.2.6" 40embedded-hal = "0.2.6"
41embedded-hal-1 = { package = "embedded-hal", version = "=1.0.0-alpha.10" } 41embedded-hal-1 = { package = "embedded-hal", version = "=1.0.0-alpha.11" }
42embedded-hal-async = { version = "=0.2.0-alpha.1" } 42embedded-hal-async = { version = "=0.2.0-alpha.2" }
43panic-probe = { version = "0.3.0", features = ["print-defmt"] } 43panic-probe = { version = "0.3.0", features = ["print-defmt"] }
44rand_core = { version = "0.6", default-features = false } 44rand_core = { version = "0.6", default-features = false }
45rand_chacha = { version = "0.3", default-features = false } 45rand_chacha = { version = "0.3", default-features = false }