aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.github/workflows/doc.yml86
-rw-r--r--.github/workflows/rust.yml2
-rw-r--r--docs/modules/ROOT/examples/basic/Cargo.toml1
-rw-r--r--docs/modules/ROOT/examples/layer-by-layer/blinky-async/Cargo.toml1
-rw-r--r--docs/modules/ROOT/examples/layer-by-layer/blinky-hal/Cargo.toml1
-rw-r--r--docs/modules/ROOT/examples/layer-by-layer/blinky-irq/Cargo.toml1
-rw-r--r--docs/modules/ROOT/examples/layer-by-layer/blinky-pac/Cargo.toml1
-rw-r--r--embassy-boot/boot/Cargo.toml1
-rw-r--r--embassy-boot/nrf/Cargo.toml1
-rw-r--r--embassy-boot/stm32/Cargo.toml1
-rw-r--r--embassy-cortex-m/Cargo.toml1
-rw-r--r--embassy-embedded-hal/Cargo.toml7
-rw-r--r--embassy-embedded-hal/src/shared_bus/asynch/spi.rs6
-rw-r--r--embassy-embedded-hal/src/shared_bus/blocking/i2c.rs3
-rw-r--r--embassy-embedded-hal/src/shared_bus/blocking/spi.rs8
-rw-r--r--embassy-executor/Cargo.toml3
-rw-r--r--embassy-hal-common/Cargo.toml1
-rw-r--r--embassy-lora/Cargo.toml5
-rw-r--r--embassy-macros/Cargo.toml1
-rw-r--r--embassy-net/Cargo.toml1
-rw-r--r--embassy-nrf/Cargo.toml5
-rw-r--r--embassy-nrf/src/gpio.rs12
-rw-r--r--embassy-nrf/src/gpiote.rs2
-rw-r--r--embassy-nrf/src/spim.rs8
-rw-r--r--embassy-nrf/src/twim.rs6
-rw-r--r--embassy-nrf/src/uarte.rs4
-rw-r--r--embassy-rp/Cargo.toml8
-rw-r--r--embassy-rp/src/gpio.rs22
-rw-r--r--embassy-rp/src/i2c.rs18
-rw-r--r--embassy-rp/src/spi.rs8
-rw-r--r--embassy-rp/src/uart/mod.rs12
-rw-r--r--embassy-stm32/Cargo.toml8
-rw-r--r--embassy-stm32/src/exti.rs2
-rw-r--r--embassy-stm32/src/flash/mod.rs27
-rw-r--r--embassy-stm32/src/gpio.rs3
-rw-r--r--embassy-stm32/src/i2c/v1.rs6
-rw-r--r--embassy-stm32/src/i2c/v2.rs6
-rw-r--r--embassy-stm32/src/spi/mod.rs8
-rw-r--r--embassy-stm32/src/usart/mod.rs104
-rw-r--r--embassy-sync/Cargo.toml10
-rw-r--r--embassy-sync/README.md24
-rw-r--r--embassy-sync/src/pubsub/mod.rs73
-rw-r--r--embassy-sync/src/pubsub/publisher.rs17
-rw-r--r--embassy-sync/src/pubsub/subscriber.rs6
-rw-r--r--embassy-time/Cargo.toml7
-rw-r--r--embassy-time/src/delay.rs2
-rw-r--r--embassy-usb-driver/Cargo.toml3
-rw-r--r--embassy-usb-driver/src/lib.rs8
-rw-r--r--embassy-usb/Cargo.toml3
-rw-r--r--examples/boot/application/nrf/Cargo.toml1
-rw-r--r--examples/boot/application/stm32f3/Cargo.toml1
-rw-r--r--examples/boot/application/stm32f3/src/bin/a.rs2
-rw-r--r--examples/boot/application/stm32f7/Cargo.toml1
-rw-r--r--examples/boot/application/stm32f7/src/bin/a.rs2
-rw-r--r--examples/boot/application/stm32h7/Cargo.toml1
-rw-r--r--examples/boot/application/stm32h7/src/bin/a.rs2
-rw-r--r--examples/boot/application/stm32l0/Cargo.toml1
-rw-r--r--examples/boot/application/stm32l0/src/bin/a.rs2
-rw-r--r--examples/boot/application/stm32l1/Cargo.toml1
-rw-r--r--examples/boot/application/stm32l1/src/bin/a.rs2
-rw-r--r--examples/boot/application/stm32l4/Cargo.toml1
-rw-r--r--examples/boot/application/stm32l4/src/bin/a.rs2
-rw-r--r--examples/boot/application/stm32wl/Cargo.toml1
-rw-r--r--examples/boot/application/stm32wl/src/bin/a.rs2
-rw-r--r--examples/boot/bootloader/nrf/Cargo.toml1
-rw-r--r--examples/boot/bootloader/stm32/Cargo.toml1
-rw-r--r--examples/boot/bootloader/stm32/src/main.rs2
-rw-r--r--examples/nrf-rtos-trace/Cargo.toml1
-rw-r--r--examples/nrf/Cargo.toml1
-rw-r--r--examples/rp/Cargo.toml3
-rw-r--r--examples/rp/src/bin/i2c_blocking.rs70
-rw-r--r--examples/rp/src/bin/spi_display.rs12
-rw-r--r--examples/std/Cargo.toml1
-rw-r--r--examples/stm32f0/Cargo.toml1
-rw-r--r--examples/stm32f1/Cargo.toml1
-rw-r--r--examples/stm32f2/Cargo.toml1
-rw-r--r--examples/stm32f3/Cargo.toml1
-rw-r--r--examples/stm32f3/src/bin/flash.rs2
-rw-r--r--examples/stm32f4/Cargo.toml1
-rw-r--r--examples/stm32f4/src/bin/flash.rs2
-rw-r--r--examples/stm32f7/Cargo.toml1
-rw-r--r--examples/stm32f7/src/bin/flash.rs2
-rw-r--r--examples/stm32g0/Cargo.toml1
-rw-r--r--examples/stm32g4/Cargo.toml1
-rw-r--r--examples/stm32h7/Cargo.toml5
-rw-r--r--examples/stm32h7/src/bin/flash.rs2
-rw-r--r--examples/stm32l0/Cargo.toml1
-rw-r--r--examples/stm32l0/src/bin/flash.rs2
-rw-r--r--examples/stm32l1/Cargo.toml1
-rw-r--r--examples/stm32l1/src/bin/flash.rs2
-rw-r--r--examples/stm32l4/Cargo.toml5
-rw-r--r--examples/stm32l5/Cargo.toml1
-rw-r--r--examples/stm32u5/Cargo.toml1
-rw-r--r--examples/stm32wb/Cargo.toml1
-rw-r--r--examples/stm32wl/Cargo.toml1
-rw-r--r--examples/stm32wl/src/bin/flash.rs2
-rw-r--r--examples/wasm/Cargo.toml1
-rw-r--r--stm32-gen-features/Cargo.toml1
-rw-r--r--stm32-metapac-gen/Cargo.toml1
-rw-r--r--tests/rp/Cargo.toml5
-rw-r--r--tests/stm32/Cargo.toml5
-rw-r--r--xtask/Cargo.toml1
102 files changed, 559 insertions, 161 deletions
diff --git a/.github/workflows/doc.yml b/.github/workflows/doc.yml
new file mode 100644
index 000000000..eb460e738
--- /dev/null
+++ b/.github/workflows/doc.yml
@@ -0,0 +1,86 @@
1name: Docs
2
3on:
4 push:
5 branches: [master]
6
7env:
8 BUILDER_THREADS: '1'
9
10jobs:
11 doc:
12 runs-on: ubuntu-latest
13
14 # Since stm32 crates take SO LONG to build, we split them
15 # into a separate job. This way it doesn't slow down updating
16 # the rest.
17 strategy:
18 matrix:
19 crates:
20 - stm32
21 - rest
22
23 # This will ensure at most one doc build job is running at a time
24 # (for stm32 and non-stm32 independently).
25 # If another job is already running, the new job will wait.
26 # If another job is already waiting, it'll be canceled.
27 # This means some commits will be skipped, but that's fine because
28 # we only care that the latest gets built.
29 concurrency: doc-${{ matrix.crates }}
30
31 steps:
32 - uses: actions/checkout@v2
33 with:
34 submodules: true
35 - name: Install Rust targets
36 run: |
37 rustup target add x86_64-unknown-linux-gnu
38 rustup target add wasm32-unknown-unknown
39 rustup target add thumbv6m-none-eabi
40 rustup target add thumbv7m-none-eabi
41 rustup target add thumbv7em-none-eabi
42 rustup target add thumbv7em-none-eabihf
43 rustup target add thumbv8m.base-none-eabi
44 rustup target add thumbv8m.main-none-eabi
45 rustup target add thumbv8m.main-none-eabihf
46
47 - name: Install docserver
48 run: |
49 wget -q -O /usr/local/bin/builder "https://github.com/embassy-rs/docserver/releases/download/v0.3/builder"
50 chmod +x /usr/local/bin/builder
51
52 - name: build-stm32
53 if: ${{ matrix.crates=='stm32' }}
54 run: |
55 mkdir crates
56 builder ./embassy-stm32 crates/embassy-stm32/git.zup
57 builder ./stm32-metapac crates/stm32-metapac/git.zup
58
59 - name: build-rest
60 if: ${{ matrix.crates=='rest' }}
61 run: |
62 mkdir crates
63 builder ./embassy-boot/boot crates/embassy-boot/git.zup
64 builder ./embassy-boot/nrf crates/embassy-boot-nrf/git.zup
65 builder ./embassy-boot/stm32 crates/embassy-boot-stm32/git.zup
66 builder ./embassy-cortex-m crates/embassy-cortex-m/git.zup
67 builder ./embassy-embedded-hal crates/embassy-embedded-hal/git.zup
68 builder ./embassy-executor crates/embassy-executor/git.zup
69 builder ./embassy-futures crates/embassy-futures/git.zup
70 builder ./embassy-lora crates/embassy-lora/git.zup
71 builder ./embassy-net crates/embassy-net/git.zup
72 builder ./embassy-nrf crates/embassy-nrf/git.zup
73 builder ./embassy-rp crates/embassy-rp/git.zup
74 builder ./embassy-sync crates/embassy-sync/git.zup
75 builder ./embassy-time crates/embassy-time/git.zup
76 builder ./embassy-usb crates/embassy-usb/git.zup
77 builder ./embassy-usb-driver crates/embassy-usb-driver/git.zup
78
79 - name: upload
80 run: |
81 mkdir -p ~/.kube
82 echo "${{secrets.KUBECONFIG}}" > ~/.kube/config
83 POD=$(kubectl -n embassy get po -l app=docserver -o jsonpath={.items[0].metadata.name})
84 kubectl cp crates $POD:/data
85
86 \ No newline at end of file
diff --git a/.github/workflows/rust.yml b/.github/workflows/rust.yml
index d2e8e316b..b93c8783d 100644
--- a/.github/workflows/rust.yml
+++ b/.github/workflows/rust.yml
@@ -11,7 +11,7 @@ env:
11 11
12jobs: 12jobs:
13 all: 13 all:
14 runs-on: ubuntu-20.04 14 runs-on: ubuntu-latest
15 needs: [build-nightly, build-stable, test] 15 needs: [build-nightly, build-stable, test]
16 steps: 16 steps:
17 - name: Done 17 - name: Done
diff --git a/docs/modules/ROOT/examples/basic/Cargo.toml b/docs/modules/ROOT/examples/basic/Cargo.toml
index ae124a871..c13f546e2 100644
--- a/docs/modules/ROOT/examples/basic/Cargo.toml
+++ b/docs/modules/ROOT/examples/basic/Cargo.toml
@@ -3,6 +3,7 @@ authors = ["Dario Nieuwenhuis <[email protected]>"]
3edition = "2018" 3edition = "2018"
4name = "embassy-basic-example" 4name = "embassy-basic-example"
5version = "0.1.0" 5version = "0.1.0"
6license = "MIT OR Apache-2.0"
6 7
7[dependencies] 8[dependencies]
8embassy-executor = { version = "0.1.0", path = "../../../../../embassy-executor", features = ["defmt", "nightly"] } 9embassy-executor = { version = "0.1.0", path = "../../../../../embassy-executor", features = ["defmt", "nightly"] }
diff --git a/docs/modules/ROOT/examples/layer-by-layer/blinky-async/Cargo.toml b/docs/modules/ROOT/examples/layer-by-layer/blinky-async/Cargo.toml
index e2933076f..c9a963d4d 100644
--- a/docs/modules/ROOT/examples/layer-by-layer/blinky-async/Cargo.toml
+++ b/docs/modules/ROOT/examples/layer-by-layer/blinky-async/Cargo.toml
@@ -2,6 +2,7 @@
2name = "blinky-async" 2name = "blinky-async"
3version = "0.1.0" 3version = "0.1.0"
4edition = "2021" 4edition = "2021"
5license = "MIT OR Apache-2.0"
5 6
6[dependencies] 7[dependencies]
7cortex-m = "0.7" 8cortex-m = "0.7"
diff --git a/docs/modules/ROOT/examples/layer-by-layer/blinky-hal/Cargo.toml b/docs/modules/ROOT/examples/layer-by-layer/blinky-hal/Cargo.toml
index dbd3aba8b..f86361dd5 100644
--- a/docs/modules/ROOT/examples/layer-by-layer/blinky-hal/Cargo.toml
+++ b/docs/modules/ROOT/examples/layer-by-layer/blinky-hal/Cargo.toml
@@ -2,6 +2,7 @@
2name = "blinky-hal" 2name = "blinky-hal"
3version = "0.1.0" 3version = "0.1.0"
4edition = "2021" 4edition = "2021"
5license = "MIT OR Apache-2.0"
5 6
6[dependencies] 7[dependencies]
7cortex-m = "0.7" 8cortex-m = "0.7"
diff --git a/docs/modules/ROOT/examples/layer-by-layer/blinky-irq/Cargo.toml b/docs/modules/ROOT/examples/layer-by-layer/blinky-irq/Cargo.toml
index 0dd326015..9733658b6 100644
--- a/docs/modules/ROOT/examples/layer-by-layer/blinky-irq/Cargo.toml
+++ b/docs/modules/ROOT/examples/layer-by-layer/blinky-irq/Cargo.toml
@@ -2,6 +2,7 @@
2name = "blinky-irq" 2name = "blinky-irq"
3version = "0.1.0" 3version = "0.1.0"
4edition = "2021" 4edition = "2021"
5license = "MIT OR Apache-2.0"
5 6
6[dependencies] 7[dependencies]
7cortex-m = "0.7" 8cortex-m = "0.7"
diff --git a/docs/modules/ROOT/examples/layer-by-layer/blinky-pac/Cargo.toml b/docs/modules/ROOT/examples/layer-by-layer/blinky-pac/Cargo.toml
index e7f4f5d1f..a077f1828 100644
--- a/docs/modules/ROOT/examples/layer-by-layer/blinky-pac/Cargo.toml
+++ b/docs/modules/ROOT/examples/layer-by-layer/blinky-pac/Cargo.toml
@@ -2,6 +2,7 @@
2name = "blinky-pac" 2name = "blinky-pac"
3version = "0.1.0" 3version = "0.1.0"
4edition = "2021" 4edition = "2021"
5license = "MIT OR Apache-2.0"
5 6
6[dependencies] 7[dependencies]
7cortex-m = "0.7" 8cortex-m = "0.7"
diff --git a/embassy-boot/boot/Cargo.toml b/embassy-boot/boot/Cargo.toml
index a42f88688..54c67a375 100644
--- a/embassy-boot/boot/Cargo.toml
+++ b/embassy-boot/boot/Cargo.toml
@@ -3,6 +3,7 @@ edition = "2021"
3name = "embassy-boot" 3name = "embassy-boot"
4version = "0.1.0" 4version = "0.1.0"
5description = "Bootloader using Embassy" 5description = "Bootloader using Embassy"
6license = "MIT OR Apache-2.0"
6 7
7[package.metadata.embassy_docs] 8[package.metadata.embassy_docs]
8src_base = "https://github.com/embassy-rs/embassy/blob/embassy-boot-v$VERSION/embassy-boot/boot/src/" 9src_base = "https://github.com/embassy-rs/embassy/blob/embassy-boot-v$VERSION/embassy-boot/boot/src/"
diff --git a/embassy-boot/nrf/Cargo.toml b/embassy-boot/nrf/Cargo.toml
index 234393e7c..c6af70144 100644
--- a/embassy-boot/nrf/Cargo.toml
+++ b/embassy-boot/nrf/Cargo.toml
@@ -3,6 +3,7 @@ edition = "2021"
3name = "embassy-boot-nrf" 3name = "embassy-boot-nrf"
4version = "0.1.0" 4version = "0.1.0"
5description = "Bootloader lib for nRF chips" 5description = "Bootloader lib for nRF chips"
6license = "MIT OR Apache-2.0"
6 7
7[package.metadata.embassy_docs] 8[package.metadata.embassy_docs]
8src_base = "https://github.com/embassy-rs/embassy/blob/embassy-boot-nrf-v$VERSION/embassy-boot/nrf/src/" 9src_base = "https://github.com/embassy-rs/embassy/blob/embassy-boot-nrf-v$VERSION/embassy-boot/nrf/src/"
diff --git a/embassy-boot/stm32/Cargo.toml b/embassy-boot/stm32/Cargo.toml
index ad4657e0d..9d12c6cfd 100644
--- a/embassy-boot/stm32/Cargo.toml
+++ b/embassy-boot/stm32/Cargo.toml
@@ -3,6 +3,7 @@ edition = "2021"
3name = "embassy-boot-stm32" 3name = "embassy-boot-stm32"
4version = "0.1.0" 4version = "0.1.0"
5description = "Bootloader lib for STM32 chips" 5description = "Bootloader lib for STM32 chips"
6license = "MIT OR Apache-2.0"
6 7
7[package.metadata.embassy_docs] 8[package.metadata.embassy_docs]
8src_base = "https://github.com/embassy-rs/embassy/blob/embassy-boot-nrf-v$VERSION/embassy-boot/stm32/src/" 9src_base = "https://github.com/embassy-rs/embassy/blob/embassy-boot-nrf-v$VERSION/embassy-boot/stm32/src/"
diff --git a/embassy-cortex-m/Cargo.toml b/embassy-cortex-m/Cargo.toml
index 7efced669..5c5718d50 100644
--- a/embassy-cortex-m/Cargo.toml
+++ b/embassy-cortex-m/Cargo.toml
@@ -2,6 +2,7 @@
2name = "embassy-cortex-m" 2name = "embassy-cortex-m"
3version = "0.1.0" 3version = "0.1.0"
4edition = "2021" 4edition = "2021"
5license = "MIT OR Apache-2.0"
5 6
6[package.metadata.embassy_docs] 7[package.metadata.embassy_docs]
7src_base = "https://github.com/embassy-rs/embassy/blob/embassy-cortex-m-v$VERSION/embassy-cortex-m/src/" 8src_base = "https://github.com/embassy-rs/embassy/blob/embassy-cortex-m-v$VERSION/embassy-cortex-m/src/"
diff --git a/embassy-embedded-hal/Cargo.toml b/embassy-embedded-hal/Cargo.toml
index 462680720..d0be6d195 100644
--- a/embassy-embedded-hal/Cargo.toml
+++ b/embassy-embedded-hal/Cargo.toml
@@ -2,13 +2,14 @@
2name = "embassy-embedded-hal" 2name = "embassy-embedded-hal"
3version = "0.1.0" 3version = "0.1.0"
4edition = "2021" 4edition = "2021"
5license = "MIT OR Apache-2.0"
5 6
6 7
7[package.metadata.embassy_docs] 8[package.metadata.embassy_docs]
8src_base = "https://github.com/embassy-rs/embassy/blob/embassy-embedded-hal-v$VERSION/embassy-embedded-hal/src/" 9src_base = "https://github.com/embassy-rs/embassy/blob/embassy-embedded-hal-v$VERSION/embassy-embedded-hal/src/"
9src_base_git = "https://github.com/embassy-rs/embassy/blob/$COMMIT/embassy-embedded-hal/src/" 10src_base_git = "https://github.com/embassy-rs/embassy/blob/$COMMIT/embassy-embedded-hal/src/"
10features = ["nightly", "std"] 11features = ["nightly", "std"]
11target = "thumbv7em-none-eabi" 12target = "x86_64-unknown-linux-gnu"
12 13
13[features] 14[features]
14std = [] 15std = []
@@ -18,8 +19,8 @@ nightly = ["embedded-hal-async", "embedded-storage-async"]
18[dependencies] 19[dependencies]
19embassy-sync = { version = "0.1.0", path = "../embassy-sync" } 20embassy-sync = { version = "0.1.0", path = "../embassy-sync" }
20embedded-hal-02 = { package = "embedded-hal", version = "0.2.6", features = ["unproven"] } 21embedded-hal-02 = { package = "embedded-hal", version = "0.2.6", features = ["unproven"] }
21embedded-hal-1 = { package = "embedded-hal", version = "1.0.0-alpha.8" } 22embedded-hal-1 = { package = "embedded-hal", version = "=1.0.0-alpha.9" }
22embedded-hal-async = { version = "0.1.0-alpha.1", optional = true } 23embedded-hal-async = { version = "=0.1.0-alpha.2", optional = true }
23embedded-storage = "0.3.0" 24embedded-storage = "0.3.0"
24embedded-storage-async = { version = "0.3.0", optional = true } 25embedded-storage-async = { version = "0.3.0", optional = true }
25nb = "1.0.0" 26nb = "1.0.0"
diff --git a/embassy-embedded-hal/src/shared_bus/asynch/spi.rs b/embassy-embedded-hal/src/shared_bus/asynch/spi.rs
index c95b59ef0..a3814d6d0 100644
--- a/embassy-embedded-hal/src/shared_bus/asynch/spi.rs
+++ b/embassy-embedded-hal/src/shared_bus/asynch/spi.rs
@@ -29,7 +29,7 @@ use core::future::Future;
29 29
30use embassy_sync::blocking_mutex::raw::RawMutex; 30use embassy_sync::blocking_mutex::raw::RawMutex;
31use embassy_sync::mutex::Mutex; 31use embassy_sync::mutex::Mutex;
32use embedded_hal_1::digital::blocking::OutputPin; 32use embedded_hal_1::digital::OutputPin;
33use embedded_hal_1::spi::ErrorType; 33use embedded_hal_1::spi::ErrorType;
34use embedded_hal_async::spi; 34use embedded_hal_async::spi;
35 35
@@ -57,7 +57,7 @@ where
57 type Error = SpiDeviceError<BUS::Error, CS::Error>; 57 type Error = SpiDeviceError<BUS::Error, CS::Error>;
58} 58}
59 59
60impl<M, BUS, CS> spi::SpiDevice for SpiDevice<'_, M, BUS, CS> 60unsafe impl<M, BUS, CS> spi::SpiDevice for SpiDevice<'_, M, BUS, CS>
61where 61where
62 M: RawMutex + 'static, 62 M: RawMutex + 'static,
63 BUS: spi::SpiBusFlush + 'static, 63 BUS: spi::SpiBusFlush + 'static,
@@ -122,7 +122,7 @@ where
122 type Error = SpiDeviceError<BUS::Error, CS::Error>; 122 type Error = SpiDeviceError<BUS::Error, CS::Error>;
123} 123}
124 124
125impl<M, BUS, CS> spi::SpiDevice for SpiDeviceWithConfig<'_, M, BUS, CS> 125unsafe impl<M, BUS, CS> spi::SpiDevice for SpiDeviceWithConfig<'_, M, BUS, CS>
126where 126where
127 M: RawMutex + 'static, 127 M: RawMutex + 'static,
128 BUS: spi::SpiBusFlush + SetConfig + 'static, 128 BUS: spi::SpiBusFlush + SetConfig + 'static,
diff --git a/embassy-embedded-hal/src/shared_bus/blocking/i2c.rs b/embassy-embedded-hal/src/shared_bus/blocking/i2c.rs
index a611e2d27..892000b26 100644
--- a/embassy-embedded-hal/src/shared_bus/blocking/i2c.rs
+++ b/embassy-embedded-hal/src/shared_bus/blocking/i2c.rs
@@ -20,8 +20,7 @@ use core::cell::RefCell;
20 20
21use embassy_sync::blocking_mutex::raw::RawMutex; 21use embassy_sync::blocking_mutex::raw::RawMutex;
22use embassy_sync::blocking_mutex::Mutex; 22use embassy_sync::blocking_mutex::Mutex;
23use embedded_hal_1::i2c::blocking::{I2c, Operation}; 23use embedded_hal_1::i2c::{ErrorType, I2c, Operation};
24use embedded_hal_1::i2c::ErrorType;
25 24
26use crate::shared_bus::I2cDeviceError; 25use crate::shared_bus::I2cDeviceError;
27use crate::SetConfig; 26use crate::SetConfig;
diff --git a/embassy-embedded-hal/src/shared_bus/blocking/spi.rs b/embassy-embedded-hal/src/shared_bus/blocking/spi.rs
index 23845d887..4a08dc36e 100644
--- a/embassy-embedded-hal/src/shared_bus/blocking/spi.rs
+++ b/embassy-embedded-hal/src/shared_bus/blocking/spi.rs
@@ -22,9 +22,9 @@ use core::cell::RefCell;
22 22
23use embassy_sync::blocking_mutex::raw::RawMutex; 23use embassy_sync::blocking_mutex::raw::RawMutex;
24use embassy_sync::blocking_mutex::Mutex; 24use embassy_sync::blocking_mutex::Mutex;
25use embedded_hal_1::digital::blocking::OutputPin; 25use embedded_hal_1::digital::OutputPin;
26use embedded_hal_1::spi; 26use embedded_hal_1::spi;
27use embedded_hal_1::spi::blocking::SpiBusFlush; 27use embedded_hal_1::spi::SpiBusFlush;
28 28
29use crate::shared_bus::SpiDeviceError; 29use crate::shared_bus::SpiDeviceError;
30use crate::SetConfig; 30use crate::SetConfig;
@@ -50,7 +50,7 @@ where
50 type Error = SpiDeviceError<BUS::Error, CS::Error>; 50 type Error = SpiDeviceError<BUS::Error, CS::Error>;
51} 51}
52 52
53impl<BUS, M, CS> embedded_hal_1::spi::blocking::SpiDevice for SpiDevice<'_, M, BUS, CS> 53impl<BUS, M, CS> embedded_hal_1::spi::SpiDevice for SpiDevice<'_, M, BUS, CS>
54where 54where
55 M: RawMutex, 55 M: RawMutex,
56 BUS: SpiBusFlush, 56 BUS: SpiBusFlush,
@@ -146,7 +146,7 @@ where
146 type Error = SpiDeviceError<BUS::Error, CS::Error>; 146 type Error = SpiDeviceError<BUS::Error, CS::Error>;
147} 147}
148 148
149impl<BUS, M, CS> embedded_hal_1::spi::blocking::SpiDevice for SpiDeviceWithConfig<'_, M, BUS, CS> 149impl<BUS, M, CS> embedded_hal_1::spi::SpiDevice for SpiDeviceWithConfig<'_, M, BUS, CS>
150where 150where
151 M: RawMutex, 151 M: RawMutex,
152 BUS: SpiBusFlush + SetConfig, 152 BUS: SpiBusFlush + SetConfig,
diff --git a/embassy-executor/Cargo.toml b/embassy-executor/Cargo.toml
index fa3d0b2b6..d0f51646d 100644
--- a/embassy-executor/Cargo.toml
+++ b/embassy-executor/Cargo.toml
@@ -2,12 +2,13 @@
2name = "embassy-executor" 2name = "embassy-executor"
3version = "0.1.0" 3version = "0.1.0"
4edition = "2021" 4edition = "2021"
5license = "MIT OR Apache-2.0"
5 6
6 7
7[package.metadata.embassy_docs] 8[package.metadata.embassy_docs]
8src_base = "https://github.com/embassy-rs/embassy/blob/embassy-executor-v$VERSION/embassy-executor/src/" 9src_base = "https://github.com/embassy-rs/embassy/blob/embassy-executor-v$VERSION/embassy-executor/src/"
9src_base_git = "https://github.com/embassy-rs/embassy/blob/$COMMIT/embassy-executor/src/" 10src_base_git = "https://github.com/embassy-rs/embassy/blob/$COMMIT/embassy-executor/src/"
10features = ["nightly", "defmt", "unstable-traits"] 11features = ["nightly", "defmt"]
11flavors = [ 12flavors = [
12 { name = "std", target = "x86_64-unknown-linux-gnu", features = ["std"] }, 13 { name = "std", target = "x86_64-unknown-linux-gnu", features = ["std"] },
13 { name = "wasm", target = "wasm32-unknown-unknown", features = ["wasm"] }, 14 { name = "wasm", target = "wasm32-unknown-unknown", features = ["wasm"] },
diff --git a/embassy-hal-common/Cargo.toml b/embassy-hal-common/Cargo.toml
index 58f0af6ab..e8617c02f 100644
--- a/embassy-hal-common/Cargo.toml
+++ b/embassy-hal-common/Cargo.toml
@@ -2,6 +2,7 @@
2name = "embassy-hal-common" 2name = "embassy-hal-common"
3version = "0.1.0" 3version = "0.1.0"
4edition = "2021" 4edition = "2021"
5license = "MIT OR Apache-2.0"
5 6
6[features] 7[features]
7 8
diff --git a/embassy-lora/Cargo.toml b/embassy-lora/Cargo.toml
index 0c2f983f6..bcb837d9d 100644
--- a/embassy-lora/Cargo.toml
+++ b/embassy-lora/Cargo.toml
@@ -2,6 +2,7 @@
2name = "embassy-lora" 2name = "embassy-lora"
3version = "0.1.0" 3version = "0.1.0"
4edition = "2021" 4edition = "2021"
5license = "MIT OR Apache-2.0"
5 6
6[package.metadata.embassy_docs] 7[package.metadata.embassy_docs]
7src_base = "https://github.com/embassy-rs/embassy/blob/embassy-lora-v$VERSION/embassy-lora/src/" 8src_base = "https://github.com/embassy-rs/embassy/blob/embassy-lora-v$VERSION/embassy-lora/src/"
@@ -30,8 +31,8 @@ log = { version = "0.4.14", optional = true }
30embassy-time = { version = "0.1.0", path = "../embassy-time" } 31embassy-time = { version = "0.1.0", path = "../embassy-time" }
31embassy-sync = { version = "0.1.0", path = "../embassy-sync" } 32embassy-sync = { version = "0.1.0", path = "../embassy-sync" }
32embassy-stm32 = { version = "0.1.0", path = "../embassy-stm32", default-features = false, optional = true } 33embassy-stm32 = { version = "0.1.0", path = "../embassy-stm32", default-features = false, optional = true }
33embedded-hal-1 = { package = "embedded-hal", version = "1.0.0-alpha.8" } 34embedded-hal-1 = { package = "embedded-hal", version = "=1.0.0-alpha.9" }
34embedded-hal-async = { version = "0.1.0-alpha.1" } 35embedded-hal-async = { version = "=0.1.0-alpha.2" }
35embassy-hal-common = { version = "0.1.0", path = "../embassy-hal-common", default-features = false } 36embassy-hal-common = { version = "0.1.0", path = "../embassy-hal-common", default-features = false }
36futures = { version = "0.3.17", default-features = false, features = [ "async-await" ] } 37futures = { version = "0.3.17", default-features = false, features = [ "async-await" ] }
37embedded-hal = { version = "0.2", features = ["unproven"] } 38embedded-hal = { version = "0.2", features = ["unproven"] }
diff --git a/embassy-macros/Cargo.toml b/embassy-macros/Cargo.toml
index 03fa79dd8..91d5ec8a3 100644
--- a/embassy-macros/Cargo.toml
+++ b/embassy-macros/Cargo.toml
@@ -2,6 +2,7 @@
2name = "embassy-macros" 2name = "embassy-macros"
3version = "0.1.0" 3version = "0.1.0"
4edition = "2021" 4edition = "2021"
5license = "MIT OR Apache-2.0"
5 6
6[dependencies] 7[dependencies]
7syn = { version = "1.0.76", features = ["full", "extra-traits"] } 8syn = { version = "1.0.76", features = ["full", "extra-traits"] }
diff --git a/embassy-net/Cargo.toml b/embassy-net/Cargo.toml
index d5b13204e..967ef26a7 100644
--- a/embassy-net/Cargo.toml
+++ b/embassy-net/Cargo.toml
@@ -2,6 +2,7 @@
2name = "embassy-net" 2name = "embassy-net"
3version = "0.1.0" 3version = "0.1.0"
4edition = "2021" 4edition = "2021"
5license = "MIT OR Apache-2.0"
5 6
6 7
7[package.metadata.embassy_docs] 8[package.metadata.embassy_docs]
diff --git a/embassy-nrf/Cargo.toml b/embassy-nrf/Cargo.toml
index d80281fa3..5459bc90c 100644
--- a/embassy-nrf/Cargo.toml
+++ b/embassy-nrf/Cargo.toml
@@ -2,6 +2,7 @@
2name = "embassy-nrf" 2name = "embassy-nrf"
3version = "0.1.0" 3version = "0.1.0"
4edition = "2021" 4edition = "2021"
5license = "MIT OR Apache-2.0"
5 6
6[package.metadata.embassy_docs] 7[package.metadata.embassy_docs]
7src_base = "https://github.com/embassy-rs/embassy/blob/embassy-nrf-v$VERSION/embassy-nrf/src/" 8src_base = "https://github.com/embassy-rs/embassy/blob/embassy-nrf-v$VERSION/embassy-nrf/src/"
@@ -73,8 +74,8 @@ embassy-embedded-hal = {version = "0.1.0", path = "../embassy-embedded-hal" }
73embassy-usb-driver = {version = "0.1.0", path = "../embassy-usb-driver", optional=true } 74embassy-usb-driver = {version = "0.1.0", path = "../embassy-usb-driver", optional=true }
74 75
75embedded-hal-02 = { package = "embedded-hal", version = "0.2.6", features = ["unproven"] } 76embedded-hal-02 = { package = "embedded-hal", version = "0.2.6", features = ["unproven"] }
76embedded-hal-1 = { package = "embedded-hal", version = "1.0.0-alpha.8", optional = true} 77embedded-hal-1 = { package = "embedded-hal", version = "=1.0.0-alpha.9", optional = true}
77embedded-hal-async = { version = "0.1.0-alpha.1", optional = true} 78embedded-hal-async = { version = "=0.1.0-alpha.2", optional = true}
78embedded-io = { version = "0.3.0", features = ["async"], optional = true } 79embedded-io = { version = "0.3.0", features = ["async"], optional = true }
79 80
80defmt = { version = "0.3", optional = true } 81defmt = { version = "0.3", optional = true }
diff --git a/embassy-nrf/src/gpio.rs b/embassy-nrf/src/gpio.rs
index 924629908..bb64e41e9 100644
--- a/embassy-nrf/src/gpio.rs
+++ b/embassy-nrf/src/gpio.rs
@@ -574,7 +574,7 @@ mod eh1 {
574 type Error = Infallible; 574 type Error = Infallible;
575 } 575 }
576 576
577 impl<'d, T: Pin> embedded_hal_1::digital::blocking::InputPin for Input<'d, T> { 577 impl<'d, T: Pin> embedded_hal_1::digital::InputPin for Input<'d, T> {
578 fn is_high(&self) -> Result<bool, Self::Error> { 578 fn is_high(&self) -> Result<bool, Self::Error> {
579 Ok(self.is_high()) 579 Ok(self.is_high())
580 } 580 }
@@ -588,7 +588,7 @@ mod eh1 {
588 type Error = Infallible; 588 type Error = Infallible;
589 } 589 }
590 590
591 impl<'d, T: Pin> embedded_hal_1::digital::blocking::OutputPin for Output<'d, T> { 591 impl<'d, T: Pin> embedded_hal_1::digital::OutputPin for Output<'d, T> {
592 fn set_high(&mut self) -> Result<(), Self::Error> { 592 fn set_high(&mut self) -> Result<(), Self::Error> {
593 Ok(self.set_high()) 593 Ok(self.set_high())
594 } 594 }
@@ -598,7 +598,7 @@ mod eh1 {
598 } 598 }
599 } 599 }
600 600
601 impl<'d, T: Pin> embedded_hal_1::digital::blocking::StatefulOutputPin for Output<'d, T> { 601 impl<'d, T: Pin> embedded_hal_1::digital::StatefulOutputPin for Output<'d, T> {
602 fn is_set_high(&self) -> Result<bool, Self::Error> { 602 fn is_set_high(&self) -> Result<bool, Self::Error> {
603 Ok(self.is_set_high()) 603 Ok(self.is_set_high())
604 } 604 }
@@ -615,7 +615,7 @@ mod eh1 {
615 /// Implement [`InputPin`] for [`Flex`]; 615 /// Implement [`InputPin`] for [`Flex`];
616 /// 616 ///
617 /// If the pin is not in input mode the result is unspecified. 617 /// If the pin is not in input mode the result is unspecified.
618 impl<'d, T: Pin> embedded_hal_1::digital::blocking::InputPin for Flex<'d, T> { 618 impl<'d, T: Pin> embedded_hal_1::digital::InputPin for Flex<'d, T> {
619 fn is_high(&self) -> Result<bool, Self::Error> { 619 fn is_high(&self) -> Result<bool, Self::Error> {
620 Ok(self.is_high()) 620 Ok(self.is_high())
621 } 621 }
@@ -625,7 +625,7 @@ mod eh1 {
625 } 625 }
626 } 626 }
627 627
628 impl<'d, T: Pin> embedded_hal_1::digital::blocking::OutputPin for Flex<'d, T> { 628 impl<'d, T: Pin> embedded_hal_1::digital::OutputPin for Flex<'d, T> {
629 fn set_high(&mut self) -> Result<(), Self::Error> { 629 fn set_high(&mut self) -> Result<(), Self::Error> {
630 Ok(self.set_high()) 630 Ok(self.set_high())
631 } 631 }
@@ -635,7 +635,7 @@ mod eh1 {
635 } 635 }
636 } 636 }
637 637
638 impl<'d, T: Pin> embedded_hal_1::digital::blocking::StatefulOutputPin for Flex<'d, T> { 638 impl<'d, T: Pin> embedded_hal_1::digital::StatefulOutputPin for Flex<'d, T> {
639 fn is_set_high(&self) -> Result<bool, Self::Error> { 639 fn is_set_high(&self) -> Result<bool, Self::Error> {
640 Ok(self.is_set_high()) 640 Ok(self.is_set_high())
641 } 641 }
diff --git a/embassy-nrf/src/gpiote.rs b/embassy-nrf/src/gpiote.rs
index b418be9d5..25ad90496 100644
--- a/embassy-nrf/src/gpiote.rs
+++ b/embassy-nrf/src/gpiote.rs
@@ -457,7 +457,7 @@ mod eh1 {
457 type Error = Infallible; 457 type Error = Infallible;
458 } 458 }
459 459
460 impl<'d, C: Channel, T: GpioPin> embedded_hal_1::digital::blocking::InputPin for InputChannel<'d, C, T> { 460 impl<'d, C: Channel, T: GpioPin> embedded_hal_1::digital::InputPin for InputChannel<'d, C, T> {
461 fn is_high(&self) -> Result<bool, Self::Error> { 461 fn is_high(&self) -> Result<bool, Self::Error> {
462 Ok(self.pin.is_high()) 462 Ok(self.pin.is_high())
463 } 463 }
diff --git a/embassy-nrf/src/spim.rs b/embassy-nrf/src/spim.rs
index 51cd73a47..d821d2353 100644
--- a/embassy-nrf/src/spim.rs
+++ b/embassy-nrf/src/spim.rs
@@ -446,25 +446,25 @@ mod eh1 {
446 type Error = Error; 446 type Error = Error;
447 } 447 }
448 448
449 impl<'d, T: Instance> embedded_hal_1::spi::blocking::SpiBusFlush for Spim<'d, T> { 449 impl<'d, T: Instance> embedded_hal_1::spi::SpiBusFlush for Spim<'d, T> {
450 fn flush(&mut self) -> Result<(), Self::Error> { 450 fn flush(&mut self) -> Result<(), Self::Error> {
451 Ok(()) 451 Ok(())
452 } 452 }
453 } 453 }
454 454
455 impl<'d, T: Instance> embedded_hal_1::spi::blocking::SpiBusRead<u8> for Spim<'d, T> { 455 impl<'d, T: Instance> embedded_hal_1::spi::SpiBusRead<u8> for Spim<'d, T> {
456 fn read(&mut self, words: &mut [u8]) -> Result<(), Self::Error> { 456 fn read(&mut self, words: &mut [u8]) -> Result<(), Self::Error> {
457 self.blocking_transfer(words, &[]) 457 self.blocking_transfer(words, &[])
458 } 458 }
459 } 459 }
460 460
461 impl<'d, T: Instance> embedded_hal_1::spi::blocking::SpiBusWrite<u8> for Spim<'d, T> { 461 impl<'d, T: Instance> embedded_hal_1::spi::SpiBusWrite<u8> for Spim<'d, T> {
462 fn write(&mut self, words: &[u8]) -> Result<(), Self::Error> { 462 fn write(&mut self, words: &[u8]) -> Result<(), Self::Error> {
463 self.blocking_write(words) 463 self.blocking_write(words)
464 } 464 }
465 } 465 }
466 466
467 impl<'d, T: Instance> embedded_hal_1::spi::blocking::SpiBus<u8> for Spim<'d, T> { 467 impl<'d, T: Instance> embedded_hal_1::spi::SpiBus<u8> for Spim<'d, T> {
468 fn transfer(&mut self, read: &mut [u8], write: &[u8]) -> Result<(), Self::Error> { 468 fn transfer(&mut self, read: &mut [u8], write: &[u8]) -> Result<(), Self::Error> {
469 self.blocking_transfer(read, write) 469 self.blocking_transfer(read, write)
470 } 470 }
diff --git a/embassy-nrf/src/twim.rs b/embassy-nrf/src/twim.rs
index 7c6ca1d30..8d6171fac 100644
--- a/embassy-nrf/src/twim.rs
+++ b/embassy-nrf/src/twim.rs
@@ -793,7 +793,7 @@ mod eh1 {
793 type Error = Error; 793 type Error = Error;
794 } 794 }
795 795
796 impl<'d, T: Instance> embedded_hal_1::i2c::blocking::I2c for Twim<'d, T> { 796 impl<'d, T: Instance> embedded_hal_1::i2c::I2c for Twim<'d, T> {
797 fn read(&mut self, address: u8, buffer: &mut [u8]) -> Result<(), Self::Error> { 797 fn read(&mut self, address: u8, buffer: &mut [u8]) -> Result<(), Self::Error> {
798 self.blocking_read(address, buffer) 798 self.blocking_read(address, buffer)
799 } 799 }
@@ -823,14 +823,14 @@ mod eh1 {
823 fn transaction<'a>( 823 fn transaction<'a>(
824 &mut self, 824 &mut self,
825 _address: u8, 825 _address: u8,
826 _operations: &mut [embedded_hal_1::i2c::blocking::Operation<'a>], 826 _operations: &mut [embedded_hal_1::i2c::Operation<'a>],
827 ) -> Result<(), Self::Error> { 827 ) -> Result<(), Self::Error> {
828 todo!(); 828 todo!();
829 } 829 }
830 830
831 fn transaction_iter<'a, O>(&mut self, _address: u8, _operations: O) -> Result<(), Self::Error> 831 fn transaction_iter<'a, O>(&mut self, _address: u8, _operations: O) -> Result<(), Self::Error>
832 where 832 where
833 O: IntoIterator<Item = embedded_hal_1::i2c::blocking::Operation<'a>>, 833 O: IntoIterator<Item = embedded_hal_1::i2c::Operation<'a>>,
834 { 834 {
835 todo!(); 835 todo!();
836 } 836 }
diff --git a/embassy-nrf/src/uarte.rs b/embassy-nrf/src/uarte.rs
index 5f9c4f17d..d99599112 100644
--- a/embassy-nrf/src/uarte.rs
+++ b/embassy-nrf/src/uarte.rs
@@ -1040,7 +1040,7 @@ mod eh1 {
1040 type Error = Error; 1040 type Error = Error;
1041 } 1041 }
1042 1042
1043 impl<'d, T: Instance> embedded_hal_1::serial::blocking::Write for Uarte<'d, T> { 1043 impl<'d, T: Instance> embedded_hal_1::serial::Write for Uarte<'d, T> {
1044 fn write(&mut self, buffer: &[u8]) -> Result<(), Self::Error> { 1044 fn write(&mut self, buffer: &[u8]) -> Result<(), Self::Error> {
1045 self.blocking_write(buffer) 1045 self.blocking_write(buffer)
1046 } 1046 }
@@ -1054,7 +1054,7 @@ mod eh1 {
1054 type Error = Error; 1054 type Error = Error;
1055 } 1055 }
1056 1056
1057 impl<'d, T: Instance> embedded_hal_1::serial::blocking::Write for UarteTx<'d, T> { 1057 impl<'d, T: Instance> embedded_hal_1::serial::Write for UarteTx<'d, T> {
1058 fn write(&mut self, buffer: &[u8]) -> Result<(), Self::Error> { 1058 fn write(&mut self, buffer: &[u8]) -> Result<(), Self::Error> {
1059 self.blocking_write(buffer) 1059 self.blocking_write(buffer)
1060 } 1060 }
diff --git a/embassy-rp/Cargo.toml b/embassy-rp/Cargo.toml
index 337a84f4a..c56858415 100644
--- a/embassy-rp/Cargo.toml
+++ b/embassy-rp/Cargo.toml
@@ -2,6 +2,7 @@
2name = "embassy-rp" 2name = "embassy-rp"
3version = "0.1.0" 3version = "0.1.0"
4edition = "2021" 4edition = "2021"
5license = "MIT OR Apache-2.0"
5 6
6[package.metadata.embassy_docs] 7[package.metadata.embassy_docs]
7src_base = "https://github.com/embassy-rs/embassy/blob/embassy-rp-v$VERSION/embassy-rp/src/" 8src_base = "https://github.com/embassy-rs/embassy/blob/embassy-rp-v$VERSION/embassy-rp/src/"
@@ -31,7 +32,7 @@ nightly = ["embassy-executor/nightly", "embedded-hal-1", "embedded-hal-async", "
31 32
32# Implement embedded-hal 1.0 alpha traits. 33# Implement embedded-hal 1.0 alpha traits.
33# Implement embedded-hal-async traits if `nightly` is set as well. 34# Implement embedded-hal-async traits if `nightly` is set as well.
34unstable-traits = ["embedded-hal-1"] 35unstable-traits = ["embedded-hal-1", "embedded-hal-nb"]
35 36
36[dependencies] 37[dependencies]
37embassy-sync = { version = "0.1.0", path = "../embassy-sync" } 38embassy-sync = { version = "0.1.0", path = "../embassy-sync" }
@@ -58,5 +59,6 @@ rp2040-pac2 = { git = "https://github.com/embassy-rs/rp2040-pac2", rev="017e3c90
58#rp2040-pac2 = { path = "../../rp2040-pac2", features = ["rt"] } 59#rp2040-pac2 = { path = "../../rp2040-pac2", features = ["rt"] }
59 60
60embedded-hal-02 = { package = "embedded-hal", version = "0.2.6", features = ["unproven"] } 61embedded-hal-02 = { package = "embedded-hal", version = "0.2.6", features = ["unproven"] }
61embedded-hal-1 = { package = "embedded-hal", version = "1.0.0-alpha.8", optional = true} 62embedded-hal-1 = { package = "embedded-hal", version = "=1.0.0-alpha.9", optional = true}
62embedded-hal-async = { version = "0.1.0-alpha.1", optional = true} 63embedded-hal-async = { version = "=0.1.0-alpha.2", optional = true}
64embedded-hal-nb = { version = "=1.0.0-alpha.1", optional = true}
diff --git a/embassy-rp/src/gpio.rs b/embassy-rp/src/gpio.rs
index 9b9a08110..a28bae96b 100644
--- a/embassy-rp/src/gpio.rs
+++ b/embassy-rp/src/gpio.rs
@@ -867,7 +867,7 @@ mod eh1 {
867 type Error = Infallible; 867 type Error = Infallible;
868 } 868 }
869 869
870 impl<'d, T: Pin> embedded_hal_1::digital::blocking::InputPin for Input<'d, T> { 870 impl<'d, T: Pin> embedded_hal_1::digital::InputPin for Input<'d, T> {
871 fn is_high(&self) -> Result<bool, Self::Error> { 871 fn is_high(&self) -> Result<bool, Self::Error> {
872 Ok(self.is_high()) 872 Ok(self.is_high())
873 } 873 }
@@ -881,7 +881,7 @@ mod eh1 {
881 type Error = Infallible; 881 type Error = Infallible;
882 } 882 }
883 883
884 impl<'d, T: Pin> embedded_hal_1::digital::blocking::OutputPin for Output<'d, T> { 884 impl<'d, T: Pin> embedded_hal_1::digital::OutputPin for Output<'d, T> {
885 fn set_high(&mut self) -> Result<(), Self::Error> { 885 fn set_high(&mut self) -> Result<(), Self::Error> {
886 Ok(self.set_high()) 886 Ok(self.set_high())
887 } 887 }
@@ -891,7 +891,7 @@ mod eh1 {
891 } 891 }
892 } 892 }
893 893
894 impl<'d, T: Pin> embedded_hal_1::digital::blocking::StatefulOutputPin for Output<'d, T> { 894 impl<'d, T: Pin> embedded_hal_1::digital::StatefulOutputPin for Output<'d, T> {
895 fn is_set_high(&self) -> Result<bool, Self::Error> { 895 fn is_set_high(&self) -> Result<bool, Self::Error> {
896 Ok(self.is_set_high()) 896 Ok(self.is_set_high())
897 } 897 }
@@ -901,7 +901,7 @@ mod eh1 {
901 } 901 }
902 } 902 }
903 903
904 impl<'d, T: Pin> embedded_hal_1::digital::blocking::ToggleableOutputPin for Output<'d, T> { 904 impl<'d, T: Pin> embedded_hal_1::digital::ToggleableOutputPin for Output<'d, T> {
905 fn toggle(&mut self) -> Result<(), Self::Error> { 905 fn toggle(&mut self) -> Result<(), Self::Error> {
906 Ok(self.toggle()) 906 Ok(self.toggle())
907 } 907 }
@@ -911,7 +911,7 @@ mod eh1 {
911 type Error = Infallible; 911 type Error = Infallible;
912 } 912 }
913 913
914 impl<'d, T: Pin> embedded_hal_1::digital::blocking::OutputPin for OutputOpenDrain<'d, T> { 914 impl<'d, T: Pin> embedded_hal_1::digital::OutputPin for OutputOpenDrain<'d, T> {
915 fn set_high(&mut self) -> Result<(), Self::Error> { 915 fn set_high(&mut self) -> Result<(), Self::Error> {
916 Ok(self.set_high()) 916 Ok(self.set_high())
917 } 917 }
@@ -921,7 +921,7 @@ mod eh1 {
921 } 921 }
922 } 922 }
923 923
924 impl<'d, T: Pin> embedded_hal_1::digital::blocking::StatefulOutputPin for OutputOpenDrain<'d, T> { 924 impl<'d, T: Pin> embedded_hal_1::digital::StatefulOutputPin for OutputOpenDrain<'d, T> {
925 fn is_set_high(&self) -> Result<bool, Self::Error> { 925 fn is_set_high(&self) -> Result<bool, Self::Error> {
926 Ok(self.is_set_high()) 926 Ok(self.is_set_high())
927 } 927 }
@@ -931,7 +931,7 @@ mod eh1 {
931 } 931 }
932 } 932 }
933 933
934 impl<'d, T: Pin> embedded_hal_1::digital::blocking::ToggleableOutputPin for OutputOpenDrain<'d, T> { 934 impl<'d, T: Pin> embedded_hal_1::digital::ToggleableOutputPin for OutputOpenDrain<'d, T> {
935 fn toggle(&mut self) -> Result<(), Self::Error> { 935 fn toggle(&mut self) -> Result<(), Self::Error> {
936 Ok(self.toggle()) 936 Ok(self.toggle())
937 } 937 }
@@ -941,7 +941,7 @@ mod eh1 {
941 type Error = Infallible; 941 type Error = Infallible;
942 } 942 }
943 943
944 impl<'d, T: Pin> embedded_hal_1::digital::blocking::InputPin for Flex<'d, T> { 944 impl<'d, T: Pin> embedded_hal_1::digital::InputPin for Flex<'d, T> {
945 fn is_high(&self) -> Result<bool, Self::Error> { 945 fn is_high(&self) -> Result<bool, Self::Error> {
946 Ok(self.is_high()) 946 Ok(self.is_high())
947 } 947 }
@@ -951,7 +951,7 @@ mod eh1 {
951 } 951 }
952 } 952 }
953 953
954 impl<'d, T: Pin> embedded_hal_1::digital::blocking::OutputPin for Flex<'d, T> { 954 impl<'d, T: Pin> embedded_hal_1::digital::OutputPin for Flex<'d, T> {
955 fn set_high(&mut self) -> Result<(), Self::Error> { 955 fn set_high(&mut self) -> Result<(), Self::Error> {
956 Ok(self.set_high()) 956 Ok(self.set_high())
957 } 957 }
@@ -961,7 +961,7 @@ mod eh1 {
961 } 961 }
962 } 962 }
963 963
964 impl<'d, T: Pin> embedded_hal_1::digital::blocking::StatefulOutputPin for Flex<'d, T> { 964 impl<'d, T: Pin> embedded_hal_1::digital::StatefulOutputPin for Flex<'d, T> {
965 fn is_set_high(&self) -> Result<bool, Self::Error> { 965 fn is_set_high(&self) -> Result<bool, Self::Error> {
966 Ok(self.is_set_high()) 966 Ok(self.is_set_high())
967 } 967 }
@@ -971,7 +971,7 @@ mod eh1 {
971 } 971 }
972 } 972 }
973 973
974 impl<'d, T: Pin> embedded_hal_1::digital::blocking::ToggleableOutputPin for Flex<'d, T> { 974 impl<'d, T: Pin> embedded_hal_1::digital::ToggleableOutputPin for Flex<'d, T> {
975 fn toggle(&mut self) -> Result<(), Self::Error> { 975 fn toggle(&mut self) -> Result<(), Self::Error> {
976 Ok(self.toggle()) 976 Ok(self.toggle())
977 } 977 }
diff --git a/embassy-rp/src/i2c.rs b/embassy-rp/src/i2c.rs
index 9596d661d..52f910cef 100644
--- a/embassy-rp/src/i2c.rs
+++ b/embassy-rp/src/i2c.rs
@@ -379,7 +379,7 @@ mod eh1 {
379 type Error = Error; 379 type Error = Error;
380 } 380 }
381 381
382 impl<'d, T: Instance, M: Mode> embedded_hal_1::i2c::blocking::I2c for I2c<'d, T, M> { 382 impl<'d, T: Instance, M: Mode> embedded_hal_1::i2c::I2c for I2c<'d, T, M> {
383 fn read(&mut self, address: u8, buffer: &mut [u8]) -> Result<(), Self::Error> { 383 fn read(&mut self, address: u8, buffer: &mut [u8]) -> Result<(), Self::Error> {
384 self.blocking_read(address, buffer) 384 self.blocking_read(address, buffer)
385 } 385 }
@@ -421,16 +421,14 @@ mod eh1 {
421 fn transaction<'a>( 421 fn transaction<'a>(
422 &mut self, 422 &mut self,
423 address: u8, 423 address: u8,
424 operations: &mut [embedded_hal_1::i2c::blocking::Operation<'a>], 424 operations: &mut [embedded_hal_1::i2c::Operation<'a>],
425 ) -> Result<(), Self::Error> { 425 ) -> Result<(), Self::Error> {
426 Self::setup(address.into())?; 426 Self::setup(address.into())?;
427 for i in 0..operations.len() { 427 for i in 0..operations.len() {
428 let last = i == operations.len() - 1; 428 let last = i == operations.len() - 1;
429 match &mut operations[i] { 429 match &mut operations[i] {
430 embedded_hal_1::i2c::blocking::Operation::Read(buf) => { 430 embedded_hal_1::i2c::Operation::Read(buf) => self.read_blocking_internal(buf, false, last)?,
431 self.read_blocking_internal(buf, false, last)? 431 embedded_hal_1::i2c::Operation::Write(buf) => self.write_blocking_internal(buf, last)?,
432 }
433 embedded_hal_1::i2c::blocking::Operation::Write(buf) => self.write_blocking_internal(buf, last)?,
434 } 432 }
435 } 433 }
436 Ok(()) 434 Ok(())
@@ -438,17 +436,15 @@ mod eh1 {
438 436
439 fn transaction_iter<'a, O>(&mut self, address: u8, operations: O) -> Result<(), Self::Error> 437 fn transaction_iter<'a, O>(&mut self, address: u8, operations: O) -> Result<(), Self::Error>
440 where 438 where
441 O: IntoIterator<Item = embedded_hal_1::i2c::blocking::Operation<'a>>, 439 O: IntoIterator<Item = embedded_hal_1::i2c::Operation<'a>>,
442 { 440 {
443 Self::setup(address.into())?; 441 Self::setup(address.into())?;
444 let mut peekable = operations.into_iter().peekable(); 442 let mut peekable = operations.into_iter().peekable();
445 while let Some(operation) = peekable.next() { 443 while let Some(operation) = peekable.next() {
446 let last = peekable.peek().is_none(); 444 let last = peekable.peek().is_none();
447 match operation { 445 match operation {
448 embedded_hal_1::i2c::blocking::Operation::Read(buf) => { 446 embedded_hal_1::i2c::Operation::Read(buf) => self.read_blocking_internal(buf, false, last)?,
449 self.read_blocking_internal(buf, false, last)? 447 embedded_hal_1::i2c::Operation::Write(buf) => self.write_blocking_internal(buf, last)?,
450 }
451 embedded_hal_1::i2c::blocking::Operation::Write(buf) => self.write_blocking_internal(buf, last)?,
452 } 448 }
453 } 449 }
454 Ok(()) 450 Ok(())
diff --git a/embassy-rp/src/spi.rs b/embassy-rp/src/spi.rs
index 03293e064..754e2dd30 100644
--- a/embassy-rp/src/spi.rs
+++ b/embassy-rp/src/spi.rs
@@ -523,25 +523,25 @@ mod eh1 {
523 type Error = Error; 523 type Error = Error;
524 } 524 }
525 525
526 impl<'d, T: Instance, M: Mode> embedded_hal_1::spi::blocking::SpiBusFlush for Spi<'d, T, M> { 526 impl<'d, T: Instance, M: Mode> embedded_hal_1::spi::SpiBusFlush for Spi<'d, T, M> {
527 fn flush(&mut self) -> Result<(), Self::Error> { 527 fn flush(&mut self) -> Result<(), Self::Error> {
528 Ok(()) 528 Ok(())
529 } 529 }
530 } 530 }
531 531
532 impl<'d, T: Instance, M: Mode> embedded_hal_1::spi::blocking::SpiBusRead<u8> for Spi<'d, T, M> { 532 impl<'d, T: Instance, M: Mode> embedded_hal_1::spi::SpiBusRead<u8> for Spi<'d, T, M> {
533 fn read(&mut self, words: &mut [u8]) -> Result<(), Self::Error> { 533 fn read(&mut self, words: &mut [u8]) -> Result<(), Self::Error> {
534 self.blocking_transfer(words, &[]) 534 self.blocking_transfer(words, &[])
535 } 535 }
536 } 536 }
537 537
538 impl<'d, T: Instance, M: Mode> embedded_hal_1::spi::blocking::SpiBusWrite<u8> for Spi<'d, T, M> { 538 impl<'d, T: Instance, M: Mode> embedded_hal_1::spi::SpiBusWrite<u8> for Spi<'d, T, M> {
539 fn write(&mut self, words: &[u8]) -> Result<(), Self::Error> { 539 fn write(&mut self, words: &[u8]) -> Result<(), Self::Error> {
540 self.blocking_write(words) 540 self.blocking_write(words)
541 } 541 }
542 } 542 }
543 543
544 impl<'d, T: Instance, M: Mode> embedded_hal_1::spi::blocking::SpiBus<u8> for Spi<'d, T, M> { 544 impl<'d, T: Instance, M: Mode> embedded_hal_1::spi::SpiBus<u8> for Spi<'d, T, M> {
545 fn transfer(&mut self, read: &mut [u8], write: &[u8]) -> Result<(), Self::Error> { 545 fn transfer(&mut self, read: &mut [u8], write: &[u8]) -> Result<(), Self::Error> {
546 self.blocking_transfer(read, write) 546 self.blocking_transfer(read, write)
547 } 547 }
diff --git a/embassy-rp/src/uart/mod.rs b/embassy-rp/src/uart/mod.rs
index 567c79db3..56c25e189 100644
--- a/embassy-rp/src/uart/mod.rs
+++ b/embassy-rp/src/uart/mod.rs
@@ -486,7 +486,7 @@ mod eh1 {
486 type Error = Error; 486 type Error = Error;
487 } 487 }
488 488
489 impl<'d, T: Instance, M: Mode> embedded_hal_1::serial::nb::Read for UartRx<'d, T, M> { 489 impl<'d, T: Instance, M: Mode> embedded_hal_nb::serial::Read for UartRx<'d, T, M> {
490 fn read(&mut self) -> nb::Result<u8, Self::Error> { 490 fn read(&mut self) -> nb::Result<u8, Self::Error> {
491 let r = T::regs(); 491 let r = T::regs();
492 unsafe { 492 unsafe {
@@ -509,7 +509,7 @@ mod eh1 {
509 } 509 }
510 } 510 }
511 511
512 impl<'d, T: Instance, M: Mode> embedded_hal_1::serial::blocking::Write for UartTx<'d, T, M> { 512 impl<'d, T: Instance, M: Mode> embedded_hal_1::serial::Write for UartTx<'d, T, M> {
513 fn write(&mut self, buffer: &[u8]) -> Result<(), Self::Error> { 513 fn write(&mut self, buffer: &[u8]) -> Result<(), Self::Error> {
514 self.blocking_write(buffer) 514 self.blocking_write(buffer)
515 } 515 }
@@ -519,7 +519,7 @@ mod eh1 {
519 } 519 }
520 } 520 }
521 521
522 impl<'d, T: Instance, M: Mode> embedded_hal_1::serial::nb::Write for UartTx<'d, T, M> { 522 impl<'d, T: Instance, M: Mode> embedded_hal_nb::serial::Write for UartTx<'d, T, M> {
523 fn write(&mut self, char: u8) -> nb::Result<(), Self::Error> { 523 fn write(&mut self, char: u8) -> nb::Result<(), Self::Error> {
524 self.blocking_write(&[char]).map_err(nb::Error::Other) 524 self.blocking_write(&[char]).map_err(nb::Error::Other)
525 } 525 }
@@ -529,13 +529,13 @@ mod eh1 {
529 } 529 }
530 } 530 }
531 531
532 impl<'d, T: Instance, M: Mode> embedded_hal_1::serial::nb::Read for Uart<'d, T, M> { 532 impl<'d, T: Instance, M: Mode> embedded_hal_nb::serial::Read for Uart<'d, T, M> {
533 fn read(&mut self) -> Result<u8, nb::Error<Self::Error>> { 533 fn read(&mut self) -> Result<u8, nb::Error<Self::Error>> {
534 embedded_hal_02::serial::Read::read(&mut self.rx) 534 embedded_hal_02::serial::Read::read(&mut self.rx)
535 } 535 }
536 } 536 }
537 537
538 impl<'d, T: Instance, M: Mode> embedded_hal_1::serial::blocking::Write for Uart<'d, T, M> { 538 impl<'d, T: Instance, M: Mode> embedded_hal_1::serial::Write for Uart<'d, T, M> {
539 fn write(&mut self, buffer: &[u8]) -> Result<(), Self::Error> { 539 fn write(&mut self, buffer: &[u8]) -> Result<(), Self::Error> {
540 self.blocking_write(buffer) 540 self.blocking_write(buffer)
541 } 541 }
@@ -545,7 +545,7 @@ mod eh1 {
545 } 545 }
546 } 546 }
547 547
548 impl<'d, T: Instance, M: Mode> embedded_hal_1::serial::nb::Write for Uart<'d, T, M> { 548 impl<'d, T: Instance, M: Mode> embedded_hal_nb::serial::Write for Uart<'d, T, M> {
549 fn write(&mut self, char: u8) -> nb::Result<(), Self::Error> { 549 fn write(&mut self, char: u8) -> nb::Result<(), Self::Error> {
550 self.blocking_write(&[char]).map_err(nb::Error::Other) 550 self.blocking_write(&[char]).map_err(nb::Error::Other)
551 } 551 }
diff --git a/embassy-stm32/Cargo.toml b/embassy-stm32/Cargo.toml
index a4a232f51..2610e5687 100644
--- a/embassy-stm32/Cargo.toml
+++ b/embassy-stm32/Cargo.toml
@@ -2,6 +2,7 @@
2name = "embassy-stm32" 2name = "embassy-stm32"
3version = "0.1.0" 3version = "0.1.0"
4edition = "2021" 4edition = "2021"
5license = "MIT OR Apache-2.0"
5 6
6[package.metadata.embassy_docs] 7[package.metadata.embassy_docs]
7src_base = "https://github.com/embassy-rs/embassy/blob/embassy-stm32-v$VERSION/embassy-stm32/src/" 8src_base = "https://github.com/embassy-rs/embassy/blob/embassy-stm32-v$VERSION/embassy-stm32/src/"
@@ -42,8 +43,9 @@ embassy-net = { version = "0.1.0", path = "../embassy-net", optional = true }
42embassy-usb-driver = {version = "0.1.0", path = "../embassy-usb-driver", optional = true } 43embassy-usb-driver = {version = "0.1.0", path = "../embassy-usb-driver", optional = true }
43 44
44embedded-hal-02 = { package = "embedded-hal", version = "0.2.6", features = ["unproven"] } 45embedded-hal-02 = { package = "embedded-hal", version = "0.2.6", features = ["unproven"] }
45embedded-hal-1 = { package = "embedded-hal", version = "1.0.0-alpha.8", optional = true} 46embedded-hal-1 = { package = "embedded-hal", version = "=1.0.0-alpha.9", optional = true}
46embedded-hal-async = { version = "0.1.0-alpha.1", optional = true} 47embedded-hal-async = { version = "=0.1.0-alpha.2", optional = true}
48embedded-hal-nb = { version = "=1.0.0-alpha.1", optional = true}
47 49
48embedded-storage = "0.3.0" 50embedded-storage = "0.3.0"
49embedded-storage-async = { version = "0.3.0", optional = true } 51embedded-storage-async = { version = "0.3.0", optional = true }
@@ -102,7 +104,7 @@ unstable-pac = []
102 104
103# Implement embedded-hal 1.0 alpha traits. 105# Implement embedded-hal 1.0 alpha traits.
104# Implement embedded-hal-async traits if `nightly` is set as well. 106# Implement embedded-hal-async traits if `nightly` is set as well.
105unstable-traits = ["embedded-hal-1"] 107unstable-traits = ["embedded-hal-1", "dep:embedded-hal-nb"]
106 108
107# BEGIN GENERATED FEATURES 109# BEGIN GENERATED FEATURES
108# Generated by stm32-gen-features. DO NOT EDIT. 110# Generated by stm32-gen-features. DO NOT EDIT.
diff --git a/embassy-stm32/src/exti.rs b/embassy-stm32/src/exti.rs
index 07c96ead0..dca991859 100644
--- a/embassy-stm32/src/exti.rs
+++ b/embassy-stm32/src/exti.rs
@@ -155,7 +155,7 @@ mod eh1 {
155 type Error = Infallible; 155 type Error = Infallible;
156 } 156 }
157 157
158 impl<'d, T: GpioPin> embedded_hal_1::digital::blocking::InputPin for ExtiInput<'d, T> { 158 impl<'d, T: GpioPin> embedded_hal_1::digital::InputPin for ExtiInput<'d, T> {
159 fn is_high(&self) -> Result<bool, Self::Error> { 159 fn is_high(&self) -> Result<bool, Self::Error> {
160 Ok(self.is_high()) 160 Ok(self.is_high())
161 } 161 }
diff --git a/embassy-stm32/src/flash/mod.rs b/embassy-stm32/src/flash/mod.rs
index 5258c9b04..988cf9fae 100644
--- a/embassy-stm32/src/flash/mod.rs
+++ b/embassy-stm32/src/flash/mod.rs
@@ -23,17 +23,6 @@ impl<'d> Flash<'d> {
23 Self { _inner: p } 23 Self { _inner: p }
24 } 24 }
25 25
26 pub fn unlock(p: impl Peripheral<P = FLASH> + 'd) -> Self {
27 let flash = Self::new(p);
28
29 unsafe { family::unlock() };
30 flash
31 }
32
33 pub fn lock(&mut self) {
34 unsafe { family::lock() };
35 }
36
37 pub fn blocking_read(&mut self, offset: u32, bytes: &mut [u8]) -> Result<(), Error> { 26 pub fn blocking_read(&mut self, offset: u32, bytes: &mut [u8]) -> Result<(), Error> {
38 let offset = FLASH_BASE as u32 + offset; 27 let offset = FLASH_BASE as u32 + offset;
39 if offset as usize >= FLASH_END || offset as usize + bytes.len() > FLASH_END { 28 if offset as usize >= FLASH_END || offset as usize + bytes.len() > FLASH_END {
@@ -57,7 +46,12 @@ impl<'d> Flash<'d> {
57 46
58 self.clear_all_err(); 47 self.clear_all_err();
59 48
60 unsafe { family::blocking_write(offset, buf) } 49 unsafe {
50 family::unlock();
51 let res = family::blocking_write(offset, buf);
52 family::lock();
53 res
54 }
61 } 55 }
62 56
63 pub fn blocking_erase(&mut self, from: u32, to: u32) -> Result<(), Error> { 57 pub fn blocking_erase(&mut self, from: u32, to: u32) -> Result<(), Error> {
@@ -72,7 +66,12 @@ impl<'d> Flash<'d> {
72 66
73 self.clear_all_err(); 67 self.clear_all_err();
74 68
75 unsafe { family::blocking_erase(from, to) } 69 unsafe {
70 family::unlock();
71 let res = family::blocking_erase(from, to);
72 family::lock();
73 res
74 }
76 } 75 }
77 76
78 fn clear_all_err(&mut self) { 77 fn clear_all_err(&mut self) {
@@ -82,7 +81,7 @@ impl<'d> Flash<'d> {
82 81
83impl Drop for Flash<'_> { 82impl Drop for Flash<'_> {
84 fn drop(&mut self) { 83 fn drop(&mut self) {
85 self.lock(); 84 unsafe { family::lock() };
86 } 85 }
87} 86}
88 87
diff --git a/embassy-stm32/src/gpio.rs b/embassy-stm32/src/gpio.rs
index d794e3989..5e3346754 100644
--- a/embassy-stm32/src/gpio.rs
+++ b/embassy-stm32/src/gpio.rs
@@ -848,8 +848,7 @@ mod eh02 {
848 848
849#[cfg(feature = "unstable-traits")] 849#[cfg(feature = "unstable-traits")]
850mod eh1 { 850mod eh1 {
851 use embedded_hal_1::digital::blocking::{InputPin, OutputPin, StatefulOutputPin, ToggleableOutputPin}; 851 use embedded_hal_1::digital::{ErrorType, InputPin, OutputPin, StatefulOutputPin, ToggleableOutputPin};
852 use embedded_hal_1::digital::ErrorType;
853 852
854 use super::*; 853 use super::*;
855 854
diff --git a/embassy-stm32/src/i2c/v1.rs b/embassy-stm32/src/i2c/v1.rs
index 9dc75789a..f39a37df6 100644
--- a/embassy-stm32/src/i2c/v1.rs
+++ b/embassy-stm32/src/i2c/v1.rs
@@ -334,7 +334,7 @@ mod eh1 {
334 type Error = Error; 334 type Error = Error;
335 } 335 }
336 336
337 impl<'d, T: Instance> embedded_hal_1::i2c::blocking::I2c for I2c<'d, T> { 337 impl<'d, T: Instance> embedded_hal_1::i2c::I2c for I2c<'d, T> {
338 fn read(&mut self, address: u8, buffer: &mut [u8]) -> Result<(), Self::Error> { 338 fn read(&mut self, address: u8, buffer: &mut [u8]) -> Result<(), Self::Error> {
339 self.blocking_read(address, buffer) 339 self.blocking_read(address, buffer)
340 } 340 }
@@ -364,14 +364,14 @@ mod eh1 {
364 fn transaction<'a>( 364 fn transaction<'a>(
365 &mut self, 365 &mut self,
366 _address: u8, 366 _address: u8,
367 _operations: &mut [embedded_hal_1::i2c::blocking::Operation<'a>], 367 _operations: &mut [embedded_hal_1::i2c::Operation<'a>],
368 ) -> Result<(), Self::Error> { 368 ) -> Result<(), Self::Error> {
369 todo!(); 369 todo!();
370 } 370 }
371 371
372 fn transaction_iter<'a, O>(&mut self, _address: u8, _operations: O) -> Result<(), Self::Error> 372 fn transaction_iter<'a, O>(&mut self, _address: u8, _operations: O) -> Result<(), Self::Error>
373 where 373 where
374 O: IntoIterator<Item = embedded_hal_1::i2c::blocking::Operation<'a>>, 374 O: IntoIterator<Item = embedded_hal_1::i2c::Operation<'a>>,
375 { 375 {
376 todo!(); 376 todo!();
377 } 377 }
diff --git a/embassy-stm32/src/i2c/v2.rs b/embassy-stm32/src/i2c/v2.rs
index b7c89931c..89b52da98 100644
--- a/embassy-stm32/src/i2c/v2.rs
+++ b/embassy-stm32/src/i2c/v2.rs
@@ -883,7 +883,7 @@ mod eh1 {
883 type Error = Error; 883 type Error = Error;
884 } 884 }
885 885
886 impl<'d, T: Instance> embedded_hal_1::i2c::blocking::I2c for I2c<'d, T, NoDma, NoDma> { 886 impl<'d, T: Instance> embedded_hal_1::i2c::I2c for I2c<'d, T, NoDma, NoDma> {
887 fn read(&mut self, address: u8, buffer: &mut [u8]) -> Result<(), Self::Error> { 887 fn read(&mut self, address: u8, buffer: &mut [u8]) -> Result<(), Self::Error> {
888 self.blocking_read(address, buffer) 888 self.blocking_read(address, buffer)
889 } 889 }
@@ -913,14 +913,14 @@ mod eh1 {
913 fn transaction<'a>( 913 fn transaction<'a>(
914 &mut self, 914 &mut self,
915 _address: u8, 915 _address: u8,
916 _operations: &mut [embedded_hal_1::i2c::blocking::Operation<'a>], 916 _operations: &mut [embedded_hal_1::i2c::Operation<'a>],
917 ) -> Result<(), Self::Error> { 917 ) -> Result<(), Self::Error> {
918 todo!(); 918 todo!();
919 } 919 }
920 920
921 fn transaction_iter<'a, O>(&mut self, _address: u8, _operations: O) -> Result<(), Self::Error> 921 fn transaction_iter<'a, O>(&mut self, _address: u8, _operations: O) -> Result<(), Self::Error>
922 where 922 where
923 O: IntoIterator<Item = embedded_hal_1::i2c::blocking::Operation<'a>>, 923 O: IntoIterator<Item = embedded_hal_1::i2c::Operation<'a>>,
924 { 924 {
925 todo!(); 925 todo!();
926 } 926 }
diff --git a/embassy-stm32/src/spi/mod.rs b/embassy-stm32/src/spi/mod.rs
index 556d12305..396427782 100644
--- a/embassy-stm32/src/spi/mod.rs
+++ b/embassy-stm32/src/spi/mod.rs
@@ -843,25 +843,25 @@ mod eh1 {
843 type Error = Error; 843 type Error = Error;
844 } 844 }
845 845
846 impl<'d, T: Instance, Tx, Rx> embedded_hal_1::spi::blocking::SpiBusFlush for Spi<'d, T, Tx, Rx> { 846 impl<'d, T: Instance, Tx, Rx> embedded_hal_1::spi::SpiBusFlush for Spi<'d, T, Tx, Rx> {
847 fn flush(&mut self) -> Result<(), Self::Error> { 847 fn flush(&mut self) -> Result<(), Self::Error> {
848 Ok(()) 848 Ok(())
849 } 849 }
850 } 850 }
851 851
852 impl<'d, T: Instance, W: Word> embedded_hal_1::spi::blocking::SpiBusRead<W> for Spi<'d, T, NoDma, NoDma> { 852 impl<'d, T: Instance, W: Word> embedded_hal_1::spi::SpiBusRead<W> for Spi<'d, T, NoDma, NoDma> {
853 fn read(&mut self, words: &mut [W]) -> Result<(), Self::Error> { 853 fn read(&mut self, words: &mut [W]) -> Result<(), Self::Error> {
854 self.blocking_read(words) 854 self.blocking_read(words)
855 } 855 }
856 } 856 }
857 857
858 impl<'d, T: Instance, W: Word> embedded_hal_1::spi::blocking::SpiBusWrite<W> for Spi<'d, T, NoDma, NoDma> { 858 impl<'d, T: Instance, W: Word> embedded_hal_1::spi::SpiBusWrite<W> for Spi<'d, T, NoDma, NoDma> {
859 fn write(&mut self, words: &[W]) -> Result<(), Self::Error> { 859 fn write(&mut self, words: &[W]) -> Result<(), Self::Error> {
860 self.blocking_write(words) 860 self.blocking_write(words)
861 } 861 }
862 } 862 }
863 863
864 impl<'d, T: Instance, W: Word> embedded_hal_1::spi::blocking::SpiBus<W> for Spi<'d, T, NoDma, NoDma> { 864 impl<'d, T: Instance, W: Word> embedded_hal_1::spi::SpiBus<W> for Spi<'d, T, NoDma, NoDma> {
865 fn transfer(&mut self, read: &mut [W], write: &[W]) -> Result<(), Self::Error> { 865 fn transfer(&mut self, read: &mut [W], write: &[W]) -> Result<(), Self::Error> {
866 self.blocking_transfer(read, write) 866 self.blocking_transfer(read, write)
867 } 867 }
diff --git a/embassy-stm32/src/usart/mod.rs b/embassy-stm32/src/usart/mod.rs
index 6c2668748..a152a0c15 100644
--- a/embassy-stm32/src/usart/mod.rs
+++ b/embassy-stm32/src/usart/mod.rs
@@ -160,6 +160,30 @@ impl<'d, T: BasicInstance, RxDma> UartRx<'d, T, RxDma> {
160 Ok(()) 160 Ok(())
161 } 161 }
162 162
163 pub fn nb_read(&mut self) -> Result<u8, nb::Error<Error>> {
164 let r = T::regs();
165 unsafe {
166 let sr = sr(r).read();
167 if sr.pe() {
168 rdr(r).read_volatile();
169 Err(nb::Error::Other(Error::Parity))
170 } else if sr.fe() {
171 rdr(r).read_volatile();
172 Err(nb::Error::Other(Error::Framing))
173 } else if sr.ne() {
174 rdr(r).read_volatile();
175 Err(nb::Error::Other(Error::Noise))
176 } else if sr.ore() {
177 rdr(r).read_volatile();
178 Err(nb::Error::Other(Error::Overrun))
179 } else if sr.rxne() {
180 Ok(rdr(r).read_volatile())
181 } else {
182 Err(nb::Error::WouldBlock)
183 }
184 }
185 }
186
163 pub fn blocking_read(&mut self, buffer: &mut [u8]) -> Result<(), Error> { 187 pub fn blocking_read(&mut self, buffer: &mut [u8]) -> Result<(), Error> {
164 unsafe { 188 unsafe {
165 let r = T::regs(); 189 let r = T::regs();
@@ -263,6 +287,10 @@ impl<'d, T: BasicInstance, TxDma, RxDma> Uart<'d, T, TxDma, RxDma> {
263 self.rx.read(buffer).await 287 self.rx.read(buffer).await
264 } 288 }
265 289
290 pub fn nb_read(&mut self) -> Result<u8, nb::Error<Error>> {
291 self.rx.nb_read()
292 }
293
266 pub fn blocking_read(&mut self, buffer: &mut [u8]) -> Result<(), Error> { 294 pub fn blocking_read(&mut self, buffer: &mut [u8]) -> Result<(), Error> {
267 self.rx.blocking_read(buffer) 295 self.rx.blocking_read(buffer)
268 } 296 }
@@ -281,27 +309,7 @@ mod eh02 {
281 impl<'d, T: BasicInstance, RxDma> embedded_hal_02::serial::Read<u8> for UartRx<'d, T, RxDma> { 309 impl<'d, T: BasicInstance, RxDma> embedded_hal_02::serial::Read<u8> for UartRx<'d, T, RxDma> {
282 type Error = Error; 310 type Error = Error;
283 fn read(&mut self) -> Result<u8, nb::Error<Self::Error>> { 311 fn read(&mut self) -> Result<u8, nb::Error<Self::Error>> {
284 let r = T::regs(); 312 self.nb_read()
285 unsafe {
286 let sr = sr(r).read();
287 if sr.pe() {
288 rdr(r).read_volatile();
289 Err(nb::Error::Other(Error::Parity))
290 } else if sr.fe() {
291 rdr(r).read_volatile();
292 Err(nb::Error::Other(Error::Framing))
293 } else if sr.ne() {
294 rdr(r).read_volatile();
295 Err(nb::Error::Other(Error::Noise))
296 } else if sr.ore() {
297 rdr(r).read_volatile();
298 Err(nb::Error::Other(Error::Overrun))
299 } else if sr.rxne() {
300 Ok(rdr(r).read_volatile())
301 } else {
302 Err(nb::Error::WouldBlock)
303 }
304 }
305 } 313 }
306 } 314 }
307 315
@@ -318,7 +326,7 @@ mod eh02 {
318 impl<'d, T: BasicInstance, TxDma, RxDma> embedded_hal_02::serial::Read<u8> for Uart<'d, T, TxDma, RxDma> { 326 impl<'d, T: BasicInstance, TxDma, RxDma> embedded_hal_02::serial::Read<u8> for Uart<'d, T, TxDma, RxDma> {
319 type Error = Error; 327 type Error = Error;
320 fn read(&mut self) -> Result<u8, nb::Error<Self::Error>> { 328 fn read(&mut self) -> Result<u8, nb::Error<Self::Error>> {
321 embedded_hal_02::serial::Read::read(&mut self.rx) 329 self.nb_read()
322 } 330 }
323 } 331 }
324 332
@@ -359,6 +367,58 @@ mod eh1 {
359 impl<'d, T: BasicInstance, RxDma> embedded_hal_1::serial::ErrorType for UartRx<'d, T, RxDma> { 367 impl<'d, T: BasicInstance, RxDma> embedded_hal_1::serial::ErrorType for UartRx<'d, T, RxDma> {
360 type Error = Error; 368 type Error = Error;
361 } 369 }
370
371 impl<'d, T: BasicInstance, RxDma> embedded_hal_nb::serial::Read for UartRx<'d, T, RxDma> {
372 fn read(&mut self) -> nb::Result<u8, Self::Error> {
373 self.nb_read()
374 }
375 }
376
377 impl<'d, T: BasicInstance, TxDma> embedded_hal_1::serial::Write for UartTx<'d, T, TxDma> {
378 fn write(&mut self, buffer: &[u8]) -> Result<(), Self::Error> {
379 self.blocking_write(buffer)
380 }
381
382 fn flush(&mut self) -> Result<(), Self::Error> {
383 self.blocking_flush()
384 }
385 }
386
387 impl<'d, T: BasicInstance, TxDma> embedded_hal_nb::serial::Write for UartTx<'d, T, TxDma> {
388 fn write(&mut self, char: u8) -> nb::Result<(), Self::Error> {
389 self.blocking_write(&[char]).map_err(nb::Error::Other)
390 }
391
392 fn flush(&mut self) -> nb::Result<(), Self::Error> {
393 self.blocking_flush().map_err(nb::Error::Other)
394 }
395 }
396
397 impl<'d, T: BasicInstance, TxDma, RxDma> embedded_hal_nb::serial::Read for Uart<'d, T, TxDma, RxDma> {
398 fn read(&mut self) -> Result<u8, nb::Error<Self::Error>> {
399 self.nb_read()
400 }
401 }
402
403 impl<'d, T: BasicInstance, TxDma, RxDma> embedded_hal_1::serial::Write for Uart<'d, T, TxDma, RxDma> {
404 fn write(&mut self, buffer: &[u8]) -> Result<(), Self::Error> {
405 self.blocking_write(buffer)
406 }
407
408 fn flush(&mut self) -> Result<(), Self::Error> {
409 self.blocking_flush()
410 }
411 }
412
413 impl<'d, T: BasicInstance, TxDma, RxDma> embedded_hal_nb::serial::Write for Uart<'d, T, TxDma, RxDma> {
414 fn write(&mut self, char: u8) -> nb::Result<(), Self::Error> {
415 self.blocking_write(&[char]).map_err(nb::Error::Other)
416 }
417
418 fn flush(&mut self) -> nb::Result<(), Self::Error> {
419 self.blocking_flush().map_err(nb::Error::Other)
420 }
421 }
362} 422}
363 423
364#[cfg(all( 424#[cfg(all(
diff --git a/embassy-sync/Cargo.toml b/embassy-sync/Cargo.toml
index 14ab1d003..584d5ba9f 100644
--- a/embassy-sync/Cargo.toml
+++ b/embassy-sync/Cargo.toml
@@ -2,6 +2,16 @@
2name = "embassy-sync" 2name = "embassy-sync"
3version = "0.1.0" 3version = "0.1.0"
4edition = "2021" 4edition = "2021"
5description = "no-std, no-alloc synchronization primitives with async support"
6repository = "https://github.com/embassy-rs/embassy"
7readme = "README.md"
8license = "MIT OR Apache-2.0"
9categories = [
10 "embedded",
11 "no-std",
12 "concurrency",
13 "asynchronous",
14]
5 15
6[package.metadata.embassy_docs] 16[package.metadata.embassy_docs]
7src_base = "https://github.com/embassy-rs/embassy/blob/embassy-sync-v$VERSION/embassy-sync/src/" 17src_base = "https://github.com/embassy-rs/embassy/blob/embassy-sync-v$VERSION/embassy-sync/src/"
diff --git a/embassy-sync/README.md b/embassy-sync/README.md
index 106295c0d..cc65cf6ef 100644
--- a/embassy-sync/README.md
+++ b/embassy-sync/README.md
@@ -1,12 +1,32 @@
1# embassy-sync 1# embassy-sync
2 2
3Synchronization primitives and data structures with an async API: 3An [Embassy](https://embassy.dev) project.
4
5Synchronization primitives and data structures with async support:
4 6
5- [`Channel`](channel::Channel) - A Multiple Producer Multiple Consumer (MPMC) channel. Each message is only received by a single consumer. 7- [`Channel`](channel::Channel) - A Multiple Producer Multiple Consumer (MPMC) channel. Each message is only received by a single consumer.
6- [`PubSubChannel`](pubsub::PubSubChannel) - A broadcast channel (publish-subscribe) channel. Each message is received by all consumers. 8- [`PubSubChannel`](pubsub::PubSubChannel) - A broadcast channel (publish-subscribe) channel. Each message is received by all consumers.
7- [`Signal`](signal::Signal) - Signalling latest value to a single consumer. 9- [`Signal`](signal::Signal) - Signalling latest value to a single consumer.
8- [`Mutex`](mutex::Mutex) - A Mutex for synchronizing state between asynchronous tasks. 10- [`Mutex`](mutex::Mutex) - Mutex for synchronizing state between asynchronous tasks.
9- [`Pipe`](pipe::Pipe) - Byte stream implementing `embedded_io` traits. 11- [`Pipe`](pipe::Pipe) - Byte stream implementing `embedded_io` traits.
10- [`WakerRegistration`](waitqueue::WakerRegistration) - Utility to register and wake a `Waker`. 12- [`WakerRegistration`](waitqueue::WakerRegistration) - Utility to register and wake a `Waker`.
11- [`AtomicWaker`](waitqueue::AtomicWaker) - A variant of `WakerRegistration` accessible using a non-mut API. 13- [`AtomicWaker`](waitqueue::AtomicWaker) - A variant of `WakerRegistration` accessible using a non-mut API.
12- [`MultiWakerRegistration`](waitqueue::MultiWakerRegistration) - Utility registering and waking multiple `Waker`'s. 14- [`MultiWakerRegistration`](waitqueue::MultiWakerRegistration) - Utility registering and waking multiple `Waker`'s.
15
16## Interoperability
17
18Futures from this crate can run on any executor.
19
20## Minimum supported Rust version (MSRV)
21
22Embassy is guaranteed to compile on the latest stable Rust version at the time of release. It might compile with older versions but that may change in any new patch release.
23
24## License
25
26This work is licensed under either of
27
28- Apache License, Version 2.0 ([LICENSE-APACHE](LICENSE-APACHE) or
29 <http://www.apache.org/licenses/LICENSE-2.0>)
30- MIT license ([LICENSE-MIT](LICENSE-MIT) or <http://opensource.org/licenses/MIT>)
31
32at your option.
diff --git a/embassy-sync/src/pubsub/mod.rs b/embassy-sync/src/pubsub/mod.rs
index 62a9e4763..faaf99dc6 100644
--- a/embassy-sync/src/pubsub/mod.rs
+++ b/embassy-sync/src/pubsub/mod.rs
@@ -192,6 +192,10 @@ impl<M: RawMutex, T: Clone, const CAP: usize, const SUBS: usize, const PUBS: usi
192 }) 192 })
193 } 193 }
194 194
195 fn available(&self, next_message_id: u64) -> u64 {
196 self.inner.lock(|s| s.borrow().next_message_id - next_message_id)
197 }
198
195 fn publish_with_context(&self, message: T, cx: Option<&mut Context<'_>>) -> Result<(), T> { 199 fn publish_with_context(&self, message: T, cx: Option<&mut Context<'_>>) -> Result<(), T> {
196 self.inner.lock(|s| { 200 self.inner.lock(|s| {
197 let mut s = s.borrow_mut(); 201 let mut s = s.borrow_mut();
@@ -217,6 +221,13 @@ impl<M: RawMutex, T: Clone, const CAP: usize, const SUBS: usize, const PUBS: usi
217 }) 221 })
218 } 222 }
219 223
224 fn space(&self) -> usize {
225 self.inner.lock(|s| {
226 let s = s.borrow();
227 s.queue.capacity() - s.queue.len()
228 })
229 }
230
220 fn unregister_subscriber(&self, subscriber_next_message_id: u64) { 231 fn unregister_subscriber(&self, subscriber_next_message_id: u64) {
221 self.inner.lock(|s| { 232 self.inner.lock(|s| {
222 let mut s = s.borrow_mut(); 233 let mut s = s.borrow_mut();
@@ -388,6 +399,10 @@ pub trait PubSubBehavior<T> {
388 /// If the message is not yet present and a context is given, then its waker is registered in the subsriber wakers. 399 /// If the message is not yet present and a context is given, then its waker is registered in the subsriber wakers.
389 fn get_message_with_context(&self, next_message_id: &mut u64, cx: Option<&mut Context<'_>>) -> Poll<WaitResult<T>>; 400 fn get_message_with_context(&self, next_message_id: &mut u64, cx: Option<&mut Context<'_>>) -> Poll<WaitResult<T>>;
390 401
402 /// Get the amount of messages that are between the given the next_message_id and the most recent message.
403 /// This is not necessarily the amount of messages a subscriber can still received as it may have lagged.
404 fn available(&self, next_message_id: u64) -> u64;
405
391 /// Try to publish a message to the queue. 406 /// Try to publish a message to the queue.
392 /// 407 ///
393 /// If the queue is full and a context is given, then its waker is registered in the publisher wakers. 408 /// If the queue is full and a context is given, then its waker is registered in the publisher wakers.
@@ -396,6 +411,9 @@ pub trait PubSubBehavior<T> {
396 /// Publish a message immediately 411 /// Publish a message immediately
397 fn publish_immediate(&self, message: T); 412 fn publish_immediate(&self, message: T);
398 413
414 /// The amount of messages that can still be published without having to wait or without having to lag the subscribers
415 fn space(&self) -> usize;
416
399 /// Let the channel know that a subscriber has dropped 417 /// Let the channel know that a subscriber has dropped
400 fn unregister_subscriber(&self, subscriber_next_message_id: u64); 418 fn unregister_subscriber(&self, subscriber_next_message_id: u64);
401 419
@@ -539,4 +557,59 @@ mod tests {
539 557
540 drop(sub0); 558 drop(sub0);
541 } 559 }
560
561 #[futures_test::test]
562 async fn correct_available() {
563 let channel = PubSubChannel::<NoopRawMutex, u32, 4, 4, 4>::new();
564
565 let sub0 = channel.subscriber().unwrap();
566 let mut sub1 = channel.subscriber().unwrap();
567 let pub0 = channel.publisher().unwrap();
568
569 assert_eq!(sub0.available(), 0);
570 assert_eq!(sub1.available(), 0);
571
572 pub0.publish(42).await;
573
574 assert_eq!(sub0.available(), 1);
575 assert_eq!(sub1.available(), 1);
576
577 sub1.next_message().await;
578
579 assert_eq!(sub1.available(), 0);
580
581 pub0.publish(42).await;
582
583 assert_eq!(sub0.available(), 2);
584 assert_eq!(sub1.available(), 1);
585 }
586
587 #[futures_test::test]
588 async fn correct_space() {
589 let channel = PubSubChannel::<NoopRawMutex, u32, 4, 4, 4>::new();
590
591 let mut sub0 = channel.subscriber().unwrap();
592 let mut sub1 = channel.subscriber().unwrap();
593 let pub0 = channel.publisher().unwrap();
594
595 assert_eq!(pub0.space(), 4);
596
597 pub0.publish(42).await;
598
599 assert_eq!(pub0.space(), 3);
600
601 pub0.publish(42).await;
602
603 assert_eq!(pub0.space(), 2);
604
605 sub0.next_message().await;
606 sub0.next_message().await;
607
608 assert_eq!(pub0.space(), 2);
609
610 sub1.next_message().await;
611 assert_eq!(pub0.space(), 3);
612 sub1.next_message().await;
613 assert_eq!(pub0.space(), 4);
614 }
542} 615}
diff --git a/embassy-sync/src/pubsub/publisher.rs b/embassy-sync/src/pubsub/publisher.rs
index 705797f60..e1edc9eb9 100644
--- a/embassy-sync/src/pubsub/publisher.rs
+++ b/embassy-sync/src/pubsub/publisher.rs
@@ -42,6 +42,14 @@ impl<'a, PSB: PubSubBehavior<T> + ?Sized, T: Clone> Pub<'a, PSB, T> {
42 pub fn try_publish(&self, message: T) -> Result<(), T> { 42 pub fn try_publish(&self, message: T) -> Result<(), T> {
43 self.channel.publish_with_context(message, None) 43 self.channel.publish_with_context(message, None)
44 } 44 }
45
46 /// The amount of messages that can still be published without having to wait or without having to lag the subscribers
47 ///
48 /// *Note: In the time between checking this and a publish action, other publishers may have had time to publish something.
49 /// So checking doesn't give any guarantees.*
50 pub fn space(&self) -> usize {
51 self.channel.space()
52 }
45} 53}
46 54
47impl<'a, PSB: PubSubBehavior<T> + ?Sized, T: Clone> Drop for Pub<'a, PSB, T> { 55impl<'a, PSB: PubSubBehavior<T> + ?Sized, T: Clone> Drop for Pub<'a, PSB, T> {
@@ -115,6 +123,14 @@ impl<'a, PSB: PubSubBehavior<T> + ?Sized, T: Clone> ImmediatePub<'a, PSB, T> {
115 pub fn try_publish(&self, message: T) -> Result<(), T> { 123 pub fn try_publish(&self, message: T) -> Result<(), T> {
116 self.channel.publish_with_context(message, None) 124 self.channel.publish_with_context(message, None)
117 } 125 }
126
127 /// The amount of messages that can still be published without having to wait or without having to lag the subscribers
128 ///
129 /// *Note: In the time between checking this and a publish action, other publishers may have had time to publish something.
130 /// So checking doesn't give any guarantees.*
131 pub fn space(&self) -> usize {
132 self.channel.space()
133 }
118} 134}
119 135
120/// An immediate publisher that holds a dynamic reference to the channel 136/// An immediate publisher that holds a dynamic reference to the channel
@@ -158,6 +174,7 @@ impl<'a, M: RawMutex, T: Clone, const CAP: usize, const SUBS: usize, const PUBS:
158} 174}
159 175
160/// Future for the publisher wait action 176/// Future for the publisher wait action
177#[must_use = "futures do nothing unless you `.await` or poll them"]
161pub struct PublisherWaitFuture<'s, 'a, PSB: PubSubBehavior<T> + ?Sized, T: Clone> { 178pub struct PublisherWaitFuture<'s, 'a, PSB: PubSubBehavior<T> + ?Sized, T: Clone> {
162 /// The message we need to publish 179 /// The message we need to publish
163 message: Option<T>, 180 message: Option<T>,
diff --git a/embassy-sync/src/pubsub/subscriber.rs b/embassy-sync/src/pubsub/subscriber.rs
index b9a2cbe18..f420a75f0 100644
--- a/embassy-sync/src/pubsub/subscriber.rs
+++ b/embassy-sync/src/pubsub/subscriber.rs
@@ -64,6 +64,11 @@ impl<'a, PSB: PubSubBehavior<T> + ?Sized, T: Clone> Sub<'a, PSB, T> {
64 } 64 }
65 } 65 }
66 } 66 }
67
68 /// The amount of messages this subscriber hasn't received yet
69 pub fn available(&self) -> u64 {
70 self.channel.available(self.next_message_id)
71 }
67} 72}
68 73
69impl<'a, PSB: PubSubBehavior<T> + ?Sized, T: Clone> Drop for Sub<'a, PSB, T> { 74impl<'a, PSB: PubSubBehavior<T> + ?Sized, T: Clone> Drop for Sub<'a, PSB, T> {
@@ -135,6 +140,7 @@ impl<'a, M: RawMutex, T: Clone, const CAP: usize, const SUBS: usize, const PUBS:
135} 140}
136 141
137/// Future for the subscriber wait action 142/// Future for the subscriber wait action
143#[must_use = "futures do nothing unless you `.await` or poll them"]
138pub struct SubscriberWaitFuture<'s, 'a, PSB: PubSubBehavior<T> + ?Sized, T: Clone> { 144pub struct SubscriberWaitFuture<'s, 'a, PSB: PubSubBehavior<T> + ?Sized, T: Clone> {
139 subscriber: &'s mut Sub<'a, PSB, T>, 145 subscriber: &'s mut Sub<'a, PSB, T>,
140} 146}
diff --git a/embassy-time/Cargo.toml b/embassy-time/Cargo.toml
index 6d71e100f..c51a71d01 100644
--- a/embassy-time/Cargo.toml
+++ b/embassy-time/Cargo.toml
@@ -2,6 +2,7 @@
2name = "embassy-time" 2name = "embassy-time"
3version = "0.1.0" 3version = "0.1.0"
4edition = "2021" 4edition = "2021"
5license = "MIT OR Apache-2.0"
5 6
6 7
7[package.metadata.embassy_docs] 8[package.metadata.embassy_docs]
@@ -105,8 +106,8 @@ defmt = { version = "0.3", optional = true }
105log = { version = "0.4.14", optional = true } 106log = { version = "0.4.14", optional = true }
106 107
107embedded-hal-02 = { package = "embedded-hal", version = "0.2.6" } 108embedded-hal-02 = { package = "embedded-hal", version = "0.2.6" }
108embedded-hal-1 = { package = "embedded-hal", version = "1.0.0-alpha.8", optional = true} 109embedded-hal-1 = { package = "embedded-hal", version = "=1.0.0-alpha.9", optional = true}
109embedded-hal-async = { version = "0.1.0-alpha.1", optional = true} 110embedded-hal-async = { version = "=0.1.0-alpha.2", optional = true}
110 111
111futures-util = { version = "0.3.17", default-features = false } 112futures-util = { version = "0.3.17", default-features = false }
112embassy-macros = { version = "0.1.0", path = "../embassy-macros"} 113embassy-macros = { version = "0.1.0", path = "../embassy-macros"}
@@ -117,4 +118,4 @@ cfg-if = "1.0.0"
117# WASM dependencies 118# WASM dependencies
118wasm-bindgen = { version = "0.2.81", optional = true } 119wasm-bindgen = { version = "0.2.81", optional = true }
119js-sys = { version = "0.3", optional = true } 120js-sys = { version = "0.3", optional = true }
120wasm-timer = { version = "0.2.5", optional = true } \ No newline at end of file 121wasm-timer = { version = "0.2.5", optional = true }
diff --git a/embassy-time/src/delay.rs b/embassy-time/src/delay.rs
index 0a7982963..ff6b6869a 100644
--- a/embassy-time/src/delay.rs
+++ b/embassy-time/src/delay.rs
@@ -18,7 +18,7 @@ pub struct Delay;
18mod eh1 { 18mod eh1 {
19 use super::*; 19 use super::*;
20 20
21 impl embedded_hal_1::delay::blocking::DelayUs for Delay { 21 impl embedded_hal_1::delay::DelayUs for Delay {
22 type Error = core::convert::Infallible; 22 type Error = core::convert::Infallible;
23 23
24 fn delay_us(&mut self, us: u32) -> Result<(), Self::Error> { 24 fn delay_us(&mut self, us: u32) -> Result<(), Self::Error> {
diff --git a/embassy-usb-driver/Cargo.toml b/embassy-usb-driver/Cargo.toml
index b525df337..d22bf7d72 100644
--- a/embassy-usb-driver/Cargo.toml
+++ b/embassy-usb-driver/Cargo.toml
@@ -2,6 +2,7 @@
2name = "embassy-usb-driver" 2name = "embassy-usb-driver"
3version = "0.1.0" 3version = "0.1.0"
4edition = "2021" 4edition = "2021"
5license = "MIT OR Apache-2.0"
5 6
6# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html 7# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
7 8
@@ -13,4 +14,4 @@ target = "thumbv7em-none-eabi"
13 14
14[dependencies] 15[dependencies]
15defmt = { version = "0.3", optional = true } 16defmt = { version = "0.3", optional = true }
16log = { version = "0.4.14", optional = true } \ No newline at end of file 17log = { version = "0.4.14", optional = true }
diff --git a/embassy-usb-driver/src/lib.rs b/embassy-usb-driver/src/lib.rs
index fc29786fc..931e9c318 100644
--- a/embassy-usb-driver/src/lib.rs
+++ b/embassy-usb-driver/src/lib.rs
@@ -54,12 +54,16 @@ impl From<EndpointAddress> for u8 {
54} 54}
55 55
56impl EndpointAddress { 56impl EndpointAddress {
57 const INBITS: u8 = Direction::In as u8; 57 const INBITS: u8 = 0x80;
58 58
59 /// Constructs a new EndpointAddress with the given index and direction. 59 /// Constructs a new EndpointAddress with the given index and direction.
60 #[inline] 60 #[inline]
61 pub fn from_parts(index: usize, dir: Direction) -> Self { 61 pub fn from_parts(index: usize, dir: Direction) -> Self {
62 EndpointAddress(index as u8 | dir as u8) 62 let dir_u8 = match dir {
63 Direction::Out => 0x00,
64 Direction::In => Self::INBITS,
65 };
66 EndpointAddress(index as u8 | dir_u8)
63 } 67 }
64 68
65 /// Gets the direction part of the address. 69 /// Gets the direction part of the address.
diff --git a/embassy-usb/Cargo.toml b/embassy-usb/Cargo.toml
index aad54dbaf..b59ba8a22 100644
--- a/embassy-usb/Cargo.toml
+++ b/embassy-usb/Cargo.toml
@@ -2,11 +2,12 @@
2name = "embassy-usb" 2name = "embassy-usb"
3version = "0.1.0" 3version = "0.1.0"
4edition = "2021" 4edition = "2021"
5license = "MIT OR Apache-2.0"
5 6
6[package.metadata.embassy_docs] 7[package.metadata.embassy_docs]
7src_base = "https://github.com/embassy-rs/embassy/blob/embassy-usb-v$VERSION/embassy-usb/src/" 8src_base = "https://github.com/embassy-rs/embassy/blob/embassy-usb-v$VERSION/embassy-usb/src/"
8src_base_git = "https://github.com/embassy-rs/embassy/blob/$COMMIT/embassy-usb/src/" 9src_base_git = "https://github.com/embassy-rs/embassy/blob/$COMMIT/embassy-usb/src/"
9features = ["defmt"] 10features = ["defmt", "usbd-hid"]
10target = "thumbv7em-none-eabi" 11target = "thumbv7em-none-eabi"
11 12
12[features] 13[features]
diff --git a/examples/boot/application/nrf/Cargo.toml b/examples/boot/application/nrf/Cargo.toml
index b9ff92578..a5d82b601 100644
--- a/examples/boot/application/nrf/Cargo.toml
+++ b/examples/boot/application/nrf/Cargo.toml
@@ -2,6 +2,7 @@
2edition = "2021" 2edition = "2021"
3name = "embassy-boot-nrf-examples" 3name = "embassy-boot-nrf-examples"
4version = "0.1.0" 4version = "0.1.0"
5license = "MIT OR Apache-2.0"
5 6
6[dependencies] 7[dependencies]
7embassy-sync = { version = "0.1.0", path = "../../../../embassy-sync" } 8embassy-sync = { version = "0.1.0", path = "../../../../embassy-sync" }
diff --git a/examples/boot/application/stm32f3/Cargo.toml b/examples/boot/application/stm32f3/Cargo.toml
index ce1e6fe4a..3a1843562 100644
--- a/examples/boot/application/stm32f3/Cargo.toml
+++ b/examples/boot/application/stm32f3/Cargo.toml
@@ -2,6 +2,7 @@
2edition = "2021" 2edition = "2021"
3name = "embassy-boot-stm32f3-examples" 3name = "embassy-boot-stm32f3-examples"
4version = "0.1.0" 4version = "0.1.0"
5license = "MIT OR Apache-2.0"
5 6
6[dependencies] 7[dependencies]
7embassy-sync = { version = "0.1.0", path = "../../../../embassy-sync", features = ["defmt"] } 8embassy-sync = { version = "0.1.0", path = "../../../../embassy-sync", features = ["defmt"] }
diff --git a/examples/boot/application/stm32f3/src/bin/a.rs b/examples/boot/application/stm32f3/src/bin/a.rs
index fdbd5ab99..d92d59b29 100644
--- a/examples/boot/application/stm32f3/src/bin/a.rs
+++ b/examples/boot/application/stm32f3/src/bin/a.rs
@@ -17,7 +17,7 @@ static APP_B: &[u8] = include_bytes!("../../b.bin");
17#[embassy_executor::main] 17#[embassy_executor::main]
18async fn main(_spawner: Spawner) { 18async fn main(_spawner: Spawner) {
19 let p = embassy_stm32::init(Default::default()); 19 let p = embassy_stm32::init(Default::default());
20 let flash = Flash::unlock(p.FLASH); 20 let flash = Flash::new(p.FLASH);
21 let mut flash = BlockingAsync::new(flash); 21 let mut flash = BlockingAsync::new(flash);
22 22
23 let button = Input::new(p.PC13, Pull::Up); 23 let button = Input::new(p.PC13, Pull::Up);
diff --git a/examples/boot/application/stm32f7/Cargo.toml b/examples/boot/application/stm32f7/Cargo.toml
index 2fc7ae834..8d9c4490e 100644
--- a/examples/boot/application/stm32f7/Cargo.toml
+++ b/examples/boot/application/stm32f7/Cargo.toml
@@ -2,6 +2,7 @@
2edition = "2021" 2edition = "2021"
3name = "embassy-boot-stm32f7-examples" 3name = "embassy-boot-stm32f7-examples"
4version = "0.1.0" 4version = "0.1.0"
5license = "MIT OR Apache-2.0"
5 6
6[dependencies] 7[dependencies]
7embassy-sync = { version = "0.1.0", path = "../../../../embassy-sync", features = ["defmt"] } 8embassy-sync = { version = "0.1.0", path = "../../../../embassy-sync", features = ["defmt"] }
diff --git a/examples/boot/application/stm32f7/src/bin/a.rs b/examples/boot/application/stm32f7/src/bin/a.rs
index 77b897b0f..79ab80e09 100644
--- a/examples/boot/application/stm32f7/src/bin/a.rs
+++ b/examples/boot/application/stm32f7/src/bin/a.rs
@@ -16,7 +16,7 @@ static APP_B: &[u8] = include_bytes!("../../b.bin");
16#[embassy_executor::main] 16#[embassy_executor::main]
17async fn main(_spawner: Spawner) { 17async fn main(_spawner: Spawner) {
18 let p = embassy_stm32::init(Default::default()); 18 let p = embassy_stm32::init(Default::default());
19 let mut flash = Flash::unlock(p.FLASH); 19 let mut flash = Flash::new(p.FLASH);
20 20
21 let button = Input::new(p.PC13, Pull::Down); 21 let button = Input::new(p.PC13, Pull::Down);
22 let mut button = ExtiInput::new(button, p.EXTI13); 22 let mut button = ExtiInput::new(button, p.EXTI13);
diff --git a/examples/boot/application/stm32h7/Cargo.toml b/examples/boot/application/stm32h7/Cargo.toml
index fd809714a..b4314aa72 100644
--- a/examples/boot/application/stm32h7/Cargo.toml
+++ b/examples/boot/application/stm32h7/Cargo.toml
@@ -2,6 +2,7 @@
2edition = "2021" 2edition = "2021"
3name = "embassy-boot-stm32h7-examples" 3name = "embassy-boot-stm32h7-examples"
4version = "0.1.0" 4version = "0.1.0"
5license = "MIT OR Apache-2.0"
5 6
6[dependencies] 7[dependencies]
7embassy-sync = { version = "0.1.0", path = "../../../../embassy-sync" } 8embassy-sync = { version = "0.1.0", path = "../../../../embassy-sync" }
diff --git a/examples/boot/application/stm32h7/src/bin/a.rs b/examples/boot/application/stm32h7/src/bin/a.rs
index 0fe598a5d..8b452be34 100644
--- a/examples/boot/application/stm32h7/src/bin/a.rs
+++ b/examples/boot/application/stm32h7/src/bin/a.rs
@@ -16,7 +16,7 @@ static APP_B: &[u8] = include_bytes!("../../b.bin");
16#[embassy_executor::main] 16#[embassy_executor::main]
17async fn main(_spawner: Spawner) { 17async fn main(_spawner: Spawner) {
18 let p = embassy_stm32::init(Default::default()); 18 let p = embassy_stm32::init(Default::default());
19 let mut flash = Flash::unlock(p.FLASH); 19 let mut flash = Flash::new(p.FLASH);
20 20
21 let button = Input::new(p.PC13, Pull::Down); 21 let button = Input::new(p.PC13, Pull::Down);
22 let mut button = ExtiInput::new(button, p.EXTI13); 22 let mut button = ExtiInput::new(button, p.EXTI13);
diff --git a/examples/boot/application/stm32l0/Cargo.toml b/examples/boot/application/stm32l0/Cargo.toml
index 470eca52a..a17d336a6 100644
--- a/examples/boot/application/stm32l0/Cargo.toml
+++ b/examples/boot/application/stm32l0/Cargo.toml
@@ -2,6 +2,7 @@
2edition = "2021" 2edition = "2021"
3name = "embassy-boot-stm32l0-examples" 3name = "embassy-boot-stm32l0-examples"
4version = "0.1.0" 4version = "0.1.0"
5license = "MIT OR Apache-2.0"
5 6
6[dependencies] 7[dependencies]
7embassy-sync = { version = "0.1.0", path = "../../../../embassy-sync", features = ["defmt"] } 8embassy-sync = { version = "0.1.0", path = "../../../../embassy-sync", features = ["defmt"] }
diff --git a/examples/boot/application/stm32l0/src/bin/a.rs b/examples/boot/application/stm32l0/src/bin/a.rs
index f0b0b80e3..59ca34386 100644
--- a/examples/boot/application/stm32l0/src/bin/a.rs
+++ b/examples/boot/application/stm32l0/src/bin/a.rs
@@ -18,7 +18,7 @@ static APP_B: &[u8] = include_bytes!("../../b.bin");
18#[embassy_executor::main] 18#[embassy_executor::main]
19async fn main(_spawner: Spawner) { 19async fn main(_spawner: Spawner) {
20 let p = embassy_stm32::init(Default::default()); 20 let p = embassy_stm32::init(Default::default());
21 let flash = Flash::unlock(p.FLASH); 21 let flash = Flash::new(p.FLASH);
22 let mut flash = BlockingAsync::new(flash); 22 let mut flash = BlockingAsync::new(flash);
23 23
24 let button = Input::new(p.PB2, Pull::Up); 24 let button = Input::new(p.PB2, Pull::Up);
diff --git a/examples/boot/application/stm32l1/Cargo.toml b/examples/boot/application/stm32l1/Cargo.toml
index 2b4b29357..683f2c860 100644
--- a/examples/boot/application/stm32l1/Cargo.toml
+++ b/examples/boot/application/stm32l1/Cargo.toml
@@ -2,6 +2,7 @@
2edition = "2021" 2edition = "2021"
3name = "embassy-boot-stm32l1-examples" 3name = "embassy-boot-stm32l1-examples"
4version = "0.1.0" 4version = "0.1.0"
5license = "MIT OR Apache-2.0"
5 6
6[dependencies] 7[dependencies]
7embassy-sync = { version = "0.1.0", path = "../../../../embassy-sync", features = ["defmt"] } 8embassy-sync = { version = "0.1.0", path = "../../../../embassy-sync", features = ["defmt"] }
diff --git a/examples/boot/application/stm32l1/src/bin/a.rs b/examples/boot/application/stm32l1/src/bin/a.rs
index f0b0b80e3..59ca34386 100644
--- a/examples/boot/application/stm32l1/src/bin/a.rs
+++ b/examples/boot/application/stm32l1/src/bin/a.rs
@@ -18,7 +18,7 @@ static APP_B: &[u8] = include_bytes!("../../b.bin");
18#[embassy_executor::main] 18#[embassy_executor::main]
19async fn main(_spawner: Spawner) { 19async fn main(_spawner: Spawner) {
20 let p = embassy_stm32::init(Default::default()); 20 let p = embassy_stm32::init(Default::default());
21 let flash = Flash::unlock(p.FLASH); 21 let flash = Flash::new(p.FLASH);
22 let mut flash = BlockingAsync::new(flash); 22 let mut flash = BlockingAsync::new(flash);
23 23
24 let button = Input::new(p.PB2, Pull::Up); 24 let button = Input::new(p.PB2, Pull::Up);
diff --git a/examples/boot/application/stm32l4/Cargo.toml b/examples/boot/application/stm32l4/Cargo.toml
index 40bddd194..b879c0d76 100644
--- a/examples/boot/application/stm32l4/Cargo.toml
+++ b/examples/boot/application/stm32l4/Cargo.toml
@@ -2,6 +2,7 @@
2edition = "2021" 2edition = "2021"
3name = "embassy-boot-stm32l4-examples" 3name = "embassy-boot-stm32l4-examples"
4version = "0.1.0" 4version = "0.1.0"
5license = "MIT OR Apache-2.0"
5 6
6[dependencies] 7[dependencies]
7embassy-sync = { version = "0.1.0", path = "../../../../embassy-sync", features = ["defmt"] } 8embassy-sync = { version = "0.1.0", path = "../../../../embassy-sync", features = ["defmt"] }
diff --git a/examples/boot/application/stm32l4/src/bin/a.rs b/examples/boot/application/stm32l4/src/bin/a.rs
index 5119bad2e..6cddc6cc8 100644
--- a/examples/boot/application/stm32l4/src/bin/a.rs
+++ b/examples/boot/application/stm32l4/src/bin/a.rs
@@ -17,7 +17,7 @@ static APP_B: &[u8] = include_bytes!("../../b.bin");
17#[embassy_executor::main] 17#[embassy_executor::main]
18async fn main(_spawner: Spawner) { 18async fn main(_spawner: Spawner) {
19 let p = embassy_stm32::init(Default::default()); 19 let p = embassy_stm32::init(Default::default());
20 let flash = Flash::unlock(p.FLASH); 20 let flash = Flash::new(p.FLASH);
21 let mut flash = BlockingAsync::new(flash); 21 let mut flash = BlockingAsync::new(flash);
22 22
23 let button = Input::new(p.PC13, Pull::Up); 23 let button = Input::new(p.PC13, Pull::Up);
diff --git a/examples/boot/application/stm32wl/Cargo.toml b/examples/boot/application/stm32wl/Cargo.toml
index 5b4a61e8f..e3bc0e49c 100644
--- a/examples/boot/application/stm32wl/Cargo.toml
+++ b/examples/boot/application/stm32wl/Cargo.toml
@@ -2,6 +2,7 @@
2edition = "2021" 2edition = "2021"
3name = "embassy-boot-stm32wl-examples" 3name = "embassy-boot-stm32wl-examples"
4version = "0.1.0" 4version = "0.1.0"
5license = "MIT OR Apache-2.0"
5 6
6[dependencies] 7[dependencies]
7embassy-sync = { version = "0.1.0", path = "../../../../embassy-sync", features = ["defmt"] } 8embassy-sync = { version = "0.1.0", path = "../../../../embassy-sync", features = ["defmt"] }
diff --git a/examples/boot/application/stm32wl/src/bin/a.rs b/examples/boot/application/stm32wl/src/bin/a.rs
index faa650778..1ff47eddd 100644
--- a/examples/boot/application/stm32wl/src/bin/a.rs
+++ b/examples/boot/application/stm32wl/src/bin/a.rs
@@ -17,7 +17,7 @@ static APP_B: &[u8] = include_bytes!("../../b.bin");
17#[embassy_executor::main] 17#[embassy_executor::main]
18async fn main(_spawner: Spawner) { 18async fn main(_spawner: Spawner) {
19 let p = embassy_stm32::init(Default::default()); 19 let p = embassy_stm32::init(Default::default());
20 let flash = Flash::unlock(p.FLASH); 20 let flash = Flash::new(p.FLASH);
21 let mut flash = BlockingAsync::new(flash); 21 let mut flash = BlockingAsync::new(flash);
22 22
23 let button = Input::new(p.PA0, Pull::Up); 23 let button = Input::new(p.PA0, Pull::Up);
diff --git a/examples/boot/bootloader/nrf/Cargo.toml b/examples/boot/bootloader/nrf/Cargo.toml
index aa2a13ecb..b417a40d1 100644
--- a/examples/boot/bootloader/nrf/Cargo.toml
+++ b/examples/boot/bootloader/nrf/Cargo.toml
@@ -3,6 +3,7 @@ edition = "2021"
3name = "nrf-bootloader-example" 3name = "nrf-bootloader-example"
4version = "0.1.0" 4version = "0.1.0"
5description = "Bootloader for nRF chips" 5description = "Bootloader for nRF chips"
6license = "MIT OR Apache-2.0"
6 7
7[dependencies] 8[dependencies]
8defmt = { version = "0.3", optional = true } 9defmt = { version = "0.3", optional = true }
diff --git a/examples/boot/bootloader/stm32/Cargo.toml b/examples/boot/bootloader/stm32/Cargo.toml
index 491777103..4ddd1c99c 100644
--- a/examples/boot/bootloader/stm32/Cargo.toml
+++ b/examples/boot/bootloader/stm32/Cargo.toml
@@ -3,6 +3,7 @@ edition = "2021"
3name = "stm32-bootloader-example" 3name = "stm32-bootloader-example"
4version = "0.1.0" 4version = "0.1.0"
5description = "Example bootloader for STM32 chips" 5description = "Example bootloader for STM32 chips"
6license = "MIT OR Apache-2.0"
6 7
7[dependencies] 8[dependencies]
8defmt = { version = "0.3", optional = true } 9defmt = { version = "0.3", optional = true }
diff --git a/examples/boot/bootloader/stm32/src/main.rs b/examples/boot/bootloader/stm32/src/main.rs
index 294464d1c..4b17cd799 100644
--- a/examples/boot/bootloader/stm32/src/main.rs
+++ b/examples/boot/bootloader/stm32/src/main.rs
@@ -20,7 +20,7 @@ fn main() -> ! {
20 */ 20 */
21 21
22 let mut bl: BootLoader<ERASE_SIZE, WRITE_SIZE> = BootLoader::default(); 22 let mut bl: BootLoader<ERASE_SIZE, WRITE_SIZE> = BootLoader::default();
23 let flash = Flash::unlock(p.FLASH); 23 let flash = Flash::new(p.FLASH);
24 let mut flash = BootFlash::<_, ERASE_SIZE, ERASE_VALUE>::new(flash); 24 let mut flash = BootFlash::<_, ERASE_SIZE, ERASE_VALUE>::new(flash);
25 let start = bl.prepare(&mut SingleFlashConfig::new(&mut flash)); 25 let start = bl.prepare(&mut SingleFlashConfig::new(&mut flash));
26 core::mem::drop(flash); 26 core::mem::drop(flash);
diff --git a/examples/nrf-rtos-trace/Cargo.toml b/examples/nrf-rtos-trace/Cargo.toml
index 87c9f33f5..d8c24dfad 100644
--- a/examples/nrf-rtos-trace/Cargo.toml
+++ b/examples/nrf-rtos-trace/Cargo.toml
@@ -2,6 +2,7 @@
2edition = "2021" 2edition = "2021"
3name = "embassy-nrf-rtos-trace-examples" 3name = "embassy-nrf-rtos-trace-examples"
4version = "0.1.0" 4version = "0.1.0"
5license = "MIT OR Apache-2.0"
5 6
6[features] 7[features]
7default = ["log", "nightly"] 8default = ["log", "nightly"]
diff --git a/examples/nrf/Cargo.toml b/examples/nrf/Cargo.toml
index 54df16ba0..91c418213 100644
--- a/examples/nrf/Cargo.toml
+++ b/examples/nrf/Cargo.toml
@@ -2,6 +2,7 @@
2edition = "2021" 2edition = "2021"
3name = "embassy-nrf-examples" 3name = "embassy-nrf-examples"
4version = "0.1.0" 4version = "0.1.0"
5license = "MIT OR Apache-2.0"
5 6
6[features] 7[features]
7default = ["nightly"] 8default = ["nightly"]
diff --git a/examples/rp/Cargo.toml b/examples/rp/Cargo.toml
index 3c8f923e7..a5af8b2f0 100644
--- a/examples/rp/Cargo.toml
+++ b/examples/rp/Cargo.toml
@@ -2,6 +2,7 @@
2edition = "2021" 2edition = "2021"
3name = "embassy-rp-examples" 3name = "embassy-rp-examples"
4version = "0.1.0" 4version = "0.1.0"
5license = "MIT OR Apache-2.0"
5 6
6 7
7[dependencies] 8[dependencies]
@@ -26,7 +27,7 @@ st7789 = "0.6.1"
26display-interface = "0.4.1" 27display-interface = "0.4.1"
27byte-slice-cast = { version = "1.2.0", default-features = false } 28byte-slice-cast = { version = "1.2.0", default-features = false }
28 29
29embedded-hal-1 = { package = "embedded-hal", version = "1.0.0-alpha.8" } 30embedded-hal-1 = { package = "embedded-hal", version = "=1.0.0-alpha.9" }
30embedded-hal-async = { version = "0.1.0-alpha.1" } 31embedded-hal-async = { version = "0.1.0-alpha.1" }
31embedded-io = { version = "0.3.0", features = ["async", "defmt"] } 32embedded-io = { version = "0.3.0", features = ["async", "defmt"] }
32static_cell = "1.0.0" 33static_cell = "1.0.0"
diff --git a/examples/rp/src/bin/i2c_blocking.rs b/examples/rp/src/bin/i2c_blocking.rs
new file mode 100644
index 000000000..7623e33c8
--- /dev/null
+++ b/examples/rp/src/bin/i2c_blocking.rs
@@ -0,0 +1,70 @@
1#![no_std]
2#![no_main]
3#![feature(type_alias_impl_trait)]
4
5use defmt::*;
6use embassy_executor::Spawner;
7use embassy_rp::i2c::{self, Config};
8use embassy_time::{Duration, Timer};
9use embedded_hal_1::i2c::I2c;
10use {defmt_rtt as _, panic_probe as _};
11
12#[allow(dead_code)]
13mod mcp23017 {
14 pub const ADDR: u8 = 0x20; // default addr
15
16 pub const IODIRA: u8 = 0x00;
17 pub const IPOLA: u8 = 0x02;
18 pub const GPINTENA: u8 = 0x04;
19 pub const DEFVALA: u8 = 0x06;
20 pub const INTCONA: u8 = 0x08;
21 pub const IOCONA: u8 = 0x0A;
22 pub const GPPUA: u8 = 0x0C;
23 pub const INTFA: u8 = 0x0E;
24 pub const INTCAPA: u8 = 0x10;
25 pub const GPIOA: u8 = 0x12;
26 pub const OLATA: u8 = 0x14;
27 pub const IODIRB: u8 = 0x01;
28 pub const IPOLB: u8 = 0x03;
29 pub const GPINTENB: u8 = 0x05;
30 pub const DEFVALB: u8 = 0x07;
31 pub const INTCONB: u8 = 0x09;
32 pub const IOCONB: u8 = 0x0B;
33 pub const GPPUB: u8 = 0x0D;
34 pub const INTFB: u8 = 0x0F;
35 pub const INTCAPB: u8 = 0x11;
36 pub const GPIOB: u8 = 0x13;
37 pub const OLATB: u8 = 0x15;
38}
39
40#[embassy_executor::main]
41async fn main(_spawner: Spawner) {
42 let p = embassy_rp::init(Default::default());
43
44 let sda = p.PIN_14;
45 let scl = p.PIN_15;
46
47 info!("set up i2c ");
48 let mut i2c = i2c::I2c::new_blocking(p.I2C1, scl, sda, Config::default());
49
50 use mcp23017::*;
51
52 info!("init mcp23017 config for IxpandO");
53 // init - a outputs, b inputs
54 i2c.write(ADDR, &[IODIRA, 0x00]).unwrap();
55 i2c.write(ADDR, &[IODIRB, 0xff]).unwrap();
56 i2c.write(ADDR, &[GPPUB, 0xff]).unwrap(); // pullups
57
58 let mut val = 0xaa;
59 loop {
60 let mut portb = [0];
61
62 i2c.write(mcp23017::ADDR, &[GPIOA, val]).unwrap();
63 i2c.write_read(mcp23017::ADDR, &[GPIOB], &mut portb).unwrap();
64
65 info!("portb = {:02x}", portb[0]);
66 val = !val;
67
68 Timer::after(Duration::from_secs(1)).await;
69 }
70}
diff --git a/examples/rp/src/bin/spi_display.rs b/examples/rp/src/bin/spi_display.rs
index 23cd4355e..778cad3fa 100644
--- a/examples/rp/src/bin/spi_display.rs
+++ b/examples/rp/src/bin/spi_display.rs
@@ -108,9 +108,9 @@ mod shared_spi {
108 use core::cell::RefCell; 108 use core::cell::RefCell;
109 use core::fmt::Debug; 109 use core::fmt::Debug;
110 110
111 use embedded_hal_1::digital::blocking::OutputPin; 111 use embedded_hal_1::digital::OutputPin;
112 use embedded_hal_1::spi; 112 use embedded_hal_1::spi;
113 use embedded_hal_1::spi::blocking::SpiDevice; 113 use embedded_hal_1::spi::SpiDevice;
114 114
115 #[derive(Copy, Clone, Eq, PartialEq, Debug)] 115 #[derive(Copy, Clone, Eq, PartialEq, Debug)]
116 pub enum SpiDeviceWithCsError<BUS, CS> { 116 pub enum SpiDeviceWithCsError<BUS, CS> {
@@ -153,7 +153,7 @@ mod shared_spi {
153 153
154 impl<'a, BUS, CS> SpiDevice for SpiDeviceWithCs<'a, BUS, CS> 154 impl<'a, BUS, CS> SpiDevice for SpiDeviceWithCs<'a, BUS, CS>
155 where 155 where
156 BUS: spi::blocking::SpiBusFlush, 156 BUS: spi::SpiBusFlush,
157 CS: OutputPin, 157 CS: OutputPin,
158 { 158 {
159 type Bus = BUS; 159 type Bus = BUS;
@@ -182,7 +182,7 @@ mod shared_spi {
182 182
183/// Driver for the XPT2046 resistive touchscreen sensor 183/// Driver for the XPT2046 resistive touchscreen sensor
184mod touch { 184mod touch {
185 use embedded_hal_1::spi::blocking::{SpiBus, SpiBusRead, SpiBusWrite, SpiDevice}; 185 use embedded_hal_1::spi::{SpiBus, SpiBusRead, SpiBusWrite, SpiDevice};
186 186
187 struct Calibration { 187 struct Calibration {
188 x1: i32, 188 x1: i32,
@@ -246,8 +246,8 @@ mod touch {
246 246
247mod my_display_interface { 247mod my_display_interface {
248 use display_interface::{DataFormat, DisplayError, WriteOnlyDataCommand}; 248 use display_interface::{DataFormat, DisplayError, WriteOnlyDataCommand};
249 use embedded_hal_1::digital::blocking::OutputPin; 249 use embedded_hal_1::digital::OutputPin;
250 use embedded_hal_1::spi::blocking::{SpiBusWrite, SpiDevice}; 250 use embedded_hal_1::spi::{SpiBusWrite, SpiDevice};
251 251
252 /// SPI display interface. 252 /// SPI display interface.
253 /// 253 ///
diff --git a/examples/std/Cargo.toml b/examples/std/Cargo.toml
index dbfd9d625..b9bd1e718 100644
--- a/examples/std/Cargo.toml
+++ b/examples/std/Cargo.toml
@@ -2,6 +2,7 @@
2edition = "2021" 2edition = "2021"
3name = "embassy-std-examples" 3name = "embassy-std-examples"
4version = "0.1.0" 4version = "0.1.0"
5license = "MIT OR Apache-2.0"
5 6
6[dependencies] 7[dependencies]
7embassy-sync = { version = "0.1.0", path = "../../embassy-sync", features = ["log"] } 8embassy-sync = { version = "0.1.0", path = "../../embassy-sync", features = ["log"] }
diff --git a/examples/stm32f0/Cargo.toml b/examples/stm32f0/Cargo.toml
index c82b79c86..a56c546ee 100644
--- a/examples/stm32f0/Cargo.toml
+++ b/examples/stm32f0/Cargo.toml
@@ -2,6 +2,7 @@
2name = "embassy-stm32f0-examples" 2name = "embassy-stm32f0-examples"
3version = "0.1.0" 3version = "0.1.0"
4edition = "2021" 4edition = "2021"
5license = "MIT OR Apache-2.0"
5 6
6# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html 7# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
7 8
diff --git a/examples/stm32f1/Cargo.toml b/examples/stm32f1/Cargo.toml
index e6553789a..6be131f30 100644
--- a/examples/stm32f1/Cargo.toml
+++ b/examples/stm32f1/Cargo.toml
@@ -2,6 +2,7 @@
2edition = "2021" 2edition = "2021"
3name = "embassy-stm32f1-examples" 3name = "embassy-stm32f1-examples"
4version = "0.1.0" 4version = "0.1.0"
5license = "MIT OR Apache-2.0"
5 6
6[dependencies] 7[dependencies]
7embassy-sync = { version = "0.1.0", path = "../../embassy-sync", features = ["defmt"] } 8embassy-sync = { version = "0.1.0", path = "../../embassy-sync", features = ["defmt"] }
diff --git a/examples/stm32f2/Cargo.toml b/examples/stm32f2/Cargo.toml
index 60cd54bd9..f6adda2a3 100644
--- a/examples/stm32f2/Cargo.toml
+++ b/examples/stm32f2/Cargo.toml
@@ -2,6 +2,7 @@
2edition = "2021" 2edition = "2021"
3name = "embassy-stm32f2-examples" 3name = "embassy-stm32f2-examples"
4version = "0.1.0" 4version = "0.1.0"
5license = "MIT OR Apache-2.0"
5 6
6[dependencies] 7[dependencies]
7embassy-sync = { version = "0.1.0", path = "../../embassy-sync", features = ["defmt"] } 8embassy-sync = { version = "0.1.0", path = "../../embassy-sync", features = ["defmt"] }
diff --git a/examples/stm32f3/Cargo.toml b/examples/stm32f3/Cargo.toml
index f5b0b880c..27188dd19 100644
--- a/examples/stm32f3/Cargo.toml
+++ b/examples/stm32f3/Cargo.toml
@@ -2,6 +2,7 @@
2edition = "2021" 2edition = "2021"
3name = "embassy-stm32f3-examples" 3name = "embassy-stm32f3-examples"
4version = "0.1.0" 4version = "0.1.0"
5license = "MIT OR Apache-2.0"
5 6
6[dependencies] 7[dependencies]
7embassy-sync = { version = "0.1.0", path = "../../embassy-sync", features = ["defmt"] } 8embassy-sync = { version = "0.1.0", path = "../../embassy-sync", features = ["defmt"] }
diff --git a/examples/stm32f3/src/bin/flash.rs b/examples/stm32f3/src/bin/flash.rs
index 2cf24dbd3..baa7484d0 100644
--- a/examples/stm32f3/src/bin/flash.rs
+++ b/examples/stm32f3/src/bin/flash.rs
@@ -15,7 +15,7 @@ async fn main(_spawner: Spawner) {
15 15
16 const ADDR: u32 = 0x26000; 16 const ADDR: u32 = 0x26000;
17 17
18 let mut f = Flash::unlock(p.FLASH); 18 let mut f = Flash::new(p.FLASH);
19 19
20 info!("Reading..."); 20 info!("Reading...");
21 let mut buf = [0u8; 8]; 21 let mut buf = [0u8; 8];
diff --git a/examples/stm32f4/Cargo.toml b/examples/stm32f4/Cargo.toml
index ea5c47a43..6d4f09fba 100644
--- a/examples/stm32f4/Cargo.toml
+++ b/examples/stm32f4/Cargo.toml
@@ -2,6 +2,7 @@
2edition = "2021" 2edition = "2021"
3name = "embassy-stm32f4-examples" 3name = "embassy-stm32f4-examples"
4version = "0.1.0" 4version = "0.1.0"
5license = "MIT OR Apache-2.0"
5 6
6 7
7[dependencies] 8[dependencies]
diff --git a/examples/stm32f4/src/bin/flash.rs b/examples/stm32f4/src/bin/flash.rs
index 393d61e86..7ea068a42 100644
--- a/examples/stm32f4/src/bin/flash.rs
+++ b/examples/stm32f4/src/bin/flash.rs
@@ -13,7 +13,7 @@ async fn main(_spawner: Spawner) {
13 let p = embassy_stm32::init(Default::default()); 13 let p = embassy_stm32::init(Default::default());
14 info!("Hello Flash!"); 14 info!("Hello Flash!");
15 15
16 let mut f = Flash::unlock(p.FLASH); 16 let mut f = Flash::new(p.FLASH);
17 17
18 // Sector 5 18 // Sector 5
19 test_flash(&mut f, 128 * 1024, 128 * 1024); 19 test_flash(&mut f, 128 * 1024, 128 * 1024);
diff --git a/examples/stm32f7/Cargo.toml b/examples/stm32f7/Cargo.toml
index 6c2f846fe..dad92c0fc 100644
--- a/examples/stm32f7/Cargo.toml
+++ b/examples/stm32f7/Cargo.toml
@@ -2,6 +2,7 @@
2edition = "2021" 2edition = "2021"
3name = "embassy-stm32f7-examples" 3name = "embassy-stm32f7-examples"
4version = "0.1.0" 4version = "0.1.0"
5license = "MIT OR Apache-2.0"
5 6
6[dependencies] 7[dependencies]
7embassy-sync = { version = "0.1.0", path = "../../embassy-sync", features = ["defmt"] } 8embassy-sync = { version = "0.1.0", path = "../../embassy-sync", features = ["defmt"] }
diff --git a/examples/stm32f7/src/bin/flash.rs b/examples/stm32f7/src/bin/flash.rs
index c10781d0c..4a7bca1fa 100644
--- a/examples/stm32f7/src/bin/flash.rs
+++ b/examples/stm32f7/src/bin/flash.rs
@@ -19,7 +19,7 @@ async fn main(_spawner: Spawner) {
19 // wait a bit before accessing the flash 19 // wait a bit before accessing the flash
20 Timer::after(Duration::from_millis(300)).await; 20 Timer::after(Duration::from_millis(300)).await;
21 21
22 let mut f = Flash::unlock(p.FLASH); 22 let mut f = Flash::new(p.FLASH);
23 23
24 info!("Reading..."); 24 info!("Reading...");
25 let mut buf = [0u8; 32]; 25 let mut buf = [0u8; 32];
diff --git a/examples/stm32g0/Cargo.toml b/examples/stm32g0/Cargo.toml
index 6baf17f36..f5673718d 100644
--- a/examples/stm32g0/Cargo.toml
+++ b/examples/stm32g0/Cargo.toml
@@ -2,6 +2,7 @@
2edition = "2021" 2edition = "2021"
3name = "embassy-stm32g0-examples" 3name = "embassy-stm32g0-examples"
4version = "0.1.0" 4version = "0.1.0"
5license = "MIT OR Apache-2.0"
5 6
6[dependencies] 7[dependencies]
7embassy-sync = { version = "0.1.0", path = "../../embassy-sync", features = ["defmt"] } 8embassy-sync = { version = "0.1.0", path = "../../embassy-sync", features = ["defmt"] }
diff --git a/examples/stm32g4/Cargo.toml b/examples/stm32g4/Cargo.toml
index d8c05a979..ecda28805 100644
--- a/examples/stm32g4/Cargo.toml
+++ b/examples/stm32g4/Cargo.toml
@@ -2,6 +2,7 @@
2edition = "2021" 2edition = "2021"
3name = "embassy-stm32g4-examples" 3name = "embassy-stm32g4-examples"
4version = "0.1.0" 4version = "0.1.0"
5license = "MIT OR Apache-2.0"
5 6
6[dependencies] 7[dependencies]
7embassy-sync = { version = "0.1.0", path = "../../embassy-sync", features = ["defmt"] } 8embassy-sync = { version = "0.1.0", path = "../../embassy-sync", features = ["defmt"] }
diff --git a/examples/stm32h7/Cargo.toml b/examples/stm32h7/Cargo.toml
index fc60d7a88..1a05b9ecb 100644
--- a/examples/stm32h7/Cargo.toml
+++ b/examples/stm32h7/Cargo.toml
@@ -2,6 +2,7 @@
2edition = "2021" 2edition = "2021"
3name = "embassy-stm32h7-examples" 3name = "embassy-stm32h7-examples"
4version = "0.1.0" 4version = "0.1.0"
5license = "MIT OR Apache-2.0"
5 6
6[dependencies] 7[dependencies]
7embassy-sync = { version = "0.1.0", path = "../../embassy-sync", features = ["defmt"] } 8embassy-sync = { version = "0.1.0", path = "../../embassy-sync", features = ["defmt"] }
@@ -17,8 +18,8 @@ defmt-rtt = "0.3"
17cortex-m = { version = "0.7.6", features = ["critical-section-single-core"] } 18cortex-m = { version = "0.7.6", features = ["critical-section-single-core"] }
18cortex-m-rt = "0.7.0" 19cortex-m-rt = "0.7.0"
19embedded-hal = "0.2.6" 20embedded-hal = "0.2.6"
20embedded-hal-1 = { package = "embedded-hal", version = "1.0.0-alpha.8" } 21embedded-hal-1 = { package = "embedded-hal", version = "=1.0.0-alpha.9" }
21embedded-hal-async = { version = "0.1.0-alpha.1" } 22embedded-hal-async = { version = "=0.1.0-alpha.2" }
22embedded-nal-async = "0.2.0" 23embedded-nal-async = "0.2.0"
23panic-probe = { version = "0.3", features = ["print-defmt"] } 24panic-probe = { version = "0.3", features = ["print-defmt"] }
24futures = { version = "0.3.17", default-features = false, features = ["async-await"] } 25futures = { version = "0.3.17", default-features = false, features = ["async-await"] }
diff --git a/examples/stm32h7/src/bin/flash.rs b/examples/stm32h7/src/bin/flash.rs
index 6682c64d5..ee86bdbf6 100644
--- a/examples/stm32h7/src/bin/flash.rs
+++ b/examples/stm32h7/src/bin/flash.rs
@@ -19,7 +19,7 @@ async fn main(_spawner: Spawner) {
19 // wait a bit before accessing the flash 19 // wait a bit before accessing the flash
20 Timer::after(Duration::from_millis(300)).await; 20 Timer::after(Duration::from_millis(300)).await;
21 21
22 let mut f = Flash::unlock(p.FLASH); 22 let mut f = Flash::new(p.FLASH);
23 23
24 info!("Reading..."); 24 info!("Reading...");
25 let mut buf = [0u8; 32]; 25 let mut buf = [0u8; 32];
diff --git a/examples/stm32l0/Cargo.toml b/examples/stm32l0/Cargo.toml
index 7e61f0c19..7e1120f48 100644
--- a/examples/stm32l0/Cargo.toml
+++ b/examples/stm32l0/Cargo.toml
@@ -2,6 +2,7 @@
2edition = "2021" 2edition = "2021"
3name = "embassy-stm32l0-examples" 3name = "embassy-stm32l0-examples"
4version = "0.1.0" 4version = "0.1.0"
5license = "MIT OR Apache-2.0"
5 6
6[features] 7[features]
7default = ["nightly"] 8default = ["nightly"]
diff --git a/examples/stm32l0/src/bin/flash.rs b/examples/stm32l0/src/bin/flash.rs
index 867cb4d3e..ffe4fb10b 100644
--- a/examples/stm32l0/src/bin/flash.rs
+++ b/examples/stm32l0/src/bin/flash.rs
@@ -15,7 +15,7 @@ async fn main(_spawner: Spawner) {
15 15
16 const ADDR: u32 = 0x26000; 16 const ADDR: u32 = 0x26000;
17 17
18 let mut f = Flash::unlock(p.FLASH); 18 let mut f = Flash::new(p.FLASH);
19 19
20 info!("Reading..."); 20 info!("Reading...");
21 let mut buf = [0u8; 8]; 21 let mut buf = [0u8; 8];
diff --git a/examples/stm32l1/Cargo.toml b/examples/stm32l1/Cargo.toml
index a943c73d2..9460febf5 100644
--- a/examples/stm32l1/Cargo.toml
+++ b/examples/stm32l1/Cargo.toml
@@ -2,6 +2,7 @@
2edition = "2021" 2edition = "2021"
3name = "embassy-stm32l1-examples" 3name = "embassy-stm32l1-examples"
4version = "0.1.0" 4version = "0.1.0"
5license = "MIT OR Apache-2.0"
5 6
6[dependencies] 7[dependencies]
7embassy-sync = { version = "0.1.0", path = "../../embassy-sync", features = ["defmt"] } 8embassy-sync = { version = "0.1.0", path = "../../embassy-sync", features = ["defmt"] }
diff --git a/examples/stm32l1/src/bin/flash.rs b/examples/stm32l1/src/bin/flash.rs
index a76b9879f..476ed51a4 100644
--- a/examples/stm32l1/src/bin/flash.rs
+++ b/examples/stm32l1/src/bin/flash.rs
@@ -15,7 +15,7 @@ async fn main(_spawner: Spawner) {
15 15
16 const ADDR: u32 = 0x26000; 16 const ADDR: u32 = 0x26000;
17 17
18 let mut f = Flash::unlock(p.FLASH); 18 let mut f = Flash::new(p.FLASH);
19 19
20 info!("Reading..."); 20 info!("Reading...");
21 let mut buf = [0u8; 8]; 21 let mut buf = [0u8; 8];
diff --git a/examples/stm32l4/Cargo.toml b/examples/stm32l4/Cargo.toml
index 35a9c20f0..657605ebe 100644
--- a/examples/stm32l4/Cargo.toml
+++ b/examples/stm32l4/Cargo.toml
@@ -2,6 +2,7 @@
2edition = "2021" 2edition = "2021"
3name = "embassy-stm32l4-examples" 3name = "embassy-stm32l4-examples"
4version = "0.1.0" 4version = "0.1.0"
5license = "MIT OR Apache-2.0"
5 6
6[features] 7[features]
7 8
@@ -18,8 +19,8 @@ defmt-rtt = "0.3"
18cortex-m = { version = "0.7.6", features = ["critical-section-single-core"] } 19cortex-m = { version = "0.7.6", features = ["critical-section-single-core"] }
19cortex-m-rt = "0.7.0" 20cortex-m-rt = "0.7.0"
20embedded-hal = "0.2.6" 21embedded-hal = "0.2.6"
21embedded-hal-1 = { package = "embedded-hal", version = "1.0.0-alpha.8" } 22embedded-hal-1 = { package = "embedded-hal", version = "=1.0.0-alpha.9" }
22embedded-hal-async = { version = "0.1.0-alpha.1" } 23embedded-hal-async = { version = "=0.1.0-alpha.2" }
23panic-probe = { version = "0.3", features = ["print-defmt"] } 24panic-probe = { version = "0.3", features = ["print-defmt"] }
24futures = { version = "0.3.17", default-features = false, features = ["async-await"] } 25futures = { version = "0.3.17", default-features = false, features = ["async-await"] }
25heapless = { version = "0.7.5", default-features = false } 26heapless = { version = "0.7.5", default-features = false }
diff --git a/examples/stm32l5/Cargo.toml b/examples/stm32l5/Cargo.toml
index 9ebab6476..63eac3ed2 100644
--- a/examples/stm32l5/Cargo.toml
+++ b/examples/stm32l5/Cargo.toml
@@ -2,6 +2,7 @@
2edition = "2021" 2edition = "2021"
3name = "embassy-stm32l5-examples" 3name = "embassy-stm32l5-examples"
4version = "0.1.0" 4version = "0.1.0"
5license = "MIT OR Apache-2.0"
5 6
6[features] 7[features]
7 8
diff --git a/examples/stm32u5/Cargo.toml b/examples/stm32u5/Cargo.toml
index 164940586..3d704011b 100644
--- a/examples/stm32u5/Cargo.toml
+++ b/examples/stm32u5/Cargo.toml
@@ -2,6 +2,7 @@
2edition = "2021" 2edition = "2021"
3name = "embassy-stm32u5-examples" 3name = "embassy-stm32u5-examples"
4version = "0.1.0" 4version = "0.1.0"
5license = "MIT OR Apache-2.0"
5 6
6[dependencies] 7[dependencies]
7embassy-sync = { version = "0.1.0", path = "../../embassy-sync", features = ["defmt"] } 8embassy-sync = { version = "0.1.0", path = "../../embassy-sync", features = ["defmt"] }
diff --git a/examples/stm32wb/Cargo.toml b/examples/stm32wb/Cargo.toml
index 923833e46..5b96fa191 100644
--- a/examples/stm32wb/Cargo.toml
+++ b/examples/stm32wb/Cargo.toml
@@ -2,6 +2,7 @@
2edition = "2021" 2edition = "2021"
3name = "embassy-stm32wb-examples" 3name = "embassy-stm32wb-examples"
4version = "0.1.0" 4version = "0.1.0"
5license = "MIT OR Apache-2.0"
5 6
6[dependencies] 7[dependencies]
7embassy-sync = { version = "0.1.0", path = "../../embassy-sync", features = ["defmt"] } 8embassy-sync = { version = "0.1.0", path = "../../embassy-sync", features = ["defmt"] }
diff --git a/examples/stm32wl/Cargo.toml b/examples/stm32wl/Cargo.toml
index 94e0fb830..c827d2b71 100644
--- a/examples/stm32wl/Cargo.toml
+++ b/examples/stm32wl/Cargo.toml
@@ -2,6 +2,7 @@
2edition = "2021" 2edition = "2021"
3name = "embassy-stm32wl-examples" 3name = "embassy-stm32wl-examples"
4version = "0.1.0" 4version = "0.1.0"
5license = "MIT OR Apache-2.0"
5 6
6[dependencies] 7[dependencies]
7embassy-sync = { version = "0.1.0", path = "../../embassy-sync", features = ["defmt"] } 8embassy-sync = { version = "0.1.0", path = "../../embassy-sync", features = ["defmt"] }
diff --git a/examples/stm32wl/src/bin/flash.rs b/examples/stm32wl/src/bin/flash.rs
index eb7489760..2a8880624 100644
--- a/examples/stm32wl/src/bin/flash.rs
+++ b/examples/stm32wl/src/bin/flash.rs
@@ -15,7 +15,7 @@ async fn main(_spawner: Spawner) {
15 15
16 const ADDR: u32 = 0x36000; 16 const ADDR: u32 = 0x36000;
17 17
18 let mut f = Flash::unlock(p.FLASH); 18 let mut f = Flash::new(p.FLASH);
19 19
20 info!("Reading..."); 20 info!("Reading...");
21 let mut buf = [0u8; 8]; 21 let mut buf = [0u8; 8];
diff --git a/examples/wasm/Cargo.toml b/examples/wasm/Cargo.toml
index ea61fb921..e0e799a34 100644
--- a/examples/wasm/Cargo.toml
+++ b/examples/wasm/Cargo.toml
@@ -2,6 +2,7 @@
2edition = "2021" 2edition = "2021"
3name = "embassy-wasm-example" 3name = "embassy-wasm-example"
4version = "0.1.0" 4version = "0.1.0"
5license = "MIT OR Apache-2.0"
5 6
6[lib] 7[lib]
7crate-type = ["cdylib"] 8crate-type = ["cdylib"]
diff --git a/stm32-gen-features/Cargo.toml b/stm32-gen-features/Cargo.toml
index f92d127ea..f4aa08ebe 100644
--- a/stm32-gen-features/Cargo.toml
+++ b/stm32-gen-features/Cargo.toml
@@ -2,6 +2,7 @@
2name = "gen_features" 2name = "gen_features"
3version = "0.1.0" 3version = "0.1.0"
4edition = "2021" 4edition = "2021"
5license = "MIT OR Apache-2.0"
5 6
6# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html 7# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
7 8
diff --git a/stm32-metapac-gen/Cargo.toml b/stm32-metapac-gen/Cargo.toml
index 0ec2075f3..3c1dab57a 100644
--- a/stm32-metapac-gen/Cargo.toml
+++ b/stm32-metapac-gen/Cargo.toml
@@ -2,6 +2,7 @@
2name = "stm32-metapac-gen" 2name = "stm32-metapac-gen"
3version = "0.1.0" 3version = "0.1.0"
4edition = "2021" 4edition = "2021"
5license = "MIT OR Apache-2.0"
5 6
6 7
7[dependencies] 8[dependencies]
diff --git a/tests/rp/Cargo.toml b/tests/rp/Cargo.toml
index 503373759..d6770d6e9 100644
--- a/tests/rp/Cargo.toml
+++ b/tests/rp/Cargo.toml
@@ -2,6 +2,7 @@
2edition = "2021" 2edition = "2021"
3name = "embassy-rp-tests" 3name = "embassy-rp-tests"
4version = "0.1.0" 4version = "0.1.0"
5license = "MIT OR Apache-2.0"
5 6
6[dependencies] 7[dependencies]
7embassy-sync = { version = "0.1.0", path = "../../embassy-sync", features = ["defmt"] } 8embassy-sync = { version = "0.1.0", path = "../../embassy-sync", features = ["defmt"] }
@@ -16,8 +17,8 @@ defmt-rtt = "0.3.0"
16cortex-m = { version = "0.7.6", features = ["critical-section-single-core"] } 17cortex-m = { version = "0.7.6", features = ["critical-section-single-core"] }
17cortex-m-rt = "0.7.0" 18cortex-m-rt = "0.7.0"
18embedded-hal = "0.2.6" 19embedded-hal = "0.2.6"
19embedded-hal-1 = { package = "embedded-hal", version = "1.0.0-alpha.8" } 20embedded-hal-1 = { package = "embedded-hal", version = "=1.0.0-alpha.9" }
20embedded-hal-async = { version = "0.1.0-alpha.1" } 21embedded-hal-async = { version = "=0.1.0-alpha.2" }
21panic-probe = { version = "0.3.0", features = ["print-defmt"] } 22panic-probe = { version = "0.3.0", features = ["print-defmt"] }
22futures = { version = "0.3.17", default-features = false, features = ["async-await"] } 23futures = { version = "0.3.17", default-features = false, features = ["async-await"] }
23embedded-io = { version = "0.3.0", features = ["async"] } 24embedded-io = { version = "0.3.0", features = ["async"] }
diff --git a/tests/stm32/Cargo.toml b/tests/stm32/Cargo.toml
index d9cd3f120..bebbf557e 100644
--- a/tests/stm32/Cargo.toml
+++ b/tests/stm32/Cargo.toml
@@ -2,6 +2,7 @@
2edition = "2021" 2edition = "2021"
3name = "embassy-stm32-tests" 3name = "embassy-stm32-tests"
4version = "0.1.0" 4version = "0.1.0"
5license = "MIT OR Apache-2.0"
5 6
6[features] 7[features]
7stm32f103c8 = ["embassy-stm32/stm32f103c8"] # Blue Pill 8stm32f103c8 = ["embassy-stm32/stm32f103c8"] # Blue Pill
@@ -24,8 +25,8 @@ defmt-rtt = "0.3.0"
24cortex-m = { version = "0.7.6", features = ["critical-section-single-core"] } 25cortex-m = { version = "0.7.6", features = ["critical-section-single-core"] }
25cortex-m-rt = "0.7.0" 26cortex-m-rt = "0.7.0"
26embedded-hal = "0.2.6" 27embedded-hal = "0.2.6"
27embedded-hal-1 = { package = "embedded-hal", version = "1.0.0-alpha.8" } 28embedded-hal-1 = { package = "embedded-hal", version = "=1.0.0-alpha.9" }
28embedded-hal-async = { version = "0.1.0-alpha.1" } 29embedded-hal-async = { version = "=0.1.0-alpha.2" }
29panic-probe = { version = "0.3.0", features = ["print-defmt"] } 30panic-probe = { version = "0.3.0", features = ["print-defmt"] }
30 31
31[profile.dev] 32[profile.dev]
diff --git a/xtask/Cargo.toml b/xtask/Cargo.toml
index d9d6c9b26..696cfdafe 100644
--- a/xtask/Cargo.toml
+++ b/xtask/Cargo.toml
@@ -2,6 +2,7 @@
2edition = "2021" 2edition = "2021"
3name = "xtask" 3name = "xtask"
4version = "0.1.0" 4version = "0.1.0"
5license = "MIT OR Apache-2.0"
5 6
6[dependencies] 7[dependencies]
7anyhow = "1.0.43" 8anyhow = "1.0.43"