aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDario Nieuwenhuis <[email protected]>2022-01-27 00:08:02 +0100
committerDario Nieuwenhuis <[email protected]>2022-01-27 00:08:02 +0100
commit0719b05d63a1d80d3b8ea39a411545a6e8e22ec2 (patch)
tree9abf789ef5213c191433466b0b201edde967eaed
parentd76cd5ceaf5140c48ef97180beae156c0c0e07c8 (diff)
traits: migrate Delay to embedded-hal 1.0+async, remove Rng and Flash.
-rw-r--r--README.md9
-rw-r--r--docs/modules/ROOT/pages/traits.adoc1
-rw-r--r--embassy-nrf/Cargo.toml2
-rw-r--r--embassy-stm32/Cargo.toml2
-rw-r--r--embassy-stm32/src/rng.rs90
-rw-r--r--embassy-traits/Cargo.toml1
-rw-r--r--embassy-traits/src/delay.rs13
-rw-r--r--embassy-traits/src/flash.rs57
-rw-r--r--embassy-traits/src/lib.rs3
-rw-r--r--embassy-traits/src/rng.rs75
-rw-r--r--embassy/Cargo.toml11
-rw-r--r--embassy/src/lib.rs1
-rw-r--r--embassy/src/time/delay.rs109
-rw-r--r--examples/nrf/Cargo.toml1
-rw-r--r--examples/stm32f1/Cargo.toml1
-rw-r--r--examples/stm32f1/src/bin/adc.rs5
-rw-r--r--examples/stm32f3/Cargo.toml1
-rw-r--r--examples/stm32f4/Cargo.toml3
-rw-r--r--examples/stm32f7/Cargo.toml1
-rw-r--r--examples/stm32g0/Cargo.toml1
-rw-r--r--examples/stm32g4/Cargo.toml1
-rw-r--r--examples/stm32h7/Cargo.toml1
-rw-r--r--examples/stm32h7/src/bin/rng.rs19
-rw-r--r--examples/stm32l0/Cargo.toml1
-rw-r--r--examples/stm32l1/Cargo.toml1
-rw-r--r--examples/stm32l4/Cargo.toml2
-rw-r--r--examples/stm32l4/src/bin/rng.rs11
-rw-r--r--examples/stm32l4/src/bin/usart_blocking_async.rs2
-rw-r--r--examples/stm32u5/Cargo.toml1
-rw-r--r--examples/stm32wb55/Cargo.toml1
-rw-r--r--examples/stm32wl55/Cargo.toml1
-rw-r--r--tests/stm32/Cargo.toml1
32 files changed, 135 insertions, 294 deletions
diff --git a/README.md b/README.md
index 62aea0064..fe273fdc1 100644
--- a/README.md
+++ b/README.md
@@ -2,15 +2,6 @@
2 2
3Embassy is a project to make async/await a first-class option for embedded development. For more information and instructions to get started, go to [https://embassy.dev](https://embassy.dev). 3Embassy is a project to make async/await a first-class option for embedded development. For more information and instructions to get started, go to [https://embassy.dev](https://embassy.dev).
4 4
5## Traits and types
6
7`embassy` provides a set of traits and types specifically designed for `async` usage.
8
9- `embassy::io`: `AsyncBufRead`, `AsyncWrite`. Traits for byte-stream IO, essentially `no_std` compatible versions of `futures::io`.
10- `embassy::traits::flash`: Flash device trait.
11- `embassy::time`: `Clock` and `Alarm` traits. Std-like `Duration` and `Instant`.
12- More traits for SPI, I2C, UART async HAL coming soon.
13
14## Executor 5## Executor
15 6
16The `embassy::executor` module provides an async/await executor designed for embedded usage. 7The `embassy::executor` module provides an async/await executor designed for embedded usage.
diff --git a/docs/modules/ROOT/pages/traits.adoc b/docs/modules/ROOT/pages/traits.adoc
index 96f3e88bb..38b8f2862 100644
--- a/docs/modules/ROOT/pages/traits.adoc
+++ b/docs/modules/ROOT/pages/traits.adoc
@@ -3,7 +3,6 @@
3Embassy provides a set of traits and types specifically designed for `async` usage. Many of these futures will be upstreamed to the `embedded-hal` crate at some point in the future, probably when the required GAT (Generic Associated Types) feature is stabilized in Rust. 3Embassy provides a set of traits and types specifically designed for `async` usage. Many of these futures will be upstreamed to the `embedded-hal` crate at some point in the future, probably when the required GAT (Generic Associated Types) feature is stabilized in Rust.
4 4
5* `embassy::io`: `AsyncBufRead`, `AsyncWrite`. Traits for byte-stream IO, essentially `no_std` compatible versions of `futures::io`. The primary reason for re-defining these traits is that the `futures::io` variant requires `std::io::Error`, which does not work in the `no_std` environment. 5* `embassy::io`: `AsyncBufRead`, `AsyncWrite`. Traits for byte-stream IO, essentially `no_std` compatible versions of `futures::io`. The primary reason for re-defining these traits is that the `futures::io` variant requires `std::io::Error`, which does not work in the `no_std` environment.
6* `embassy::traits`: Async traits for Flash, SPI, I2C, UART, RNG, GPIO and more.
7* `embassy::time`: Time `Driver` trait that is implemented for different platforms. Time in Embassy is represented using the `Duration` and `Instant` types. 6* `embassy::time`: Time `Driver` trait that is implemented for different platforms. Time in Embassy is represented using the `Duration` and `Instant` types.
8 7
9These traits are implemented by the platform-specific crates, such as `embassy-nrf` or `embassy-stm32`. 8These traits are implemented by the platform-specific crates, such as `embassy-nrf` or `embassy-stm32`.
diff --git a/embassy-nrf/Cargo.toml b/embassy-nrf/Cargo.toml
index c9bd2bc14..f64e2a950 100644
--- a/embassy-nrf/Cargo.toml
+++ b/embassy-nrf/Cargo.toml
@@ -50,7 +50,7 @@ embassy = { version = "0.1.0", path = "../embassy" }
50embassy-macros = { version = "0.1.0", path = "../embassy-macros", features = ["nrf"]} 50embassy-macros = { version = "0.1.0", path = "../embassy-macros", features = ["nrf"]}
51embassy-hal-common = {version = "0.1.0", path = "../embassy-hal-common" } 51embassy-hal-common = {version = "0.1.0", path = "../embassy-hal-common" }
52 52
53embedded-hal-02 = { package = "embedded-hal", version = "0.2.6" } 53embedded-hal-02 = { package = "embedded-hal", version = "0.2.6", features = ["unproven"] }
54embedded-hal-1 = { package = "embedded-hal", version = "1.0.0-alpha.6", git = "https://github.com/embassy-rs/embedded-hal", branch = "embassy", optional = true} 54embedded-hal-1 = { package = "embedded-hal", version = "1.0.0-alpha.6", git = "https://github.com/embassy-rs/embedded-hal", branch = "embassy", optional = true}
55embedded-hal-async = { version = "0.0.1", git = "https://github.com/embassy-rs/embedded-hal", branch = "embassy", optional = true} 55embedded-hal-async = { version = "0.0.1", git = "https://github.com/embassy-rs/embedded-hal", branch = "embassy", optional = true}
56 56
diff --git a/embassy-stm32/Cargo.toml b/embassy-stm32/Cargo.toml
index e0fd1d963..1aa665fb6 100644
--- a/embassy-stm32/Cargo.toml
+++ b/embassy-stm32/Cargo.toml
@@ -11,7 +11,7 @@ embassy-macros = { version = "0.1.0", path = "../embassy-macros", features = ["s
11embassy-hal-common = {version = "0.1.0", path = "../embassy-hal-common" } 11embassy-hal-common = {version = "0.1.0", path = "../embassy-hal-common" }
12embassy-net = { version = "0.1.0", path = "../embassy-net", default-features = false, optional = true } 12embassy-net = { version = "0.1.0", path = "../embassy-net", default-features = false, optional = true }
13 13
14embedded-hal-02 = { package = "embedded-hal", version = "0.2.6" } 14embedded-hal-02 = { package = "embedded-hal", version = "0.2.6", features = ["unproven"] }
15embedded-hal-1 = { package = "embedded-hal", version = "1.0.0-alpha.6", git = "https://github.com/embassy-rs/embedded-hal", branch = "embassy", optional = true} 15embedded-hal-1 = { package = "embedded-hal", version = "1.0.0-alpha.6", git = "https://github.com/embassy-rs/embedded-hal", branch = "embassy", optional = true}
16embedded-hal-async = { version = "0.0.1", git = "https://github.com/embassy-rs/embedded-hal", branch = "embassy", optional = true} 16embedded-hal-async = { version = "0.0.1", git = "https://github.com/embassy-rs/embedded-hal", branch = "embassy", optional = true}
17 17
diff --git a/embassy-stm32/src/rng.rs b/embassy-stm32/src/rng.rs
index dd059eda7..bfacdeefa 100644
--- a/embassy-stm32/src/rng.rs
+++ b/embassy-stm32/src/rng.rs
@@ -1,8 +1,6 @@
1#![macro_use] 1#![macro_use]
2 2
3use core::future::Future;
4use core::task::Poll; 3use core::task::Poll;
5use embassy::traits;
6use embassy::util::Unborrow; 4use embassy::util::Unborrow;
7use embassy::waitqueue::AtomicWaker; 5use embassy::waitqueue::AtomicWaker;
8use embassy_hal_common::unborrow; 6use embassy_hal_common::unborrow;
@@ -48,6 +46,46 @@ impl<T: Instance> Rng<T> {
48 // Reference manual says to discard the first. 46 // Reference manual says to discard the first.
49 let _ = self.next_u32(); 47 let _ = self.next_u32();
50 } 48 }
49
50 pub async fn async_fill_bytes(&mut self, dest: &mut [u8]) -> Result<(), Error> {
51 unsafe {
52 T::regs().cr().modify(|reg| {
53 reg.set_rngen(true);
54 })
55 }
56
57 for chunk in dest.chunks_mut(4) {
58 poll_fn(|cx| {
59 RNG_WAKER.register(cx.waker());
60 unsafe {
61 T::regs().cr().modify(|reg| {
62 reg.set_ie(true);
63 });
64 }
65
66 let bits = unsafe { T::regs().sr().read() };
67
68 if bits.drdy() {
69 Poll::Ready(Ok(()))
70 } else if bits.seis() {
71 self.reset();
72 Poll::Ready(Err(Error::SeedError))
73 } else if bits.ceis() {
74 self.reset();
75 Poll::Ready(Err(Error::ClockError))
76 } else {
77 Poll::Pending
78 }
79 })
80 .await?;
81 let random_bytes = unsafe { T::regs().dr().read() }.to_be_bytes();
82 for (dest, src) in chunk.iter_mut().zip(random_bytes.iter()) {
83 *dest = *src
84 }
85 }
86
87 Ok(())
88 }
51} 89}
52 90
53impl<T: Instance> RngCore for Rng<T> { 91impl<T: Instance> RngCore for Rng<T> {
@@ -83,54 +121,6 @@ impl<T: Instance> RngCore for Rng<T> {
83 121
84impl<T: Instance> CryptoRng for Rng<T> {} 122impl<T: Instance> CryptoRng for Rng<T> {}
85 123
86impl<T: Instance> traits::rng::Rng for Rng<T> {
87 type Error = Error;
88 type RngFuture<'a>
89 where
90 Self: 'a,
91 = impl Future<Output = Result<(), Self::Error>> + 'a;
92
93 fn fill_bytes<'a>(&'a mut self, dest: &'a mut [u8]) -> Self::RngFuture<'a> {
94 unsafe {
95 T::regs().cr().modify(|reg| {
96 reg.set_rngen(true);
97 });
98 }
99 async move {
100 for chunk in dest.chunks_mut(4) {
101 poll_fn(|cx| {
102 RNG_WAKER.register(cx.waker());
103 unsafe {
104 T::regs().cr().modify(|reg| {
105 reg.set_ie(true);
106 });
107 }
108
109 let bits = unsafe { T::regs().sr().read() };
110
111 if bits.drdy() {
112 Poll::Ready(Ok(()))
113 } else if bits.seis() {
114 self.reset();
115 Poll::Ready(Err(Error::SeedError))
116 } else if bits.ceis() {
117 self.reset();
118 Poll::Ready(Err(Error::ClockError))
119 } else {
120 Poll::Pending
121 }
122 })
123 .await?;
124 let random_bytes = unsafe { T::regs().dr().read() }.to_be_bytes();
125 for (dest, src) in chunk.iter_mut().zip(random_bytes.iter()) {
126 *dest = *src
127 }
128 }
129 Ok(())
130 }
131 }
132}
133
134pub(crate) mod sealed { 124pub(crate) mod sealed {
135 use super::*; 125 use super::*;
136 126
diff --git a/embassy-traits/Cargo.toml b/embassy-traits/Cargo.toml
index 4d0d21916..39875687f 100644
--- a/embassy-traits/Cargo.toml
+++ b/embassy-traits/Cargo.toml
@@ -8,7 +8,6 @@ edition = "2018"
8std = [] 8std = []
9 9
10[dependencies] 10[dependencies]
11defmt = { version = "0.3", optional = true }
12embedded-hal-02 = { package = "embedded-hal", version = "0.2.6", features = ["unproven"] } 11embedded-hal-02 = { package = "embedded-hal", version = "0.2.6", features = ["unproven"] }
13embedded-hal-1 = { package = "embedded-hal", version = "1.0.0-alpha.6", git = "https://github.com/embassy-rs/embedded-hal", branch = "embassy" } 12embedded-hal-1 = { package = "embedded-hal", version = "1.0.0-alpha.6", git = "https://github.com/embassy-rs/embedded-hal", branch = "embassy" }
14embedded-hal-async = { version = "0.0.1", git = "https://github.com/embassy-rs/embedded-hal", branch = "embassy"} 13embedded-hal-async = { version = "0.0.1", git = "https://github.com/embassy-rs/embedded-hal", branch = "embassy"}
diff --git a/embassy-traits/src/delay.rs b/embassy-traits/src/delay.rs
deleted file mode 100644
index c4ef155ee..000000000
--- a/embassy-traits/src/delay.rs
+++ /dev/null
@@ -1,13 +0,0 @@
1use core::future::Future;
2
3pub trait Delay {
4 type DelayFuture<'a>: Future<Output = ()> + 'a
5 where
6 Self: 'a;
7
8 /// Future that completes after now + millis
9 fn delay_ms(&mut self, millis: u64) -> Self::DelayFuture<'_>;
10
11 /// Future that completes after now + micros
12 fn delay_us(&mut self, micros: u64) -> Self::DelayFuture<'_>;
13}
diff --git a/embassy-traits/src/flash.rs b/embassy-traits/src/flash.rs
deleted file mode 100644
index 94e11dbc5..000000000
--- a/embassy-traits/src/flash.rs
+++ /dev/null
@@ -1,57 +0,0 @@
1use core::future::Future;
2
3#[derive(Copy, Clone, Debug, Eq, PartialEq)]
4#[cfg_attr(feature = "defmt", derive(defmt::Format))]
5#[non_exhaustive]
6pub enum Error {
7 Failed,
8 AddressMisaligned,
9 BufferMisaligned,
10}
11
12pub trait Flash {
13 type ReadFuture<'a>: Future<Output = Result<(), Error>>
14 where
15 Self: 'a;
16
17 type WriteFuture<'a>: Future<Output = Result<(), Error>>
18 where
19 Self: 'a;
20
21 type ErasePageFuture<'a>: Future<Output = Result<(), Error>>
22 where
23 Self: 'a;
24
25 /// Reads data from the flash device.
26 ///
27 /// address must be a multiple of self.read_size().
28 /// buf.len() must be a multiple of self.read_size().
29 fn read<'a>(&'a mut self, address: usize, buf: &'a mut [u8]) -> Self::ReadFuture<'a>;
30
31 /// Writes data to the flash device.
32 ///
33 /// address must be a multiple of self.write_size().
34 /// buf.len() must be a multiple of self.write_size().
35 fn write<'a>(&'a mut self, address: usize, buf: &'a [u8]) -> Self::WriteFuture<'a>;
36
37 /// Erases a single page from the flash device.
38 ///
39 /// address must be a multiple of self.erase_size().
40 fn erase(&mut self, address: usize) -> Self::ErasePageFuture<'_>;
41
42 /// Returns the total size, in bytes.
43 /// This is not guaranteed to be a power of 2.
44 fn size(&self) -> usize;
45
46 /// Returns the read size in bytes.
47 /// This is guaranteed to be a power of 2.
48 fn read_size(&self) -> usize;
49
50 /// Returns the write size in bytes.
51 /// This is guaranteed to be a power of 2.
52 fn write_size(&self) -> usize;
53
54 /// Returns the erase size in bytes.
55 /// This is guaranteed to be a power of 2.
56 fn erase_size(&self) -> usize;
57}
diff --git a/embassy-traits/src/lib.rs b/embassy-traits/src/lib.rs
index a41d0106f..9c5c367a8 100644
--- a/embassy-traits/src/lib.rs
+++ b/embassy-traits/src/lib.rs
@@ -3,6 +3,3 @@
3#![feature(type_alias_impl_trait)] 3#![feature(type_alias_impl_trait)]
4 4
5pub mod adapter; 5pub mod adapter;
6pub mod delay;
7pub mod flash;
8pub mod rng;
diff --git a/embassy-traits/src/rng.rs b/embassy-traits/src/rng.rs
deleted file mode 100644
index ec97406b0..000000000
--- a/embassy-traits/src/rng.rs
+++ /dev/null
@@ -1,75 +0,0 @@
1use core::future::Future;
2
3/// Random-number Generator
4pub trait Rng {
5 type Error;
6
7 type RngFuture<'a>: Future<Output = Result<(), Self::Error>> + 'a
8 where
9 Self: 'a;
10
11 /// Completely fill the provided buffer with random bytes.
12 ///
13 /// May result in delays if entropy is exhausted prior to completely
14 /// filling the buffer. Upon completion, the buffer will be completely
15 /// filled or an error will have been reported.
16 fn fill_bytes<'a>(&'a mut self, dest: &'a mut [u8]) -> Self::RngFuture<'a>;
17}
18
19pub struct Random<T: Rng> {
20 rng: T,
21}
22
23impl<T: Rng> Random<T> {
24 pub fn new(rng: T) -> Self {
25 Self { rng }
26 }
27
28 pub async fn next_u8(&mut self, range: u8) -> Result<u8, T::Error> {
29 // Lemire's method
30 let t = (-(range as i8) % (range as i8)) as u8;
31 loop {
32 let mut buf = [0; 1];
33 self.rng.fill_bytes(&mut buf).await?;
34 let x = u8::from_le_bytes(buf);
35 let m = x as u16 * range as u16;
36 let l = m as u8;
37 if l < t {
38 continue;
39 }
40 return Ok((m >> 8) as u8);
41 }
42 }
43
44 pub async fn next_u16(&mut self, range: u16) -> Result<u16, T::Error> {
45 // Lemire's method
46 let t = (-(range as i16) % (range as i16)) as u16;
47 loop {
48 let mut buf = [0; 2];
49 self.rng.fill_bytes(&mut buf).await?;
50 let x = u16::from_le_bytes(buf);
51 let m = x as u32 * range as u32;
52 let l = m as u16;
53 if l < t {
54 continue;
55 }
56 return Ok((m >> 16) as u16);
57 }
58 }
59
60 pub async fn next_u32(&mut self, range: u32) -> Result<u32, T::Error> {
61 // Lemire's method
62 let t = (-(range as i32) % (range as i32)) as u32;
63 loop {
64 let mut buf = [0; 4];
65 self.rng.fill_bytes(&mut buf).await?;
66 let x = u32::from_le_bytes(buf);
67 let m = x as u64 * range as u64;
68 let l = m as u32;
69 if l < t {
70 continue;
71 }
72 return Ok((m >> 32) as u32);
73 }
74 }
75}
diff --git a/embassy/Cargo.toml b/embassy/Cargo.toml
index 611c35eed..ccb5574d7 100644
--- a/embassy/Cargo.toml
+++ b/embassy/Cargo.toml
@@ -7,9 +7,12 @@ resolver = "2"
7 7
8[features] 8[features]
9default = [] 9default = []
10std = ["futures/std", "embassy-traits/std", "time", "time-tick-1mhz", "embassy-macros/std"] 10std = ["futures/std", "time", "time-tick-1mhz", "embassy-macros/std"]
11wasm = ["wasm-bindgen", "js-sys", "embassy-macros/wasm", "wasm-timer", "time", "time-tick-1mhz"] 11wasm = ["wasm-bindgen", "js-sys", "embassy-macros/wasm", "wasm-timer", "time", "time-tick-1mhz"]
12 12
13# Implement embedded-hal 1.0 alpha and embedded-hal-async traits.
14unstable-traits = ["embedded-hal-1", "embedded-hal-async"]
15
13# Enable `embassy::time` module. 16# Enable `embassy::time` module.
14# NOTE: This feature is only intended to be enabled by crates providing the time driver implementation. 17# NOTE: This feature is only intended to be enabled by crates providing the time driver implementation.
15# Enabling it directly without supplying a time driver will fail to link. 18# Enabling it directly without supplying a time driver will fail to link.
@@ -29,13 +32,15 @@ executor-agnostic = []
29defmt = { version = "0.3", optional = true } 32defmt = { version = "0.3", optional = true }
30log = { version = "0.4.14", optional = true } 33log = { version = "0.4.14", optional = true }
31 34
35embedded-hal-02 = { package = "embedded-hal", version = "0.2.6" }
36embedded-hal-1 = { package = "embedded-hal", version = "1.0.0-alpha.6", git = "https://github.com/embassy-rs/embedded-hal", branch = "embassy", optional = true}
37embedded-hal-async = { version = "0.0.1", git = "https://github.com/embassy-rs/embedded-hal", branch = "embassy", optional = true}
38
32futures = { version = "0.3.17", default-features = false, features = [ "cfg-target-has-atomic", "unstable" ] } 39futures = { version = "0.3.17", default-features = false, features = [ "cfg-target-has-atomic", "unstable" ] }
33pin-project = { version = "1.0.8", default-features = false } 40pin-project = { version = "1.0.8", default-features = false }
34embassy-macros = { version = "0.1.0", path = "../embassy-macros"} 41embassy-macros = { version = "0.1.0", path = "../embassy-macros"}
35embassy-traits = { version = "0.1.0", path = "../embassy-traits"}
36atomic-polyfill = "0.1.5" 42atomic-polyfill = "0.1.5"
37critical-section = "0.2.5" 43critical-section = "0.2.5"
38embedded-hal = "0.2.6"
39heapless = "0.7.5" 44heapless = "0.7.5"
40cfg-if = "1.0.0" 45cfg-if = "1.0.0"
41 46
diff --git a/embassy/src/lib.rs b/embassy/src/lib.rs
index 9d8ef3888..2be0e0052 100644
--- a/embassy/src/lib.rs
+++ b/embassy/src/lib.rs
@@ -21,7 +21,6 @@ pub mod time;
21pub mod util; 21pub mod util;
22 22
23pub use embassy_macros::*; 23pub use embassy_macros::*;
24pub use embassy_traits as traits;
25 24
26#[doc(hidden)] 25#[doc(hidden)]
27/// Implementation details for embassy macros. DO NOT USE. 26/// Implementation details for embassy macros. DO NOT USE.
diff --git a/embassy/src/time/delay.rs b/embassy/src/time/delay.rs
index 13c2191f6..ff32941ee 100644
--- a/embassy/src/time/delay.rs
+++ b/embassy/src/time/delay.rs
@@ -1,6 +1,10 @@
1use core::future::Future; 1use super::{Duration, Instant};
2 2
3use super::{Duration, Instant, Timer}; 3/// Blocks for at least `duration`.
4pub fn block_for(duration: Duration) {
5 let expires_at = Instant::now() + duration;
6 while Instant::now() < expires_at {}
7}
4 8
5/// Type implementing async delays and blocking `embedded-hal` delays. 9/// Type implementing async delays and blocking `embedded-hal` delays.
6/// 10///
@@ -10,55 +14,86 @@ use super::{Duration, Instant, Timer};
10/// active driver. 14/// active driver.
11pub struct Delay; 15pub struct Delay;
12 16
13impl crate::traits::delay::Delay for Delay { 17#[cfg(feature = "unstable-traits")]
14 type DelayFuture<'a> = impl Future<Output = ()> + 'a; 18mod eh1 {
19 use core::future::Future;
20 use futures::FutureExt;
15 21
16 fn delay_ms(&mut self, millis: u64) -> Self::DelayFuture<'_> { 22 use super::*;
17 Timer::after(Duration::from_millis(millis)) 23 use crate::time::Timer;
18 } 24
19 fn delay_us(&mut self, micros: u64) -> Self::DelayFuture<'_> { 25 impl embedded_hal_1::delay::blocking::DelayUs for Delay {
20 Timer::after(Duration::from_micros(micros)) 26 type Error = core::convert::Infallible;
27
28 fn delay_us(&mut self, us: u32) -> Result<(), Self::Error> {
29 Ok(block_for(Duration::from_micros(us as u64)))
30 }
31
32 fn delay_ms(&mut self, ms: u32) -> Result<(), Self::Error> {
33 Ok(block_for(Duration::from_millis(ms as u64)))
34 }
21 } 35 }
22}
23 36
24impl embedded_hal::blocking::delay::DelayMs<u8> for Delay { 37 impl embedded_hal_async::delay::DelayUs for Delay {
25 fn delay_ms(&mut self, ms: u8) { 38 type Error = core::convert::Infallible;
26 block_for(Duration::from_millis(ms as u64)) 39
40 type DelayUsFuture<'a>
41 where
42 Self: 'a,
43 = impl Future<Output = Result<(), Self::Error>> + 'a;
44
45 fn delay_us(&mut self, micros: u32) -> Self::DelayUsFuture<'_> {
46 Timer::after(Duration::from_micros(micros as _)).map(Ok)
47 }
48
49 type DelayMsFuture<'a>
50 where
51 Self: 'a,
52 = impl Future<Output = Result<(), Self::Error>> + 'a;
53
54 fn delay_ms(&mut self, millis: u32) -> Self::DelayMsFuture<'_> {
55 Timer::after(Duration::from_millis(millis as _)).map(Ok)
56 }
27 } 57 }
28} 58}
29 59
30impl embedded_hal::blocking::delay::DelayMs<u16> for Delay { 60mod eh02 {
31 fn delay_ms(&mut self, ms: u16) { 61 use super::*;
32 block_for(Duration::from_millis(ms as u64)) 62 use embedded_hal_02::blocking::delay::{DelayMs, DelayUs};
63
64 impl DelayMs<u8> for Delay {
65 fn delay_ms(&mut self, ms: u8) {
66 block_for(Duration::from_millis(ms as u64))
67 }
33 } 68 }
34}
35 69
36impl embedded_hal::blocking::delay::DelayMs<u32> for Delay { 70 impl DelayMs<u16> for Delay {
37 fn delay_ms(&mut self, ms: u32) { 71 fn delay_ms(&mut self, ms: u16) {
38 block_for(Duration::from_millis(ms as u64)) 72 block_for(Duration::from_millis(ms as u64))
73 }
39 } 74 }
40}
41 75
42impl embedded_hal::blocking::delay::DelayUs<u8> for Delay { 76 impl DelayMs<u32> for Delay {
43 fn delay_us(&mut self, us: u8) { 77 fn delay_ms(&mut self, ms: u32) {
44 block_for(Duration::from_micros(us as u64)) 78 block_for(Duration::from_millis(ms as u64))
79 }
45 } 80 }
46}
47 81
48impl embedded_hal::blocking::delay::DelayUs<u16> for Delay { 82 impl DelayUs<u8> for Delay {
49 fn delay_us(&mut self, us: u16) { 83 fn delay_us(&mut self, us: u8) {
50 block_for(Duration::from_micros(us as u64)) 84 block_for(Duration::from_micros(us as u64))
85 }
51 } 86 }
52}
53 87
54impl embedded_hal::blocking::delay::DelayUs<u32> for Delay { 88 impl DelayUs<u16> for Delay {
55 fn delay_us(&mut self, us: u32) { 89 fn delay_us(&mut self, us: u16) {
56 block_for(Duration::from_micros(us as u64)) 90 block_for(Duration::from_micros(us as u64))
91 }
57 } 92 }
58}
59 93
60/// Blocks for at least `duration`. 94 impl DelayUs<u32> for Delay {
61pub fn block_for(duration: Duration) { 95 fn delay_us(&mut self, us: u32) {
62 let expires_at = Instant::now() + duration; 96 block_for(Duration::from_micros(us as u64))
63 while Instant::now() < expires_at {} 97 }
98 }
64} 99}
diff --git a/examples/nrf/Cargo.toml b/examples/nrf/Cargo.toml
index fa7286923..eb1872d45 100644
--- a/examples/nrf/Cargo.toml
+++ b/examples/nrf/Cargo.toml
@@ -7,7 +7,6 @@ version = "0.1.0"
7 7
8[dependencies] 8[dependencies]
9embassy = { version = "0.1.0", path = "../../embassy", features = ["defmt"] } 9embassy = { version = "0.1.0", path = "../../embassy", features = ["defmt"] }
10embassy-traits = { version = "0.1.0", path = "../../embassy-traits", features = ["defmt"] }
11embassy-nrf = { version = "0.1.0", path = "../../embassy-nrf", features = ["defmt", "nrf52840", "time-driver-rtc1", "gpiote"] } 10embassy-nrf = { version = "0.1.0", path = "../../embassy-nrf", features = ["defmt", "nrf52840", "time-driver-rtc1", "gpiote"] }
12 11
13defmt = "0.3" 12defmt = "0.3"
diff --git a/examples/stm32f1/Cargo.toml b/examples/stm32f1/Cargo.toml
index 44673104e..677e40892 100644
--- a/examples/stm32f1/Cargo.toml
+++ b/examples/stm32f1/Cargo.toml
@@ -7,7 +7,6 @@ resolver = "2"
7 7
8[dependencies] 8[dependencies]
9embassy = { version = "0.1.0", path = "../../embassy", features = ["defmt"] } 9embassy = { version = "0.1.0", path = "../../embassy", features = ["defmt"] }
10embassy-traits = { version = "0.1.0", path = "../../embassy-traits", features = ["defmt"] }
11embassy-stm32 = { version = "0.1.0", path = "../../embassy-stm32", features = ["defmt", "stm32f103c8", "unstable-pac", "memory-x", "time-driver-any"] } 10embassy-stm32 = { version = "0.1.0", path = "../../embassy-stm32", features = ["defmt", "stm32f103c8", "unstable-pac", "memory-x", "time-driver-any"] }
12 11
13defmt = "0.3" 12defmt = "0.3"
diff --git a/examples/stm32f1/src/bin/adc.rs b/examples/stm32f1/src/bin/adc.rs
index de2214630..d24f3f5cb 100644
--- a/examples/stm32f1/src/bin/adc.rs
+++ b/examples/stm32f1/src/bin/adc.rs
@@ -6,10 +6,9 @@
6mod example_common; 6mod example_common;
7 7
8use embassy::executor::Spawner; 8use embassy::executor::Spawner;
9use embassy::time::Delay; 9use embassy::time::{Delay, Duration, Timer};
10use embassy_stm32::adc::Adc; 10use embassy_stm32::adc::Adc;
11use embassy_stm32::Peripherals; 11use embassy_stm32::Peripherals;
12use embassy_traits::delay::Delay as _;
13use example_common::*; 12use example_common::*;
14 13
15#[embassy::main] 14#[embassy::main]
@@ -24,6 +23,6 @@ async fn main(_spawner: Spawner, p: Peripherals) {
24 loop { 23 loop {
25 let v = adc.read(&mut pin); 24 let v = adc.read(&mut pin);
26 info!("--> {} - {} mV", v, adc.to_millivolts(v)); 25 info!("--> {} - {} mV", v, adc.to_millivolts(v));
27 Delay.delay_ms(100).await; 26 Timer::after(Duration::from_millis(100)).await;
28 } 27 }
29} 28}
diff --git a/examples/stm32f3/Cargo.toml b/examples/stm32f3/Cargo.toml
index d36188798..8b6bc010c 100644
--- a/examples/stm32f3/Cargo.toml
+++ b/examples/stm32f3/Cargo.toml
@@ -7,7 +7,6 @@ resolver = "2"
7 7
8[dependencies] 8[dependencies]
9embassy = { version = "0.1.0", path = "../../embassy", features = ["defmt"] } 9embassy = { version = "0.1.0", path = "../../embassy", features = ["defmt"] }
10embassy-traits = { version = "0.1.0", path = "../../embassy-traits", features = ["defmt"] }
11embassy-stm32 = { version = "0.1.0", path = "../../embassy-stm32", features = ["defmt", "stm32f303vc", "unstable-pac", "memory-x", "time-driver-any", "exti"] } 10embassy-stm32 = { version = "0.1.0", path = "../../embassy-stm32", features = ["defmt", "stm32f303vc", "unstable-pac", "memory-x", "time-driver-any", "exti"] }
12 11
13defmt = "0.3" 12defmt = "0.3"
diff --git a/examples/stm32f4/Cargo.toml b/examples/stm32f4/Cargo.toml
index 070d17d48..67b212d5c 100644
--- a/examples/stm32f4/Cargo.toml
+++ b/examples/stm32f4/Cargo.toml
@@ -7,8 +7,7 @@ resolver = "2"
7 7
8 8
9[dependencies] 9[dependencies]
10embassy = { version = "0.1.0", path = "../../embassy", features = ["defmt"] } 10embassy = { version = "0.1.0", path = "../../embassy", features = ["defmt", "unstable-traits"] }
11embassy-traits = { version = "0.1.0", path = "../../embassy-traits", features = ["defmt"] }
12embassy-stm32 = { version = "0.1.0", path = "../../embassy-stm32", features = ["defmt", "stm32f429zi", "unstable-pac", "memory-x", "time-driver-any", "exti"] } 11embassy-stm32 = { version = "0.1.0", path = "../../embassy-stm32", features = ["defmt", "stm32f429zi", "unstable-pac", "memory-x", "time-driver-any", "exti"] }
13 12
14defmt = "0.3" 13defmt = "0.3"
diff --git a/examples/stm32f7/Cargo.toml b/examples/stm32f7/Cargo.toml
index f9bbd8757..0b724fd85 100644
--- a/examples/stm32f7/Cargo.toml
+++ b/examples/stm32f7/Cargo.toml
@@ -7,7 +7,6 @@ resolver = "2"
7 7
8[dependencies] 8[dependencies]
9embassy = { version = "0.1.0", path = "../../embassy", features = ["defmt"] } 9embassy = { version = "0.1.0", path = "../../embassy", features = ["defmt"] }
10embassy-traits = { version = "0.1.0", path = "../../embassy-traits", features = ["defmt"] }
11embassy-stm32 = { version = "0.1.0", path = "../../embassy-stm32", features = ["defmt", "net", "stm32f767zi", "unstable-pac", "time-driver-any", "exti"] } 10embassy-stm32 = { version = "0.1.0", path = "../../embassy-stm32", features = ["defmt", "net", "stm32f767zi", "unstable-pac", "time-driver-any", "exti"] }
12embassy-net = { path = "../../embassy-net", default-features = false, features = ["defmt", "tcp", "medium-ethernet", "pool-16"] } 11embassy-net = { path = "../../embassy-net", default-features = false, features = ["defmt", "tcp", "medium-ethernet", "pool-16"] }
13 12
diff --git a/examples/stm32g0/Cargo.toml b/examples/stm32g0/Cargo.toml
index 692267501..5e33d79ca 100644
--- a/examples/stm32g0/Cargo.toml
+++ b/examples/stm32g0/Cargo.toml
@@ -7,7 +7,6 @@ resolver = "2"
7 7
8[dependencies] 8[dependencies]
9embassy = { version = "0.1.0", path = "../../embassy", features = ["defmt"] } 9embassy = { version = "0.1.0", path = "../../embassy", features = ["defmt"] }
10embassy-traits = { version = "0.1.0", path = "../../embassy-traits", features = ["defmt"] }
11embassy-stm32 = { version = "0.1.0", path = "../../embassy-stm32", features = ["defmt", "time-driver-any", "stm32g071rb", "memory-x", "unstable-pac", "exti"] } 10embassy-stm32 = { version = "0.1.0", path = "../../embassy-stm32", features = ["defmt", "time-driver-any", "stm32g071rb", "memory-x", "unstable-pac", "exti"] }
12 11
13defmt = "0.3" 12defmt = "0.3"
diff --git a/examples/stm32g4/Cargo.toml b/examples/stm32g4/Cargo.toml
index d61eb86cd..f78066b7d 100644
--- a/examples/stm32g4/Cargo.toml
+++ b/examples/stm32g4/Cargo.toml
@@ -7,7 +7,6 @@ resolver = "2"
7 7
8[dependencies] 8[dependencies]
9embassy = { version = "0.1.0", path = "../../embassy", features = ["defmt"] } 9embassy = { version = "0.1.0", path = "../../embassy", features = ["defmt"] }
10embassy-traits = { version = "0.1.0", path = "../../embassy-traits", features = ["defmt"] }
11embassy-stm32 = { version = "0.1.0", path = "../../embassy-stm32", features = ["defmt", "time-driver-any", "stm32g491re", "memory-x", "unstable-pac", "exti"] } 10embassy-stm32 = { version = "0.1.0", path = "../../embassy-stm32", features = ["defmt", "time-driver-any", "stm32g491re", "memory-x", "unstable-pac", "exti"] }
12embassy-hal-common = {version = "0.1.0", path = "../../embassy-hal-common" } 11embassy-hal-common = {version = "0.1.0", path = "../../embassy-hal-common" }
13 12
diff --git a/examples/stm32h7/Cargo.toml b/examples/stm32h7/Cargo.toml
index 16adcdb91..463dd83d5 100644
--- a/examples/stm32h7/Cargo.toml
+++ b/examples/stm32h7/Cargo.toml
@@ -9,7 +9,6 @@ resolver = "2"
9 9
10[dependencies] 10[dependencies]
11embassy = { version = "0.1.0", path = "../../embassy", features = ["defmt"] } 11embassy = { version = "0.1.0", path = "../../embassy", features = ["defmt"] }
12embassy-traits = { version = "0.1.0", path = "../../embassy-traits", features = ["defmt"] }
13embassy-stm32 = { version = "0.1.0", path = "../../embassy-stm32", features = ["defmt", "stm32h743zi", "net", "time-driver-any", "exti", "unstable-pac", "unstable-traits"] } 12embassy-stm32 = { version = "0.1.0", path = "../../embassy-stm32", features = ["defmt", "stm32h743zi", "net", "time-driver-any", "exti", "unstable-pac", "unstable-traits"] }
14embassy-net = { path = "../../embassy-net", default-features = false, features = ["defmt", "tcp", "medium-ethernet", "pool-16"] } 13embassy-net = { path = "../../embassy-net", default-features = false, features = ["defmt", "tcp", "medium-ethernet", "pool-16"] }
15embassy-hal-common = { path = "../../embassy-hal-common", default-features = false, features = ["defmt"] } 14embassy-hal-common = { path = "../../embassy-hal-common", default-features = false, features = ["defmt"] }
diff --git a/examples/stm32h7/src/bin/rng.rs b/examples/stm32h7/src/bin/rng.rs
index 8e03861d5..932cfcb8b 100644
--- a/examples/stm32h7/src/bin/rng.rs
+++ b/examples/stm32h7/src/bin/rng.rs
@@ -5,9 +5,6 @@
5#[path = "../example_common.rs"] 5#[path = "../example_common.rs"]
6mod example_common; 6mod example_common;
7use embassy::executor::Spawner; 7use embassy::executor::Spawner;
8use embassy::time::{Duration, Timer};
9use embassy::traits::rng::Random;
10use embassy_stm32::gpio::{Level, Output, Speed};
11use embassy_stm32::rng::Rng; 8use embassy_stm32::rng::Rng;
12use embassy_stm32::Peripherals; 9use embassy_stm32::Peripherals;
13use example_common::*; 10use example_common::*;
@@ -16,17 +13,9 @@ use example_common::*;
16async fn main(_spawner: Spawner, p: Peripherals) { 13async fn main(_spawner: Spawner, p: Peripherals) {
17 info!("Hello World!"); 14 info!("Hello World!");
18 15
19 let mut led = Output::new(p.PB14, Level::High, Speed::Low); 16 let mut rng = Rng::new(p.RNG);
20 17
21 let mut rng = Random::new(Rng::new(p.RNG)); 18 let mut buf = [0u8; 16];
22 19 unwrap!(rng.async_fill_bytes(&mut buf).await);
23 loop { 20 info!("random bytes: {:02x}", buf);
24 info!("high {}", unwrap!(rng.next_u8(16).await));
25 led.set_high();
26 Timer::after(Duration::from_millis(500)).await;
27
28 info!("low {}", unwrap!(rng.next_u8(16).await));
29 led.set_low();
30 Timer::after(Duration::from_millis(500)).await;
31 }
32} 21}
diff --git a/examples/stm32l0/Cargo.toml b/examples/stm32l0/Cargo.toml
index 2c27e276c..f5d1a1d41 100644
--- a/examples/stm32l0/Cargo.toml
+++ b/examples/stm32l0/Cargo.toml
@@ -7,7 +7,6 @@ resolver = "2"
7 7
8[dependencies] 8[dependencies]
9embassy = { version = "0.1.0", path = "../../embassy", features = ["defmt"] } 9embassy = { version = "0.1.0", path = "../../embassy", features = ["defmt"] }
10embassy-traits = { version = "0.1.0", path = "../../embassy-traits", features = ["defmt"] }
11embassy-stm32 = { version = "0.1.0", path = "../../embassy-stm32", features = ["defmt", "stm32l072cz", "time-driver-any", "exti", "unstable-traits", "memory-x"] } 10embassy-stm32 = { version = "0.1.0", path = "../../embassy-stm32", features = ["defmt", "stm32l072cz", "time-driver-any", "exti", "unstable-traits", "memory-x"] }
12 11
13embassy-lora = { version = "0.1.0", path = "../../embassy-lora", features = ["sx127x", "time", "defmt"] } 12embassy-lora = { version = "0.1.0", path = "../../embassy-lora", features = ["sx127x", "time", "defmt"] }
diff --git a/examples/stm32l1/Cargo.toml b/examples/stm32l1/Cargo.toml
index aad7cf6d2..86252d558 100644
--- a/examples/stm32l1/Cargo.toml
+++ b/examples/stm32l1/Cargo.toml
@@ -7,7 +7,6 @@ resolver = "2"
7 7
8[dependencies] 8[dependencies]
9embassy = { version = "0.1.0", path = "../../embassy", features = ["defmt"] } 9embassy = { version = "0.1.0", path = "../../embassy", features = ["defmt"] }
10embassy-traits = { version = "0.1.0", path = "../../embassy-traits", features = ["defmt"] }
11embassy-stm32 = { version = "0.1.0", path = "../../embassy-stm32", features = ["defmt", "stm32l151cb-a", "time-driver-any", "memory-x"] } 10embassy-stm32 = { version = "0.1.0", path = "../../embassy-stm32", features = ["defmt", "stm32l151cb-a", "time-driver-any", "memory-x"] }
12 11
13defmt = "0.3" 12defmt = "0.3"
diff --git a/examples/stm32l4/Cargo.toml b/examples/stm32l4/Cargo.toml
index ca76a1299..654d5f473 100644
--- a/examples/stm32l4/Cargo.toml
+++ b/examples/stm32l4/Cargo.toml
@@ -9,7 +9,7 @@ resolver = "2"
9 9
10[dependencies] 10[dependencies]
11embassy = { version = "0.1.0", path = "../../embassy", features = ["defmt" ] } 11embassy = { version = "0.1.0", path = "../../embassy", features = ["defmt" ] }
12embassy-traits = { version = "0.1.0", path = "../../embassy-traits", features = ["defmt"] } 12embassy-traits = { version = "0.1.0", path = "../../embassy-traits" }
13embassy-stm32 = { version = "0.1.0", path = "../../embassy-stm32", features = ["defmt", "unstable-pac", "stm32l4s5vi", "time-driver-any", "exti", "unstable-traits"] } 13embassy-stm32 = { version = "0.1.0", path = "../../embassy-stm32", features = ["defmt", "unstable-pac", "stm32l4s5vi", "time-driver-any", "exti", "unstable-traits"] }
14 14
15defmt = "0.3" 15defmt = "0.3"
diff --git a/examples/stm32l4/src/bin/rng.rs b/examples/stm32l4/src/bin/rng.rs
index c60b1d8bc..37db9e05a 100644
--- a/examples/stm32l4/src/bin/rng.rs
+++ b/examples/stm32l4/src/bin/rng.rs
@@ -5,8 +5,6 @@
5#[path = "../example_common.rs"] 5#[path = "../example_common.rs"]
6mod example_common; 6mod example_common;
7use embassy::executor::Spawner; 7use embassy::executor::Spawner;
8use embassy::time::{Duration, Timer};
9use embassy::traits::rng::Random;
10use embassy_stm32::rcc::{ClockSrc, PLLClkDiv, PLLMul, PLLSource, PLLSrcDiv}; 8use embassy_stm32::rcc::{ClockSrc, PLLClkDiv, PLLMul, PLLSource, PLLSrcDiv};
11use embassy_stm32::rng::Rng; 9use embassy_stm32::rng::Rng;
12use embassy_stm32::{Config, Peripherals}; 10use embassy_stm32::{Config, Peripherals};
@@ -28,10 +26,9 @@ fn config() -> Config {
28async fn main(_spawner: Spawner, p: Peripherals) { 26async fn main(_spawner: Spawner, p: Peripherals) {
29 info!("Hello World!"); 27 info!("Hello World!");
30 28
31 let mut rng = Random::new(Rng::new(p.RNG)); 29 let mut rng = Rng::new(p.RNG);
32 30
33 loop { 31 let mut buf = [0u8; 16];
34 info!("random {}", unwrap!(rng.next_u8(16).await)); 32 unwrap!(rng.async_fill_bytes(&mut buf).await);
35 Timer::after(Duration::from_secs(1)).await; 33 info!("random bytes: {:02x}", buf);
36 }
37} 34}
diff --git a/examples/stm32l4/src/bin/usart_blocking_async.rs b/examples/stm32l4/src/bin/usart_blocking_async.rs
index 10b7127da..dae673a5d 100644
--- a/examples/stm32l4/src/bin/usart_blocking_async.rs
+++ b/examples/stm32l4/src/bin/usart_blocking_async.rs
@@ -6,10 +6,10 @@
6mod example_common; 6mod example_common;
7 7
8use embassy::executor::Spawner; 8use embassy::executor::Spawner;
9use embassy::traits::adapter::BlockingAsync;
10use embassy_stm32::dma::NoDma; 9use embassy_stm32::dma::NoDma;
11use embassy_stm32::usart::{Config, Uart}; 10use embassy_stm32::usart::{Config, Uart};
12use embassy_stm32::Peripherals; 11use embassy_stm32::Peripherals;
12use embassy_traits::adapter::BlockingAsync;
13use embedded_hal_async::serial::{Read, Write}; 13use embedded_hal_async::serial::{Read, Write};
14use example_common::*; 14use example_common::*;
15 15
diff --git a/examples/stm32u5/Cargo.toml b/examples/stm32u5/Cargo.toml
index 5552b80d9..85a2d8455 100644
--- a/examples/stm32u5/Cargo.toml
+++ b/examples/stm32u5/Cargo.toml
@@ -7,7 +7,6 @@ resolver = "2"
7 7
8[dependencies] 8[dependencies]
9embassy = { version = "0.1.0", path = "../../embassy", features = ["defmt"] } 9embassy = { version = "0.1.0", path = "../../embassy", features = ["defmt"] }
10embassy-traits = { version = "0.1.0", path = "../../embassy-traits", features = ["defmt"] }
11embassy-stm32 = { version = "0.1.0", path = "../../embassy-stm32", features = ["defmt", "unstable-pac", "stm32u585ai", "memory-x" ] } 10embassy-stm32 = { version = "0.1.0", path = "../../embassy-stm32", features = ["defmt", "unstable-pac", "stm32u585ai", "memory-x" ] }
12 11
13defmt = "0.3" 12defmt = "0.3"
diff --git a/examples/stm32wb55/Cargo.toml b/examples/stm32wb55/Cargo.toml
index 7ba244ac6..e1c7689ef 100644
--- a/examples/stm32wb55/Cargo.toml
+++ b/examples/stm32wb55/Cargo.toml
@@ -7,7 +7,6 @@ resolver = "2"
7 7
8[dependencies] 8[dependencies]
9embassy = { version = "0.1.0", path = "../../embassy", features = ["defmt"] } 9embassy = { version = "0.1.0", path = "../../embassy", features = ["defmt"] }
10embassy-traits = { version = "0.1.0", path = "../../embassy-traits", features = ["defmt"] }
11embassy-stm32 = { version = "0.1.0", path = "../../embassy-stm32", features = ["defmt", "stm32wb55cc", "time-driver-any", "exti"] } 10embassy-stm32 = { version = "0.1.0", path = "../../embassy-stm32", features = ["defmt", "stm32wb55cc", "time-driver-any", "exti"] }
12 11
13defmt = "0.3" 12defmt = "0.3"
diff --git a/examples/stm32wl55/Cargo.toml b/examples/stm32wl55/Cargo.toml
index f68fb4fa2..f2e97699b 100644
--- a/examples/stm32wl55/Cargo.toml
+++ b/examples/stm32wl55/Cargo.toml
@@ -7,7 +7,6 @@ resolver = "2"
7 7
8[dependencies] 8[dependencies]
9embassy = { version = "0.1.0", path = "../../embassy", features = ["defmt"] } 9embassy = { version = "0.1.0", path = "../../embassy", features = ["defmt"] }
10embassy-traits = { version = "0.1.0", path = "../../embassy-traits", features = ["defmt"] }
11embassy-stm32 = { version = "0.1.0", path = "../../embassy-stm32", features = ["defmt", "stm32wl55jc-cm4", "time-driver-any", "memory-x", "subghz", "unstable-pac", "exti"] } 10embassy-stm32 = { version = "0.1.0", path = "../../embassy-stm32", features = ["defmt", "stm32wl55jc-cm4", "time-driver-any", "memory-x", "subghz", "unstable-pac", "exti"] }
12embassy-lora = { version = "0.1.0", path = "../../embassy-lora", features = ["stm32wl", "time"] } 11embassy-lora = { version = "0.1.0", path = "../../embassy-lora", features = ["stm32wl", "time"] }
13 12
diff --git a/tests/stm32/Cargo.toml b/tests/stm32/Cargo.toml
index 63bfb9d22..1741508cb 100644
--- a/tests/stm32/Cargo.toml
+++ b/tests/stm32/Cargo.toml
@@ -14,7 +14,6 @@ stm32wb55rg = ["embassy-stm32/stm32wb55rg"]
14 14
15[dependencies] 15[dependencies]
16embassy = { version = "0.1.0", path = "../../embassy", features = ["defmt"] } 16embassy = { version = "0.1.0", path = "../../embassy", features = ["defmt"] }
17embassy-traits = { version = "0.1.0", path = "../../embassy-traits", features = ["defmt"] }
18embassy-stm32 = { version = "0.1.0", path = "../../embassy-stm32", features = ["defmt", "unstable-pac", "memory-x", "time-driver-tim2"] } 17embassy-stm32 = { version = "0.1.0", path = "../../embassy-stm32", features = ["defmt", "unstable-pac", "memory-x", "time-driver-tim2"] }
19 18
20defmt = "0.3.0" 19defmt = "0.3.0"